google_cloud_billing_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_type;
26extern crate lazy_static;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// A billing account in the
39/// [Google Cloud Console](https://console.cloud.google.com/). You can assign a
40/// billing account to one or more projects.
41#[derive(Clone, Default, PartialEq)]
42#[non_exhaustive]
43pub struct BillingAccount {
44 /// Output only. The resource name of the billing account. The resource name
45 /// has the form `billingAccounts/{billing_account_id}`. For example,
46 /// `billingAccounts/012345-567890-ABCDEF` would be the resource name for
47 /// billing account `012345-567890-ABCDEF`.
48 pub name: std::string::String,
49
50 /// Output only. True if the billing account is open, and will therefore be
51 /// charged for any usage on associated projects. False if the billing account
52 /// is closed, and therefore projects associated with it are unable to use paid
53 /// services.
54 pub open: bool,
55
56 /// The display name given to the billing account, such as `My Billing
57 /// Account`. This name is displayed in the Google Cloud Console.
58 pub display_name: std::string::String,
59
60 /// If this account is a
61 /// [subaccount](https://cloud.google.com/billing/docs/concepts), then this
62 /// will be the resource name of the parent billing account that it is being
63 /// resold through.
64 /// Otherwise this will be empty.
65 pub master_billing_account: std::string::String,
66
67 /// Output only. The billing account's parent resource identifier.
68 /// Use the `MoveBillingAccount` method to update the account's parent resource
69 /// if it is a organization.
70 /// Format:
71 ///
72 /// - `organizations/{organization_id}`, for example,
73 /// `organizations/12345678`
74 /// - `billingAccounts/{billing_account_id}`, for example,
75 /// `billingAccounts/012345-567890-ABCDEF`
76 pub parent: std::string::String,
77
78 /// Optional. The currency in which the billing account is billed and charged,
79 /// represented as an ISO 4217 code such as `USD`.
80 ///
81 /// Billing account currency is determined at the time of billing account
82 /// creation and cannot be updated subsequently, so this field should not be
83 /// set on update requests. In addition, a subaccount always matches the
84 /// currency of its parent billing account, so this field should not be set on
85 /// subaccount creation requests. Clients can read this field to determine the
86 /// currency of an existing billing account.
87 pub currency_code: std::string::String,
88
89 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
90}
91
92impl BillingAccount {
93 pub fn new() -> Self {
94 std::default::Default::default()
95 }
96
97 /// Sets the value of [name][crate::model::BillingAccount::name].
98 ///
99 /// # Example
100 /// ```ignore,no_run
101 /// # use google_cloud_billing_v1::model::BillingAccount;
102 /// let x = BillingAccount::new().set_name("example");
103 /// ```
104 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105 self.name = v.into();
106 self
107 }
108
109 /// Sets the value of [open][crate::model::BillingAccount::open].
110 ///
111 /// # Example
112 /// ```ignore,no_run
113 /// # use google_cloud_billing_v1::model::BillingAccount;
114 /// let x = BillingAccount::new().set_open(true);
115 /// ```
116 pub fn set_open<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
117 self.open = v.into();
118 self
119 }
120
121 /// Sets the value of [display_name][crate::model::BillingAccount::display_name].
122 ///
123 /// # Example
124 /// ```ignore,no_run
125 /// # use google_cloud_billing_v1::model::BillingAccount;
126 /// let x = BillingAccount::new().set_display_name("example");
127 /// ```
128 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
129 self.display_name = v.into();
130 self
131 }
132
133 /// Sets the value of [master_billing_account][crate::model::BillingAccount::master_billing_account].
134 ///
135 /// # Example
136 /// ```ignore,no_run
137 /// # use google_cloud_billing_v1::model::BillingAccount;
138 /// let x = BillingAccount::new().set_master_billing_account("example");
139 /// ```
140 pub fn set_master_billing_account<T: std::convert::Into<std::string::String>>(
141 mut self,
142 v: T,
143 ) -> Self {
144 self.master_billing_account = v.into();
145 self
146 }
147
148 /// Sets the value of [parent][crate::model::BillingAccount::parent].
149 ///
150 /// # Example
151 /// ```ignore,no_run
152 /// # use google_cloud_billing_v1::model::BillingAccount;
153 /// let x = BillingAccount::new().set_parent("example");
154 /// ```
155 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
156 self.parent = v.into();
157 self
158 }
159
160 /// Sets the value of [currency_code][crate::model::BillingAccount::currency_code].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_billing_v1::model::BillingAccount;
165 /// let x = BillingAccount::new().set_currency_code("example");
166 /// ```
167 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168 self.currency_code = v.into();
169 self
170 }
171}
172
173impl wkt::message::Message for BillingAccount {
174 fn typename() -> &'static str {
175 "type.googleapis.com/google.cloud.billing.v1.BillingAccount"
176 }
177}
178
179/// Encapsulation of billing information for a Google Cloud Console project. A
180/// project has at most one associated billing account at a time (but a billing
181/// account can be assigned to multiple projects).
182#[derive(Clone, Default, PartialEq)]
183#[non_exhaustive]
184pub struct ProjectBillingInfo {
185 /// Output only. The resource name for the `ProjectBillingInfo`; has the form
186 /// `projects/{project_id}/billingInfo`. For example, the resource name for the
187 /// billing information for project `tokyo-rain-123` would be
188 /// `projects/tokyo-rain-123/billingInfo`.
189 pub name: std::string::String,
190
191 /// Output only. The ID of the project that this `ProjectBillingInfo`
192 /// represents, such as `tokyo-rain-123`. This is a convenience field so that
193 /// you don't need to parse the `name` field to obtain a project ID.
194 pub project_id: std::string::String,
195
196 /// The resource name of the billing account associated with the project, if
197 /// any. For example, `billingAccounts/012345-567890-ABCDEF`.
198 pub billing_account_name: std::string::String,
199
200 /// Output only. True if the project is associated with an open billing
201 /// account, to which usage on the project is charged. False if the project is
202 /// associated with a closed billing account, or no billing account at all, and
203 /// therefore cannot use paid services.
204 pub billing_enabled: bool,
205
206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
207}
208
209impl ProjectBillingInfo {
210 pub fn new() -> Self {
211 std::default::Default::default()
212 }
213
214 /// Sets the value of [name][crate::model::ProjectBillingInfo::name].
215 ///
216 /// # Example
217 /// ```ignore,no_run
218 /// # use google_cloud_billing_v1::model::ProjectBillingInfo;
219 /// let x = ProjectBillingInfo::new().set_name("example");
220 /// ```
221 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
222 self.name = v.into();
223 self
224 }
225
226 /// Sets the value of [project_id][crate::model::ProjectBillingInfo::project_id].
227 ///
228 /// # Example
229 /// ```ignore,no_run
230 /// # use google_cloud_billing_v1::model::ProjectBillingInfo;
231 /// let x = ProjectBillingInfo::new().set_project_id("example");
232 /// ```
233 pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
234 self.project_id = v.into();
235 self
236 }
237
238 /// Sets the value of [billing_account_name][crate::model::ProjectBillingInfo::billing_account_name].
239 ///
240 /// # Example
241 /// ```ignore,no_run
242 /// # use google_cloud_billing_v1::model::ProjectBillingInfo;
243 /// let x = ProjectBillingInfo::new().set_billing_account_name("example");
244 /// ```
245 pub fn set_billing_account_name<T: std::convert::Into<std::string::String>>(
246 mut self,
247 v: T,
248 ) -> Self {
249 self.billing_account_name = v.into();
250 self
251 }
252
253 /// Sets the value of [billing_enabled][crate::model::ProjectBillingInfo::billing_enabled].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_billing_v1::model::ProjectBillingInfo;
258 /// let x = ProjectBillingInfo::new().set_billing_enabled(true);
259 /// ```
260 pub fn set_billing_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
261 self.billing_enabled = v.into();
262 self
263 }
264}
265
266impl wkt::message::Message for ProjectBillingInfo {
267 fn typename() -> &'static str {
268 "type.googleapis.com/google.cloud.billing.v1.ProjectBillingInfo"
269 }
270}
271
272/// Request message for `GetBillingAccount`.
273#[derive(Clone, Default, PartialEq)]
274#[non_exhaustive]
275pub struct GetBillingAccountRequest {
276 /// Required. The resource name of the billing account to retrieve. For
277 /// example, `billingAccounts/012345-567890-ABCDEF`.
278 pub name: std::string::String,
279
280 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
281}
282
283impl GetBillingAccountRequest {
284 pub fn new() -> Self {
285 std::default::Default::default()
286 }
287
288 /// Sets the value of [name][crate::model::GetBillingAccountRequest::name].
289 ///
290 /// # Example
291 /// ```ignore,no_run
292 /// # use google_cloud_billing_v1::model::GetBillingAccountRequest;
293 /// let x = GetBillingAccountRequest::new().set_name("example");
294 /// ```
295 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
296 self.name = v.into();
297 self
298 }
299}
300
301impl wkt::message::Message for GetBillingAccountRequest {
302 fn typename() -> &'static str {
303 "type.googleapis.com/google.cloud.billing.v1.GetBillingAccountRequest"
304 }
305}
306
307/// Request message for `ListBillingAccounts`.
308#[derive(Clone, Default, PartialEq)]
309#[non_exhaustive]
310pub struct ListBillingAccountsRequest {
311 /// Requested page size. The maximum page size is 100; this is also the
312 /// default.
313 pub page_size: i32,
314
315 /// A token identifying a page of results to return. This should be a
316 /// `next_page_token` value returned from a previous `ListBillingAccounts`
317 /// call. If unspecified, the first page of results is returned.
318 pub page_token: std::string::String,
319
320 /// Options for how to filter the returned billing accounts.
321 /// This only supports filtering for
322 /// [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
323 /// single provided parent billing account.
324 /// (for example,
325 /// `master_billing_account=billingAccounts/012345-678901-ABCDEF`).
326 /// Boolean algebra and other fields are not currently supported.
327 pub filter: std::string::String,
328
329 /// Optional. The parent resource to list billing accounts from.
330 /// Format:
331 ///
332 /// - `organizations/{organization_id}`, for example,
333 /// `organizations/12345678`
334 /// - `billingAccounts/{billing_account_id}`, for example,
335 /// `billingAccounts/012345-567890-ABCDEF`
336 pub parent: std::string::String,
337
338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
339}
340
341impl ListBillingAccountsRequest {
342 pub fn new() -> Self {
343 std::default::Default::default()
344 }
345
346 /// Sets the value of [page_size][crate::model::ListBillingAccountsRequest::page_size].
347 ///
348 /// # Example
349 /// ```ignore,no_run
350 /// # use google_cloud_billing_v1::model::ListBillingAccountsRequest;
351 /// let x = ListBillingAccountsRequest::new().set_page_size(42);
352 /// ```
353 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
354 self.page_size = v.into();
355 self
356 }
357
358 /// Sets the value of [page_token][crate::model::ListBillingAccountsRequest::page_token].
359 ///
360 /// # Example
361 /// ```ignore,no_run
362 /// # use google_cloud_billing_v1::model::ListBillingAccountsRequest;
363 /// let x = ListBillingAccountsRequest::new().set_page_token("example");
364 /// ```
365 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
366 self.page_token = v.into();
367 self
368 }
369
370 /// Sets the value of [filter][crate::model::ListBillingAccountsRequest::filter].
371 ///
372 /// # Example
373 /// ```ignore,no_run
374 /// # use google_cloud_billing_v1::model::ListBillingAccountsRequest;
375 /// let x = ListBillingAccountsRequest::new().set_filter("example");
376 /// ```
377 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
378 self.filter = v.into();
379 self
380 }
381
382 /// Sets the value of [parent][crate::model::ListBillingAccountsRequest::parent].
383 ///
384 /// # Example
385 /// ```ignore,no_run
386 /// # use google_cloud_billing_v1::model::ListBillingAccountsRequest;
387 /// let x = ListBillingAccountsRequest::new().set_parent("example");
388 /// ```
389 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390 self.parent = v.into();
391 self
392 }
393}
394
395impl wkt::message::Message for ListBillingAccountsRequest {
396 fn typename() -> &'static str {
397 "type.googleapis.com/google.cloud.billing.v1.ListBillingAccountsRequest"
398 }
399}
400
401/// Response message for `ListBillingAccounts`.
402#[derive(Clone, Default, PartialEq)]
403#[non_exhaustive]
404pub struct ListBillingAccountsResponse {
405 /// A list of billing accounts.
406 pub billing_accounts: std::vec::Vec<crate::model::BillingAccount>,
407
408 /// A token to retrieve the next page of results. To retrieve the next page,
409 /// call `ListBillingAccounts` again with the `page_token` field set to this
410 /// value. This field is empty if there are no more results to retrieve.
411 pub next_page_token: std::string::String,
412
413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
414}
415
416impl ListBillingAccountsResponse {
417 pub fn new() -> Self {
418 std::default::Default::default()
419 }
420
421 /// Sets the value of [billing_accounts][crate::model::ListBillingAccountsResponse::billing_accounts].
422 ///
423 /// # Example
424 /// ```ignore,no_run
425 /// # use google_cloud_billing_v1::model::ListBillingAccountsResponse;
426 /// use google_cloud_billing_v1::model::BillingAccount;
427 /// let x = ListBillingAccountsResponse::new()
428 /// .set_billing_accounts([
429 /// BillingAccount::default()/* use setters */,
430 /// BillingAccount::default()/* use (different) setters */,
431 /// ]);
432 /// ```
433 pub fn set_billing_accounts<T, V>(mut self, v: T) -> Self
434 where
435 T: std::iter::IntoIterator<Item = V>,
436 V: std::convert::Into<crate::model::BillingAccount>,
437 {
438 use std::iter::Iterator;
439 self.billing_accounts = v.into_iter().map(|i| i.into()).collect();
440 self
441 }
442
443 /// Sets the value of [next_page_token][crate::model::ListBillingAccountsResponse::next_page_token].
444 ///
445 /// # Example
446 /// ```ignore,no_run
447 /// # use google_cloud_billing_v1::model::ListBillingAccountsResponse;
448 /// let x = ListBillingAccountsResponse::new().set_next_page_token("example");
449 /// ```
450 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
451 self.next_page_token = v.into();
452 self
453 }
454}
455
456impl wkt::message::Message for ListBillingAccountsResponse {
457 fn typename() -> &'static str {
458 "type.googleapis.com/google.cloud.billing.v1.ListBillingAccountsResponse"
459 }
460}
461
462#[doc(hidden)]
463impl google_cloud_gax::paginator::internal::PageableResponse for ListBillingAccountsResponse {
464 type PageItem = crate::model::BillingAccount;
465
466 fn items(self) -> std::vec::Vec<Self::PageItem> {
467 self.billing_accounts
468 }
469
470 fn next_page_token(&self) -> std::string::String {
471 use std::clone::Clone;
472 self.next_page_token.clone()
473 }
474}
475
476/// Request message for `CreateBillingAccount`.
477#[derive(Clone, Default, PartialEq)]
478#[non_exhaustive]
479pub struct CreateBillingAccountRequest {
480 /// Required. The billing account resource to create.
481 /// Currently CreateBillingAccount only supports subaccount creation, so
482 /// any created billing accounts must be under a provided parent billing
483 /// account.
484 pub billing_account: std::option::Option<crate::model::BillingAccount>,
485
486 /// Optional. The parent to create a billing account from.
487 /// Format:
488 ///
489 /// - `billingAccounts/{billing_account_id}`, for example,
490 /// `billingAccounts/012345-567890-ABCDEF`
491 pub parent: std::string::String,
492
493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
494}
495
496impl CreateBillingAccountRequest {
497 pub fn new() -> Self {
498 std::default::Default::default()
499 }
500
501 /// Sets the value of [billing_account][crate::model::CreateBillingAccountRequest::billing_account].
502 ///
503 /// # Example
504 /// ```ignore,no_run
505 /// # use google_cloud_billing_v1::model::CreateBillingAccountRequest;
506 /// use google_cloud_billing_v1::model::BillingAccount;
507 /// let x = CreateBillingAccountRequest::new().set_billing_account(BillingAccount::default()/* use setters */);
508 /// ```
509 pub fn set_billing_account<T>(mut self, v: T) -> Self
510 where
511 T: std::convert::Into<crate::model::BillingAccount>,
512 {
513 self.billing_account = std::option::Option::Some(v.into());
514 self
515 }
516
517 /// Sets or clears the value of [billing_account][crate::model::CreateBillingAccountRequest::billing_account].
518 ///
519 /// # Example
520 /// ```ignore,no_run
521 /// # use google_cloud_billing_v1::model::CreateBillingAccountRequest;
522 /// use google_cloud_billing_v1::model::BillingAccount;
523 /// let x = CreateBillingAccountRequest::new().set_or_clear_billing_account(Some(BillingAccount::default()/* use setters */));
524 /// let x = CreateBillingAccountRequest::new().set_or_clear_billing_account(None::<BillingAccount>);
525 /// ```
526 pub fn set_or_clear_billing_account<T>(mut self, v: std::option::Option<T>) -> Self
527 where
528 T: std::convert::Into<crate::model::BillingAccount>,
529 {
530 self.billing_account = v.map(|x| x.into());
531 self
532 }
533
534 /// Sets the value of [parent][crate::model::CreateBillingAccountRequest::parent].
535 ///
536 /// # Example
537 /// ```ignore,no_run
538 /// # use google_cloud_billing_v1::model::CreateBillingAccountRequest;
539 /// let x = CreateBillingAccountRequest::new().set_parent("example");
540 /// ```
541 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
542 self.parent = v.into();
543 self
544 }
545}
546
547impl wkt::message::Message for CreateBillingAccountRequest {
548 fn typename() -> &'static str {
549 "type.googleapis.com/google.cloud.billing.v1.CreateBillingAccountRequest"
550 }
551}
552
553/// Request message for `UpdateBillingAccount`.
554#[derive(Clone, Default, PartialEq)]
555#[non_exhaustive]
556pub struct UpdateBillingAccountRequest {
557 /// Required. The name of the billing account resource to be updated.
558 pub name: std::string::String,
559
560 /// Required. The billing account resource to replace the resource on the
561 /// server.
562 pub account: std::option::Option<crate::model::BillingAccount>,
563
564 /// The update mask applied to the resource.
565 /// Only "display_name" is currently supported.
566 pub update_mask: std::option::Option<wkt::FieldMask>,
567
568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
569}
570
571impl UpdateBillingAccountRequest {
572 pub fn new() -> Self {
573 std::default::Default::default()
574 }
575
576 /// Sets the value of [name][crate::model::UpdateBillingAccountRequest::name].
577 ///
578 /// # Example
579 /// ```ignore,no_run
580 /// # use google_cloud_billing_v1::model::UpdateBillingAccountRequest;
581 /// let x = UpdateBillingAccountRequest::new().set_name("example");
582 /// ```
583 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
584 self.name = v.into();
585 self
586 }
587
588 /// Sets the value of [account][crate::model::UpdateBillingAccountRequest::account].
589 ///
590 /// # Example
591 /// ```ignore,no_run
592 /// # use google_cloud_billing_v1::model::UpdateBillingAccountRequest;
593 /// use google_cloud_billing_v1::model::BillingAccount;
594 /// let x = UpdateBillingAccountRequest::new().set_account(BillingAccount::default()/* use setters */);
595 /// ```
596 pub fn set_account<T>(mut self, v: T) -> Self
597 where
598 T: std::convert::Into<crate::model::BillingAccount>,
599 {
600 self.account = std::option::Option::Some(v.into());
601 self
602 }
603
604 /// Sets or clears the value of [account][crate::model::UpdateBillingAccountRequest::account].
605 ///
606 /// # Example
607 /// ```ignore,no_run
608 /// # use google_cloud_billing_v1::model::UpdateBillingAccountRequest;
609 /// use google_cloud_billing_v1::model::BillingAccount;
610 /// let x = UpdateBillingAccountRequest::new().set_or_clear_account(Some(BillingAccount::default()/* use setters */));
611 /// let x = UpdateBillingAccountRequest::new().set_or_clear_account(None::<BillingAccount>);
612 /// ```
613 pub fn set_or_clear_account<T>(mut self, v: std::option::Option<T>) -> Self
614 where
615 T: std::convert::Into<crate::model::BillingAccount>,
616 {
617 self.account = v.map(|x| x.into());
618 self
619 }
620
621 /// Sets the value of [update_mask][crate::model::UpdateBillingAccountRequest::update_mask].
622 ///
623 /// # Example
624 /// ```ignore,no_run
625 /// # use google_cloud_billing_v1::model::UpdateBillingAccountRequest;
626 /// use wkt::FieldMask;
627 /// let x = UpdateBillingAccountRequest::new().set_update_mask(FieldMask::default()/* use setters */);
628 /// ```
629 pub fn set_update_mask<T>(mut self, v: T) -> Self
630 where
631 T: std::convert::Into<wkt::FieldMask>,
632 {
633 self.update_mask = std::option::Option::Some(v.into());
634 self
635 }
636
637 /// Sets or clears the value of [update_mask][crate::model::UpdateBillingAccountRequest::update_mask].
638 ///
639 /// # Example
640 /// ```ignore,no_run
641 /// # use google_cloud_billing_v1::model::UpdateBillingAccountRequest;
642 /// use wkt::FieldMask;
643 /// let x = UpdateBillingAccountRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
644 /// let x = UpdateBillingAccountRequest::new().set_or_clear_update_mask(None::<FieldMask>);
645 /// ```
646 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
647 where
648 T: std::convert::Into<wkt::FieldMask>,
649 {
650 self.update_mask = v.map(|x| x.into());
651 self
652 }
653}
654
655impl wkt::message::Message for UpdateBillingAccountRequest {
656 fn typename() -> &'static str {
657 "type.googleapis.com/google.cloud.billing.v1.UpdateBillingAccountRequest"
658 }
659}
660
661/// Request message for `ListProjectBillingInfo`.
662#[derive(Clone, Default, PartialEq)]
663#[non_exhaustive]
664pub struct ListProjectBillingInfoRequest {
665 /// Required. The resource name of the billing account associated with the
666 /// projects that you want to list. For example,
667 /// `billingAccounts/012345-567890-ABCDEF`.
668 pub name: std::string::String,
669
670 /// Requested page size. The maximum page size is 100; this is also the
671 /// default.
672 pub page_size: i32,
673
674 /// A token identifying a page of results to be returned. This should be a
675 /// `next_page_token` value returned from a previous `ListProjectBillingInfo`
676 /// call. If unspecified, the first page of results is returned.
677 pub page_token: std::string::String,
678
679 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
680}
681
682impl ListProjectBillingInfoRequest {
683 pub fn new() -> Self {
684 std::default::Default::default()
685 }
686
687 /// Sets the value of [name][crate::model::ListProjectBillingInfoRequest::name].
688 ///
689 /// # Example
690 /// ```ignore,no_run
691 /// # use google_cloud_billing_v1::model::ListProjectBillingInfoRequest;
692 /// let x = ListProjectBillingInfoRequest::new().set_name("example");
693 /// ```
694 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
695 self.name = v.into();
696 self
697 }
698
699 /// Sets the value of [page_size][crate::model::ListProjectBillingInfoRequest::page_size].
700 ///
701 /// # Example
702 /// ```ignore,no_run
703 /// # use google_cloud_billing_v1::model::ListProjectBillingInfoRequest;
704 /// let x = ListProjectBillingInfoRequest::new().set_page_size(42);
705 /// ```
706 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
707 self.page_size = v.into();
708 self
709 }
710
711 /// Sets the value of [page_token][crate::model::ListProjectBillingInfoRequest::page_token].
712 ///
713 /// # Example
714 /// ```ignore,no_run
715 /// # use google_cloud_billing_v1::model::ListProjectBillingInfoRequest;
716 /// let x = ListProjectBillingInfoRequest::new().set_page_token("example");
717 /// ```
718 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
719 self.page_token = v.into();
720 self
721 }
722}
723
724impl wkt::message::Message for ListProjectBillingInfoRequest {
725 fn typename() -> &'static str {
726 "type.googleapis.com/google.cloud.billing.v1.ListProjectBillingInfoRequest"
727 }
728}
729
730/// Request message for `ListProjectBillingInfoResponse`.
731#[derive(Clone, Default, PartialEq)]
732#[non_exhaustive]
733pub struct ListProjectBillingInfoResponse {
734 /// A list of `ProjectBillingInfo` resources representing the projects
735 /// associated with the billing account.
736 pub project_billing_info: std::vec::Vec<crate::model::ProjectBillingInfo>,
737
738 /// A token to retrieve the next page of results. To retrieve the next page,
739 /// call `ListProjectBillingInfo` again with the `page_token` field set to this
740 /// value. This field is empty if there are no more results to retrieve.
741 pub next_page_token: std::string::String,
742
743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
744}
745
746impl ListProjectBillingInfoResponse {
747 pub fn new() -> Self {
748 std::default::Default::default()
749 }
750
751 /// Sets the value of [project_billing_info][crate::model::ListProjectBillingInfoResponse::project_billing_info].
752 ///
753 /// # Example
754 /// ```ignore,no_run
755 /// # use google_cloud_billing_v1::model::ListProjectBillingInfoResponse;
756 /// use google_cloud_billing_v1::model::ProjectBillingInfo;
757 /// let x = ListProjectBillingInfoResponse::new()
758 /// .set_project_billing_info([
759 /// ProjectBillingInfo::default()/* use setters */,
760 /// ProjectBillingInfo::default()/* use (different) setters */,
761 /// ]);
762 /// ```
763 pub fn set_project_billing_info<T, V>(mut self, v: T) -> Self
764 where
765 T: std::iter::IntoIterator<Item = V>,
766 V: std::convert::Into<crate::model::ProjectBillingInfo>,
767 {
768 use std::iter::Iterator;
769 self.project_billing_info = v.into_iter().map(|i| i.into()).collect();
770 self
771 }
772
773 /// Sets the value of [next_page_token][crate::model::ListProjectBillingInfoResponse::next_page_token].
774 ///
775 /// # Example
776 /// ```ignore,no_run
777 /// # use google_cloud_billing_v1::model::ListProjectBillingInfoResponse;
778 /// let x = ListProjectBillingInfoResponse::new().set_next_page_token("example");
779 /// ```
780 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
781 self.next_page_token = v.into();
782 self
783 }
784}
785
786impl wkt::message::Message for ListProjectBillingInfoResponse {
787 fn typename() -> &'static str {
788 "type.googleapis.com/google.cloud.billing.v1.ListProjectBillingInfoResponse"
789 }
790}
791
792#[doc(hidden)]
793impl google_cloud_gax::paginator::internal::PageableResponse for ListProjectBillingInfoResponse {
794 type PageItem = crate::model::ProjectBillingInfo;
795
796 fn items(self) -> std::vec::Vec<Self::PageItem> {
797 self.project_billing_info
798 }
799
800 fn next_page_token(&self) -> std::string::String {
801 use std::clone::Clone;
802 self.next_page_token.clone()
803 }
804}
805
806/// Request message for `GetProjectBillingInfo`.
807#[derive(Clone, Default, PartialEq)]
808#[non_exhaustive]
809pub struct GetProjectBillingInfoRequest {
810 /// Required. The resource name of the project for which billing information is
811 /// retrieved. For example, `projects/tokyo-rain-123`.
812 pub name: std::string::String,
813
814 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
815}
816
817impl GetProjectBillingInfoRequest {
818 pub fn new() -> Self {
819 std::default::Default::default()
820 }
821
822 /// Sets the value of [name][crate::model::GetProjectBillingInfoRequest::name].
823 ///
824 /// # Example
825 /// ```ignore,no_run
826 /// # use google_cloud_billing_v1::model::GetProjectBillingInfoRequest;
827 /// let x = GetProjectBillingInfoRequest::new().set_name("example");
828 /// ```
829 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
830 self.name = v.into();
831 self
832 }
833}
834
835impl wkt::message::Message for GetProjectBillingInfoRequest {
836 fn typename() -> &'static str {
837 "type.googleapis.com/google.cloud.billing.v1.GetProjectBillingInfoRequest"
838 }
839}
840
841/// Request message for `UpdateProjectBillingInfo`.
842#[derive(Clone, Default, PartialEq)]
843#[non_exhaustive]
844pub struct UpdateProjectBillingInfoRequest {
845 /// Required. The resource name of the project associated with the billing
846 /// information that you want to update. For example,
847 /// `projects/tokyo-rain-123`.
848 pub name: std::string::String,
849
850 /// The new billing information for the project. Output-only fields are
851 /// ignored; thus, you can leave empty all fields except
852 /// `billing_account_name`.
853 pub project_billing_info: std::option::Option<crate::model::ProjectBillingInfo>,
854
855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
856}
857
858impl UpdateProjectBillingInfoRequest {
859 pub fn new() -> Self {
860 std::default::Default::default()
861 }
862
863 /// Sets the value of [name][crate::model::UpdateProjectBillingInfoRequest::name].
864 ///
865 /// # Example
866 /// ```ignore,no_run
867 /// # use google_cloud_billing_v1::model::UpdateProjectBillingInfoRequest;
868 /// let x = UpdateProjectBillingInfoRequest::new().set_name("example");
869 /// ```
870 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
871 self.name = v.into();
872 self
873 }
874
875 /// Sets the value of [project_billing_info][crate::model::UpdateProjectBillingInfoRequest::project_billing_info].
876 ///
877 /// # Example
878 /// ```ignore,no_run
879 /// # use google_cloud_billing_v1::model::UpdateProjectBillingInfoRequest;
880 /// use google_cloud_billing_v1::model::ProjectBillingInfo;
881 /// let x = UpdateProjectBillingInfoRequest::new().set_project_billing_info(ProjectBillingInfo::default()/* use setters */);
882 /// ```
883 pub fn set_project_billing_info<T>(mut self, v: T) -> Self
884 where
885 T: std::convert::Into<crate::model::ProjectBillingInfo>,
886 {
887 self.project_billing_info = std::option::Option::Some(v.into());
888 self
889 }
890
891 /// Sets or clears the value of [project_billing_info][crate::model::UpdateProjectBillingInfoRequest::project_billing_info].
892 ///
893 /// # Example
894 /// ```ignore,no_run
895 /// # use google_cloud_billing_v1::model::UpdateProjectBillingInfoRequest;
896 /// use google_cloud_billing_v1::model::ProjectBillingInfo;
897 /// let x = UpdateProjectBillingInfoRequest::new().set_or_clear_project_billing_info(Some(ProjectBillingInfo::default()/* use setters */));
898 /// let x = UpdateProjectBillingInfoRequest::new().set_or_clear_project_billing_info(None::<ProjectBillingInfo>);
899 /// ```
900 pub fn set_or_clear_project_billing_info<T>(mut self, v: std::option::Option<T>) -> Self
901 where
902 T: std::convert::Into<crate::model::ProjectBillingInfo>,
903 {
904 self.project_billing_info = v.map(|x| x.into());
905 self
906 }
907}
908
909impl wkt::message::Message for UpdateProjectBillingInfoRequest {
910 fn typename() -> &'static str {
911 "type.googleapis.com/google.cloud.billing.v1.UpdateProjectBillingInfoRequest"
912 }
913}
914
915/// Request message for `MoveBillingAccount` RPC.
916#[derive(Clone, Default, PartialEq)]
917#[non_exhaustive]
918pub struct MoveBillingAccountRequest {
919 /// Required. The resource name of the billing account to move.
920 /// Must be of the form `billingAccounts/{billing_account_id}`.
921 /// The specified billing account cannot be a subaccount, since a subaccount
922 /// always belongs to the same organization as its parent account.
923 pub name: std::string::String,
924
925 /// Required. The resource name of the Organization to move
926 /// the billing account under.
927 /// Must be of the form `organizations/{organization_id}`.
928 pub destination_parent: std::string::String,
929
930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
931}
932
933impl MoveBillingAccountRequest {
934 pub fn new() -> Self {
935 std::default::Default::default()
936 }
937
938 /// Sets the value of [name][crate::model::MoveBillingAccountRequest::name].
939 ///
940 /// # Example
941 /// ```ignore,no_run
942 /// # use google_cloud_billing_v1::model::MoveBillingAccountRequest;
943 /// let x = MoveBillingAccountRequest::new().set_name("example");
944 /// ```
945 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
946 self.name = v.into();
947 self
948 }
949
950 /// Sets the value of [destination_parent][crate::model::MoveBillingAccountRequest::destination_parent].
951 ///
952 /// # Example
953 /// ```ignore,no_run
954 /// # use google_cloud_billing_v1::model::MoveBillingAccountRequest;
955 /// let x = MoveBillingAccountRequest::new().set_destination_parent("example");
956 /// ```
957 pub fn set_destination_parent<T: std::convert::Into<std::string::String>>(
958 mut self,
959 v: T,
960 ) -> Self {
961 self.destination_parent = v.into();
962 self
963 }
964}
965
966impl wkt::message::Message for MoveBillingAccountRequest {
967 fn typename() -> &'static str {
968 "type.googleapis.com/google.cloud.billing.v1.MoveBillingAccountRequest"
969 }
970}
971
972/// Encapsulates a single service in Google Cloud Platform.
973#[derive(Clone, Default, PartialEq)]
974#[non_exhaustive]
975pub struct Service {
976 /// The resource name for the service.
977 /// Example: "services/6F81-5844-456A"
978 pub name: std::string::String,
979
980 /// The identifier for the service.
981 /// Example: "6F81-5844-456A"
982 pub service_id: std::string::String,
983
984 /// A human readable display name for this service.
985 pub display_name: std::string::String,
986
987 /// The business under which the service is offered.
988 /// Ex. "businessEntities/GCP", "businessEntities/Maps"
989 pub business_entity_name: std::string::String,
990
991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
992}
993
994impl Service {
995 pub fn new() -> Self {
996 std::default::Default::default()
997 }
998
999 /// Sets the value of [name][crate::model::Service::name].
1000 ///
1001 /// # Example
1002 /// ```ignore,no_run
1003 /// # use google_cloud_billing_v1::model::Service;
1004 /// let x = Service::new().set_name("example");
1005 /// ```
1006 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1007 self.name = v.into();
1008 self
1009 }
1010
1011 /// Sets the value of [service_id][crate::model::Service::service_id].
1012 ///
1013 /// # Example
1014 /// ```ignore,no_run
1015 /// # use google_cloud_billing_v1::model::Service;
1016 /// let x = Service::new().set_service_id("example");
1017 /// ```
1018 pub fn set_service_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1019 self.service_id = v.into();
1020 self
1021 }
1022
1023 /// Sets the value of [display_name][crate::model::Service::display_name].
1024 ///
1025 /// # Example
1026 /// ```ignore,no_run
1027 /// # use google_cloud_billing_v1::model::Service;
1028 /// let x = Service::new().set_display_name("example");
1029 /// ```
1030 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1031 self.display_name = v.into();
1032 self
1033 }
1034
1035 /// Sets the value of [business_entity_name][crate::model::Service::business_entity_name].
1036 ///
1037 /// # Example
1038 /// ```ignore,no_run
1039 /// # use google_cloud_billing_v1::model::Service;
1040 /// let x = Service::new().set_business_entity_name("example");
1041 /// ```
1042 pub fn set_business_entity_name<T: std::convert::Into<std::string::String>>(
1043 mut self,
1044 v: T,
1045 ) -> Self {
1046 self.business_entity_name = v.into();
1047 self
1048 }
1049}
1050
1051impl wkt::message::Message for Service {
1052 fn typename() -> &'static str {
1053 "type.googleapis.com/google.cloud.billing.v1.Service"
1054 }
1055}
1056
1057/// Encapsulates a single SKU in Google Cloud
1058#[derive(Clone, Default, PartialEq)]
1059#[non_exhaustive]
1060pub struct Sku {
1061 /// The resource name for the SKU.
1062 /// Example: "services/6F81-5844-456A/skus/D041-B8A1-6E0B"
1063 pub name: std::string::String,
1064
1065 /// The identifier for the SKU.
1066 /// Example: "D041-B8A1-6E0B"
1067 pub sku_id: std::string::String,
1068
1069 /// A human readable description of the SKU, has a maximum length of 256
1070 /// characters.
1071 pub description: std::string::String,
1072
1073 /// The category hierarchy of this SKU, purely for organizational purpose.
1074 pub category: std::option::Option<crate::model::Category>,
1075
1076 /// List of service regions this SKU is offered at.
1077 /// Example: "asia-east1"
1078 /// Service regions can be found at <https://cloud.google.com/about/locations/>
1079 pub service_regions: std::vec::Vec<std::string::String>,
1080
1081 /// A timeline of pricing info for this SKU in chronological order.
1082 pub pricing_info: std::vec::Vec<crate::model::PricingInfo>,
1083
1084 /// Identifies the service provider.
1085 /// This is 'Google' for first party services in Google Cloud Platform.
1086 pub service_provider_name: std::string::String,
1087
1088 /// The geographic taxonomy for this sku.
1089 pub geo_taxonomy: std::option::Option<crate::model::GeoTaxonomy>,
1090
1091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1092}
1093
1094impl Sku {
1095 pub fn new() -> Self {
1096 std::default::Default::default()
1097 }
1098
1099 /// Sets the value of [name][crate::model::Sku::name].
1100 ///
1101 /// # Example
1102 /// ```ignore,no_run
1103 /// # use google_cloud_billing_v1::model::Sku;
1104 /// let x = Sku::new().set_name("example");
1105 /// ```
1106 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1107 self.name = v.into();
1108 self
1109 }
1110
1111 /// Sets the value of [sku_id][crate::model::Sku::sku_id].
1112 ///
1113 /// # Example
1114 /// ```ignore,no_run
1115 /// # use google_cloud_billing_v1::model::Sku;
1116 /// let x = Sku::new().set_sku_id("example");
1117 /// ```
1118 pub fn set_sku_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1119 self.sku_id = v.into();
1120 self
1121 }
1122
1123 /// Sets the value of [description][crate::model::Sku::description].
1124 ///
1125 /// # Example
1126 /// ```ignore,no_run
1127 /// # use google_cloud_billing_v1::model::Sku;
1128 /// let x = Sku::new().set_description("example");
1129 /// ```
1130 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1131 self.description = v.into();
1132 self
1133 }
1134
1135 /// Sets the value of [category][crate::model::Sku::category].
1136 ///
1137 /// # Example
1138 /// ```ignore,no_run
1139 /// # use google_cloud_billing_v1::model::Sku;
1140 /// use google_cloud_billing_v1::model::Category;
1141 /// let x = Sku::new().set_category(Category::default()/* use setters */);
1142 /// ```
1143 pub fn set_category<T>(mut self, v: T) -> Self
1144 where
1145 T: std::convert::Into<crate::model::Category>,
1146 {
1147 self.category = std::option::Option::Some(v.into());
1148 self
1149 }
1150
1151 /// Sets or clears the value of [category][crate::model::Sku::category].
1152 ///
1153 /// # Example
1154 /// ```ignore,no_run
1155 /// # use google_cloud_billing_v1::model::Sku;
1156 /// use google_cloud_billing_v1::model::Category;
1157 /// let x = Sku::new().set_or_clear_category(Some(Category::default()/* use setters */));
1158 /// let x = Sku::new().set_or_clear_category(None::<Category>);
1159 /// ```
1160 pub fn set_or_clear_category<T>(mut self, v: std::option::Option<T>) -> Self
1161 where
1162 T: std::convert::Into<crate::model::Category>,
1163 {
1164 self.category = v.map(|x| x.into());
1165 self
1166 }
1167
1168 /// Sets the value of [service_regions][crate::model::Sku::service_regions].
1169 ///
1170 /// # Example
1171 /// ```ignore,no_run
1172 /// # use google_cloud_billing_v1::model::Sku;
1173 /// let x = Sku::new().set_service_regions(["a", "b", "c"]);
1174 /// ```
1175 pub fn set_service_regions<T, V>(mut self, v: T) -> Self
1176 where
1177 T: std::iter::IntoIterator<Item = V>,
1178 V: std::convert::Into<std::string::String>,
1179 {
1180 use std::iter::Iterator;
1181 self.service_regions = v.into_iter().map(|i| i.into()).collect();
1182 self
1183 }
1184
1185 /// Sets the value of [pricing_info][crate::model::Sku::pricing_info].
1186 ///
1187 /// # Example
1188 /// ```ignore,no_run
1189 /// # use google_cloud_billing_v1::model::Sku;
1190 /// use google_cloud_billing_v1::model::PricingInfo;
1191 /// let x = Sku::new()
1192 /// .set_pricing_info([
1193 /// PricingInfo::default()/* use setters */,
1194 /// PricingInfo::default()/* use (different) setters */,
1195 /// ]);
1196 /// ```
1197 pub fn set_pricing_info<T, V>(mut self, v: T) -> Self
1198 where
1199 T: std::iter::IntoIterator<Item = V>,
1200 V: std::convert::Into<crate::model::PricingInfo>,
1201 {
1202 use std::iter::Iterator;
1203 self.pricing_info = v.into_iter().map(|i| i.into()).collect();
1204 self
1205 }
1206
1207 /// Sets the value of [service_provider_name][crate::model::Sku::service_provider_name].
1208 ///
1209 /// # Example
1210 /// ```ignore,no_run
1211 /// # use google_cloud_billing_v1::model::Sku;
1212 /// let x = Sku::new().set_service_provider_name("example");
1213 /// ```
1214 pub fn set_service_provider_name<T: std::convert::Into<std::string::String>>(
1215 mut self,
1216 v: T,
1217 ) -> Self {
1218 self.service_provider_name = v.into();
1219 self
1220 }
1221
1222 /// Sets the value of [geo_taxonomy][crate::model::Sku::geo_taxonomy].
1223 ///
1224 /// # Example
1225 /// ```ignore,no_run
1226 /// # use google_cloud_billing_v1::model::Sku;
1227 /// use google_cloud_billing_v1::model::GeoTaxonomy;
1228 /// let x = Sku::new().set_geo_taxonomy(GeoTaxonomy::default()/* use setters */);
1229 /// ```
1230 pub fn set_geo_taxonomy<T>(mut self, v: T) -> Self
1231 where
1232 T: std::convert::Into<crate::model::GeoTaxonomy>,
1233 {
1234 self.geo_taxonomy = std::option::Option::Some(v.into());
1235 self
1236 }
1237
1238 /// Sets or clears the value of [geo_taxonomy][crate::model::Sku::geo_taxonomy].
1239 ///
1240 /// # Example
1241 /// ```ignore,no_run
1242 /// # use google_cloud_billing_v1::model::Sku;
1243 /// use google_cloud_billing_v1::model::GeoTaxonomy;
1244 /// let x = Sku::new().set_or_clear_geo_taxonomy(Some(GeoTaxonomy::default()/* use setters */));
1245 /// let x = Sku::new().set_or_clear_geo_taxonomy(None::<GeoTaxonomy>);
1246 /// ```
1247 pub fn set_or_clear_geo_taxonomy<T>(mut self, v: std::option::Option<T>) -> Self
1248 where
1249 T: std::convert::Into<crate::model::GeoTaxonomy>,
1250 {
1251 self.geo_taxonomy = v.map(|x| x.into());
1252 self
1253 }
1254}
1255
1256impl wkt::message::Message for Sku {
1257 fn typename() -> &'static str {
1258 "type.googleapis.com/google.cloud.billing.v1.Sku"
1259 }
1260}
1261
1262/// Represents the category hierarchy of a SKU.
1263#[derive(Clone, Default, PartialEq)]
1264#[non_exhaustive]
1265pub struct Category {
1266 /// The display name of the service this SKU belongs to.
1267 pub service_display_name: std::string::String,
1268
1269 /// The type of product the SKU refers to.
1270 /// Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
1271 pub resource_family: std::string::String,
1272
1273 /// A group classification for related SKUs.
1274 /// Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
1275 pub resource_group: std::string::String,
1276
1277 /// Represents how the SKU is consumed.
1278 /// Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
1279 pub usage_type: std::string::String,
1280
1281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1282}
1283
1284impl Category {
1285 pub fn new() -> Self {
1286 std::default::Default::default()
1287 }
1288
1289 /// Sets the value of [service_display_name][crate::model::Category::service_display_name].
1290 ///
1291 /// # Example
1292 /// ```ignore,no_run
1293 /// # use google_cloud_billing_v1::model::Category;
1294 /// let x = Category::new().set_service_display_name("example");
1295 /// ```
1296 pub fn set_service_display_name<T: std::convert::Into<std::string::String>>(
1297 mut self,
1298 v: T,
1299 ) -> Self {
1300 self.service_display_name = v.into();
1301 self
1302 }
1303
1304 /// Sets the value of [resource_family][crate::model::Category::resource_family].
1305 ///
1306 /// # Example
1307 /// ```ignore,no_run
1308 /// # use google_cloud_billing_v1::model::Category;
1309 /// let x = Category::new().set_resource_family("example");
1310 /// ```
1311 pub fn set_resource_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1312 self.resource_family = v.into();
1313 self
1314 }
1315
1316 /// Sets the value of [resource_group][crate::model::Category::resource_group].
1317 ///
1318 /// # Example
1319 /// ```ignore,no_run
1320 /// # use google_cloud_billing_v1::model::Category;
1321 /// let x = Category::new().set_resource_group("example");
1322 /// ```
1323 pub fn set_resource_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1324 self.resource_group = v.into();
1325 self
1326 }
1327
1328 /// Sets the value of [usage_type][crate::model::Category::usage_type].
1329 ///
1330 /// # Example
1331 /// ```ignore,no_run
1332 /// # use google_cloud_billing_v1::model::Category;
1333 /// let x = Category::new().set_usage_type("example");
1334 /// ```
1335 pub fn set_usage_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1336 self.usage_type = v.into();
1337 self
1338 }
1339}
1340
1341impl wkt::message::Message for Category {
1342 fn typename() -> &'static str {
1343 "type.googleapis.com/google.cloud.billing.v1.Category"
1344 }
1345}
1346
1347/// Represents the pricing information for a SKU at a single point of time.
1348#[derive(Clone, Default, PartialEq)]
1349#[non_exhaustive]
1350pub struct PricingInfo {
1351 /// The timestamp from which this pricing was effective within the requested
1352 /// time range. This is guaranteed to be greater than or equal to the
1353 /// start_time field in the request and less than the end_time field in the
1354 /// request. If a time range was not specified in the request this field will
1355 /// be equivalent to a time within the last 12 hours, indicating the latest
1356 /// pricing info.
1357 pub effective_time: std::option::Option<wkt::Timestamp>,
1358
1359 /// An optional human readable summary of the pricing information, has a
1360 /// maximum length of 256 characters.
1361 pub summary: std::string::String,
1362
1363 /// Expresses the pricing formula. See `PricingExpression` for an example.
1364 pub pricing_expression: std::option::Option<crate::model::PricingExpression>,
1365
1366 /// Aggregation Info. This can be left unspecified if the pricing expression
1367 /// doesn't require aggregation.
1368 pub aggregation_info: std::option::Option<crate::model::AggregationInfo>,
1369
1370 /// Conversion rate used for currency conversion, from USD to the currency
1371 /// specified in the request. This includes any surcharge collected for billing
1372 /// in non USD currency. If a currency is not specified in the request this
1373 /// defaults to 1.0.
1374 /// Example: USD * currency_conversion_rate = JPY
1375 pub currency_conversion_rate: f64,
1376
1377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1378}
1379
1380impl PricingInfo {
1381 pub fn new() -> Self {
1382 std::default::Default::default()
1383 }
1384
1385 /// Sets the value of [effective_time][crate::model::PricingInfo::effective_time].
1386 ///
1387 /// # Example
1388 /// ```ignore,no_run
1389 /// # use google_cloud_billing_v1::model::PricingInfo;
1390 /// use wkt::Timestamp;
1391 /// let x = PricingInfo::new().set_effective_time(Timestamp::default()/* use setters */);
1392 /// ```
1393 pub fn set_effective_time<T>(mut self, v: T) -> Self
1394 where
1395 T: std::convert::Into<wkt::Timestamp>,
1396 {
1397 self.effective_time = std::option::Option::Some(v.into());
1398 self
1399 }
1400
1401 /// Sets or clears the value of [effective_time][crate::model::PricingInfo::effective_time].
1402 ///
1403 /// # Example
1404 /// ```ignore,no_run
1405 /// # use google_cloud_billing_v1::model::PricingInfo;
1406 /// use wkt::Timestamp;
1407 /// let x = PricingInfo::new().set_or_clear_effective_time(Some(Timestamp::default()/* use setters */));
1408 /// let x = PricingInfo::new().set_or_clear_effective_time(None::<Timestamp>);
1409 /// ```
1410 pub fn set_or_clear_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
1411 where
1412 T: std::convert::Into<wkt::Timestamp>,
1413 {
1414 self.effective_time = v.map(|x| x.into());
1415 self
1416 }
1417
1418 /// Sets the value of [summary][crate::model::PricingInfo::summary].
1419 ///
1420 /// # Example
1421 /// ```ignore,no_run
1422 /// # use google_cloud_billing_v1::model::PricingInfo;
1423 /// let x = PricingInfo::new().set_summary("example");
1424 /// ```
1425 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1426 self.summary = v.into();
1427 self
1428 }
1429
1430 /// Sets the value of [pricing_expression][crate::model::PricingInfo::pricing_expression].
1431 ///
1432 /// # Example
1433 /// ```ignore,no_run
1434 /// # use google_cloud_billing_v1::model::PricingInfo;
1435 /// use google_cloud_billing_v1::model::PricingExpression;
1436 /// let x = PricingInfo::new().set_pricing_expression(PricingExpression::default()/* use setters */);
1437 /// ```
1438 pub fn set_pricing_expression<T>(mut self, v: T) -> Self
1439 where
1440 T: std::convert::Into<crate::model::PricingExpression>,
1441 {
1442 self.pricing_expression = std::option::Option::Some(v.into());
1443 self
1444 }
1445
1446 /// Sets or clears the value of [pricing_expression][crate::model::PricingInfo::pricing_expression].
1447 ///
1448 /// # Example
1449 /// ```ignore,no_run
1450 /// # use google_cloud_billing_v1::model::PricingInfo;
1451 /// use google_cloud_billing_v1::model::PricingExpression;
1452 /// let x = PricingInfo::new().set_or_clear_pricing_expression(Some(PricingExpression::default()/* use setters */));
1453 /// let x = PricingInfo::new().set_or_clear_pricing_expression(None::<PricingExpression>);
1454 /// ```
1455 pub fn set_or_clear_pricing_expression<T>(mut self, v: std::option::Option<T>) -> Self
1456 where
1457 T: std::convert::Into<crate::model::PricingExpression>,
1458 {
1459 self.pricing_expression = v.map(|x| x.into());
1460 self
1461 }
1462
1463 /// Sets the value of [aggregation_info][crate::model::PricingInfo::aggregation_info].
1464 ///
1465 /// # Example
1466 /// ```ignore,no_run
1467 /// # use google_cloud_billing_v1::model::PricingInfo;
1468 /// use google_cloud_billing_v1::model::AggregationInfo;
1469 /// let x = PricingInfo::new().set_aggregation_info(AggregationInfo::default()/* use setters */);
1470 /// ```
1471 pub fn set_aggregation_info<T>(mut self, v: T) -> Self
1472 where
1473 T: std::convert::Into<crate::model::AggregationInfo>,
1474 {
1475 self.aggregation_info = std::option::Option::Some(v.into());
1476 self
1477 }
1478
1479 /// Sets or clears the value of [aggregation_info][crate::model::PricingInfo::aggregation_info].
1480 ///
1481 /// # Example
1482 /// ```ignore,no_run
1483 /// # use google_cloud_billing_v1::model::PricingInfo;
1484 /// use google_cloud_billing_v1::model::AggregationInfo;
1485 /// let x = PricingInfo::new().set_or_clear_aggregation_info(Some(AggregationInfo::default()/* use setters */));
1486 /// let x = PricingInfo::new().set_or_clear_aggregation_info(None::<AggregationInfo>);
1487 /// ```
1488 pub fn set_or_clear_aggregation_info<T>(mut self, v: std::option::Option<T>) -> Self
1489 where
1490 T: std::convert::Into<crate::model::AggregationInfo>,
1491 {
1492 self.aggregation_info = v.map(|x| x.into());
1493 self
1494 }
1495
1496 /// Sets the value of [currency_conversion_rate][crate::model::PricingInfo::currency_conversion_rate].
1497 ///
1498 /// # Example
1499 /// ```ignore,no_run
1500 /// # use google_cloud_billing_v1::model::PricingInfo;
1501 /// let x = PricingInfo::new().set_currency_conversion_rate(42.0);
1502 /// ```
1503 pub fn set_currency_conversion_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1504 self.currency_conversion_rate = v.into();
1505 self
1506 }
1507}
1508
1509impl wkt::message::Message for PricingInfo {
1510 fn typename() -> &'static str {
1511 "type.googleapis.com/google.cloud.billing.v1.PricingInfo"
1512 }
1513}
1514
1515/// Expresses a mathematical pricing formula. For Example:-
1516///
1517/// `usage_unit: GBy`
1518/// `tiered_rates:`
1519/// `[start_usage_amount: 20, unit_price: $10]`
1520/// `[start_usage_amount: 100, unit_price: $5]`
1521///
1522/// The above expresses a pricing formula where the first 20GB is free, the
1523/// next 80GB is priced at $10 per GB followed by $5 per GB for additional
1524/// usage.
1525#[derive(Clone, Default, PartialEq)]
1526#[non_exhaustive]
1527pub struct PricingExpression {
1528 /// The short hand for unit of usage this pricing is specified in.
1529 /// Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
1530 pub usage_unit: std::string::String,
1531
1532 /// The recommended quantity of units for displaying pricing info. When
1533 /// displaying pricing info it is recommended to display:
1534 /// (unit_price * display_quantity) per display_quantity usage_unit.
1535 /// This field does not affect the pricing formula and is for display purposes
1536 /// only.
1537 /// Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
1538 /// the display_quantity is "1000" then the recommended way of displaying the
1539 /// pricing info is "0.10 USD per 1000 GB"
1540 pub display_quantity: f64,
1541
1542 /// The list of tiered rates for this pricing. The total cost is computed by
1543 /// applying each of the tiered rates on usage. This repeated list is sorted
1544 /// by ascending order of start_usage_amount.
1545 pub tiered_rates: std::vec::Vec<crate::model::pricing_expression::TierRate>,
1546
1547 /// The unit of usage in human readable form.
1548 /// Example: "gibi byte".
1549 pub usage_unit_description: std::string::String,
1550
1551 /// The base unit for the SKU which is the unit used in usage exports.
1552 /// Example: "By"
1553 pub base_unit: std::string::String,
1554
1555 /// The base unit in human readable form.
1556 /// Example: "byte".
1557 pub base_unit_description: std::string::String,
1558
1559 /// Conversion factor for converting from price per usage_unit to price per
1560 /// base_unit, and start_usage_amount to start_usage_amount in base_unit.
1561 /// unit_price / base_unit_conversion_factor = price per base_unit.
1562 /// start_usage_amount * base_unit_conversion_factor = start_usage_amount in
1563 /// base_unit.
1564 pub base_unit_conversion_factor: f64,
1565
1566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1567}
1568
1569impl PricingExpression {
1570 pub fn new() -> Self {
1571 std::default::Default::default()
1572 }
1573
1574 /// Sets the value of [usage_unit][crate::model::PricingExpression::usage_unit].
1575 ///
1576 /// # Example
1577 /// ```ignore,no_run
1578 /// # use google_cloud_billing_v1::model::PricingExpression;
1579 /// let x = PricingExpression::new().set_usage_unit("example");
1580 /// ```
1581 pub fn set_usage_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1582 self.usage_unit = v.into();
1583 self
1584 }
1585
1586 /// Sets the value of [display_quantity][crate::model::PricingExpression::display_quantity].
1587 ///
1588 /// # Example
1589 /// ```ignore,no_run
1590 /// # use google_cloud_billing_v1::model::PricingExpression;
1591 /// let x = PricingExpression::new().set_display_quantity(42.0);
1592 /// ```
1593 pub fn set_display_quantity<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1594 self.display_quantity = v.into();
1595 self
1596 }
1597
1598 /// Sets the value of [tiered_rates][crate::model::PricingExpression::tiered_rates].
1599 ///
1600 /// # Example
1601 /// ```ignore,no_run
1602 /// # use google_cloud_billing_v1::model::PricingExpression;
1603 /// use google_cloud_billing_v1::model::pricing_expression::TierRate;
1604 /// let x = PricingExpression::new()
1605 /// .set_tiered_rates([
1606 /// TierRate::default()/* use setters */,
1607 /// TierRate::default()/* use (different) setters */,
1608 /// ]);
1609 /// ```
1610 pub fn set_tiered_rates<T, V>(mut self, v: T) -> Self
1611 where
1612 T: std::iter::IntoIterator<Item = V>,
1613 V: std::convert::Into<crate::model::pricing_expression::TierRate>,
1614 {
1615 use std::iter::Iterator;
1616 self.tiered_rates = v.into_iter().map(|i| i.into()).collect();
1617 self
1618 }
1619
1620 /// Sets the value of [usage_unit_description][crate::model::PricingExpression::usage_unit_description].
1621 ///
1622 /// # Example
1623 /// ```ignore,no_run
1624 /// # use google_cloud_billing_v1::model::PricingExpression;
1625 /// let x = PricingExpression::new().set_usage_unit_description("example");
1626 /// ```
1627 pub fn set_usage_unit_description<T: std::convert::Into<std::string::String>>(
1628 mut self,
1629 v: T,
1630 ) -> Self {
1631 self.usage_unit_description = v.into();
1632 self
1633 }
1634
1635 /// Sets the value of [base_unit][crate::model::PricingExpression::base_unit].
1636 ///
1637 /// # Example
1638 /// ```ignore,no_run
1639 /// # use google_cloud_billing_v1::model::PricingExpression;
1640 /// let x = PricingExpression::new().set_base_unit("example");
1641 /// ```
1642 pub fn set_base_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1643 self.base_unit = v.into();
1644 self
1645 }
1646
1647 /// Sets the value of [base_unit_description][crate::model::PricingExpression::base_unit_description].
1648 ///
1649 /// # Example
1650 /// ```ignore,no_run
1651 /// # use google_cloud_billing_v1::model::PricingExpression;
1652 /// let x = PricingExpression::new().set_base_unit_description("example");
1653 /// ```
1654 pub fn set_base_unit_description<T: std::convert::Into<std::string::String>>(
1655 mut self,
1656 v: T,
1657 ) -> Self {
1658 self.base_unit_description = v.into();
1659 self
1660 }
1661
1662 /// Sets the value of [base_unit_conversion_factor][crate::model::PricingExpression::base_unit_conversion_factor].
1663 ///
1664 /// # Example
1665 /// ```ignore,no_run
1666 /// # use google_cloud_billing_v1::model::PricingExpression;
1667 /// let x = PricingExpression::new().set_base_unit_conversion_factor(42.0);
1668 /// ```
1669 pub fn set_base_unit_conversion_factor<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1670 self.base_unit_conversion_factor = v.into();
1671 self
1672 }
1673}
1674
1675impl wkt::message::Message for PricingExpression {
1676 fn typename() -> &'static str {
1677 "type.googleapis.com/google.cloud.billing.v1.PricingExpression"
1678 }
1679}
1680
1681/// Defines additional types related to [PricingExpression].
1682pub mod pricing_expression {
1683 #[allow(unused_imports)]
1684 use super::*;
1685
1686 /// The price rate indicating starting usage and its corresponding price.
1687 #[derive(Clone, Default, PartialEq)]
1688 #[non_exhaustive]
1689 pub struct TierRate {
1690 /// Usage is priced at this rate only after this amount.
1691 /// Example: start_usage_amount of 10 indicates that the usage will be priced
1692 /// at the unit_price after the first 10 usage_units.
1693 pub start_usage_amount: f64,
1694
1695 /// The price per unit of usage.
1696 /// Example: unit_price of amount $10 indicates that each unit will cost $10.
1697 pub unit_price: std::option::Option<google_cloud_type::model::Money>,
1698
1699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1700 }
1701
1702 impl TierRate {
1703 pub fn new() -> Self {
1704 std::default::Default::default()
1705 }
1706
1707 /// Sets the value of [start_usage_amount][crate::model::pricing_expression::TierRate::start_usage_amount].
1708 ///
1709 /// # Example
1710 /// ```ignore,no_run
1711 /// # use google_cloud_billing_v1::model::pricing_expression::TierRate;
1712 /// let x = TierRate::new().set_start_usage_amount(42.0);
1713 /// ```
1714 pub fn set_start_usage_amount<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1715 self.start_usage_amount = v.into();
1716 self
1717 }
1718
1719 /// Sets the value of [unit_price][crate::model::pricing_expression::TierRate::unit_price].
1720 ///
1721 /// # Example
1722 /// ```ignore,no_run
1723 /// # use google_cloud_billing_v1::model::pricing_expression::TierRate;
1724 /// use google_cloud_type::model::Money;
1725 /// let x = TierRate::new().set_unit_price(Money::default()/* use setters */);
1726 /// ```
1727 pub fn set_unit_price<T>(mut self, v: T) -> Self
1728 where
1729 T: std::convert::Into<google_cloud_type::model::Money>,
1730 {
1731 self.unit_price = std::option::Option::Some(v.into());
1732 self
1733 }
1734
1735 /// Sets or clears the value of [unit_price][crate::model::pricing_expression::TierRate::unit_price].
1736 ///
1737 /// # Example
1738 /// ```ignore,no_run
1739 /// # use google_cloud_billing_v1::model::pricing_expression::TierRate;
1740 /// use google_cloud_type::model::Money;
1741 /// let x = TierRate::new().set_or_clear_unit_price(Some(Money::default()/* use setters */));
1742 /// let x = TierRate::new().set_or_clear_unit_price(None::<Money>);
1743 /// ```
1744 pub fn set_or_clear_unit_price<T>(mut self, v: std::option::Option<T>) -> Self
1745 where
1746 T: std::convert::Into<google_cloud_type::model::Money>,
1747 {
1748 self.unit_price = v.map(|x| x.into());
1749 self
1750 }
1751 }
1752
1753 impl wkt::message::Message for TierRate {
1754 fn typename() -> &'static str {
1755 "type.googleapis.com/google.cloud.billing.v1.PricingExpression.TierRate"
1756 }
1757 }
1758}
1759
1760/// Represents the aggregation level and interval for pricing of a single SKU.
1761#[derive(Clone, Default, PartialEq)]
1762#[non_exhaustive]
1763pub struct AggregationInfo {
1764 pub aggregation_level: crate::model::aggregation_info::AggregationLevel,
1765
1766 pub aggregation_interval: crate::model::aggregation_info::AggregationInterval,
1767
1768 /// The number of intervals to aggregate over.
1769 /// Example: If aggregation_level is "DAILY" and aggregation_count is 14,
1770 /// aggregation will be over 14 days.
1771 pub aggregation_count: i32,
1772
1773 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1774}
1775
1776impl AggregationInfo {
1777 pub fn new() -> Self {
1778 std::default::Default::default()
1779 }
1780
1781 /// Sets the value of [aggregation_level][crate::model::AggregationInfo::aggregation_level].
1782 ///
1783 /// # Example
1784 /// ```ignore,no_run
1785 /// # use google_cloud_billing_v1::model::AggregationInfo;
1786 /// use google_cloud_billing_v1::model::aggregation_info::AggregationLevel;
1787 /// let x0 = AggregationInfo::new().set_aggregation_level(AggregationLevel::Account);
1788 /// let x1 = AggregationInfo::new().set_aggregation_level(AggregationLevel::Project);
1789 /// ```
1790 pub fn set_aggregation_level<
1791 T: std::convert::Into<crate::model::aggregation_info::AggregationLevel>,
1792 >(
1793 mut self,
1794 v: T,
1795 ) -> Self {
1796 self.aggregation_level = v.into();
1797 self
1798 }
1799
1800 /// Sets the value of [aggregation_interval][crate::model::AggregationInfo::aggregation_interval].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_billing_v1::model::AggregationInfo;
1805 /// use google_cloud_billing_v1::model::aggregation_info::AggregationInterval;
1806 /// let x0 = AggregationInfo::new().set_aggregation_interval(AggregationInterval::Daily);
1807 /// let x1 = AggregationInfo::new().set_aggregation_interval(AggregationInterval::Monthly);
1808 /// ```
1809 pub fn set_aggregation_interval<
1810 T: std::convert::Into<crate::model::aggregation_info::AggregationInterval>,
1811 >(
1812 mut self,
1813 v: T,
1814 ) -> Self {
1815 self.aggregation_interval = v.into();
1816 self
1817 }
1818
1819 /// Sets the value of [aggregation_count][crate::model::AggregationInfo::aggregation_count].
1820 ///
1821 /// # Example
1822 /// ```ignore,no_run
1823 /// # use google_cloud_billing_v1::model::AggregationInfo;
1824 /// let x = AggregationInfo::new().set_aggregation_count(42);
1825 /// ```
1826 pub fn set_aggregation_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1827 self.aggregation_count = v.into();
1828 self
1829 }
1830}
1831
1832impl wkt::message::Message for AggregationInfo {
1833 fn typename() -> &'static str {
1834 "type.googleapis.com/google.cloud.billing.v1.AggregationInfo"
1835 }
1836}
1837
1838/// Defines additional types related to [AggregationInfo].
1839pub mod aggregation_info {
1840 #[allow(unused_imports)]
1841 use super::*;
1842
1843 /// The level at which usage is aggregated to compute cost.
1844 /// Example: "ACCOUNT" aggregation level indicates that usage for tiered
1845 /// pricing is aggregated across all projects in a single account.
1846 ///
1847 /// # Working with unknown values
1848 ///
1849 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1850 /// additional enum variants at any time. Adding new variants is not considered
1851 /// a breaking change. Applications should write their code in anticipation of:
1852 ///
1853 /// - New values appearing in future releases of the client library, **and**
1854 /// - New values received dynamically, without application changes.
1855 ///
1856 /// Please consult the [Working with enums] section in the user guide for some
1857 /// guidelines.
1858 ///
1859 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1860 #[derive(Clone, Debug, PartialEq)]
1861 #[non_exhaustive]
1862 pub enum AggregationLevel {
1863 Unspecified,
1864 Account,
1865 Project,
1866 /// If set, the enum was initialized with an unknown value.
1867 ///
1868 /// Applications can examine the value using [AggregationLevel::value] or
1869 /// [AggregationLevel::name].
1870 UnknownValue(aggregation_level::UnknownValue),
1871 }
1872
1873 #[doc(hidden)]
1874 pub mod aggregation_level {
1875 #[allow(unused_imports)]
1876 use super::*;
1877 #[derive(Clone, Debug, PartialEq)]
1878 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1879 }
1880
1881 impl AggregationLevel {
1882 /// Gets the enum value.
1883 ///
1884 /// Returns `None` if the enum contains an unknown value deserialized from
1885 /// the string representation of enums.
1886 pub fn value(&self) -> std::option::Option<i32> {
1887 match self {
1888 Self::Unspecified => std::option::Option::Some(0),
1889 Self::Account => std::option::Option::Some(1),
1890 Self::Project => std::option::Option::Some(2),
1891 Self::UnknownValue(u) => u.0.value(),
1892 }
1893 }
1894
1895 /// Gets the enum value as a string.
1896 ///
1897 /// Returns `None` if the enum contains an unknown value deserialized from
1898 /// the integer representation of enums.
1899 pub fn name(&self) -> std::option::Option<&str> {
1900 match self {
1901 Self::Unspecified => std::option::Option::Some("AGGREGATION_LEVEL_UNSPECIFIED"),
1902 Self::Account => std::option::Option::Some("ACCOUNT"),
1903 Self::Project => std::option::Option::Some("PROJECT"),
1904 Self::UnknownValue(u) => u.0.name(),
1905 }
1906 }
1907 }
1908
1909 impl std::default::Default for AggregationLevel {
1910 fn default() -> Self {
1911 use std::convert::From;
1912 Self::from(0)
1913 }
1914 }
1915
1916 impl std::fmt::Display for AggregationLevel {
1917 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1918 wkt::internal::display_enum(f, self.name(), self.value())
1919 }
1920 }
1921
1922 impl std::convert::From<i32> for AggregationLevel {
1923 fn from(value: i32) -> Self {
1924 match value {
1925 0 => Self::Unspecified,
1926 1 => Self::Account,
1927 2 => Self::Project,
1928 _ => Self::UnknownValue(aggregation_level::UnknownValue(
1929 wkt::internal::UnknownEnumValue::Integer(value),
1930 )),
1931 }
1932 }
1933 }
1934
1935 impl std::convert::From<&str> for AggregationLevel {
1936 fn from(value: &str) -> Self {
1937 use std::string::ToString;
1938 match value {
1939 "AGGREGATION_LEVEL_UNSPECIFIED" => Self::Unspecified,
1940 "ACCOUNT" => Self::Account,
1941 "PROJECT" => Self::Project,
1942 _ => Self::UnknownValue(aggregation_level::UnknownValue(
1943 wkt::internal::UnknownEnumValue::String(value.to_string()),
1944 )),
1945 }
1946 }
1947 }
1948
1949 impl serde::ser::Serialize for AggregationLevel {
1950 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1951 where
1952 S: serde::Serializer,
1953 {
1954 match self {
1955 Self::Unspecified => serializer.serialize_i32(0),
1956 Self::Account => serializer.serialize_i32(1),
1957 Self::Project => serializer.serialize_i32(2),
1958 Self::UnknownValue(u) => u.0.serialize(serializer),
1959 }
1960 }
1961 }
1962
1963 impl<'de> serde::de::Deserialize<'de> for AggregationLevel {
1964 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1965 where
1966 D: serde::Deserializer<'de>,
1967 {
1968 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AggregationLevel>::new(
1969 ".google.cloud.billing.v1.AggregationInfo.AggregationLevel",
1970 ))
1971 }
1972 }
1973
1974 /// The interval at which usage is aggregated to compute cost.
1975 /// Example: "MONTHLY" aggregation interval indicates that usage for tiered
1976 /// pricing is aggregated every month.
1977 ///
1978 /// # Working with unknown values
1979 ///
1980 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1981 /// additional enum variants at any time. Adding new variants is not considered
1982 /// a breaking change. Applications should write their code in anticipation of:
1983 ///
1984 /// - New values appearing in future releases of the client library, **and**
1985 /// - New values received dynamically, without application changes.
1986 ///
1987 /// Please consult the [Working with enums] section in the user guide for some
1988 /// guidelines.
1989 ///
1990 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1991 #[derive(Clone, Debug, PartialEq)]
1992 #[non_exhaustive]
1993 pub enum AggregationInterval {
1994 Unspecified,
1995 Daily,
1996 Monthly,
1997 /// If set, the enum was initialized with an unknown value.
1998 ///
1999 /// Applications can examine the value using [AggregationInterval::value] or
2000 /// [AggregationInterval::name].
2001 UnknownValue(aggregation_interval::UnknownValue),
2002 }
2003
2004 #[doc(hidden)]
2005 pub mod aggregation_interval {
2006 #[allow(unused_imports)]
2007 use super::*;
2008 #[derive(Clone, Debug, PartialEq)]
2009 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2010 }
2011
2012 impl AggregationInterval {
2013 /// Gets the enum value.
2014 ///
2015 /// Returns `None` if the enum contains an unknown value deserialized from
2016 /// the string representation of enums.
2017 pub fn value(&self) -> std::option::Option<i32> {
2018 match self {
2019 Self::Unspecified => std::option::Option::Some(0),
2020 Self::Daily => std::option::Option::Some(1),
2021 Self::Monthly => std::option::Option::Some(2),
2022 Self::UnknownValue(u) => u.0.value(),
2023 }
2024 }
2025
2026 /// Gets the enum value as a string.
2027 ///
2028 /// Returns `None` if the enum contains an unknown value deserialized from
2029 /// the integer representation of enums.
2030 pub fn name(&self) -> std::option::Option<&str> {
2031 match self {
2032 Self::Unspecified => std::option::Option::Some("AGGREGATION_INTERVAL_UNSPECIFIED"),
2033 Self::Daily => std::option::Option::Some("DAILY"),
2034 Self::Monthly => std::option::Option::Some("MONTHLY"),
2035 Self::UnknownValue(u) => u.0.name(),
2036 }
2037 }
2038 }
2039
2040 impl std::default::Default for AggregationInterval {
2041 fn default() -> Self {
2042 use std::convert::From;
2043 Self::from(0)
2044 }
2045 }
2046
2047 impl std::fmt::Display for AggregationInterval {
2048 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2049 wkt::internal::display_enum(f, self.name(), self.value())
2050 }
2051 }
2052
2053 impl std::convert::From<i32> for AggregationInterval {
2054 fn from(value: i32) -> Self {
2055 match value {
2056 0 => Self::Unspecified,
2057 1 => Self::Daily,
2058 2 => Self::Monthly,
2059 _ => Self::UnknownValue(aggregation_interval::UnknownValue(
2060 wkt::internal::UnknownEnumValue::Integer(value),
2061 )),
2062 }
2063 }
2064 }
2065
2066 impl std::convert::From<&str> for AggregationInterval {
2067 fn from(value: &str) -> Self {
2068 use std::string::ToString;
2069 match value {
2070 "AGGREGATION_INTERVAL_UNSPECIFIED" => Self::Unspecified,
2071 "DAILY" => Self::Daily,
2072 "MONTHLY" => Self::Monthly,
2073 _ => Self::UnknownValue(aggregation_interval::UnknownValue(
2074 wkt::internal::UnknownEnumValue::String(value.to_string()),
2075 )),
2076 }
2077 }
2078 }
2079
2080 impl serde::ser::Serialize for AggregationInterval {
2081 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2082 where
2083 S: serde::Serializer,
2084 {
2085 match self {
2086 Self::Unspecified => serializer.serialize_i32(0),
2087 Self::Daily => serializer.serialize_i32(1),
2088 Self::Monthly => serializer.serialize_i32(2),
2089 Self::UnknownValue(u) => u.0.serialize(serializer),
2090 }
2091 }
2092 }
2093
2094 impl<'de> serde::de::Deserialize<'de> for AggregationInterval {
2095 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2096 where
2097 D: serde::Deserializer<'de>,
2098 {
2099 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AggregationInterval>::new(
2100 ".google.cloud.billing.v1.AggregationInfo.AggregationInterval",
2101 ))
2102 }
2103 }
2104}
2105
2106/// Encapsulates the geographic taxonomy data for a sku.
2107#[derive(Clone, Default, PartialEq)]
2108#[non_exhaustive]
2109pub struct GeoTaxonomy {
2110 /// The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.
2111 pub r#type: crate::model::geo_taxonomy::Type,
2112
2113 /// The list of regions associated with a sku. Empty for Global skus, which are
2114 /// associated with all Google Cloud regions.
2115 pub regions: std::vec::Vec<std::string::String>,
2116
2117 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2118}
2119
2120impl GeoTaxonomy {
2121 pub fn new() -> Self {
2122 std::default::Default::default()
2123 }
2124
2125 /// Sets the value of [r#type][crate::model::GeoTaxonomy::type].
2126 ///
2127 /// # Example
2128 /// ```ignore,no_run
2129 /// # use google_cloud_billing_v1::model::GeoTaxonomy;
2130 /// use google_cloud_billing_v1::model::geo_taxonomy::Type;
2131 /// let x0 = GeoTaxonomy::new().set_type(Type::Global);
2132 /// let x1 = GeoTaxonomy::new().set_type(Type::Regional);
2133 /// let x2 = GeoTaxonomy::new().set_type(Type::MultiRegional);
2134 /// ```
2135 pub fn set_type<T: std::convert::Into<crate::model::geo_taxonomy::Type>>(
2136 mut self,
2137 v: T,
2138 ) -> Self {
2139 self.r#type = v.into();
2140 self
2141 }
2142
2143 /// Sets the value of [regions][crate::model::GeoTaxonomy::regions].
2144 ///
2145 /// # Example
2146 /// ```ignore,no_run
2147 /// # use google_cloud_billing_v1::model::GeoTaxonomy;
2148 /// let x = GeoTaxonomy::new().set_regions(["a", "b", "c"]);
2149 /// ```
2150 pub fn set_regions<T, V>(mut self, v: T) -> Self
2151 where
2152 T: std::iter::IntoIterator<Item = V>,
2153 V: std::convert::Into<std::string::String>,
2154 {
2155 use std::iter::Iterator;
2156 self.regions = v.into_iter().map(|i| i.into()).collect();
2157 self
2158 }
2159}
2160
2161impl wkt::message::Message for GeoTaxonomy {
2162 fn typename() -> &'static str {
2163 "type.googleapis.com/google.cloud.billing.v1.GeoTaxonomy"
2164 }
2165}
2166
2167/// Defines additional types related to [GeoTaxonomy].
2168pub mod geo_taxonomy {
2169 #[allow(unused_imports)]
2170 use super::*;
2171
2172 /// The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL.
2173 ///
2174 /// # Working with unknown values
2175 ///
2176 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2177 /// additional enum variants at any time. Adding new variants is not considered
2178 /// a breaking change. Applications should write their code in anticipation of:
2179 ///
2180 /// - New values appearing in future releases of the client library, **and**
2181 /// - New values received dynamically, without application changes.
2182 ///
2183 /// Please consult the [Working with enums] section in the user guide for some
2184 /// guidelines.
2185 ///
2186 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2187 #[derive(Clone, Debug, PartialEq)]
2188 #[non_exhaustive]
2189 pub enum Type {
2190 /// The type is not specified.
2191 Unspecified,
2192 /// The sku is global in nature, e.g. a license sku. Global skus are
2193 /// available in all regions, and so have an empty region list.
2194 Global,
2195 /// The sku is available in a specific region, e.g. "us-west2".
2196 Regional,
2197 /// The sku is associated with multiple regions, e.g. "us-west2" and
2198 /// "us-east1".
2199 MultiRegional,
2200 /// If set, the enum was initialized with an unknown value.
2201 ///
2202 /// Applications can examine the value using [Type::value] or
2203 /// [Type::name].
2204 UnknownValue(r#type::UnknownValue),
2205 }
2206
2207 #[doc(hidden)]
2208 pub mod r#type {
2209 #[allow(unused_imports)]
2210 use super::*;
2211 #[derive(Clone, Debug, PartialEq)]
2212 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2213 }
2214
2215 impl Type {
2216 /// Gets the enum value.
2217 ///
2218 /// Returns `None` if the enum contains an unknown value deserialized from
2219 /// the string representation of enums.
2220 pub fn value(&self) -> std::option::Option<i32> {
2221 match self {
2222 Self::Unspecified => std::option::Option::Some(0),
2223 Self::Global => std::option::Option::Some(1),
2224 Self::Regional => std::option::Option::Some(2),
2225 Self::MultiRegional => std::option::Option::Some(3),
2226 Self::UnknownValue(u) => u.0.value(),
2227 }
2228 }
2229
2230 /// Gets the enum value as a string.
2231 ///
2232 /// Returns `None` if the enum contains an unknown value deserialized from
2233 /// the integer representation of enums.
2234 pub fn name(&self) -> std::option::Option<&str> {
2235 match self {
2236 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2237 Self::Global => std::option::Option::Some("GLOBAL"),
2238 Self::Regional => std::option::Option::Some("REGIONAL"),
2239 Self::MultiRegional => std::option::Option::Some("MULTI_REGIONAL"),
2240 Self::UnknownValue(u) => u.0.name(),
2241 }
2242 }
2243 }
2244
2245 impl std::default::Default for Type {
2246 fn default() -> Self {
2247 use std::convert::From;
2248 Self::from(0)
2249 }
2250 }
2251
2252 impl std::fmt::Display for Type {
2253 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2254 wkt::internal::display_enum(f, self.name(), self.value())
2255 }
2256 }
2257
2258 impl std::convert::From<i32> for Type {
2259 fn from(value: i32) -> Self {
2260 match value {
2261 0 => Self::Unspecified,
2262 1 => Self::Global,
2263 2 => Self::Regional,
2264 3 => Self::MultiRegional,
2265 _ => Self::UnknownValue(r#type::UnknownValue(
2266 wkt::internal::UnknownEnumValue::Integer(value),
2267 )),
2268 }
2269 }
2270 }
2271
2272 impl std::convert::From<&str> for Type {
2273 fn from(value: &str) -> Self {
2274 use std::string::ToString;
2275 match value {
2276 "TYPE_UNSPECIFIED" => Self::Unspecified,
2277 "GLOBAL" => Self::Global,
2278 "REGIONAL" => Self::Regional,
2279 "MULTI_REGIONAL" => Self::MultiRegional,
2280 _ => Self::UnknownValue(r#type::UnknownValue(
2281 wkt::internal::UnknownEnumValue::String(value.to_string()),
2282 )),
2283 }
2284 }
2285 }
2286
2287 impl serde::ser::Serialize for Type {
2288 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2289 where
2290 S: serde::Serializer,
2291 {
2292 match self {
2293 Self::Unspecified => serializer.serialize_i32(0),
2294 Self::Global => serializer.serialize_i32(1),
2295 Self::Regional => serializer.serialize_i32(2),
2296 Self::MultiRegional => serializer.serialize_i32(3),
2297 Self::UnknownValue(u) => u.0.serialize(serializer),
2298 }
2299 }
2300 }
2301
2302 impl<'de> serde::de::Deserialize<'de> for Type {
2303 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2304 where
2305 D: serde::Deserializer<'de>,
2306 {
2307 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2308 ".google.cloud.billing.v1.GeoTaxonomy.Type",
2309 ))
2310 }
2311 }
2312}
2313
2314/// Request message for `ListServices`.
2315#[derive(Clone, Default, PartialEq)]
2316#[non_exhaustive]
2317pub struct ListServicesRequest {
2318 /// Requested page size. Defaults to 5000.
2319 pub page_size: i32,
2320
2321 /// A token identifying a page of results to return. This should be a
2322 /// `next_page_token` value returned from a previous `ListServices`
2323 /// call. If unspecified, the first page of results is returned.
2324 pub page_token: std::string::String,
2325
2326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2327}
2328
2329impl ListServicesRequest {
2330 pub fn new() -> Self {
2331 std::default::Default::default()
2332 }
2333
2334 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
2335 ///
2336 /// # Example
2337 /// ```ignore,no_run
2338 /// # use google_cloud_billing_v1::model::ListServicesRequest;
2339 /// let x = ListServicesRequest::new().set_page_size(42);
2340 /// ```
2341 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2342 self.page_size = v.into();
2343 self
2344 }
2345
2346 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
2347 ///
2348 /// # Example
2349 /// ```ignore,no_run
2350 /// # use google_cloud_billing_v1::model::ListServicesRequest;
2351 /// let x = ListServicesRequest::new().set_page_token("example");
2352 /// ```
2353 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2354 self.page_token = v.into();
2355 self
2356 }
2357}
2358
2359impl wkt::message::Message for ListServicesRequest {
2360 fn typename() -> &'static str {
2361 "type.googleapis.com/google.cloud.billing.v1.ListServicesRequest"
2362 }
2363}
2364
2365/// Response message for `ListServices`.
2366#[derive(Clone, Default, PartialEq)]
2367#[non_exhaustive]
2368pub struct ListServicesResponse {
2369 /// A list of services.
2370 pub services: std::vec::Vec<crate::model::Service>,
2371
2372 /// A token to retrieve the next page of results. To retrieve the next page,
2373 /// call `ListServices` again with the `page_token` field set to this
2374 /// value. This field is empty if there are no more results to retrieve.
2375 pub next_page_token: std::string::String,
2376
2377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2378}
2379
2380impl ListServicesResponse {
2381 pub fn new() -> Self {
2382 std::default::Default::default()
2383 }
2384
2385 /// Sets the value of [services][crate::model::ListServicesResponse::services].
2386 ///
2387 /// # Example
2388 /// ```ignore,no_run
2389 /// # use google_cloud_billing_v1::model::ListServicesResponse;
2390 /// use google_cloud_billing_v1::model::Service;
2391 /// let x = ListServicesResponse::new()
2392 /// .set_services([
2393 /// Service::default()/* use setters */,
2394 /// Service::default()/* use (different) setters */,
2395 /// ]);
2396 /// ```
2397 pub fn set_services<T, V>(mut self, v: T) -> Self
2398 where
2399 T: std::iter::IntoIterator<Item = V>,
2400 V: std::convert::Into<crate::model::Service>,
2401 {
2402 use std::iter::Iterator;
2403 self.services = v.into_iter().map(|i| i.into()).collect();
2404 self
2405 }
2406
2407 /// Sets the value of [next_page_token][crate::model::ListServicesResponse::next_page_token].
2408 ///
2409 /// # Example
2410 /// ```ignore,no_run
2411 /// # use google_cloud_billing_v1::model::ListServicesResponse;
2412 /// let x = ListServicesResponse::new().set_next_page_token("example");
2413 /// ```
2414 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2415 self.next_page_token = v.into();
2416 self
2417 }
2418}
2419
2420impl wkt::message::Message for ListServicesResponse {
2421 fn typename() -> &'static str {
2422 "type.googleapis.com/google.cloud.billing.v1.ListServicesResponse"
2423 }
2424}
2425
2426#[doc(hidden)]
2427impl google_cloud_gax::paginator::internal::PageableResponse for ListServicesResponse {
2428 type PageItem = crate::model::Service;
2429
2430 fn items(self) -> std::vec::Vec<Self::PageItem> {
2431 self.services
2432 }
2433
2434 fn next_page_token(&self) -> std::string::String {
2435 use std::clone::Clone;
2436 self.next_page_token.clone()
2437 }
2438}
2439
2440/// Request message for `ListSkus`.
2441#[derive(Clone, Default, PartialEq)]
2442#[non_exhaustive]
2443pub struct ListSkusRequest {
2444 /// Required. The name of the service.
2445 /// Example: "services/6F81-5844-456A"
2446 pub parent: std::string::String,
2447
2448 /// Optional inclusive start time of the time range for which the pricing
2449 /// versions will be returned. Timestamps in the future are not allowed.
2450 /// The time range has to be within a single calendar month in
2451 /// America/Los_Angeles timezone. Time range as a whole is optional. If not
2452 /// specified, the latest pricing will be returned (up to 12 hours old at
2453 /// most).
2454 pub start_time: std::option::Option<wkt::Timestamp>,
2455
2456 /// Optional exclusive end time of the time range for which the pricing
2457 /// versions will be returned. Timestamps in the future are not allowed.
2458 /// The time range has to be within a single calendar month in
2459 /// America/Los_Angeles timezone. Time range as a whole is optional. If not
2460 /// specified, the latest pricing will be returned (up to 12 hours old at
2461 /// most).
2462 pub end_time: std::option::Option<wkt::Timestamp>,
2463
2464 /// The ISO 4217 currency code for the pricing info in the response proto.
2465 /// Will use the conversion rate as of start_time.
2466 /// Optional. If not specified USD will be used.
2467 pub currency_code: std::string::String,
2468
2469 /// Requested page size. Defaults to 5000.
2470 pub page_size: i32,
2471
2472 /// A token identifying a page of results to return. This should be a
2473 /// `next_page_token` value returned from a previous `ListSkus`
2474 /// call. If unspecified, the first page of results is returned.
2475 pub page_token: std::string::String,
2476
2477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2478}
2479
2480impl ListSkusRequest {
2481 pub fn new() -> Self {
2482 std::default::Default::default()
2483 }
2484
2485 /// Sets the value of [parent][crate::model::ListSkusRequest::parent].
2486 ///
2487 /// # Example
2488 /// ```ignore,no_run
2489 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2490 /// let x = ListSkusRequest::new().set_parent("example");
2491 /// ```
2492 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2493 self.parent = v.into();
2494 self
2495 }
2496
2497 /// Sets the value of [start_time][crate::model::ListSkusRequest::start_time].
2498 ///
2499 /// # Example
2500 /// ```ignore,no_run
2501 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2502 /// use wkt::Timestamp;
2503 /// let x = ListSkusRequest::new().set_start_time(Timestamp::default()/* use setters */);
2504 /// ```
2505 pub fn set_start_time<T>(mut self, v: T) -> Self
2506 where
2507 T: std::convert::Into<wkt::Timestamp>,
2508 {
2509 self.start_time = std::option::Option::Some(v.into());
2510 self
2511 }
2512
2513 /// Sets or clears the value of [start_time][crate::model::ListSkusRequest::start_time].
2514 ///
2515 /// # Example
2516 /// ```ignore,no_run
2517 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2518 /// use wkt::Timestamp;
2519 /// let x = ListSkusRequest::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2520 /// let x = ListSkusRequest::new().set_or_clear_start_time(None::<Timestamp>);
2521 /// ```
2522 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2523 where
2524 T: std::convert::Into<wkt::Timestamp>,
2525 {
2526 self.start_time = v.map(|x| x.into());
2527 self
2528 }
2529
2530 /// Sets the value of [end_time][crate::model::ListSkusRequest::end_time].
2531 ///
2532 /// # Example
2533 /// ```ignore,no_run
2534 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2535 /// use wkt::Timestamp;
2536 /// let x = ListSkusRequest::new().set_end_time(Timestamp::default()/* use setters */);
2537 /// ```
2538 pub fn set_end_time<T>(mut self, v: T) -> Self
2539 where
2540 T: std::convert::Into<wkt::Timestamp>,
2541 {
2542 self.end_time = std::option::Option::Some(v.into());
2543 self
2544 }
2545
2546 /// Sets or clears the value of [end_time][crate::model::ListSkusRequest::end_time].
2547 ///
2548 /// # Example
2549 /// ```ignore,no_run
2550 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2551 /// use wkt::Timestamp;
2552 /// let x = ListSkusRequest::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2553 /// let x = ListSkusRequest::new().set_or_clear_end_time(None::<Timestamp>);
2554 /// ```
2555 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2556 where
2557 T: std::convert::Into<wkt::Timestamp>,
2558 {
2559 self.end_time = v.map(|x| x.into());
2560 self
2561 }
2562
2563 /// Sets the value of [currency_code][crate::model::ListSkusRequest::currency_code].
2564 ///
2565 /// # Example
2566 /// ```ignore,no_run
2567 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2568 /// let x = ListSkusRequest::new().set_currency_code("example");
2569 /// ```
2570 pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2571 self.currency_code = v.into();
2572 self
2573 }
2574
2575 /// Sets the value of [page_size][crate::model::ListSkusRequest::page_size].
2576 ///
2577 /// # Example
2578 /// ```ignore,no_run
2579 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2580 /// let x = ListSkusRequest::new().set_page_size(42);
2581 /// ```
2582 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2583 self.page_size = v.into();
2584 self
2585 }
2586
2587 /// Sets the value of [page_token][crate::model::ListSkusRequest::page_token].
2588 ///
2589 /// # Example
2590 /// ```ignore,no_run
2591 /// # use google_cloud_billing_v1::model::ListSkusRequest;
2592 /// let x = ListSkusRequest::new().set_page_token("example");
2593 /// ```
2594 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2595 self.page_token = v.into();
2596 self
2597 }
2598}
2599
2600impl wkt::message::Message for ListSkusRequest {
2601 fn typename() -> &'static str {
2602 "type.googleapis.com/google.cloud.billing.v1.ListSkusRequest"
2603 }
2604}
2605
2606/// Response message for `ListSkus`.
2607#[derive(Clone, Default, PartialEq)]
2608#[non_exhaustive]
2609pub struct ListSkusResponse {
2610 /// The list of public SKUs of the given service.
2611 pub skus: std::vec::Vec<crate::model::Sku>,
2612
2613 /// A token to retrieve the next page of results. To retrieve the next page,
2614 /// call `ListSkus` again with the `page_token` field set to this
2615 /// value. This field is empty if there are no more results to retrieve.
2616 pub next_page_token: std::string::String,
2617
2618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2619}
2620
2621impl ListSkusResponse {
2622 pub fn new() -> Self {
2623 std::default::Default::default()
2624 }
2625
2626 /// Sets the value of [skus][crate::model::ListSkusResponse::skus].
2627 ///
2628 /// # Example
2629 /// ```ignore,no_run
2630 /// # use google_cloud_billing_v1::model::ListSkusResponse;
2631 /// use google_cloud_billing_v1::model::Sku;
2632 /// let x = ListSkusResponse::new()
2633 /// .set_skus([
2634 /// Sku::default()/* use setters */,
2635 /// Sku::default()/* use (different) setters */,
2636 /// ]);
2637 /// ```
2638 pub fn set_skus<T, V>(mut self, v: T) -> Self
2639 where
2640 T: std::iter::IntoIterator<Item = V>,
2641 V: std::convert::Into<crate::model::Sku>,
2642 {
2643 use std::iter::Iterator;
2644 self.skus = v.into_iter().map(|i| i.into()).collect();
2645 self
2646 }
2647
2648 /// Sets the value of [next_page_token][crate::model::ListSkusResponse::next_page_token].
2649 ///
2650 /// # Example
2651 /// ```ignore,no_run
2652 /// # use google_cloud_billing_v1::model::ListSkusResponse;
2653 /// let x = ListSkusResponse::new().set_next_page_token("example");
2654 /// ```
2655 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2656 self.next_page_token = v.into();
2657 self
2658 }
2659}
2660
2661impl wkt::message::Message for ListSkusResponse {
2662 fn typename() -> &'static str {
2663 "type.googleapis.com/google.cloud.billing.v1.ListSkusResponse"
2664 }
2665}
2666
2667#[doc(hidden)]
2668impl google_cloud_gax::paginator::internal::PageableResponse for ListSkusResponse {
2669 type PageItem = crate::model::Sku;
2670
2671 fn items(self) -> std::vec::Vec<Self::PageItem> {
2672 self.skus
2673 }
2674
2675 fn next_page_token(&self) -> std::string::String {
2676 use std::clone::Clone;
2677 self.next_page_token.clone()
2678 }
2679}