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:



7668
7669
7670
# File 'lib/infrawrench/client.rb', line 7668

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:



7694
7695
7696
7697
7698
7699
7700
7701
7702
# File 'lib/infrawrench/client.rb', line 7694

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:



7723
7724
7725
7726
7727
7728
7729
7730
7731
# File 'lib/infrawrench/client.rb', line 7723

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:



7755
7756
7757
7758
7759
7760
7761
7762
7763
# File 'lib/infrawrench/client.rb', line 7755

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:



7777
7778
7779
7780
7781
7782
7783
7784
# File 'lib/infrawrench/client.rb', line 7777

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:



7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
# File 'lib/infrawrench/client.rb', line 7801

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:



7848
7849
7850
7851
7852
7853
7854
7855
7856
# File 'lib/infrawrench/client.rb', line 7848

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:



7879
7880
7881
7882
7883
7884
7885
7886
7887
# File 'lib/infrawrench/client.rb', line 7879

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