Class: Infrawrench::BusinessMetricsValuesNamespace

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

Overview

client.business_metrics.values

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ BusinessMetricsValuesNamespace

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

Parameters:



2291
2292
2293
# File 'lib/infrawrench/client.rb', line 2291

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Report metric values

Write a batch of days. Re-reporting a day restates it rather than accumulating, which is what makes a nightly job safe to retry. Nothing lands unless the whole batch validates, so a bad row is a 400 rather than half a month restated. The same guarantees back infra.businessMetrics.write(...) in a workflow — both go through one validator.

Requires permission: costs:write.

POST /api/org/orgId/business-metrics/id/values

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.

  • id (String)

    Metric id or key

  • body (Hash)

    Request body, shaped as BusinessMetricValuesInput.

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

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

  • id: (String)
  • body: (business_metric_values_input)
  • 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:



2319
2320
2321
2322
2323
2324
2325
2326
2327
# File 'lib/infrawrench/client.rb', line 2319

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

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

List a metric's reported values

Newest day first.

Requires permission: costs:read.

GET /api/org/orgId/business-metrics/id/values

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.

  • id (String)

    Metric id or key

  • limit (Integer, nil) (defaults to: nil)

    Default 90.

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

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

  • id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • limit: (Integer, 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:



2348
2349
2350
2351
2352
2353
2354
2355
2356
# File 'lib/infrawrench/client.rb', line 2348

def get(id:, org_id: nil, limit: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/business-metrics/{id}/values",
    path_params: { "orgId" => org_id, "id" => id },
    query: { "limit" => limit },
    request_options: request_options
  )
end