Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Доступны в регионе
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • AI Studio
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Партнёрская программа
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»
Yandex Cloud Billing
  • Начало работы
  • Управление доступом
  • Правила тарификации
  • Справочник Terraform
    • Аутентификация в API
      • Overview
        • Overview
        • Get
        • List
        • Create
  • Аудитные логи Audit Trails

В этой статье:

  • gRPC request
  • CreateBudgetRequest
  • CostBudgetSpec
  • ThresholdRule
  • ConsumptionFilter
  • CloudFoldersConsumptionFilter
  • ExpenseBudgetSpec
  • BalanceBudgetSpec
  • operation.Operation
  • CreateBudgetMetadata
  • Budget
  • CostBudgetSpec
  • ThresholdRule
  • ConsumptionFilter
  • CloudFoldersConsumptionFilter
  • ExpenseBudgetSpec
  • BalanceBudgetSpec
  1. Справочник API
  2. gRPC (англ.)
  3. Budget
  4. Create

Billing API, gRPC: BudgetService.Create

Статья создана
Yandex Cloud
Обновлена 24 апреля 2025 г.
  • gRPC request
  • CreateBudgetRequest
  • CostBudgetSpec
  • ThresholdRule
  • ConsumptionFilter
  • CloudFoldersConsumptionFilter
  • ExpenseBudgetSpec
  • BalanceBudgetSpec
  • operation.Operation
  • CreateBudgetMetadata
  • Budget
  • CostBudgetSpec
  • ThresholdRule
  • ConsumptionFilter
  • CloudFoldersConsumptionFilter
  • ExpenseBudgetSpec
  • BalanceBudgetSpec

Creates a budget for the specified billing account.

gRPC requestgRPC request

rpc Create (CreateBudgetRequest) returns (operation.Operation)

CreateBudgetRequestCreateBudgetRequest

{
  "billing_account_id": "string",
  "name": "string",
  // Includes only one of the fields `cost_budget_spec`, `expense_budget_spec`, `balance_budget_spec`
  "cost_budget_spec": {
    "amount": "string",
    "notification_user_account_ids": [
      "string"
    ],
    "threshold_rules": [
      {
        "type": "ThresholdType",
        "amount": "string",
        "notification_user_account_ids": [
          "string"
        ]
      }
    ],
    "filter": {
      "service_ids": [
        "string"
      ],
      "cloud_folders_filters": [
        {
          "cloud_id": "string",
          "folder_ids": [
            "string"
          ]
        }
      ]
    },
    // Includes only one of the fields `reset_period`, `start_date`
    "reset_period": "ResetPeriodType",
    "start_date": "string",
    // end of the list of possible fields
    "end_date": "string"
  },
  "expense_budget_spec": {
    "amount": "string",
    "notification_user_account_ids": [
      "string"
    ],
    "threshold_rules": [
      {
        "type": "ThresholdType",
        "amount": "string",
        "notification_user_account_ids": [
          "string"
        ]
      }
    ],
    "filter": {
      "service_ids": [
        "string"
      ],
      "cloud_folders_filters": [
        {
          "cloud_id": "string",
          "folder_ids": [
            "string"
          ]
        }
      ]
    },
    // Includes only one of the fields `reset_period`, `start_date`
    "reset_period": "ResetPeriodType",
    "start_date": "string",
    // end of the list of possible fields
    "end_date": "string"
  },
  "balance_budget_spec": {
    "amount": "string",
    "notification_user_account_ids": [
      "string"
    ],
    "threshold_rules": [
      {
        "type": "ThresholdType",
        "amount": "string",
        "notification_user_account_ids": [
          "string"
        ]
      }
    ],
    "start_date": "string",
    "end_date": "string"
  }
  // end of the list of possible fields
}

Field

Description

billing_account_id

string

Required field. ID of the billing account to list budgets corresponding to.
To get the billing account ID, use yandex.cloud.billing.v1.BillingAccountService.List request.

name

string

Required field. Name of the budget.

cost_budget_spec

CostBudgetSpec

Cost budget specification.

Includes only one of the fields cost_budget_spec, expense_budget_spec, balance_budget_spec.

Specification of the budget.

expense_budget_spec

ExpenseBudgetSpec

Expense budget specification.

Includes only one of the fields cost_budget_spec, expense_budget_spec, balance_budget_spec.

Specification of the budget.

balance_budget_spec

BalanceBudgetSpec

Balance budget specification.

Includes only one of the fields cost_budget_spec, expense_budget_spec, balance_budget_spec.

Specification of the budget.

CostBudgetSpecCostBudgetSpec

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

Field

Description

amount

string

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the budget exceeds.

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.

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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

  • RESET_PERIOD_TYPE_UNSPECIFIED
  • MONTHLY: Reset budget every month.
  • QUARTER: Reset budget every quarter.
  • ANNUALLY: Reset budget every 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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

end_date

string

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

ThresholdRuleThresholdRule

Rules that define intermediate cost thresholds of the budget.

Field

Description

type

enum ThresholdType

Required field. Type of the rule.

  • THRESHOLD_TYPE_UNSPECIFIED
  • PERCENT: Percent.
  • AMOUNT: The same as budget amount.

amount

string

Required field. Amount of the rule.

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the threshold exceeds.

ConsumptionFilterConsumptionFilter

Filter that can be used for specific resources selection.

Field

Description

service_ids[]

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.

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.

CloudFoldersConsumptionFilterCloudFoldersConsumptionFilter

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

Field

Description

cloud_id

string

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

folder_ids[]

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.

ExpenseBudgetSpecExpenseBudgetSpec

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

Field

Description

amount

string

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the budget exceeds.

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.

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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

  • RESET_PERIOD_TYPE_UNSPECIFIED
  • MONTHLY: Reset budget every month.
  • QUARTER: Reset budget every quarter.
  • ANNUALLY: Reset budget every 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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

end_date

string

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

BalanceBudgetSpecBalanceBudgetSpec

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

Field

Description

amount

string

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the budget exceeds.

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 field. End date of the budget.
Must be the last day of a month and must be formatted like YYYY-MM-DD.

operation.Operationoperation.Operation

{
  "id": "string",
  "description": "string",
  "created_at": "google.protobuf.Timestamp",
  "created_by": "string",
  "modified_at": "google.protobuf.Timestamp",
  "done": "bool",
  "metadata": {
    "budget_id": "string"
  },
  // Includes only one of the fields `error`, `response`
  "error": "google.rpc.Status",
  "response": {
    "id": "string",
    "name": "string",
    "created_at": "google.protobuf.Timestamp",
    "billing_account_id": "string",
    "status": "BudgetStatus",
    // Includes only one of the fields `cost_budget`, `expense_budget`, `balance_budget`
    "cost_budget": {
      "amount": "string",
      "notification_user_account_ids": [
        "string"
      ],
      "threshold_rules": [
        {
          "type": "ThresholdType",
          "amount": "string",
          "notification_user_account_ids": [
            "string"
          ]
        }
      ],
      "filter": {
        "service_ids": [
          "string"
        ],
        "cloud_folders_filters": [
          {
            "cloud_id": "string",
            "folder_ids": [
              "string"
            ]
          }
        ]
      },
      // Includes only one of the fields `reset_period`, `start_date`
      "reset_period": "ResetPeriodType",
      "start_date": "string",
      // end of the list of possible fields
      "end_date": "string"
    },
    "expense_budget": {
      "amount": "string",
      "notification_user_account_ids": [
        "string"
      ],
      "threshold_rules": [
        {
          "type": "ThresholdType",
          "amount": "string",
          "notification_user_account_ids": [
            "string"
          ]
        }
      ],
      "filter": {
        "service_ids": [
          "string"
        ],
        "cloud_folders_filters": [
          {
            "cloud_id": "string",
            "folder_ids": [
              "string"
            ]
          }
        ]
      },
      // Includes only one of the fields `reset_period`, `start_date`
      "reset_period": "ResetPeriodType",
      "start_date": "string",
      // end of the list of possible fields
      "end_date": "string"
    },
    "balance_budget": {
      "amount": "string",
      "notification_user_account_ids": [
        "string"
      ],
      "threshold_rules": [
        {
          "type": "ThresholdType",
          "amount": "string",
          "notification_user_account_ids": [
            "string"
          ]
        }
      ],
      "start_date": "string",
      "end_date": "string"
    }
    // end of the list of possible fields
  }
  // end of the list of possible fields
}

