Updates a budget and returns the updated budget. WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. Budget fields that are not exposed in this API will not be changed by this method.

Scopes

You will need authorization for at least one of the following scopes to make a valid call:

  • https://www.googleapis.com/auth/cloud-billing
  • https://www.googleapis.com/auth/cloud-platform

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-billing. You can set the scope for this method like this: billingbudgets1-beta1 --scope <scope> billing-accounts budgets-patch ...

Required Scalar Argument

  • <name> (string)
    • Output only. Resource name of the budget. The resource name implies the scope of a budget. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

GoogleCloudBillingBudgetsV1beta1UpdateBudgetRequest:
  budget:
    all-updates-rule:
      disable-default-iam-recipients: boolean
      enable-project-level-recipients: boolean
      monitoring-notification-channels: [string]
      pubsub-topic: string
      schema-version: string
    amount:
      specified-amount:
        currency-code: string
        nanos: integer
        units: string
    budget-filter:
      calendar-period: string
      credit-types: [string]
      credit-types-treatment: string
      custom-period:
        end-date:
          day: integer
          month: integer
          year: integer
        start-date:
          day: integer
          month: integer
          year: integer
      projects: [string]
      resource-ancestors: [string]
      services: [string]
      subaccounts: [string]
    display-name: string
    etag: string
    name: string
    ownership-scope: string
  update-mask: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r .budget.all-updates-rule disable-default-iam-recipients=true
    • Optional. When set to true, disables default notifications sent when a threshold is exceeded. Default notifications are sent to those with Billing Account Administrator and Billing Account User IAM roles for the target account.
  • enable-project-level-recipients=false
    • Optional. When set to true, and when the budget has a single project configured, notifications will be sent to project level recipients of that project. This field will be ignored if the budget has multiple or no project configured. Currently, project level recipients are the users with Owner role on a cloud project.
  • monitoring-notification-channels=lorem
    • Optional. Targets to send notifications to when a threshold is exceeded. This is in addition to default recipients who have billing account IAM roles. The value is the full REST resource name of a monitoring notification channel with the form projects/{project_id}/notificationChannels/{channel_id}. A maximum of 5 channels are allowed. See https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients for more details.
    • Each invocation of this argument appends the given value to the array.
  • pubsub-topic=eos
    • Optional. The name of the Pub/Sub topic where budget related messages will be published, in the form projects/{project_id}/topics/{topic_id}. Updates are sent at regular intervals to the topic. The topic needs to be created before the budget is created; see https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications for more details. Caller is expected to have pubsub.topics.setIamPolicy permission on the topic when it's set for a budget, otherwise, the API call will fail with PERMISSION_DENIED. See https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#permissions_required_for_this_task for more details on Pub/Sub roles and permissions.
  • schema-version=labore

    • Optional. Required when AllUpdatesRule.pubsub_topic is set. The schema version of the notification sent to AllUpdatesRule.pubsub_topic. Only "1.0" is accepted. It represents the JSON schema as defined in https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format.
  • ..amount.specified-amount currency-code=sed

    • The three-letter currency code defined in ISO 4217.
  • nanos=31
    • Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero. For example $-1.75 is represented as units=-1 and nanos=-750,000,000.
  • units=sed

    • The whole units of the amount. For example if currencyCode is &#34;USD&#34;, then 1 unit is one US dollar.
  • ...budget-filter calendar-period=no

    • Optional. Specifies to track usage for recurring calendar period. For example, assume that CalendarPeriod.QUARTER is set. The budget will track usage from April 1 to June 30, when the current calendar month is April, May, June. After that, it will track usage from July 1 to September 30 when the current calendar month is July, August, September, so on.
  • credit-types=stet
    • Optional. If Filter.credit_types_treatment is INCLUDE_SPECIFIED_CREDITS, this is a list of credit types to be subtracted from gross cost to determine the spend for threshold calculations. See a list of acceptable credit type values. If Filter.credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be empty.
    • Each invocation of this argument appends the given value to the array.
  • credit-types-treatment=kasd
    • Optional. If not set, default behavior is INCLUDE_ALL_CREDITS.
  • custom-period.end-date day=77
    • Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
  • month=58
    • Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
  • year=77

    • Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
  • ..start-date day=33

    • Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
  • month=25
    • Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
  • year=70

    • Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
  • ... projects=sed

    • Optional. A set of projects of the form projects/{project}, specifying that usage from only this set of projects should be included in the budget. If omitted, the report will include all usage for the billing account, regardless of which project the usage occurred on.
    • Each invocation of this argument appends the given value to the array.
  • resource-ancestors=duo
    • Optional. A set of folder and organization names of the form folders/{folderId} or organizations/{organizationId}, specifying that usage from only this set of folders and organizations should be included in the budget. If omitted, the budget includes all usage that the billing account pays for. If the folder or organization contains projects that are paid for by a different Cloud Billing account, the budget doesn't apply to those projects.
    • Each invocation of this argument appends the given value to the array.
  • services=dolore
    • Optional. A set of services of the form services/{service_id}, specifying that usage from only this set of services should be included in the budget. If omitted, the report will include usage for all the services. The service names are available through the Catalog API: https://cloud.google.com/billing/v1/how-tos/catalog-api.
    • Each invocation of this argument appends the given value to the array.
  • subaccounts=et

    • Optional. A set of subaccounts of the form billingAccounts/{account_id}, specifying that usage from only this set of subaccounts should be included in the budget. If a subaccount is set to the name of the parent account, usage from the parent account will be included. If omitted, the report will include usage from the parent account and all subaccounts, if they exist.
    • Each invocation of this argument appends the given value to the array.
  • .. display-name=voluptua.

    • User data for display name in UI. Validation: <= 60 chars.
  • etag=amet.
    • Optional. Etag to validate that the object is unchanged for a read-modify-write operation. An empty etag will cause an update to overwrite other changes.
  • name=consetetur
    • Output only. Resource name of the budget. The resource name implies the scope of a budget. Values are of the form billingAccounts/{billingAccountId}/budgets/{budgetId}.
  • ownership-scope=diam

    • No description provided.
  • .. update-mask=dolor

    • Optional. Indicates which fields in the provided budget to update. Read-only fields (such as name) cannot be changed. If this is not provided, then only fields with non-default values from the request are updated. See https://developers.google.com/protocol-buffers/docs/proto3#default for more details about default values.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").