Class: Infrawrench::CommitmentsNamespace

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

Overview

client.commitments

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CommitmentsNamespace

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

Parameters:



3147
3148
3149
# File 'lib/infrawrench/client.rb', line 3147

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Reservations, savings plans and committed-use discounts

The organization's purchased commitments — reserved instances, savings plans, committed-use discounts — with three derived readings.

Coverage is a range, not a number: the broad ratio counts every uncovered usage dollar in the denominator (a lower bound — egress and per-request charges can never be committed against), the narrow ratio only uncovered usage in cells where a commitment demonstrably landed (an upper bound). Accounts whose plugin cannot distinguish charge types are excluded and listed; a scope where every account is excluded reports unavailable, not 0%.

Utilization is measured only over days cost data was actually collected — a collection gap is reported as missing days, never counted as idle commitment. Unit-denominated commitments (GCP) report null with a reason, never 0%. Azure's own reported utilization rides on each holding separately and is never blended with the derived figure.

The planner recommends committing at the p10 floor of daily uncovered spend, gated on presence, trend, floor and materiality. Savings are quoted against published "up to" discount rates and marked as such. Nothing is ever purchased automatically.

Requires permission: costs:read.

GET /api/org/orgId/commitments

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

Raises:



3184
3185
3186
3187
3188
3189
3190
3191
# File 'lib/infrawrench/client.rb', line 3184

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