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.
3670 3671 3672 |
# File 'lib/infrawrench/client.rb', line 3670 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
3701 3702 3703 3704 3705 3706 3707 3708 3709 |
# File 'lib/infrawrench/client.rb', line 3701 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
3742 3743 3744 3745 3746 3747 3748 3749 3750 |
# File 'lib/infrawrench/client.rb', line 3742 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
3773 3774 3775 3776 3777 3778 3779 3780 3781 |
# File 'lib/infrawrench/client.rb', line 3773 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 |