Class: Infrawrench::CostCentresRulesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::CostCentresRulesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.cost_centres.rules
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create an allocation rule.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete an allocation rule.
-
#initialize(transport) ⇒ CostCentresRulesNamespace
constructor
private
A new instance of CostCentresRulesNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List allocation rules in evaluation order.
-
#swap(body:, org_id: nil, request_options: nil) ⇒ Array<Hash>
Swap the priorities of two allocation rules.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update an allocation rule.
Constructor Details
#initialize(transport) ⇒ CostCentresRulesNamespace
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 CostCentresRulesNamespace.
1635 1636 1637 |
# File 'lib/infrawrench/client.rb', line 1635 def initialize(transport) @transport = transport end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create an allocation rule
Maps spend onto a cost centre. Rules evaluate first-match-wins by ascending priority against each cost row's tags, account, provider, and service.
Requires permission: costs:write.
POST /api/org/orgId/cost-centres/rules
Raises on 400: Bad request
Raises on 404: Not found
1659 1660 1661 1662 1663 1664 1665 1666 1667 |
# File 'lib/infrawrench/client.rb', line 1659 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/cost-centres/rules", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete an allocation rule
Requires permission: costs:write.
DELETE /api/org/orgId/cost-centres/rules/id
Raises on 404: Not found
1683 1684 1685 1686 1687 1688 1689 1690 |
# File 'lib/infrawrench/client.rb', line 1683 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/cost-centres/rules/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List allocation rules in evaluation order
Requires permission: costs:read.
GET /api/org/orgId/cost-centres/rules
1704 1705 1706 1707 1708 1709 1710 1711 |
# File 'lib/infrawrench/client.rb', line 1704 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/cost-centres/rules", path_params: { "orgId" => org_id }, request_options: ) end |
#swap(body:, org_id: nil, request_options: nil) ⇒ Array<Hash>
Swap the priorities of two allocation rules
Atomically swaps priorities so first-match-wins order can be edited without a half-applied pair of independent updates.
Requires permission: costs:write.
POST /api/org/orgId/cost-centres/rules/swap
Raises on 400: Bad request
Raises on 404: Not found
1733 1734 1735 1736 1737 1738 1739 1740 1741 |
# File 'lib/infrawrench/client.rb', line 1733 def swap(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/cost-centres/rules/swap", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update an allocation rule
Requires permission: costs:write.
PUT /api/org/orgId/cost-centres/rules/id
Raises on 400: Bad request
Raises on 404: Not found
1760 1761 1762 1763 1764 1765 1766 1767 1768 |
# File 'lib/infrawrench/client.rb', line 1760 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/cost-centres/rules/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |