From a15a776b0ced4b222b9f3263167bcbb6b4accc08 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Tue, 27 Oct 2020 17:27:41 -0700 Subject: [PATCH] feat: Add support for credit type filter field. PiperOrigin-RevId: 339364732 --- .../billing/budgets/v1/budget_model.proto | 75 ++++++++++++------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/google/cloud/billing/budgets/v1/budget_model.proto b/google/cloud/billing/budgets/v1/budget_model.proto index 693538c1..1cbdbd7b 100644 --- a/google/cloud/billing/budgets/v1/budget_model.proto +++ b/google/cloud/billing/budgets/v1/budget_model.proto @@ -55,10 +55,13 @@ message Budget { // Optional. Rules that trigger alerts (notifications of thresholds // being crossed) when spend exceeds the specified percentages of the budget. - repeated ThresholdRule threshold_rules = 5 [(google.api.field_behavior) = OPTIONAL]; + repeated ThresholdRule threshold_rules = 5 + [(google.api.field_behavior) = OPTIONAL]; - // Optional. Rules to apply to notifications sent based on budget spend and thresholds. - NotificationsRule notifications_rule = 6 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Rules to apply to notifications sent based on budget spend and + // thresholds. + NotificationsRule notifications_rule = 6 + [(google.api.field_behavior) = OPTIONAL]; // Optional. Etag to validate that the object is unchanged for a // read-modify-write operation. @@ -86,9 +89,7 @@ message BudgetAmount { // that is, there are no other options yet. // Future configuration will be described here (for example, configuring a // percentage of last period's spend). -message LastPeriodAmount { - -} +message LastPeriodAmount {} // ThresholdRule contains a definition of a threshold which triggers // an alert (a notification of a threshold being crossed) to be sent when @@ -124,10 +125,10 @@ message ThresholdRule { // NotificationsRule defines notifications that are sent based on budget spend // and thresholds. message NotificationsRule { - // 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 + // 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#manage-notifications // for more details. // Caller is expected to have @@ -142,20 +143,23 @@ message NotificationsRule { // https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format string schema_version = 2 [(google.api.field_behavior) = OPTIONAL]; - // 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 + // 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. - repeated string monitoring_notification_channels = 3 [(google.api.field_behavior) = OPTIONAL]; + repeated string monitoring_notification_channels = 3 + [(google.api.field_behavior) = OPTIONAL]; - // 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. - bool disable_default_iam_recipients = 4 [(google.api.field_behavior) = OPTIONAL]; + // 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. + bool disable_default_iam_recipients = 4 + [(google.api.field_behavior) = OPTIONAL]; } // A filter for a budget, limiting the scope of the cost to calculate. @@ -173,6 +177,10 @@ message Filter { // All types of credit are added to the net cost to determine the spend for // threshold calculations. EXCLUDE_ALL_CREDITS = 2; + + // Credit types specified in the credit_types field are subtracted from the + // gross cost to determine the spend for threshold calculations. + INCLUDE_SPECIFIED_CREDITS = 3; } // Optional. A set of projects of the form `projects/{project}`, @@ -182,8 +190,18 @@ message Filter { // Only zero or one project can be specified currently. repeated string projects = 1 [(google.api.field_behavior) = OPTIONAL]; + // Optional. A list of credit types to be subtracted from gross cost to + // determine the spend for threshold calculations if and only if + // credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If + // credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be + // empty. See credits.type on + // https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema + // for a list of acceptable credit type values in this field. + repeated string credit_types = 7 [(google.api.field_behavior) = OPTIONAL]; + // Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`. - CreditTypesTreatment credit_types_treatment = 4 [(google.api.field_behavior) = OPTIONAL]; + CreditTypesTreatment credit_types_treatment = 4 + [(google.api.field_behavior) = OPTIONAL]; // Optional. A set of services of the form `services/{service_id}`, // specifying that usage from only this set of services should be @@ -193,17 +211,18 @@ message Filter { // https://cloud.google.com/billing/v1/how-tos/catalog-api. repeated string services = 3 [(google.api.field_behavior) = OPTIONAL]; - // 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, + // 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 the field is omitted, // the report will include usage from the parent account and all subaccounts, // if they exist. repeated string subaccounts = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. A single label and value pair specifying that usage from only this set of - // labeled resources should be included in the budget. Currently, multiple - // entries or multiple values per entry are not allowed. If omitted, the - // report will include all labeled and unlabeled usage. - map labels = 6 [(google.api.field_behavior) = OPTIONAL]; + // Optional. A single label and value pair specifying that usage from only + // this set of labeled resources should be included in the budget. Currently, + // multiple entries or multiple values per entry are not allowed. If omitted, + // the report will include all labeled and unlabeled usage. + map labels = 6 + [(google.api.field_behavior) = OPTIONAL]; }