Class: Infrawrench::IacNamespace

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

Overview

client.iac

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ IacNamespace

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

Parameters:



7925
7926
7927
7928
# File 'lib/infrawrench/client.rb', line 7925

def initialize(transport)
  @transport = transport
  @states = IacStatesNamespace.new(@transport)
end

Instance Attribute Details

#statesIacStatesNamespace (readonly)

Returns client.iac.states.

Returns:



7921
7922
7923
# File 'lib/infrawrench/client.rb', line 7921

def states
  @states
end

Instance Method Details

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

Generate Terraform import blocks for unmanaged resources

Terraform 1.5+ import blocks plus the matching resource stanzas, generated by the same plugin export mappers and HCL serializer that back "Export to Terraform…". Resources no plugin can express are returned in unsupported with a reason, never dropped.

POST /api/org/orgId/iac/import-plan

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

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

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

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

Returns:

  • (Hash)

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

Raises:



7950
7951
7952
7953
7954
7955
7956
7957
7958
# File 'lib/infrawrench/client.rb', line 7950

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

#reconciliation(state_id:, org_id: nil, request_options: nil) ⇒ Hash

Classify inventory against a state document

Every synced resource classified as managed, drifted or unmanaged against one uploaded state, plus state entries with no inventory match. Unmanaged resources carry the ownership and first-seen join that answers "who made this by hand, and when".

GET /api/org/orgId/iac/reconciliation

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.

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

  • (Hash)

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

Raises:



7980
7981
7982
7983
7984
7985
7986
7987
7988
# File 'lib/infrawrench/client.rb', line 7980

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

#resource(resource_id:, org_id: nil, request_options: nil) ⇒ Hash

IaC status for one resource

The managed/unmanaged badge for a resource detail page, computed against the newest state document. status is null when the organization has uploaded none — absence of a state is not evidence of ClickOps. A query parameter rather than a path segment because composite resource ids contain slashes.

GET /api/org/orgId/iac/resource

Raises on 400: Bad request

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

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

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

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

Returns:

  • (Hash)

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

Raises:



8009
8010
8011
8012
8013
8014
8015
8016
8017
# File 'lib/infrawrench/client.rb', line 8009

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