org_budgets
Creates, updates, deletes, gets or lists an org_budgets resource.
Overview
| Name | org_budgets |
| Type | Resource |
| Id | github.billing.org_budgets |
Fields
The following fields are returned by SELECT queries:
- get_budget_org
- get_all_budgets_org
Response when updating a budget
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the budget. |
budget_entity_name | string | The name of the entity to apply the budget to (example: octocat/hello-world) |
budget_alerting | object | |
budget_amount | integer | The budget amount in whole dollars. For license-based products, this represents the number of licenses. |
budget_product_sku | string | A single product or sku to apply the budget to. (example: actions_linux) |
budget_scope | string | The type of scope for the budget (enterprise, organization, repository, cost_center) (example: enterprise) |
budget_type | string | The type of pricing for the budget (ProductPricing) (example: ProductPricing) |
prevent_further_usage | boolean | Whether to prevent additional spending once the budget is exceeded |
Response when getting all budgets
| Name | Datatype | Description |
|---|---|---|
budgets | array | Array of budget objects for the enterprise |
has_next_page | boolean | Indicates if there are more pages of results available (maps to hasNextPage from billing platform) |
total_count | integer | Total number of budgets matching the query |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_budget_org | select | org, budget_id | > [!NOTE] > This endpoint is in public preview and is subject to change. Gets a budget by ID. The authenticated user must be an organization admin or billing manager. | |
get_all_budgets_org | select | org | page, per_page, scope | > [!NOTE] > This endpoint is in public preview and is subject to change. Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. Each page returns up to 10 budgets. |
update_budget_org | update | org, budget_id | > [!NOTE] > This endpoint is in public preview and is subject to change. Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager. | |
delete_budget_org | delete | org, budget_id | > [!NOTE] > This endpoint is in public preview and is subject to change. Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
budget_id | string | The ID corresponding to the budget. |
org | string | The organization name. The name is not case sensitive. |
page | integer | The page number of the results to fetch. |
per_page | integer | The number of results per page (max 10). |
scope | string | Filter budgets by scope type. |
SELECT examples
- get_budget_org
- get_all_budgets_org
> [!NOTE]
> This endpoint is in public preview and is subject to change.
Gets a budget by ID. The authenticated user must be an organization admin or billing manager.
SELECT
id,
budget_entity_name,
budget_alerting,
budget_amount,
budget_product_sku,
budget_scope,
budget_type,
prevent_further_usage
FROM github.billing.org_budgets
WHERE org = '{{ org }}' -- required
AND budget_id = '{{ budget_id }}' -- required
;
> [!NOTE]
> This endpoint is in public preview and is subject to change.
Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager.
Each page returns up to 10 budgets.
SELECT
budgets,
has_next_page,
total_count
FROM github.billing.org_budgets
WHERE org = '{{ org }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND scope = '{{ scope }}'
;
UPDATE examples
- update_budget_org
> [!NOTE]
> This endpoint is in public preview and is subject to change.
Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager.
UPDATE github.billing.org_budgets
SET
budget_amount = {{ budget_amount }},
prevent_further_usage = {{ prevent_further_usage }},
budget_alerting = '{{ budget_alerting }}',
budget_scope = '{{ budget_scope }}',
budget_entity_name = '{{ budget_entity_name }}',
budget_type = '{{ budget_type }}',
budget_product_sku = '{{ budget_product_sku }}'
WHERE
org = '{{ org }}' --required
AND budget_id = '{{ budget_id }}' --required
RETURNING
budget,
message;
DELETE examples
- delete_budget_org
> [!NOTE]
> This endpoint is in public preview and is subject to change.
Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager.
DELETE FROM github.billing.org_budgets
WHERE org = '{{ org }}' --required
AND budget_id = '{{ budget_id }}' --required
;