@@ -19,6 +19,7 @@ package google.cloud.billing.budgets.v1;
1919import "google/api/field_behavior.proto" ;
2020import "google/api/resource.proto" ;
2121import "google/protobuf/struct.proto" ;
22+ import "google/type/date.proto" ;
2223import "google/type/money.proto" ;
2324
2425option go_package = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1;budgets" ;
@@ -29,8 +30,8 @@ option java_package = "com.google.cloud.billing.budgets.v1";
2930// A budget is a plan that describes what you expect to spend on Cloud
3031// projects, plus the rules to execute as spend is tracked against that plan,
3132// (for example, send an alert when 90% of the target spend is met).
32- // Currently all plans are monthly budgets so the usage period(s) tracked are
33- // implied (calendar months of usage back-to-back) .
33+ // The budget time period is configurable, with options such as month (default),
34+ // quarter, year, or custom time period .
3435message Budget {
3536 option (google.api.resource ) = {
3637 type : "billingbudgets.googleapis.com/Budget"
@@ -46,8 +47,9 @@ message Budget {
4647 // characters.
4748 string display_name = 2 ;
4849
49- // Optional. Filters that define which resources are used to compute
50- // the actual spend against the budget.
50+ // Optional. Filters that define which resources are used to compute the
51+ // actual spend against the budget amount, such as projects, services, and the
52+ // budget's time period, as well as other filters.
5153 Filter budget_filter = 3 [(google.api.field_behavior ) = OPTIONAL ];
5254
5355 // Required. Budgeted amount.
@@ -81,15 +83,23 @@ message BudgetAmount {
8183 google.type.Money specified_amount = 1 ;
8284
8385 // Use the last period's actual spend as the budget for the present period.
86+ // LastPeriodAmount can only be set when the budget's time period is a
87+ // [Filter.calendar_period][google.cloud.billing.budgets.v1.Filter.calendar_period].
88+ // It cannot be set in combination with
89+ // [Filter.custom_period][google.cloud.billing.budgets.v1.Filter.custom_period].
8490 LastPeriodAmount last_period_amount = 2 ;
8591 }
8692}
8793
88- // Describes a budget amount targeted to last period's spend.
89- // At this time, the amount is automatically 100% of last period's spend;
90- // that is, there are no other options yet.
91- // Future configuration will be described here (for example, configuring a
92- // percentage of last period's spend).
94+ // Describes a budget amount targeted to the last
95+ // [Filter.calendar_period][google.cloud.billing.budgets.v1.Filter.calendar_period]
96+ // spend. At this time, the amount is automatically 100% of the last calendar
97+ // period's spend; that is, there are no other options yet.
98+ // Future configuration options will be described here (for example, configuring
99+ // a percentage of last period's spend).
100+ // LastPeriodAmount cannot be set for a budget configured with
101+ // a
102+ // [Filter.custom_period][google.cloud.billing.budgets.v1.Filter.custom_period].
93103message LastPeriodAmount {}
94104
95105// ThresholdRule contains a definition of a threshold which triggers
@@ -110,6 +120,10 @@ message ThresholdRule {
110120
111121 // Use forecasted spend for the period as the basis for comparison against
112122 // the threshold.
123+ // FORECASTED_SPEND can only be set when the budget's time period is a
124+ // [Filter.calendar_period][google.cloud.billing.budgets.v1.Filter.calendar_period].
125+ // It cannot be set in combination with
126+ // [Filter.custom_period][google.cloud.billing.budgets.v1.Filter.custom_period].
113127 FORECASTED_SPEND = 2 ;
114128 }
115129
@@ -168,10 +182,12 @@ message NotificationsRule {
168182
169183// A filter for a budget, limiting the scope of the cost to calculate.
170184message Filter {
171- // Specifies how credits should be treated when determining spend for
172- // threshold calculations.
185+ // Specifies how credits are applied when determining the spend for
186+ // threshold calculations. Budgets track the total cost minus any applicable
187+ // selected credits.
188+ // [See the documentation for a list of credit
189+ // types](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type).
173190 enum CreditTypesTreatment {
174- // This is an invalid value.
175191 CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0 ;
176192
177193 // All types of credit are subtracted from the gross cost to determine the
@@ -182,7 +198,9 @@ message Filter {
182198 // threshold calculations.
183199 EXCLUDE_ALL_CREDITS = 2 ;
184200
185- // Credit types specified in the credit_types field are subtracted from the
201+ // [Credit
202+ // types](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type)
203+ // specified in the credit_types field are subtracted from the
186204 // gross cost to determine the spend for threshold calculations.
187205 INCLUDE_SPECIFIED_CREDITS = 3 ;
188206 }
@@ -198,13 +216,12 @@ message Filter {
198216 // [Filter.credit_types_treatment][google.cloud.billing.budgets.v1.Filter.credit_types_treatment]
199217 // is INCLUDE_SPECIFIED_CREDITS, this is a list of credit types to be
200218 // subtracted from gross cost to determine the spend for threshold
201- // calculations.
219+ // calculations. See [a list of acceptable credit type
220+ // values](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type).
202221 //
203222 // If
204223 // [Filter.credit_types_treatment][google.cloud.billing.budgets.v1.Filter.credit_types_treatment]
205- // is **not** INCLUDE_SPECIFIED_CREDITS, this field must be empty. See [a list
206- // of acceptable credit type
207- // values](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type).
224+ // is **not** INCLUDE_SPECIFIED_CREDITS, this field must be empty.
208225 repeated string credit_types = 7 [(google.api.field_behavior ) = OPTIONAL ];
209226
210227 // Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
@@ -233,4 +250,51 @@ message Filter {
233250 // the report will include all labeled and unlabeled usage.
234251 map <string , google.protobuf.ListValue > labels = 6
235252 [(google.api.field_behavior ) = OPTIONAL ];
253+
254+ // Multiple options to choose the budget's time period, specifying that only
255+ // usage that occurs during this time period should be included in the budget.
256+ // If not set, the `usage_period` defaults to CalendarPeriod.MONTH.
257+ oneof usage_period {
258+ // Optional. Specifies to track usage for recurring calendar period.
259+ // For example, assume that CalendarPeriod.QUARTER is set. The budget will
260+ // track usage from April 1 to June 30, when the current calendar month is
261+ // April, May, June. After that, it will track usage from July 1 to
262+ // September 30 when the current calendar month is July, August, September,
263+ // so on.
264+ CalendarPeriod calendar_period = 8 [(google.api.field_behavior ) = OPTIONAL ];
265+
266+ // Optional. Specifies to track usage from any start date (required) to any
267+ // end date (optional). This time period is static, it does not recur.
268+ CustomPeriod custom_period = 9 [(google.api.field_behavior ) = OPTIONAL ];
269+ }
270+ }
271+
272+ // All date times begin at 12 AM US and Canadian Pacific Time (UTC-8).
273+ message CustomPeriod {
274+ // Required. The start date must be after January 1, 2017.
275+ google.type.Date start_date = 1 [(google.api.field_behavior ) = REQUIRED ];
276+
277+ // Optional. The end date of the time period. Budgets with elapsed end date
278+ // won't be processed. If unset, specifies to track all usage incurred since
279+ // the start_date.
280+ google.type.Date end_date = 2 [(google.api.field_behavior ) = OPTIONAL ];
281+ }
282+
283+ // A `CalendarPeriod` represents the abstract concept of a time period that
284+ // has a canonical start. Grammatically, "the start of the current
285+ // `CalendarPeriod`". All calendar times begin at 12 AM US and Canadian
286+ // Pacific Time (UTC-8).
287+ enum CalendarPeriod {
288+ CALENDAR_PERIOD_UNSPECIFIED = 0 ;
289+
290+ // A month. Month starts on the first day of each month, such as January 1,
291+ // February 1, March 1, and so on.
292+ MONTH = 1 ;
293+
294+ // A quarter. Quarters start on dates January 1, April 1, July 1, and October
295+ // 1 of each year.
296+ QUARTER = 2 ;
297+
298+ // A year. Year starts on January 1.
299+ YEAR = 3 ;
236300}
0 commit comments