Class: Infrawrench::EnvironmentsInstancesNamespace

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

Overview

client.environments.instances

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ EnvironmentsInstancesNamespace

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

Parameters:



7009
7010
7011
# File 'lib/infrawrench/client.rb', line 7009

def initialize(transport)
  @transport = transport
end

Instance Method Details

#delete(instance_id:, org_id: nil, request_options: nil) ⇒ nil

Forget a torn-down environment

Removes the record. Refuses while the instance still owns resources — the row is the only thing that knows they exist. Audit-logged.

Requires permission: resources:write.

DELETE /api/org/orgId/environments/instances/instanceId

Raises on 404: Not found

Raises on 409: The environment is still live — tear it down first

Parameters:

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

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

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

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

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



7032
7033
7034
7035
7036
7037
7038
7039
7040
# File 'lib/infrawrench/client.rb', line 7032

def delete(instance_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/environments/instances/{instanceId}",
    path_params: { "orgId" => org_id, "instanceId" => instance_id },
    accept: :empty,
    request_options: request_options
  )
end

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

List environment instances

Newest first. Reading this also reconciles instances past their deadline against what the lease pass already deleted, so an environment whose resources are all gone stops reporting itself as running.

Requires permission: resources:read.

GET /api/org/orgId/environments/instances

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 EnvironmentInstanceList — see sig/infrawrench/sdk.rbs.

Raises:



7058
7059
7060
7061
7062
7063
7064
7065
# File 'lib/infrawrench/client.rb', line 7058

def get(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/environments/instances",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#get_org_org_id_environments_instances_instance_id(instance_id:, org_id: nil, request_options: nil) ⇒ Hash

Get an environment instance

Requires permission: resources:read.

GET /api/org/orgId/environments/instances/instanceId

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.

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

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

  • instance_id: (String)
  • org_id: (String, 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:



7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
# File 'lib/infrawrench/client.rb', line 7082

def get_org_org_id_environments_instances_instance_id(
  instance_id:,
  org_id: nil,
  request_options: nil
)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/environments/instances/{instanceId}",
    path_params: { "orgId" => org_id, "instanceId" => instance_id },
    request_options: request_options
  )
end

#teardown(instance_id:, org_id: nil, request_options: nil) ⇒ Hash

Tear an environment down now

Deletes every created member through the ordinary deleteResource path, in reverse creation order. Idempotent: a member already gone, a resource the provider answers 404 for, and an instance already torn down all succeed quietly, so this is safe to retry. Blocked by an active change freeze. Audit-logged.

Requires permission: resources:delete.

POST /api/org/orgId/environments/instances/instanceId/teardown

Raises on 404: Not found

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.

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

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

  • instance_id: (String)
  • org_id: (String, 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:



7120
7121
7122
7123
7124
7125
7126
7127
# File 'lib/infrawrench/client.rb', line 7120

def teardown(instance_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/environments/instances/{instanceId}/teardown",
    path_params: { "orgId" => org_id, "instanceId" => instance_id },
    request_options: request_options
  )
end