Class: Infrawrench::CostReportsNamespace
- Inherits:
-
Object
- Object
- Infrawrench::CostReportsNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.cost_reports
Instance Attribute Summary collapse
-
#notifications ⇒ CostReportsNotificationsNamespace
readonly
client.cost_reports.notifications.
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a cost report.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a cost report.
-
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a cost report.
-
#initialize(transport) ⇒ CostReportsNamespace
constructor
private
A new instance of CostReportsNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List saved cost reports.
-
#run(id:, org_id: nil, request_options: nil) ⇒ Hash
Run a cost report.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a cost report.
Constructor Details
#initialize(transport) ⇒ CostReportsNamespace
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 CostReportsNamespace.
4360 4361 4362 4363 |
# File 'lib/infrawrench/client.rb', line 4360 def initialize(transport) @transport = transport @notifications = CostReportsNotificationsNamespace.new(@transport) end |
Instance Attribute Details
#notifications ⇒ CostReportsNotificationsNamespace (readonly)
Returns client.cost_reports.notifications.
4356 4357 4358 |
# File 'lib/infrawrench/client.rb', line 4356 def notifications @notifications end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a cost report
Requires permission: costs:write.
POST /api/org/orgId/cost-reports
Raises on 400: Bad request
4379 4380 4381 4382 4383 4384 4385 4386 4387 |
# File 'lib/infrawrench/client.rb', line 4379 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/cost-reports", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a cost report
Soft delete. Every dashboard card pointing at the report is removed with it — a card whose report is gone could only ever render as an unavailable tile.
Requires permission: costs:write.
DELETE /api/org/orgId/cost-reports/id
Raises on 404: Not found
4407 4408 4409 4410 4411 4412 4413 4414 |
# File 'lib/infrawrench/client.rb', line 4407 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/cost-reports/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a cost report
Requires permission: costs:read.
GET /api/org/orgId/cost-reports/id
Raises on 404: Not found
4430 4431 4432 4433 4434 4435 4436 4437 |
# File 'lib/infrawrench/client.rb', line 4430 def get(id:, org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/cost-reports/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List saved cost reports
Requires permission: costs:read.
GET /api/org/orgId/cost-reports
4451 4452 4453 4454 4455 4456 4457 4458 |
# File 'lib/infrawrench/client.rb', line 4451 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/cost-reports", path_params: { "orgId" => org_id }, request_options: ) end |
#run(id:, org_id: nil, request_options: nil) ⇒ Hash
Run a cost report
Executes the report's saved config and returns the series, along with the inclusive window a relative preset resolved to. Takes no body: the report is the query, so a caller never has to reassemble its config to get the numbers.
Requires permission: costs:read.
POST /api/org/orgId/cost-reports/id/run
Raises on 400: Bad request
Raises on 404: Not found
4482 4483 4484 4485 4486 4487 4488 4489 |
# File 'lib/infrawrench/client.rb', line 4482 def run(id:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/cost-reports/{id}/run", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a cost report
Replaces the report's name, description, config and folder. Every dashboard showing the report picks up the new config — that is what referencing a report by id buys.
Requires permission: costs:write.
PUT /api/org/orgId/cost-reports/id
Raises on 400: Bad request
Raises on 404: Not found
4512 4513 4514 4515 4516 4517 4518 4519 4520 |
# File 'lib/infrawrench/client.rb', line 4512 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/cost-reports/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |