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.
3453 3454 3455 |
# File 'lib/infrawrench/client.rb', line 3453 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
3484 3485 3486 3487 3488 3489 3490 3491 3492 |
# File 'lib/infrawrench/client.rb', line 3484 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
3525 3526 3527 3528 3529 3530 3531 3532 3533 |
# File 'lib/infrawrench/client.rb', line 3525 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
3556 3557 3558 3559 3560 3561 3562 3563 3564 |
# File 'lib/infrawrench/client.rb', line 3556 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 |