1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738
// This file is @generated by prost-build.
/// A budget is a plan that describes what you expect to spend on Cloud
/// projects, plus the rules to execute as spend is tracked against that plan,
/// (for example, send an alert when 90% of the target spend is met).
/// The budget time period is configurable, with options such as month (default),
/// quarter, year, or custom time period.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Budget {
/// 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}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// User data for display name in UI.
/// Validation: <= 60 chars.
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
/// Optional. Filters that define which resources are used to compute the
/// actual spend against the budget amount, such as projects, services, and the
/// budget's time period, as well as other filters.
#[prost(message, optional, tag = "3")]
pub budget_filter: ::core::option::Option<Filter>,
/// Required. Budgeted amount.
#[prost(message, optional, tag = "4")]
pub amount: ::core::option::Option<BudgetAmount>,
/// Optional. Rules that trigger alerts (notifications of thresholds
/// being crossed) when spend exceeds the specified percentages of the budget.
///
/// Optional for `pubsubTopic` notifications.
///
/// Required if using email notifications.
#[prost(message, repeated, tag = "5")]
pub threshold_rules: ::prost::alloc::vec::Vec<ThresholdRule>,
/// Optional. Rules to apply to notifications sent based on budget spend and
/// thresholds.
#[prost(message, optional, tag = "6")]
pub all_updates_rule: ::core::option::Option<AllUpdatesRule>,
/// 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.
#[prost(string, tag = "7")]
pub etag: ::prost::alloc::string::String,
}
/// The budgeted amount for each usage period.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BudgetAmount {
/// Specification for what amount to use as the budget.
#[prost(oneof = "budget_amount::BudgetAmount", tags = "1, 2")]
pub budget_amount: ::core::option::Option<budget_amount::BudgetAmount>,
}
/// Nested message and enum types in `BudgetAmount`.
pub mod budget_amount {
/// Specification for what amount to use as the budget.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum BudgetAmount {
/// A specified amount to use as the budget.
/// `currency_code` is optional. If specified when creating a budget, it must
/// match the currency of the billing account. If specified when updating a
/// budget, it must match the currency_code of the existing budget.
/// The `currency_code` is provided on output.
#[prost(message, tag = "1")]
SpecifiedAmount(super::super::super::super::super::r#type::Money),
/// Use the last period's actual spend as the budget for the present period.
/// LastPeriodAmount can only be set when the budget's time period is a
/// [Filter.calendar_period][google.cloud.billing.budgets.v1beta1.Filter.calendar_period].
/// It cannot be set in combination with
/// [Filter.custom_period][google.cloud.billing.budgets.v1beta1.Filter.custom_period].
#[prost(message, tag = "2")]
LastPeriodAmount(super::LastPeriodAmount),
}
}
/// Describes a budget amount targeted to the last
/// [Filter.calendar_period][google.cloud.billing.budgets.v1beta1.Filter.calendar_period]
/// spend. At this time, the amount is automatically 100% of the last calendar
/// period's spend; that is, there are no other options yet.
/// Future configuration options will be described here (for example, configuring
/// a percentage of last period's spend).
/// LastPeriodAmount cannot be set for a budget configured with
/// a
/// [Filter.custom_period][google.cloud.billing.budgets.v1beta1.Filter.custom_period].
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LastPeriodAmount {}
/// ThresholdRule contains the definition of a threshold. Threshold rules define
/// the triggering events used to generate a budget notification email. When a
/// threshold is crossed (spend exceeds the specified percentages of the
/// budget), budget alert emails are sent to the email recipients you specify
/// in the
/// [NotificationsRule](#notificationsrule).
///
/// Threshold rules also affect the fields included in the
/// [JSON data
/// object](<https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format>)
/// sent to a Pub/Sub topic.
///
/// Threshold rules are _required_ if using email notifications.
///
/// Threshold rules are _optional_ if only setting a
/// [`pubsubTopic` NotificationsRule](#NotificationsRule),
/// unless you want your JSON data object to include data about the thresholds
/// you set.
///
/// For more information, see
/// [set budget threshold rules and
/// actions](<https://cloud.google.com/billing/docs/how-to/budgets#budget-actions>).
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ThresholdRule {
/// Required. Send an alert when this threshold is exceeded.
/// This is a 1.0-based percentage, so 0.5 = 50%.
/// Validation: non-negative number.
#[prost(double, tag = "1")]
pub threshold_percent: f64,
/// Optional. The type of basis used to determine if spend has passed the
/// threshold. Behavior defaults to CURRENT_SPEND if not set.
#[prost(enumeration = "threshold_rule::Basis", tag = "2")]
pub spend_basis: i32,
}
/// Nested message and enum types in `ThresholdRule`.
pub mod threshold_rule {
/// The type of basis used to determine if spend has passed the threshold.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Basis {
/// Unspecified threshold basis.
Unspecified = 0,
/// Use current spend as the basis for comparison against the threshold.
CurrentSpend = 1,
/// Use forecasted spend for the period as the basis for comparison against
/// the threshold.
/// FORECASTED_SPEND can only be set when the budget's time period is a
/// [Filter.calendar_period][google.cloud.billing.budgets.v1beta1.Filter.calendar_period].
/// It cannot be set in combination with
/// [Filter.custom_period][google.cloud.billing.budgets.v1beta1.Filter.custom_period].
ForecastedSpend = 2,
}
impl Basis {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Basis::Unspecified => "BASIS_UNSPECIFIED",
Basis::CurrentSpend => "CURRENT_SPEND",
Basis::ForecastedSpend => "FORECASTED_SPEND",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BASIS_UNSPECIFIED" => Some(Self::Unspecified),
"CURRENT_SPEND" => Some(Self::CurrentSpend),
"FORECASTED_SPEND" => Some(Self::ForecastedSpend),
_ => None,
}
}
}
}
/// AllUpdatesRule defines notifications that are sent based on budget spend
/// and thresholds.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AllUpdatesRule {
/// 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.
#[prost(string, tag = "1")]
pub pubsub_topic: ::prost::alloc::string::String,
/// Optional. Required when
/// [AllUpdatesRule.pubsub_topic][google.cloud.billing.budgets.v1beta1.AllUpdatesRule.pubsub_topic]
/// is set. The schema version of the notification sent to
/// [AllUpdatesRule.pubsub_topic][google.cloud.billing.budgets.v1beta1.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.>
#[prost(string, tag = "2")]
pub schema_version: ::prost::alloc::string::String,
/// 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.
#[prost(string, repeated, tag = "3")]
pub monitoring_notification_channels: ::prost::alloc::vec::Vec<
::prost::alloc::string::String,
>,
/// 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.
#[prost(bool, tag = "4")]
pub disable_default_iam_recipients: bool,
/// 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.
#[prost(bool, tag = "5")]
pub enable_project_level_recipients: bool,
}
/// A filter for a budget, limiting the scope of the cost to calculate.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Filter {
/// 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.
#[prost(string, repeated, tag = "1")]
pub projects: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// 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.
#[prost(string, repeated, tag = "2")]
pub resource_ancestors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. If
/// [Filter.credit_types_treatment][google.cloud.billing.budgets.v1beta1.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](<https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type>).
///
/// If
/// [Filter.credit_types_treatment][google.cloud.billing.budgets.v1beta1.Filter.credit_types_treatment]
/// is **not** INCLUDE_SPECIFIED_CREDITS, this field must be empty.
#[prost(string, repeated, tag = "7")]
pub credit_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
#[prost(enumeration = "filter::CreditTypesTreatment", tag = "4")]
pub credit_types_treatment: i32,
/// 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.>
#[prost(string, repeated, tag = "3")]
pub services: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// 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.
#[prost(string, repeated, tag = "5")]
pub subaccounts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional. A single label and value pair specifying that usage from only
/// this set of labeled resources should be included in the budget. If omitted,
/// the report will include all labeled and unlabeled usage.
///
/// An object containing a single `"key": value` pair. Example: `{ "name":
/// "wrench" }`.
///
/// _Currently, multiple entries or multiple values per entry are not
/// allowed._
#[prost(btree_map = "string, message", tag = "6")]
pub labels: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost_types::ListValue,
>,
/// Multiple options to choose the budget's time period, specifying that only
/// usage that occurs during this time period should be included in the budget.
/// If not set, the <code>usage_period</code> defaults to CalendarPeriod.MONTH.
#[prost(oneof = "filter::UsagePeriod", tags = "8, 9")]
pub usage_period: ::core::option::Option<filter::UsagePeriod>,
}
/// Nested message and enum types in `Filter`.
pub mod filter {
/// Specifies how credits are applied when determining the spend for
/// threshold calculations. Budgets track the total cost minus any applicable
/// selected credits.
/// [See the documentation for a list of credit
/// types](<https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type>).
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum CreditTypesTreatment {
Unspecified = 0,
/// All types of credit are subtracted from the gross cost to determine the
/// spend for threshold calculations.
IncludeAllCredits = 1,
/// All types of credit are added to the net cost to determine the spend for
/// threshold calculations.
ExcludeAllCredits = 2,
/// [Credit
/// types](<https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#credits-type>)
/// specified in the credit_types field are subtracted from the
/// gross cost to determine the spend for threshold calculations.
IncludeSpecifiedCredits = 3,
}
impl CreditTypesTreatment {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
CreditTypesTreatment::Unspecified => "CREDIT_TYPES_TREATMENT_UNSPECIFIED",
CreditTypesTreatment::IncludeAllCredits => "INCLUDE_ALL_CREDITS",
CreditTypesTreatment::ExcludeAllCredits => "EXCLUDE_ALL_CREDITS",
CreditTypesTreatment::IncludeSpecifiedCredits => {
"INCLUDE_SPECIFIED_CREDITS"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CREDIT_TYPES_TREATMENT_UNSPECIFIED" => Some(Self::Unspecified),
"INCLUDE_ALL_CREDITS" => Some(Self::IncludeAllCredits),
"EXCLUDE_ALL_CREDITS" => Some(Self::ExcludeAllCredits),
"INCLUDE_SPECIFIED_CREDITS" => Some(Self::IncludeSpecifiedCredits),
_ => None,
}
}
}
/// Multiple options to choose the budget's time period, specifying that only
/// usage that occurs during this time period should be included in the budget.
/// If not set, the <code>usage_period</code> defaults to CalendarPeriod.MONTH.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum UsagePeriod {
/// 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.
#[prost(enumeration = "super::CalendarPeriod", tag = "8")]
CalendarPeriod(i32),
/// Optional. Specifies to track usage from any start date (required) to any
/// end date (optional). This time period is static, it does not recur.
#[prost(message, tag = "9")]
CustomPeriod(super::CustomPeriod),
}
}
/// All date times begin at 12 AM US and Canadian Pacific Time (UTC-8).
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CustomPeriod {
/// Required. The start date must be after January 1, 2017.
#[prost(message, optional, tag = "1")]
pub start_date: ::core::option::Option<super::super::super::super::r#type::Date>,
/// Optional. The end date of the time period. Budgets with elapsed end date
/// won't be processed. If unset, specifies to track all usage incurred since
/// the start_date.
#[prost(message, optional, tag = "2")]
pub end_date: ::core::option::Option<super::super::super::super::r#type::Date>,
}
/// A `CalendarPeriod` represents the abstract concept of a time period that
/// has a canonical start. Grammatically, "the start of the current
/// `CalendarPeriod`". All calendar times begin at 12 AM US and Canadian
/// Pacific Time (UTC-8).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CalendarPeriod {
/// Calendar period is unset. This is the default if the budget is for a
/// custom time period (CustomPeriod).
Unspecified = 0,
/// A month. Month starts on the first day of each month, such as January 1,
/// February 1, March 1, and so on.
Month = 1,
/// A quarter. Quarters start on dates January 1, April 1, July 1, and October
/// 1 of each year.
Quarter = 2,
/// A year. Year starts on January 1.
Year = 3,
}
impl CalendarPeriod {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
CalendarPeriod::Unspecified => "CALENDAR_PERIOD_UNSPECIFIED",
CalendarPeriod::Month => "MONTH",
CalendarPeriod::Quarter => "QUARTER",
CalendarPeriod::Year => "YEAR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CALENDAR_PERIOD_UNSPECIFIED" => Some(Self::Unspecified),
"MONTH" => Some(Self::Month),
"QUARTER" => Some(Self::Quarter),
"YEAR" => Some(Self::Year),
_ => None,
}
}
}
/// Request for CreateBudget
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateBudgetRequest {
/// Required. The name of the billing account to create the budget in. Values
/// are of the form `billingAccounts/{billingAccountId}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Budget to create.
#[prost(message, optional, tag = "2")]
pub budget: ::core::option::Option<Budget>,
}
/// Request for UpdateBudget
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateBudgetRequest {
/// Required. The updated budget object.
/// The budget to update is specified by the budget name in the budget.
#[prost(message, optional, tag = "1")]
pub budget: ::core::option::Option<Budget>,
/// 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.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Request for GetBudget
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBudgetRequest {
/// Required. Name of budget to get. Values are of the form
/// `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Request for ListBudgets
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBudgetsRequest {
/// Required. Name of billing account to list budgets under. Values
/// are of the form `billingAccounts/{billingAccountId}`.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Optional. Set the scope of the budgets to be returned, in the format of the
/// resource name. The scope of a budget is the cost that it tracks, such as
/// costs for a single project, or the costs for all projects in a folder. Only
/// project scope (in the format of "projects/project-id" or "projects/123") is
/// supported in this field. When this field is set to a project's resource
/// name, the budgets returned are tracking the costs for that project.
#[prost(string, tag = "4")]
pub scope: ::prost::alloc::string::String,
/// Optional. The maximum number of budgets to return per page.
/// The default and maximum value are 100.
#[prost(int32, tag = "2")]
pub page_size: i32,
/// Optional. The value returned by the last `ListBudgetsResponse` which
/// indicates that this is a continuation of a prior `ListBudgets` call,
/// and that the system should return the next page of data.
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
/// Response for ListBudgets
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListBudgetsResponse {
/// List of the budgets owned by the requested billing account.
#[prost(message, repeated, tag = "1")]
pub budgets: ::prost::alloc::vec::Vec<Budget>,
/// If not empty, indicates that there may be more budgets that match the
/// request; this value should be passed in a new `ListBudgetsRequest`.
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
/// Request for DeleteBudget
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteBudgetRequest {
/// Required. Name of the budget to delete. Values are of the form
/// `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod budget_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// BudgetService stores Cloud Billing budgets, which define a
/// budget plan and rules to execute as we track spend against that plan.
#[derive(Debug, Clone)]
pub struct BudgetServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> BudgetServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> BudgetServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BudgetServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Creates a new budget. See
/// [Quotas and limits](https://cloud.google.com/billing/quotas)
/// for more information on the limits of the number of budgets you can create.
pub async fn create_budget(
&mut self,
request: impl tonic::IntoRequest<super::CreateBudgetRequest>,
) -> std::result::Result<tonic::Response<super::Budget>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.billing.budgets.v1beta1.BudgetService/CreateBudget",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.billing.budgets.v1beta1.BudgetService",
"CreateBudget",
),
);
self.inner.unary(req, path, codec).await
}
/// 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.
pub async fn update_budget(
&mut self,
request: impl tonic::IntoRequest<super::UpdateBudgetRequest>,
) -> std::result::Result<tonic::Response<super::Budget>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.billing.budgets.v1beta1.BudgetService/UpdateBudget",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.billing.budgets.v1beta1.BudgetService",
"UpdateBudget",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns a budget.
///
/// WARNING: There are some fields exposed on the Google Cloud Console that
/// aren't available on this API. When reading from the API, you will not
/// see these fields in the return value, though they may have been set
/// in the Cloud Console.
pub async fn get_budget(
&mut self,
request: impl tonic::IntoRequest<super::GetBudgetRequest>,
) -> std::result::Result<tonic::Response<super::Budget>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.billing.budgets.v1beta1.BudgetService/GetBudget",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.billing.budgets.v1beta1.BudgetService",
"GetBudget",
),
);
self.inner.unary(req, path, codec).await
}
/// Returns a list of budgets for a billing account.
///
/// WARNING: There are some fields exposed on the Google Cloud Console that
/// aren't available on this API. When reading from the API, you will not
/// see these fields in the return value, though they may have been set
/// in the Cloud Console.
pub async fn list_budgets(
&mut self,
request: impl tonic::IntoRequest<super::ListBudgetsRequest>,
) -> std::result::Result<
tonic::Response<super::ListBudgetsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.billing.budgets.v1beta1.BudgetService/ListBudgets",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.billing.budgets.v1beta1.BudgetService",
"ListBudgets",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes a budget. Returns successfully if already deleted.
pub async fn delete_budget(
&mut self,
request: impl tonic::IntoRequest<super::DeleteBudgetRequest>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.billing.budgets.v1beta1.BudgetService/DeleteBudget",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.billing.budgets.v1beta1.BudgetService",
"DeleteBudget",
),
);
self.inner.unary(req, path, codec).await
}
}
}