Class: Infrawrench::EnvironmentDiffNamespace

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

Overview

client.environment_diff

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ EnvironmentDiffNamespace

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

Parameters:



7196
7197
7198
# File 'lib/infrawrench/client.rb', line 7196

def initialize(transport)
  @transport = transport
end

Instance Method Details

#get(a:, b:, org_id: nil, resource_type_id: nil, include_identity_fields: nil, request_options: nil) ⇒ Hash

Compare two accounts' resource inventories

Compares two accounts of the same provider — typically staging against production — over already-synced state: which resource types exist in one and not the other, the per-type count deltas, and the fields on which two corresponding resources disagree (instance class, engine version, feature flags).

Resources are paired by resource type plus name with environment words removed, so api-staging lines up with api-prod without any naming convention to configure. By default the comparison hides divergences that are artefacts of being two different resources — ids, links, network addresses and timestamps — because every resource has different ones; pass includeIdentityFields=true to see them.

Read-only and cheap: no provider API calls are made, so results reflect the last sync.

Requires permission: resources:read.

GET /api/org/orgId/environment-diff

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.

  • a (String)

    Baseline account id — by convention the environment that works.

  • b (String)

    Compared account id. Must differ from a and use the same provider.

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

    Compare one resource type only.

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

    Compare identity and timestamp fields too, instead of filtering them out.

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

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

  • a: (String)
  • b: (String)
  • org_id: (String, nil) (defaults to: nil)
  • resource_type_id: (String, nil) (defaults to: nil)
  • include_identity_fields: ("true", "false", nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

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

Raises:



7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
# File 'lib/infrawrench/client.rb', line 7237

def get(
  a:,
  b:,
  org_id: nil,
  resource_type_id: nil,
  include_identity_fields: nil,
  request_options: nil
)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/environment-diff",
    path_params: { "orgId" => org_id },
    query: {
      "a" => a,
      "b" => b,
      "resourceTypeId" => resource_type_id,
      "includeIdentityFields" => include_identity_fields
    },
    request_options: request_options
  )
end