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.
7067 7068 7069 |
# File 'lib/infrawrench/client.rb', line 7067 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
7093 7094 7095 7096 7097 7098 7099 7100 7101 |
# File 'lib/infrawrench/client.rb', line 7093 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
7122 7123 7124 7125 7126 7127 7128 7129 7130 |
# File 'lib/infrawrench/client.rb', line 7122 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
7154 7155 7156 7157 7158 7159 7160 7161 7162 |
# File 'lib/infrawrench/client.rb', line 7154 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
7176 7177 7178 7179 7180 7181 7182 7183 |
# File 'lib/infrawrench/client.rb', line 7176 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
7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 |
# File 'lib/infrawrench/client.rb', line 7200 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.
7247 7248 7249 7250 7251 7252 7253 7254 7255 |
# File 'lib/infrawrench/client.rb', line 7247 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
7278 7279 7280 7281 7282 7283 7284 7285 7286 |
# File 'lib/infrawrench/client.rb', line 7278 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 |