Billing API, gRPC: BudgetService
A set of methods for managing Budget resources.
Call | Description |
---|---|
Get | Returns the specified budget. |
List | Retrieves the list of budgets corresponding to the specified billing account. |
Create | Creates a budget for the specified billing account. |
Calls BudgetService
Get
Returns the specified budget.
rpc Get (GetBudgetRequest) returns (Budget)
GetBudgetRequest
Field | Description |
---|---|
id | string Required. ID of the budget to return. To get the budget ID, use BudgetService.List request. The maximum string length in characters is 50. |
Budget
Field | Description |
---|---|
id | string ID of the budget. |
name | string Name of the budget. |
created_at | google.protobuf.Timestamp Creation timestamp. |
billing_account_id | string ID of the billing account that the budget belongs to. |
status | enum BudgetStatus Status of the budget.
|
budget_spec | oneof: cost_budget , expense_budget or balance_budget Specification of the budget. |
cost_budget | CostBudgetSpec Cost budget specification. |
expense_budget | ExpenseBudgetSpec Expense budget specification. |
balance_budget | BalanceBudgetSpec Balance budget specification. |
CostBudgetSpec
Field | Description |
---|---|
amount | string Required. Max cost threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate cost thresholds of the budget. |
filter | ConsumptionFilter Filter that can be used for specific resources selection. Only consumption cost of selected resources are used for the budget calculation. |
start_type | oneof: reset_period or start_date Start type of the budget. |
reset_period | enum ResetPeriodType Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
|
start_date | string Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
ThresholdRule
Field | Description |
---|---|
type | enum ThresholdType Required. Type of the rule.
|
amount | string Required. Amount of the rule.
|
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the threshold exceeds. |
ConsumptionFilter
Field | Description |
---|---|
service_ids[] | string IDs of the billing.v1.Service . Only consumption of resources corresponding to the given services is used for the budget calculation. Empty sequence means no services filters. |
cloud_folders_filters[] | CloudFoldersConsumptionFilter Cloud and folders consumption filter. Only consumption within specified clouds and folders is used for the budget calculation. Empty sequence means no cloud and folders filters. |
CloudFoldersConsumptionFilter
Field | Description |
---|---|
cloud_id | string ID of the resourcemanager.v1.Cloud . Only consumption within specified cloud is used for the budget calculation. |
folder_ids[] | string IDs of the resourcemanager.v1.Folder . Only consumption within specified folders of the given cloud is used for the budget calculation. Empty sequence means no folders filters and the whole cloud consumption will be used. |
ExpenseBudgetSpec
Field | Description |
---|---|
amount | string Required. Max expense threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate expense thresholds of the budget. |
filter | ConsumptionFilter Filter that can be used for specific resources selection. Only consumption expense of selected resources are used for the budget calculation. |
start_type | oneof: reset_period or start_date Start type of the budget. |
reset_period | enum ResetPeriodType Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
|
start_date | string Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
BalanceBudgetSpec
Field | Description |
---|---|
amount | string Required. Max balance threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate balance thresholds of the budget. |
start_date | string Start_date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
List
Retrieves the list of budgets corresponding to the specified billing account.
rpc List (ListBudgetsRequest) returns (ListBudgetsResponse)
ListBudgetsRequest
Field | Description |
---|---|
billing_account_id | string Required. ID of the billing account to list budgets corresponding to. To get the billing account ID, use BillingAccountService.List request. The maximum string length in characters is 50. |
page_size | int64 The maximum number of results per page to return. If the number of available results is larger than page_size , the service returns a ListBudgetsResponse.next_page_token that can be used to get the next page of results in subsequent list requests. The maximum value is 1000. |
page_token | string Page token. To get the next page of results, set page_token to the ListBudgetsResponse.next_page_token returned by a previous list request. The maximum string length in characters is 100. |
ListBudgetsResponse
Field | Description |
---|---|
budgets[] | Budget List of budgets. |
next_page_token | string This token allows you to get the next page of results for list requests. If the number of results is larger than ListBudgetsRequest.page_size, use next_page_token as the value for the ListBudgetsRequest.page_token query parameter in the next list request. Each subsequent list request will have its own next_page_token to continue paging through the results. |
Budget
Field | Description |
---|---|
id | string ID of the budget. |
name | string Name of the budget. |
created_at | google.protobuf.Timestamp Creation timestamp. |
billing_account_id | string ID of the billing account that the budget belongs to. |
status | enum BudgetStatus Status of the budget.
|
budget_spec | oneof: cost_budget , expense_budget or balance_budget Specification of the budget. |
cost_budget | CostBudgetSpec Cost budget specification. |
expense_budget | ExpenseBudgetSpec Expense budget specification. |
balance_budget | BalanceBudgetSpec Balance budget specification. |
CostBudgetSpec
Field | Description |
---|---|
amount | string Required. Max cost threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate cost thresholds of the budget. |
filter | ConsumptionFilter Filter that can be used for specific resources selection. Only consumption cost of selected resources are used for the budget calculation. |
start_type | oneof: reset_period or start_date Start type of the budget. |
reset_period | enum ResetPeriodType Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
|
start_date | string Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
ThresholdRule
Field | Description |
---|---|
type | enum ThresholdType Required. Type of the rule.
|
amount | string Required. Amount of the rule.
|
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the threshold exceeds. |
ConsumptionFilter
Field | Description |
---|---|
service_ids[] | string IDs of the billing.v1.Service . Only consumption of resources corresponding to the given services is used for the budget calculation. Empty sequence means no services filters. |
cloud_folders_filters[] | CloudFoldersConsumptionFilter Cloud and folders consumption filter. Only consumption within specified clouds and folders is used for the budget calculation. Empty sequence means no cloud and folders filters. |
CloudFoldersConsumptionFilter
Field | Description |
---|---|
cloud_id | string ID of the resourcemanager.v1.Cloud . Only consumption within specified cloud is used for the budget calculation. |
folder_ids[] | string IDs of the resourcemanager.v1.Folder . Only consumption within specified folders of the given cloud is used for the budget calculation. Empty sequence means no folders filters and the whole cloud consumption will be used. |
ExpenseBudgetSpec
Field | Description |
---|---|
amount | string Required. Max expense threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate expense thresholds of the budget. |
filter | ConsumptionFilter Filter that can be used for specific resources selection. Only consumption expense of selected resources are used for the budget calculation. |
start_type | oneof: reset_period or start_date Start type of the budget. |
reset_period | enum ResetPeriodType Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
|
start_date | string Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
BalanceBudgetSpec
Field | Description |
---|---|
amount | string Required. Max balance threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate balance thresholds of the budget. |
start_date | string Start_date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
Create
Creates a budget for the specified billing account.
rpc Create (CreateBudgetRequest) returns (operation.Operation)
Metadata and response of Operation:
Operation.metadata:CreateBudgetMetadata
Operation.response:Budget
CreateBudgetRequest
Field | Description |
---|---|
billing_account_id | string Required. ID of the billing account to list budgets corresponding to. To get the billing account ID, use billing.v1.BillingAccountService.List request. The maximum string length in characters is 50. |
name | string Required. Name of the budget. |
budget_spec | oneof: cost_budget_spec , expense_budget_spec or balance_budget_spec Specification of the budget. |
cost_budget_spec | CostBudgetSpec Cost budget specification. |
expense_budget_spec | ExpenseBudgetSpec Expense budget specification. |
balance_budget_spec | BalanceBudgetSpec Balance budget specification. |
CostBudgetSpec
Field | Description |
---|---|
amount | string Required. Max cost threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate cost thresholds of the budget. |
filter | ConsumptionFilter Filter that can be used for specific resources selection. Only consumption cost of selected resources are used for the budget calculation. |
start_type | oneof: reset_period or start_date Start type of the budget. |
reset_period | enum ResetPeriodType Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
|
start_date | string Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
ThresholdRule
Field | Description |
---|---|
type | enum ThresholdType Required. Type of the rule.
|
amount | string Required. Amount of the rule.
|
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the threshold exceeds. |
ConsumptionFilter
Field | Description |
---|---|
service_ids[] | string IDs of the billing.v1.Service . Only consumption of resources corresponding to the given services is used for the budget calculation. Empty sequence means no services filters. |
cloud_folders_filters[] | CloudFoldersConsumptionFilter Cloud and folders consumption filter. Only consumption within specified clouds and folders is used for the budget calculation. Empty sequence means no cloud and folders filters. |
CloudFoldersConsumptionFilter
Field | Description |
---|---|
cloud_id | string ID of the resourcemanager.v1.Cloud . Only consumption within specified cloud is used for the budget calculation. |
folder_ids[] | string IDs of the resourcemanager.v1.Folder . Only consumption within specified folders of the given cloud is used for the budget calculation. Empty sequence means no folders filters and the whole cloud consumption will be used. |
ExpenseBudgetSpec
Field | Description |
---|---|
amount | string Required. Max expense threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate expense thresholds of the budget. |
filter | ConsumptionFilter Filter that can be used for specific resources selection. Only consumption expense of selected resources are used for the budget calculation. |
start_type | oneof: reset_period or start_date Start type of the budget. |
reset_period | enum ResetPeriodType Periodic start type that resets budget after specified period is finished. First time budget is calculated in the current period, i.e. current month, quarter or year.
|
start_date | string Custom start date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
BalanceBudgetSpec
Field | Description |
---|---|
amount | string Required. Max balance threshold of the budget. Amount currency is the same as corresponding billing.v1.BillingAccount.currency . |
notification_user_account_ids[] | string IDs of the iam.v1.UserAccount . Specified users will be be notified if the budget exceeds. The minimum number of elements is 1. |
threshold_rules[] | ThresholdRule List of the ThresholdRule. Rules define intermediate balance thresholds of the budget. |
start_date | string Start_date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD. |
end_date | string Required. End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD. |
Operation
Field | Description |
---|---|
id | string ID of the operation. |
description | string Description of the operation. 0-256 characters long. |
created_at | google.protobuf.Timestamp Creation timestamp. |
created_by | string ID of the user or service account who initiated the operation. |
modified_at | google.protobuf.Timestamp The time when the Operation resource was last modified. |
done | bool If the value is false , it means the operation is still in progress. If true , the operation is completed, and either error or response is available. |
metadata | google.protobuf.Any Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any. |
result | oneof: error or response The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true , exactly one of error or response is set. |
error | google.rpc.Status The error result of the operation in case of failure or cancellation. |
response | google.protobuf.Any if operation finished successfully. |
CreateBudgetMetadata
Field | Description |
---|---|
budget_id | string ID of the budget. |
Budget
Field | Description |
---|---|
id | string ID of the budget. |
name | string Name of the budget. |
created_at | google.protobuf.Timestamp Creation timestamp. |
billing_account_id | string ID of the billing account that the budget belongs to. |
status | enum BudgetStatus Status of the budget.
|
budget_spec | oneof: cost_budget , expense_budget or balance_budget Specification of the budget. |
cost_budget | CostBudgetSpec Cost budget specification. |
expense_budget | ExpenseBudgetSpec Expense budget specification. |
balance_budget | BalanceBudgetSpec Balance budget specification. |