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:



6955
6956
6957
# File 'lib/infrawrench/client.rb', line 6955

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:



6978
6979
6980
6981
6982
6983
6984
6985
6986
# File 'lib/infrawrench/client.rb', line 6978

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:



7004
7005
7006
7007
7008
7009
7010
7011
# File 'lib/infrawrench/client.rb', line 7004

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:



7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
# File 'lib/infrawrench/client.rb', line 7028

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:



7066
7067
7068
7069
7070
7071
7072
7073
# File 'lib/infrawrench/client.rb', line 7066

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