Get
Returns the specified budget.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const GetBudgetRequest = cloudApi.billing.budget_service.GetBudgetRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.BudgetServiceClient);
const result = await client.get(
GetBudgetRequest.fromPartial({
id: "id",
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.billing.v1.budget_service_pb2_grpc import BudgetServiceStub
from yandex.cloud.billing.v1.budget_service_pb2 import GetBudgetRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(BudgetServiceStub)
response = service.Get(GetBudgetRequest(id="id"))
print(response)
GetBudgetRequest
id
: string
ID of the budget to return. To get the budget ID, use BudgetService.List request.
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
: CostBudgetSpecCost budget specification.
expenseBudget
: ExpenseBudgetSpecExpense budget specification.
balanceBudget
: BalanceBudgetSpecBalance 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
: ResetPeriodTypePeriodic 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
: stringCustom 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
: ResetPeriodTypePeriodic 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
: stringCustom 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.