@@ -45,7 +45,9 @@ class CalendarPeriod(proto.Enum):
4545
4646 Values:
4747 CALENDAR_PERIOD_UNSPECIFIED (0):
48- No description available.
48+ Calendar period is unset. This is the default
49+ if the budget is for a custom time period
50+ (CustomPeriod).
4951 MONTH (1):
5052 A month. Month starts on the first day of
5153 each month, such as January 1, February 1, March
@@ -87,17 +89,20 @@ class Budget(proto.Message):
8789 amount (google.cloud.billing.budgets_v1.types.BudgetAmount):
8890 Required. Budgeted amount.
8991 threshold_rules (MutableSequence[google.cloud.billing.budgets_v1.types.ThresholdRule]):
90- Optional. Rules that trigger alerts
91- (notifications of thresholds being crossed) when
92- spend exceeds the specified percentages of the
93- budget.
92+ Optional. Rules that trigger alerts (notifications of
93+ thresholds being crossed) when spend exceeds the specified
94+ percentages of the budget.
95+
96+ Optional for ``pubsubTopic`` notifications.
97+
98+ Required if using email notifications.
9499 notifications_rule (google.cloud.billing.budgets_v1.types.NotificationsRule):
95100 Optional. Rules to apply to notifications
96101 sent based on budget spend and thresholds.
97102 etag (str):
98103 Optional. Etag to validate that the object is
99104 unchanged for a read-modify-write operation.
100- An empty etag will cause an update to overwrite
105+ An empty etag causes an update to overwrite
101106 other changes.
102107 """
103108
@@ -185,22 +190,32 @@ class LastPeriodAmount(proto.Message):
185190 [Filter.calendar_period][google.cloud.billing.budgets.v1.Filter.calendar_period]
186191 spend. At this time, the amount is automatically 100% of the last
187192 calendar period's spend; that is, there are no other options yet.
188- Future configuration options will be described here (for example,
189- configuring a percentage of last period's spend). LastPeriodAmount
190- cannot be set for a budget configured with a
193+ LastPeriodAmount cannot be set for a budget configured with a
191194 [Filter.custom_period][google.cloud.billing.budgets.v1.Filter.custom_period].
192195
193196 """
194197
195198
196199class ThresholdRule (proto .Message ):
197- r"""ThresholdRule contains a definition of a threshold which triggers an
198- alert (a notification of a threshold being crossed) to be sent when
199- spend goes above the specified amount. Alerts are automatically
200- e-mailed to users with the Billing Account Administrator role or the
201- Billing Account User role. The thresholds here have no effect on
202- notifications sent to anything configured under
203- ``Budget.all_updates_rule``.
200+ r"""ThresholdRule contains the definition of a threshold. Threshold
201+ rules define the triggering events used to generate a budget
202+ notification email. When a threshold is crossed (spend exceeds the
203+ specified percentages of the budget), budget alert emails are sent
204+ to the email recipients you specify in the
205+ `NotificationsRule <#notificationsrule>`__.
206+
207+ Threshold rules also affect the fields included in the `JSON data
208+ object <https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format>`__
209+ sent to a Pub/Sub topic.
210+
211+ Threshold rules are *required* if using email notifications.
212+
213+ Threshold rules are *optional* if only setting a ```pubsubTopic``
214+ NotificationsRule <#NotificationsRule>`__, unless you want your JSON
215+ data object to include data about the thresholds you set.
216+
217+ For more information, see `set budget threshold rules and
218+ actions <https://cloud.google.com/billing/docs/how-to/budgets#budget-actions>`__.
204219
205220 Attributes:
206221 threshold_percent (float):
@@ -252,18 +267,36 @@ class NotificationsRule(proto.Message):
252267
253268 Attributes:
254269 pubsub_topic (str):
255- Optional. The name of the Pub/Sub topic where budget related
256- messages will be published, in the form
270+ Optional. The name of the Pub/Sub topic where budget- related
271+ messages are published, in the form
257272 ``projects/{project_id}/topics/{topic_id}``. Updates are
258- sent at regular intervals to the topic. The topic needs to
259- be created before the budget is created; see
260- https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
261- for more details. Caller is expected to have
262- ``pubsub.topics.setIamPolicy`` permission on the topic when
263- it's set for a budget, otherwise, the API call will fail
264- with PERMISSION_DENIED. See
265- https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
266- for more details on Pub/Sub roles and permissions.
273+ sent to the topic at regular intervals; the timing of the
274+ updates is not dependent on the `threshold
275+ rules <#thresholdrule>`__ you've set.
276+
277+ Note that if you want your `Pub/Sub JSON
278+ object <https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format>`__
279+ to contain data for ``alertThresholdExceeded``, you need at
280+ least one `alert threshold rule <#thresholdrule>`__. When
281+ you set threshold rules, you must also enable at least one
282+ of the email notification options, either using the default
283+ IAM recipients or Cloud Monitoring email notification
284+ channels.
285+
286+ To use Pub/Sub topics with budgets, you must do the
287+ following:
288+
289+ 1. Create the Pub/Sub topic before connecting it to your
290+ budget. For guidance, see `Manage programmatic budget
291+ alert
292+ notifications <https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications>`__.
293+
294+ 2. Grant the API caller the ``pubsub.topics.setIamPolicy``
295+ permission on the Pub/Sub topic. If not set, the API call
296+ fails with PERMISSION_DENIED. For additional details on
297+ Pub/Sub roles and permissions, see `Permissions required
298+ for this
299+ task <https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#permissions_required_for_this_task>`__.
267300 schema_version (str):
268301 Optional. Required when
269302 [NotificationsRule.pubsub_topic][google.cloud.billing.budgets.v1.NotificationsRule.pubsub_topic]
@@ -273,15 +306,29 @@ class NotificationsRule(proto.Message):
273306 defined in
274307 https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format.
275308 monitoring_notification_channels (MutableSequence[str]):
276- Optional. Targets to send notifications to when a threshold
277- is exceeded. This is in addition to default recipients who
278- have billing account IAM roles. The value is the full REST
279- resource name of a monitoring notification channel with the
280- form
309+ Optional. Email targets to send notifications to when a
310+ threshold is exceeded. This is in addition to the
311+ ``DefaultIamRecipients`` who receive alert emails based on
312+ their billing account IAM role. The value is the full REST
313+ resource name of a Cloud Monitoring email notification
314+ channel with the form
281315 ``projects/{project_id}/notificationChannels/{channel_id}``.
282- A maximum of 5 channels are allowed. See
283- https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
284- for more details.
316+ A maximum of 5 email notifications are allowed.
317+
318+ To customize budget alert email recipients with monitoring
319+ notification channels, you *must create the monitoring
320+ notification channels before you link them to a budget*. For
321+ guidance on setting up notification channels to use with
322+ budgets, see `Customize budget alert email
323+ recipients <https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients>`__.
324+
325+ For Cloud Billing budget alerts, you *must use email
326+ notification channels*. The other types of notification
327+ channels are *not* supported, such as Slack, SMS, or
328+ PagerDuty. If you want to `send budget notifications to
329+ Slack <https://cloud.google.com/billing/docs/how-to/notify#send_notifications_to_slack>`__,
330+ use a pubsubTopic and configure `programmatic
331+ notifications <https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications>`__.
285332 disable_default_iam_recipients (bool):
286333 Optional. When set to true, disables default
287334 notifications sent when a threshold is exceeded.
@@ -324,9 +371,16 @@ class Filter(proto.Message):
324371 Optional. A set of projects of the form
325372 ``projects/{project}``, specifying that usage from only this
326373 set of projects should be included in the budget. If
327- omitted, the report will include all usage for the billing
374+ omitted, the report includes all usage for the billing
328375 account, regardless of which project the usage occurred on.
329- Only zero or one project can be specified currently.
376+ resource_ancestors (MutableSequence[str]):
377+ Optional. A set of folder and organization names of the form
378+ ``folders/{folderId}`` or
379+ ``organizations/{organizationId}``, specifying that usage
380+ from only this set of folders and organizations should be
381+ included in the budget. If omitted, the report includes all
382+ usage for all organizations, regardless of which
383+ organization the usage occurred on.
330384 credit_types (MutableSequence[str]):
331385 Optional. If
332386 [Filter.credit_types_treatment][google.cloud.billing.budgets.v1.Filter.credit_types_treatment]
@@ -347,32 +401,35 @@ class Filter(proto.Message):
347401 Optional. A set of services of the form
348402 ``services/{service_id}``, specifying that usage from only
349403 this set of services should be included in the budget. If
350- omitted, the report will include usage for all the services.
351- The service names are available through the Catalog API:
404+ omitted, the report includes usage for all the services. The
405+ service names are available through the Catalog API:
352406 https://cloud.google.com/billing/v1/how-tos/catalog-api.
353407 subaccounts (MutableSequence[str]):
354408 Optional. A set of subaccounts of the form
355409 ``billingAccounts/{account_id}``, specifying that usage from
356410 only this set of subaccounts should be included in the
357411 budget. If a subaccount is set to the name of the parent
358- account, usage from the parent account will be included. If
359- the field is omitted, the report will include usage from the
360- parent account and all subaccounts, if they exist.
412+ account, usage from the parent account is included. If the
413+ field is omitted, the report includes usage from the parent
414+ account and all subaccounts, if they exist.
361415 labels (MutableMapping[str, google.protobuf.struct_pb2.ListValue]):
362- Optional. A single label and value pair
363- specifying that usage from only this set of
364- labeled resources should be included in the
365- budget. Currently, multiple entries or multiple
366- values per entry are not allowed. If omitted,
367- the report will include all labeled and
368- unlabeled usage.
416+ Optional. A single label and value pair specifying that
417+ usage from only this set of labeled resources should be
418+ included in the budget. If omitted, the report includes all
419+ labeled and unlabeled usage.
420+
421+ An object containing a single ``"key": value`` pair.
422+ Example: ``{ "name": "wrench" }``.
423+
424+ *Currently, multiple entries or multiple values per entry
425+ are not allowed.*
369426 calendar_period (google.cloud.billing.budgets_v1.types.CalendarPeriod):
370427 Optional. Specifies to track usage for
371428 recurring calendar period. For example, assume
372429 that CalendarPeriod.QUARTER is set. The budget
373- will track usage from April 1 to June 30, when
374- the current calendar month is April, May, June.
375- After that, it will track usage from July 1 to
430+ tracks usage from April 1 to June 30, when the
431+ current calendar month is April, May, June.
432+ After that, it tracks usage from July 1 to
376433 September 30 when the current calendar month is
377434 July, August, September, so on.
378435
@@ -420,6 +477,10 @@ class CreditTypesTreatment(proto.Enum):
420477 proto .STRING ,
421478 number = 1 ,
422479 )
480+ resource_ancestors : MutableSequence [str ] = proto .RepeatedField (
481+ proto .STRING ,
482+ number = 2 ,
483+ )
423484 credit_types : MutableSequence [str ] = proto .RepeatedField (
424485 proto .STRING ,
425486 number = 7 ,
0 commit comments