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:



7583
7584
7585
# File 'lib/infrawrench/client.rb', line 7583

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:



7607
7608
7609
7610
7611
7612
7613
7614
7615
# File 'lib/infrawrench/client.rb', line 7607

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:



7629
7630
7631
7632
7633
7634
7635
7636
7637
# File 'lib/infrawrench/client.rb', line 7629

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:



7653
7654
7655
7656
7657
7658
7659
7660
# File 'lib/infrawrench/client.rb', line 7653

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