Budget API
Note: The Budget API is currently in beta. Please read the documentation carefully.
The Budget API allows you to create, update, and delete recurring budget rules to control your Kubernetes spending. Weekly and monthly budgets can be established to set limits on cost spend.
post
http://<your-kubecost-address>
/model/budget/recurring/set
Set recurring budget rule or update existing rule
get
http://<your-kubecost-address>
/model/budget/recurring/list
Get recurring budget rule(s)
delete
https://<your-kubecost-address>
/model/budget/recurring/delete
Delete recurring budget rule
Creating and updating recurring budget rules uses POST requests, which will require submitting a JSON object in the body of your request instead of adding parameters directly into the path (such as when deleting a recurring budget rule). See the Examples section below for more information on formatting your requests.
The
id
parameter when using the endpoint /setRecurringBudgetRules
is considered optional, but its use will vary depending on whether you want to create or update a budget rule. When creating a new budget rule,
id
should not be used. An ID for the budget rule will then be randomly generated in the response. When updating an existing budget rule, id
needs to be used to identify which budget rule you want to modify, even if you only have one existing rule.The
id
value of your recurring budget is needed to update or delete it. If you don't have the id
value saved, you can retrieve it using /getRecurringBudgetRules
, which will generate all existing budgets and their respective id
values.Warning: This feature is currently not in operation.kind
is therefore an optional parameter that will not affect your recurring budget.
Request
Response
{
"name": "example-test",
"property": "cluster",
"values": [
"test"
],
"kind": "soft",
"interval": "weekly",
"intervalDay": 3,
"amount": 100
}
{
"code": 200,
"data": [
{
"name": "example-test",
"id": "e59c076c-a5c1-422b-a9d6-e39bd8037c0a",
"property": "cluster",
"values": [
"test"
],
"kind": "soft",
"interval": "weekly",
"intervalDay": 3,
"amount": 100
}
}
Request
Response
http://<your-kubecost-address>/model/getRecurringBudgetRules
{
"code": 200,
"data": [
{
"name": "example-rule-1",
"id": "e18c936b-6f24-4a21-a4a6-8b764e62e039",
"filter": "namespace",
"kind": "soft",
"interval": "weekly",
"intervalDay": 2,
"amount": 25
},
{
"name": "example-rule-2",
"id": "9487dc23-46a6-4477-8e81-9530fa23fdea",
"filter": "cluster",
"kind": "hard",
"interval": "monthly",
"intervalDay": 15,
"amount": 50
}
]
}
Last modified 16d ago