Class: Infrawrench::ConfigNamespace
- Inherits:
-
Object
- Object
- Infrawrench::ConfigNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.config
Instance Method Summary collapse
-
#apply(body:, org_id: nil, request_options: nil) ⇒ Hash
Apply a configuration document.
-
#export(org_id: nil, sections: nil, request_options: nil) ⇒ Hash
Export the organization's configuration as one document.
-
#initialize(transport) ⇒ ConfigNamespace
constructor
private
A new instance of ConfigNamespace.
-
#plan(body:, org_id: nil, request_options: nil) ⇒ Hash
Preview what applying a document would do.
Constructor Details
#initialize(transport) ⇒ ConfigNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ConfigNamespace.
3198 3199 3200 |
# File 'lib/infrawrench/client.rb', line 3198 def initialize(transport) @transport = transport end |
Instance Method Details
#apply(body:, org_id: nil, request_options: nil) ⇒ Hash
Apply a configuration document
Applies the document in a single transaction and returns the plan that was executed — all or nothing, so a failure never leaves the organization halfway between two configurations.
Requires the write permission of every section the document carries, so this cannot be used to reach past a role that withholds one.
Requires permission: config:write.
POST /api/org/orgId/config/apply
Raises on 400: Bad request
Raises on 402: Payment required — the organization's plan does not include this
Raises on 403: Forbidden
3229 3230 3231 3232 3233 3234 3235 3236 3237 |
# File 'lib/infrawrench/client.rb', line 3229 def apply(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/config/apply", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#export(org_id: nil, sections: nil, request_options: nil) ⇒ Hash
Export the organization's configuration as one document
Dashboards, workflows, custom graphs, budgets, metric alerts, synthetic probes, cost centres, the tag policy and the org-wide alert settings, addressed by stable keys rather than row ids so the result applies to any organization.
Credentials, accounts, resources and workflow signing secrets are never included. Ordering is stable, so re-exporting an unchanged organization produces the same bytes — commit it to git and the diff is the change.
Requires the read permission of every section exported; it refuses rather
than silently omitting one, because a partial document applied in
replace mode would delete what the exporter could not see.
Requires permission: config:read.
GET /api/org/orgId/config/export
Raises on 400: Bad request
Raises on 403: Forbidden
3270 3271 3272 3273 3274 3275 3276 3277 3278 |
# File 'lib/infrawrench/client.rb', line 3270 def export(org_id: nil, sections: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/config/export", path_params: { "orgId" => org_id }, query: { "sections" => sections }, request_options: ) end |
#plan(body:, org_id: nil, request_options: nil) ⇒ Hash
Preview what applying a document would do
The dry run: validates the document, resolves its cross-references against this organization, and returns the create/update/delete/unchanged plan without writing anything. Read-only, so a reviewer with read access can run it on a pull request.
Requires permission: config:read.
POST /api/org/orgId/config/plan
Raises on 400: Bad request
Raises on 403: Forbidden
3301 3302 3303 3304 3305 3306 3307 3308 3309 |
# File 'lib/infrawrench/client.rb', line 3301 def plan(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/config/plan", path_params: { "orgId" => org_id }, body: body, request_options: ) end |