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:



7481
7482
7483
# File 'lib/infrawrench/client.rb', line 7481

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:



7504
7505
7506
7507
7508
7509
7510
7511
7512
# File 'lib/infrawrench/client.rb', line 7504

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:



7530
7531
7532
7533
7534
7535
7536
7537
# File 'lib/infrawrench/client.rb', line 7530

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:



7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
# File 'lib/infrawrench/client.rb', line 7554

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:



7592
7593
7594
7595
7596
7597
7598
7599
# File 'lib/infrawrench/client.rb', line 7592

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