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:



6880
6881
6882
# File 'lib/infrawrench/client.rb', line 6880

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:



6903
6904
6905
6906
6907
6908
6909
6910
6911
# File 'lib/infrawrench/client.rb', line 6903

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:



6929
6930
6931
6932
6933
6934
6935
6936
# File 'lib/infrawrench/client.rb', line 6929

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:



6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
# File 'lib/infrawrench/client.rb', line 6953

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:



6991
6992
6993
6994
6995
6996
6997
6998
# File 'lib/infrawrench/client.rb', line 6991

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