Class: Infrawrench::EnvironmentsTemplatesNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.environments.templates

Instance Method Summary collapse

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.

Parameters:



7142
7143
7144
# File 'lib/infrawrench/client.rb', line 7142

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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as EnvironmentTemplateInput.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • body: (environment_template_input, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as EnvironmentTemplate — see sig/infrawrench/sdk.rbs.

Raises:



7168
7169
7170
7171
7172
7173
7174
7175
7176
# File 'lib/infrawrench/client.rb', line 7168

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: 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • template_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • template_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (nil)

    This endpoint returns no content.

Raises:



7197
7198
7199
7200
7201
7202
7203
7204
7205
# File 'lib/infrawrench/client.rb', line 7197

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: 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 partialnull 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • template_id (String)
  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as EnvironmentEstimateRequest.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • template_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: (environment_estimate_request, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as EnvironmentCostEstimate — see sig/infrawrench/sdk.rbs.

Raises:



7229
7230
7231
7232
7233
7234
7235
7236
7237
# File 'lib/infrawrench/client.rb', line 7229

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: request_options
  )
end

#get(org_id: nil, request_options: nil) ⇒ Hash

List environment templates

Requires permission: resources:read.

GET /api/org/orgId/environments/templates

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as EnvironmentTemplateList — see sig/infrawrench/sdk.rbs.

Raises:



7251
7252
7253
7254
7255
7256
7257
7258
# File 'lib/infrawrench/client.rb', line 7251

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: 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • template_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • template_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as EnvironmentTemplate — see sig/infrawrench/sdk.rbs.

Raises:



7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
# File 'lib/infrawrench/client.rb', line 7275

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: 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.

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • template_id (String)
  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as EnvironmentInstantiateRequest.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • template_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: (environment_instantiate_request, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as EnvironmentInstance — see sig/infrawrench/sdk.rbs.

Raises:



7322
7323
7324
7325
7326
7327
7328
7329
7330
# File 'lib/infrawrench/client.rb', line 7322

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: 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • template_id (String)
  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as EnvironmentTemplateInput.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • template_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: (environment_template_input, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as EnvironmentTemplate — see sig/infrawrench/sdk.rbs.

Raises:



7353
7354
7355
7356
7357
7358
7359
7360
7361
# File 'lib/infrawrench/client.rb', line 7353

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: request_options
  )
end