Skip to main content

List

Retrieves the list of budgets corresponding to the specified billing account.

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const ListBudgetsRequest = cloudApi.billing.budget_service.ListBudgetsRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.BudgetServiceClient);

const result = await client.list(
ListBudgetsRequest.fromPartial({
billingAccountId: "billingAccountId",
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();

ListBudgetsRequest

billingAccountId : string

ID of the billing account to list budgets corresponding to. To get the billing account ID, use BillingAccountService.List request.

pageSize : 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.

pageToken : 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.

ListBudgetsResponse

budgets : Budget

List of budgets.

nextPageToken : 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

A Budget resource. For more information, see /docs/billing/concepts/budget.

id : string

ID of the budget.

name : string

Name of the budget.

createdAt : google.protobuf.Timestamp

Creation timestamp.

billingAccountId : string

ID of the billing account that the budget belongs to.

status : BudgetStatus

Status of the budget.

One of budgetSpec

Specification of the budget.

  • costBudget : CostBudgetSpec

    Cost budget specification.

  • expenseBudget : ExpenseBudgetSpec

    Expense budget specification.

  • balanceBudget : BalanceBudgetSpec

    Balance budget specification.

CostBudgetSpec

Cost budget specification describes budget that can be used to control cost of cloud resources usage.

amount : string

Max cost threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency.

notificationUserAccountIds : string

IDs of the yandex.cloud.iam.v1.UserAccount. Specified users will be be notified if the budget exceeds.

thresholdRules : 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.

One of startType

Start type of the budget.

  • resetPeriod : 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.

  • startDate : string
    Custom start date of the budget.

    Must be the first day of a month and must be formatted like YYYY-MM-DD.

endDate : string

End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD.

ExpenseBudgetSpec

Expense budget specification describes budget that can be used to control expense of cloud resources usage.

amount : string

Max expense threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency.

notificationUserAccountIds : string

IDs of the yandex.cloud.iam.v1.UserAccount. Specified users will be be notified if the budget exceeds.

thresholdRules : 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.

  • resetPeriod : 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.

  • startDate : string
    Custom start date of the budget.

    Must be the first day of a month and must be formatted like YYYY-MM-DD.

endDate : string

End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD.

BalanceBudgetSpec

Balance budget specification describes budget that can be used to control yandex.cloud.billing.v1.BillingAccount.balance.

amount : string

Max balance threshold of the budget. Amount currency is the same as corresponding yandex.cloud.billing.v1.BillingAccount.currency.

notificationUserAccountIds : string

IDs of the yandex.cloud.iam.v1.UserAccount. Specified users will be be notified if the budget exceeds.

thresholdRules : ThresholdRule

List of the ThresholdRule. Rules define intermediate balance thresholds of the budget.

startDate : string

Start_date of the budget. Must be the first day of a month and must be formatted like YYYY-MM-DD.

endDate : string

End date of the budget. Must be the last day of a month and must be formatted like YYYY-MM-DD.

ThresholdRule

Rules that define intermediate cost thresholds of the budget.

type : ThresholdType

Type of the rule.

amount : string

Amount of the rule.

  • Must be less than 100 if type is PERCENT.
  • Must be less than budget's amount if type is AMOUNT.
notificationUserAccountIds : string

IDs of the yandex.cloud.iam.v1.UserAccount. Specified users will be be notified if the threshold exceeds.

ConsumptionFilter

Filter that can be used for specific resources selection.

serviceIds : string

IDs of the yandex.cloud.billing.v1.Service. Only consumption of resources corresponding to the given services is used for the budget calculation. Empty sequence means no services filters.

cloudFoldersFilters : 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

Filter that can be used for specific cloud and its folders selection.

cloudId : string

ID of the yandex.cloud.resourcemanager.v1.Cloud. Only consumption within specified cloud is used for the budget calculation.

folderIds : string

IDs of the yandex.cloud.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.