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:



7264
7265
7266
# File 'lib/infrawrench/client.rb', line 7264

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:



7287
7288
7289
7290
7291
7292
7293
7294
7295
# File 'lib/infrawrench/client.rb', line 7287

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:



7313
7314
7315
7316
7317
7318
7319
7320
# File 'lib/infrawrench/client.rb', line 7313

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:



7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
# File 'lib/infrawrench/client.rb', line 7337

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:



7375
7376
7377
7378
7379
7380
7381
7382
# File 'lib/infrawrench/client.rb', line 7375

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