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.
2358 2359 2360 |
# File 'lib/infrawrench/client.rb', line 2358 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
2383 2384 2385 2386 2387 2388 2389 2390 2391 |
# File 'lib/infrawrench/client.rb', line 2383 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
2410 2411 2412 2413 2414 2415 2416 2417 |
# File 'lib/infrawrench/client.rb', line 2410 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
2433 2434 2435 2436 2437 2438 2439 2440 |
# File 'lib/infrawrench/client.rb', line 2433 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
2464 2465 2466 2467 2468 2469 2470 2471 |
# File 'lib/infrawrench/client.rb', line 2464 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
2496 2497 2498 2499 2500 2501 2502 2503 2504 |
# File 'lib/infrawrench/client.rb', line 2496 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 |