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.
1900 1901 1902 |
# File 'lib/infrawrench/client.rb', line 1900 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
1925 1926 1927 1928 1929 1930 1931 1932 1933 |
# File 'lib/infrawrench/client.rb', line 1925 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
1952 1953 1954 1955 1956 1957 1958 1959 |
# File 'lib/infrawrench/client.rb', line 1952 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
1975 1976 1977 1978 1979 1980 1981 1982 |
# File 'lib/infrawrench/client.rb', line 1975 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
2006 2007 2008 2009 2010 2011 2012 2013 |
# File 'lib/infrawrench/client.rb', line 2006 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
2038 2039 2040 2041 2042 2043 2044 2045 2046 |
# File 'lib/infrawrench/client.rb', line 2038 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 |