Class: Infrawrench::EnvironmentsTemplatesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::EnvironmentsTemplatesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.environments.templates
Instance Method Summary collapse
-
#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Create an environment template.
-
#delete(template_id:, org_id: nil, request_options: nil) ⇒ nil
Delete an environment template.
-
#estimate(template_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Price an instantiation before it runs.
-
#get(org_id: nil, request_options: nil) ⇒ Hash
List environment templates.
-
#get_org_org_id_environments_templates_template_id(template_id:, org_id: nil, request_options: nil) ⇒ Hash
Get an environment template.
-
#initialize(transport) ⇒ EnvironmentsTemplatesNamespace
constructor
private
A new instance of EnvironmentsTemplatesNamespace.
-
#instantiate(template_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Stamp out an environment.
-
#update(template_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Replace an environment template.
Constructor Details
#initialize(transport) ⇒ EnvironmentsTemplatesNamespace
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 EnvironmentsTemplatesNamespace.
7451 7452 7453 |
# File 'lib/infrawrench/client.rb', line 7451 def initialize(transport) @transport = transport end |
Instance Method Details
#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Create an environment template
Save a capture draft as a template. Member keys must be unique, every parameter and member reference must resolve, and the members must be orderable — a dependency cycle is rejected here rather than half-way through an apply. Audit-logged.
Requires permission: resources:write.
POST /api/org/orgId/environments/templates
Raises on 400: Bad request
Raises on 409: A template with that name already exists
7477 7478 7479 7480 7481 7482 7483 7484 7485 |
# File 'lib/infrawrench/client.rb', line 7477 def create(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/environments/templates", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(template_id:, org_id: nil, request_options: nil) ⇒ nil
Delete an environment template
Live instances keep running and keep their TTL — they own real resources,
and the template is only where they came from. Their templateId becomes
null; the denormalized templateName is what the surface reads.
Audit-logged.
Requires permission: resources:write.
DELETE /api/org/orgId/environments/templates/templateId
Raises on 404: Not found
7506 7507 7508 7509 7510 7511 7512 7513 7514 |
# File 'lib/infrawrench/client.rb', line 7506 def delete(template_id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/environments/templates/{templateId}", path_params: { "orgId" => org_id, "templateId" => template_id }, accept: :empty, request_options: ) end |
#estimate(template_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Price an instantiation before it runs
Runs each member's create fields through the plugin's own estimateCost.
A member the plugin cannot price is counted in unpricedCount and makes
the total partial — null is never rounded to zero.
Requires permission: resources:read.
POST /api/org/orgId/environments/templates/templateId/estimate
Raises on 400: Bad request
Raises on 404: Not found
7538 7539 7540 7541 7542 7543 7544 7545 7546 |
# File 'lib/infrawrench/client.rb', line 7538 def estimate(template_id:, org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/environments/templates/{templateId}/estimate", path_params: { "orgId" => org_id, "templateId" => template_id }, body: body, request_options: ) end |
#get(org_id: nil, request_options: nil) ⇒ Hash
List environment templates
Requires permission: resources:read.
GET /api/org/orgId/environments/templates
7560 7561 7562 7563 7564 7565 7566 7567 |
# File 'lib/infrawrench/client.rb', line 7560 def get(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/environments/templates", path_params: { "orgId" => org_id }, request_options: ) end |
#get_org_org_id_environments_templates_template_id(template_id:, org_id: nil, request_options: nil) ⇒ Hash
Get an environment template
Requires permission: resources:read.
GET /api/org/orgId/environments/templates/templateId
Raises on 404: Not found
7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 |
# File 'lib/infrawrench/client.rb', line 7584 def get_org_org_id_environments_templates_template_id( template_id:, org_id: nil, request_options: nil ) @transport.request( http_method: "GET", path: "/api/org/{orgId}/environments/templates/{templateId}", path_params: { "orgId" => org_id, "templateId" => template_id }, request_options: ) end |
#instantiate(template_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Stamp out an environment
Creates the template's resources in dependency order through the ordinary
createResource path, name-prefixed per instance, and attaches an
auto-delete lease to each so expiry runs through the existing lease pass.
ttlHours is required. Requires resources:write and
resources:delete (the lease is a standing deletion, the same rule POST /leases applies), and is blocked by an active change freeze. A create
that fails part-way returns a partial instance whose created members are
recorded and tearable-down, never an error with orphaned resources behind
it. Audit-logged.
Requires permission: resources:write.
POST /api/org/orgId/environments/templates/templateId/instantiate
Raises on 400: Bad request
Raises on 404: Not found
Raises on 409: The organization is at its live-environment limit
Raises on 423: Blocked by an active change freeze. Retry with the
x-change-freeze-override: true header if you hold freezes:override;
both blocks and overrides are audit-logged.
7631 7632 7633 7634 7635 7636 7637 7638 7639 |
# File 'lib/infrawrench/client.rb', line 7631 def instantiate(template_id:, org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/environments/templates/{templateId}/instantiate", path_params: { "orgId" => org_id, "templateId" => template_id }, body: body, request_options: ) end |
#update(template_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Replace an environment template
The whole document is replaced. Live instances are unaffected. Audit-logged.
Requires permission: resources:write.
PUT /api/org/orgId/environments/templates/templateId
Raises on 400: Bad request
Raises on 404: Not found
7662 7663 7664 7665 7666 7667 7668 7669 7670 |
# File 'lib/infrawrench/client.rb', line 7662 def update(template_id:, org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/environments/templates/{templateId}", path_params: { "orgId" => org_id, "templateId" => template_id }, body: body, request_options: ) end |