Class: Infrawrench::IacStatesNamespace

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

Overview

client.iac.states

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ IacStatesNamespace

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

Parameters:



7529
7530
7531
# File 'lib/infrawrench/client.rb', line 7529

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash

Upload a Terraform state document

Parses a .tfstate (format version 4) or terraform show -json output (format_version 1.x) and records the resource instances it contains. Attributes the state marks sensitive are dropped before anything is written. The format version is checked, not assumed: an unsupported version is a 400 rather than a partial read.

POST /api/org/orgId/iac/states

Raises on 400: Bad request

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.

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as IacStateUploadRequest.

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

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

  • org_id: (String, nil) (defaults to: nil)
  • body: (iac_state_upload_request, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Hash — see sig/infrawrench/sdk.rbs.

Raises:



7553
7554
7555
7556
7557
7558
7559
7560
7561
# File 'lib/infrawrench/client.rb', line 7553

def create(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/iac/states",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

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

Delete an uploaded state document

DELETE /api/org/orgId/iac/states/stateId

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.

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

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

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



7575
7576
7577
7578
7579
7580
7581
7582
7583
# File 'lib/infrawrench/client.rb', line 7575

def delete(state_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/iac/states/{stateId}",
    path_params: { "orgId" => org_id, "stateId" => state_id },
    accept: :empty,
    request_options: request_options
  )
end

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

List uploaded Terraform state documents

Every state document the organization has uploaded, newest first. The documents themselves are never stored — only the parsed, redacted projection.

GET /api/org/orgId/iac/states

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

Raises:



7599
7600
7601
7602
7603
7604
7605
7606
# File 'lib/infrawrench/client.rb', line 7599

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