Class: Infrawrench::CostsNamespace
- Inherits:
-
Object
- Object
- Infrawrench::CostsNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.costs
Instance Method Summary collapse
-
#dimensions(dimension:, org_id: nil, tag_key: nil, request_options: nil) ⇒ Hash
List distinct values for a cost dimension.
-
#initialize(transport) ⇒ CostsNamespace
constructor
private
A new instance of CostsNamespace.
-
#query(body:, org_id: nil, request_options: nil) ⇒ Hash
Query aggregated cost series.
-
#rows(body:, org_id: nil, request_options: nil) ⇒ Hash
Push cost rows from your own systems.
-
#status(org_id: nil, request_options: nil) ⇒ Hash
Per-account cost collection status.
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.
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.
Requires permission: costs:read.
GET /api/org/orgId/costs/dimensions
Raises on 400: Bad request
1225 1226 1227 1228 1229 1230 1231 1232 1233 |
# File 'lib/infrawrench/client.rb', line 1225 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: ) 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.
Requires permission: costs:read.
POST /api/org/orgId/costs/query
Raises on 400: Bad request
1254 1255 1256 1257 1258 1259 1260 1261 1262 |
# File 'lib/infrawrench/client.rb', line 1254 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: ) end |
#rows(body:, org_id: nil, request_options: nil) ⇒ Hash
Push cost rows from your own systems
Reports spend Infrawrench has no provider plugin for — a parsed SaaS invoice, an internal chargeback, a colo bill — into the same store the provider collectors write to, so it appears in cost graphs, dimension filters, and budgets alongside everything else.
Rows are grouped under a caller-chosen source. Writes are idempotent per
(source, day, service, region, resourceId, tags, currency): pushing the
same day again restates that day rather than adding to it, so a nightly
job can safely re-push a trailing window. Rows pushed under a source can
never overwrite rows a provider collector wrote.
The whole batch is validated before anything is stored, so a 400 means nothing was written.
Requires permission: costs:write.
POST /api/org/orgId/costs/rows
Raises on 400: Bad request
1292 1293 1294 1295 1296 1297 1298 1299 1300 |
# File 'lib/infrawrench/client.rb', line 1292 def rows(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/costs/rows", path_params: { "orgId" => org_id }, body: body, 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.
Requires permission: costs:read.
GET /api/org/orgId/costs/status
1316 1317 1318 1319 1320 1321 1322 1323 |
# File 'lib/infrawrench/client.rb', line 1316 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: ) end |