Class: Infrawrench::CostsNamespace

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

Overview

client.costs

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CostsNamespace

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

Parameters:



1202
1203
1204
# File 'lib/infrawrench/client.rb', line 1202

def initialize(transport)
  @transport = transport
end

Instance Method Details

#dimensions(dimension:, org_id: nil, tag_key: nil, request_options: nil) ⇒ Hash

List distinct values for a cost dimension

Feeds the filter and group-by pickers. Pass dimension=tag-keys for tag keys; dimension=tag requires tagKey.

GET /api/org/orgId/costs/dimensions

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.

  • dimension (String)
  • tag_key (String, nil) (defaults to: nil)
  • request_options (Hash, nil) (defaults to: nil)

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

  • dimension: ("provider", "account", "service", "region", "resource", "tag", "tag-keys")
  • org_id: (String, nil) (defaults to: nil)
  • tag_key: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

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

Raises:



1223
1224
1225
1226
1227
1228
1229
1230
1231
# File 'lib/infrawrench/client.rb', line 1223

def dimensions(dimension:, org_id: nil, tag_key: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/costs/dimensions",
    path_params: { "orgId" => org_id },
    query: { "dimension" => dimension, "tagKey" => tag_key },
    request_options: request_options
  )
end

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

Query aggregated cost series

Aggregates collected provider spend into per-bucket, per-group series for cost graphs. Currencies are never merged; mixed-currency orgs get one series per currency. Optionally returns a previous-period comparison and a trend forecast.

POST /api/org/orgId/costs/query

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.

  • body (Hash)

    Request body, shaped as CostQueryRequest.

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

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

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

Returns:

  • (Hash)

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

Raises:



1250
1251
1252
1253
1254
1255
1256
1257
1258
# File 'lib/infrawrench/client.rb', line 1250

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

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

Per-account cost collection status

Which accounts support cost collection, whether their history backfill has completed, and the ingested date coverage.

GET /api/org/orgId/costs/status

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

Raises:



1272
1273
1274
1275
1276
1277
1278
1279
# File 'lib/infrawrench/client.rb', line 1272

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