Class: Infrawrench::CostsAnomalySettingsNamespace

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

Overview

client.costs.anomaly_settings

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CostsAnomalySettingsNamespace

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

Parameters:



1522
1523
1524
# File 'lib/infrawrench/client.rb', line 1522

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Get the organization's anomaly detection thresholds

The tunable part of cost anomaly detection. Everything else about the model — the 28-day baseline, the 7-day notification cooldown, the minimum history a baseline needs — is fixed. An organization that has never changed a threshold reads back the defaults. The response also carries the derived, read-only smsConfigured.

Requires permission: costs:read.

GET /api/org/orgId/costs/anomaly-settings

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

Raises:



1544
1545
1546
1547
1548
1549
1550
1551
# File 'lib/infrawrench/client.rb', line 1544

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

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

Update the organization's anomaly detection thresholds

Takes effect on the next detection pass (which runs after each cost collection). Anomalies already stored are not re-judged. All four fields are required — this is a PUT of the whole settings object, not a patch — and smsAlerts deliberately has no server-side default, so a client that omits it is rejected rather than silently switching an organization's SMS paging back off. smsConfigured is derived and is not accepted here.

Requires permission: costs:write.

PUT /api/org/orgId/costs/anomaly-settings

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

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

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

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

Returns:

  • (Hash)

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

Raises:



1575
1576
1577
1578
1579
1580
1581
1582
1583
# File 'lib/infrawrench/client.rb', line 1575

def update(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "PUT",
    path: "/api/org/{orgId}/costs/anomaly-settings",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end