An Operation resource. For more information, see 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

CreateBudgetMetadata

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.

error

google.rpc.Status

The error result of the operation in case of failure or cancellation.

Includes only one of the fields error, 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.

response

Budget

The normal response of the operation in case of success.
If the original method returns no data on success, such as Delete,
the response is google.protobuf.Empty.
If the original method is the standard Create/Update,
the response should be the target resource of the operation.
Any method that returns a long-running operation should document the response type, if any.

Includes only one of the fields error, 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.

CreateBudgetMetadataCreateBudgetMetadata

Field

Description

budget_id

string

ID of the budget.

BudgetBudget

A Budget resource. For more information, see [/docs/billing/concepts/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_STATUS_UNSPECIFIED
  • CREATING: The budget is being created.
  • ACTIVE: The budget is active.
  • FINISHED: The budget is finished.

cost_budget

CostBudgetSpec

Cost budget specification.

Includes only one of the fields cost_budget, expense_budget, balance_budget.

Specification of the budget.

expense_budget

ExpenseBudgetSpec

Expense budget specification.

Includes only one of the fields cost_budget, expense_budget, balance_budget.

Specification of the budget.

balance_budget

BalanceBudgetSpec

Balance budget specification.

Includes only one of the fields cost_budget, expense_budget, balance_budget.

Specification of the budget.

CostBudgetSpecCostBudgetSpec

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

Field

Description

amount

string

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the budget exceeds.

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.

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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

  • RESET_PERIOD_TYPE_UNSPECIFIED
  • MONTHLY: Reset budget every month.
  • QUARTER: Reset budget every quarter.
  • ANNUALLY: Reset budget every 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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

end_date

string

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

ThresholdRuleThresholdRule

Rules that define intermediate cost thresholds of the budget.

Field

Description

type

enum ThresholdType

Required field. Type of the rule.

  • THRESHOLD_TYPE_UNSPECIFIED
  • PERCENT: Percent.
  • AMOUNT: The same as budget amount.

amount

string

Required field. Amount of the rule.

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the threshold exceeds.

ConsumptionFilterConsumptionFilter

Filter that can be used for specific resources selection.

Field

Description

service_ids[]

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.

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.

CloudFoldersConsumptionFilterCloudFoldersConsumptionFilter

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

Field

Description

cloud_id

string

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

folder_ids[]

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.

ExpenseBudgetSpecExpenseBudgetSpec

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

Field

Description

amount

string

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the budget exceeds.

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.

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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

  • RESET_PERIOD_TYPE_UNSPECIFIED
  • MONTHLY: Reset budget every month.
  • QUARTER: Reset budget every quarter.
  • ANNUALLY: Reset budget every 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.

Includes only one of the fields reset_period, start_date.

Start type of the budget.

end_date

string

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

BalanceBudgetSpecBalanceBudgetSpec

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

Field

Description

amount

string

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

notification_user_account_ids[]

string

User account IDs.
Specified users will be be notified if the budget exceeds.

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 field. End date of the budget.
Must be the last day of a month and must be formatted like YYYY-MM-DD.

Была ли статья полезна?

Предыдущая
List
Следующая
Overview
Проект Яндекса
© 2025 ТОО «Облачные Сервисы Казахстан»