Class: Infrawrench::BillingRulesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::BillingRulesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.billing_rules
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a billing rule.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a billing rule.
-
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a billing rule.
-
#initialize(transport) ⇒ BillingRulesNamespace
constructor
private
A new instance of BillingRulesNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List billing rules in evaluation order.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a billing rule.
Constructor Details
#initialize(transport) ⇒ BillingRulesNamespace
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 BillingRulesNamespace.
2236 2237 2238 |
# File 'lib/infrawrench/client.rb', line 2236 def initialize(transport) @transport = transport end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a billing rule
Requires org:settings:write rather than costs:write: a billing rule
changes every figure the organisation reports about itself, which is a
governance act on the scale of stating an exchange rate, not the scale of
saving a report.
Requires permission: org:settings:write.
POST /api/org/orgId/billing-rules
Raises on 400: Bad request
Raises on 409: Conflict
2261 2262 2263 2264 2265 2266 2267 2268 2269 |
# File 'lib/infrawrench/client.rb', line 2261 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/billing-rules", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a billing rule
Nothing cascades and nothing is restated: no adjustment was ever written into stored cost data, so the next read simply computes without this rule.
Requires permission: org:settings:write.
DELETE /api/org/orgId/billing-rules/id
Raises on 404: Not found
2288 2289 2290 2291 2292 2293 2294 2295 |
# File 'lib/infrawrench/client.rb', line 2288 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/billing-rules/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a billing rule
Requires permission: costs:read.
GET /api/org/orgId/billing-rules/id
Raises on 404: Not found
2311 2312 2313 2314 2315 2316 2317 2318 |
# File 'lib/infrawrench/client.rb', line 2311 def get(id:, org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/billing-rules/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List billing rules in evaluation order
Billing rules are the organisation's own adjustments to collected spend — a markup that recovers shared overhead, a discount negotiated outside the provider's pricing, a shared cluster reallocated onto the teams that use it.
They are applied at query time and never written into stored cost data. Collected spend stays exactly what the provider reported, so it can still be reconciled against an invoice, and editing or deleting a rule restates nothing.
Requires permission: costs:read.
GET /api/org/orgId/billing-rules
2342 2343 2344 2345 2346 2347 2348 2349 |
# File 'lib/infrawrench/client.rb', line 2342 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/billing-rules", path_params: { "orgId" => org_id }, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a billing rule
A full replace, enabled included — switching a markup off is an edit of
the rule, so there is one audited action for “this rule changed” rather
than two.
Requires permission: org:settings:write.
PUT /api/org/orgId/billing-rules/id
Raises on 400: Bad request
Raises on 404: Not found
Raises on 409: Conflict
2374 2375 2376 2377 2378 2379 2380 2381 2382 |
# File 'lib/infrawrench/client.rb', line 2374 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/billing-rules/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |