google_cloud_commerce_consumer_procurement_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_longrunning;
25extern crate google_cloud_lro;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// Assignment protocol for a license pool.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct AssignmentProtocol {
41 /// The type of assignment protocol.
42 pub assignment_type: std::option::Option<crate::model::assignment_protocol::AssignmentType>,
43
44 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
45}
46
47impl AssignmentProtocol {
48 /// Creates a new default instance.
49 pub fn new() -> Self {
50 std::default::Default::default()
51 }
52
53 /// Sets the value of [assignment_type][crate::model::AssignmentProtocol::assignment_type].
54 ///
55 /// Note that all the setters affecting `assignment_type` are mutually
56 /// exclusive.
57 ///
58 /// # Example
59 /// ```ignore,no_run
60 /// # use google_cloud_commerce_consumer_procurement_v1::model::AssignmentProtocol;
61 /// use google_cloud_commerce_consumer_procurement_v1::model::assignment_protocol::ManualAssignmentType;
62 /// let x = AssignmentProtocol::new().set_assignment_type(Some(
63 /// google_cloud_commerce_consumer_procurement_v1::model::assignment_protocol::AssignmentType::ManualAssignmentType(ManualAssignmentType::default().into())));
64 /// ```
65 pub fn set_assignment_type<
66 T: std::convert::Into<std::option::Option<crate::model::assignment_protocol::AssignmentType>>,
67 >(
68 mut self,
69 v: T,
70 ) -> Self {
71 self.assignment_type = v.into();
72 self
73 }
74
75 /// The value of [assignment_type][crate::model::AssignmentProtocol::assignment_type]
76 /// if it holds a `ManualAssignmentType`, `None` if the field is not set or
77 /// holds a different branch.
78 pub fn manual_assignment_type(
79 &self,
80 ) -> std::option::Option<
81 &std::boxed::Box<crate::model::assignment_protocol::ManualAssignmentType>,
82 > {
83 #[allow(unreachable_patterns)]
84 self.assignment_type.as_ref().and_then(|v| match v {
85 crate::model::assignment_protocol::AssignmentType::ManualAssignmentType(v) => {
86 std::option::Option::Some(v)
87 }
88 _ => std::option::Option::None,
89 })
90 }
91
92 /// Sets the value of [assignment_type][crate::model::AssignmentProtocol::assignment_type]
93 /// to hold a `ManualAssignmentType`.
94 ///
95 /// Note that all the setters affecting `assignment_type` are
96 /// mutually exclusive.
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_commerce_consumer_procurement_v1::model::AssignmentProtocol;
101 /// use google_cloud_commerce_consumer_procurement_v1::model::assignment_protocol::ManualAssignmentType;
102 /// let x = AssignmentProtocol::new().set_manual_assignment_type(ManualAssignmentType::default()/* use setters */);
103 /// assert!(x.manual_assignment_type().is_some());
104 /// assert!(x.auto_assignment_type().is_none());
105 /// ```
106 pub fn set_manual_assignment_type<
107 T: std::convert::Into<
108 std::boxed::Box<crate::model::assignment_protocol::ManualAssignmentType>,
109 >,
110 >(
111 mut self,
112 v: T,
113 ) -> Self {
114 self.assignment_type = std::option::Option::Some(
115 crate::model::assignment_protocol::AssignmentType::ManualAssignmentType(v.into()),
116 );
117 self
118 }
119
120 /// The value of [assignment_type][crate::model::AssignmentProtocol::assignment_type]
121 /// if it holds a `AutoAssignmentType`, `None` if the field is not set or
122 /// holds a different branch.
123 pub fn auto_assignment_type(
124 &self,
125 ) -> std::option::Option<&std::boxed::Box<crate::model::assignment_protocol::AutoAssignmentType>>
126 {
127 #[allow(unreachable_patterns)]
128 self.assignment_type.as_ref().and_then(|v| match v {
129 crate::model::assignment_protocol::AssignmentType::AutoAssignmentType(v) => {
130 std::option::Option::Some(v)
131 }
132 _ => std::option::Option::None,
133 })
134 }
135
136 /// Sets the value of [assignment_type][crate::model::AssignmentProtocol::assignment_type]
137 /// to hold a `AutoAssignmentType`.
138 ///
139 /// Note that all the setters affecting `assignment_type` are
140 /// mutually exclusive.
141 ///
142 /// # Example
143 /// ```ignore,no_run
144 /// # use google_cloud_commerce_consumer_procurement_v1::model::AssignmentProtocol;
145 /// use google_cloud_commerce_consumer_procurement_v1::model::assignment_protocol::AutoAssignmentType;
146 /// let x = AssignmentProtocol::new().set_auto_assignment_type(AutoAssignmentType::default()/* use setters */);
147 /// assert!(x.auto_assignment_type().is_some());
148 /// assert!(x.manual_assignment_type().is_none());
149 /// ```
150 pub fn set_auto_assignment_type<
151 T: std::convert::Into<std::boxed::Box<crate::model::assignment_protocol::AutoAssignmentType>>,
152 >(
153 mut self,
154 v: T,
155 ) -> Self {
156 self.assignment_type = std::option::Option::Some(
157 crate::model::assignment_protocol::AssignmentType::AutoAssignmentType(v.into()),
158 );
159 self
160 }
161}
162
163impl wkt::message::Message for AssignmentProtocol {
164 fn typename() -> &'static str {
165 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol"
166 }
167}
168
169/// Defines additional types related to [AssignmentProtocol].
170pub mod assignment_protocol {
171 #[allow(unused_imports)]
172 use super::*;
173
174 /// Allow manual assignments triggered by administrative operations only.
175 #[derive(Clone, Default, PartialEq)]
176 #[non_exhaustive]
177 pub struct ManualAssignmentType {
178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
179 }
180
181 impl ManualAssignmentType {
182 /// Creates a new default instance.
183 pub fn new() -> Self {
184 std::default::Default::default()
185 }
186 }
187
188 impl wkt::message::Message for ManualAssignmentType {
189 fn typename() -> &'static str {
190 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.ManualAssignmentType"
191 }
192 }
193
194 /// Configuration for automatic assignments handled by data plane operations.
195 #[derive(Clone, Default, PartialEq)]
196 #[non_exhaustive]
197 pub struct AutoAssignmentType {
198 /// Optional. The time to live for an inactive license. After this time has
199 /// passed, the license will be automatically unassigned from the user. Must
200 /// be at least 7 days, if set. If unset, the license will never expire.
201 pub inactive_license_ttl: std::option::Option<wkt::Duration>,
202
203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
204 }
205
206 impl AutoAssignmentType {
207 /// Creates a new default instance.
208 pub fn new() -> Self {
209 std::default::Default::default()
210 }
211
212 /// Sets the value of [inactive_license_ttl][crate::model::assignment_protocol::AutoAssignmentType::inactive_license_ttl].
213 ///
214 /// # Example
215 /// ```ignore,no_run
216 /// # use google_cloud_commerce_consumer_procurement_v1::model::assignment_protocol::AutoAssignmentType;
217 /// use wkt::Duration;
218 /// let x = AutoAssignmentType::new().set_inactive_license_ttl(Duration::default()/* use setters */);
219 /// ```
220 pub fn set_inactive_license_ttl<T>(mut self, v: T) -> Self
221 where
222 T: std::convert::Into<wkt::Duration>,
223 {
224 self.inactive_license_ttl = std::option::Option::Some(v.into());
225 self
226 }
227
228 /// Sets or clears the value of [inactive_license_ttl][crate::model::assignment_protocol::AutoAssignmentType::inactive_license_ttl].
229 ///
230 /// # Example
231 /// ```ignore,no_run
232 /// # use google_cloud_commerce_consumer_procurement_v1::model::assignment_protocol::AutoAssignmentType;
233 /// use wkt::Duration;
234 /// let x = AutoAssignmentType::new().set_or_clear_inactive_license_ttl(Some(Duration::default()/* use setters */));
235 /// let x = AutoAssignmentType::new().set_or_clear_inactive_license_ttl(None::<Duration>);
236 /// ```
237 pub fn set_or_clear_inactive_license_ttl<T>(mut self, v: std::option::Option<T>) -> Self
238 where
239 T: std::convert::Into<wkt::Duration>,
240 {
241 self.inactive_license_ttl = v.map(|x| x.into());
242 self
243 }
244 }
245
246 impl wkt::message::Message for AutoAssignmentType {
247 fn typename() -> &'static str {
248 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.AutoAssignmentType"
249 }
250 }
251
252 /// The type of assignment protocol.
253 #[derive(Clone, Debug, PartialEq)]
254 #[non_exhaustive]
255 pub enum AssignmentType {
256 /// Allow manual assignments triggered by administrative operations only.
257 ManualAssignmentType(
258 std::boxed::Box<crate::model::assignment_protocol::ManualAssignmentType>,
259 ),
260 /// Allow automatic assignments triggered by data plane operations.
261 AutoAssignmentType(std::boxed::Box<crate::model::assignment_protocol::AutoAssignmentType>),
262 }
263}
264
265/// A license pool represents a pool of licenses that can be assigned to users.
266#[derive(Clone, Default, PartialEq)]
267#[non_exhaustive]
268pub struct LicensePool {
269 /// Identifier. Format:
270 /// `billingAccounts/{billing_account}/orders/{order}/licensePool`
271 pub name: std::string::String,
272
273 /// Required. Assignment protocol for the license pool.
274 pub license_assignment_protocol: std::option::Option<crate::model::AssignmentProtocol>,
275
276 /// Output only. Licenses count that are available to be assigned.
277 pub available_license_count: i32,
278
279 /// Output only. Total number of licenses in the pool.
280 pub total_license_count: i32,
281
282 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
283}
284
285impl LicensePool {
286 /// Creates a new default instance.
287 pub fn new() -> Self {
288 std::default::Default::default()
289 }
290
291 /// Sets the value of [name][crate::model::LicensePool::name].
292 ///
293 /// # Example
294 /// ```ignore,no_run
295 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
296 /// # let billing_account_id = "billing_account_id";
297 /// # let order_id = "order_id";
298 /// let x = LicensePool::new().set_name(format!("billingAccounts/{billing_account_id}/orders/{order_id}/licensePool"));
299 /// ```
300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
301 self.name = v.into();
302 self
303 }
304
305 /// Sets the value of [license_assignment_protocol][crate::model::LicensePool::license_assignment_protocol].
306 ///
307 /// # Example
308 /// ```ignore,no_run
309 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
310 /// use google_cloud_commerce_consumer_procurement_v1::model::AssignmentProtocol;
311 /// let x = LicensePool::new().set_license_assignment_protocol(AssignmentProtocol::default()/* use setters */);
312 /// ```
313 pub fn set_license_assignment_protocol<T>(mut self, v: T) -> Self
314 where
315 T: std::convert::Into<crate::model::AssignmentProtocol>,
316 {
317 self.license_assignment_protocol = std::option::Option::Some(v.into());
318 self
319 }
320
321 /// Sets or clears the value of [license_assignment_protocol][crate::model::LicensePool::license_assignment_protocol].
322 ///
323 /// # Example
324 /// ```ignore,no_run
325 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
326 /// use google_cloud_commerce_consumer_procurement_v1::model::AssignmentProtocol;
327 /// let x = LicensePool::new().set_or_clear_license_assignment_protocol(Some(AssignmentProtocol::default()/* use setters */));
328 /// let x = LicensePool::new().set_or_clear_license_assignment_protocol(None::<AssignmentProtocol>);
329 /// ```
330 pub fn set_or_clear_license_assignment_protocol<T>(mut self, v: std::option::Option<T>) -> Self
331 where
332 T: std::convert::Into<crate::model::AssignmentProtocol>,
333 {
334 self.license_assignment_protocol = v.map(|x| x.into());
335 self
336 }
337
338 /// Sets the value of [available_license_count][crate::model::LicensePool::available_license_count].
339 ///
340 /// # Example
341 /// ```ignore,no_run
342 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
343 /// let x = LicensePool::new().set_available_license_count(42);
344 /// ```
345 pub fn set_available_license_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
346 self.available_license_count = v.into();
347 self
348 }
349
350 /// Sets the value of [total_license_count][crate::model::LicensePool::total_license_count].
351 ///
352 /// # Example
353 /// ```ignore,no_run
354 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
355 /// let x = LicensePool::new().set_total_license_count(42);
356 /// ```
357 pub fn set_total_license_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
358 self.total_license_count = v.into();
359 self
360 }
361}
362
363impl wkt::message::Message for LicensePool {
364 fn typename() -> &'static str {
365 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.LicensePool"
366 }
367}
368
369/// Request message for getting a license pool.
370#[derive(Clone, Default, PartialEq)]
371#[non_exhaustive]
372pub struct GetLicensePoolRequest {
373 /// Required. The name of the license pool to get.
374 /// Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
375 pub name: std::string::String,
376
377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
378}
379
380impl GetLicensePoolRequest {
381 /// Creates a new default instance.
382 pub fn new() -> Self {
383 std::default::Default::default()
384 }
385
386 /// Sets the value of [name][crate::model::GetLicensePoolRequest::name].
387 ///
388 /// # Example
389 /// ```ignore,no_run
390 /// # use google_cloud_commerce_consumer_procurement_v1::model::GetLicensePoolRequest;
391 /// let x = GetLicensePoolRequest::new().set_name("example");
392 /// ```
393 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
394 self.name = v.into();
395 self
396 }
397}
398
399impl wkt::message::Message for GetLicensePoolRequest {
400 fn typename() -> &'static str {
401 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.GetLicensePoolRequest"
402 }
403}
404
405/// Request message for updating a license pool.
406#[derive(Clone, Default, PartialEq)]
407#[non_exhaustive]
408pub struct UpdateLicensePoolRequest {
409 /// Required. The license pool to update.
410 ///
411 /// The license pool's name field is used to identify the license pool to
412 /// update. Format:
413 /// `billingAccounts/{billing_account}/orders/{order}/licensePool`.
414 pub license_pool: std::option::Option<crate::model::LicensePool>,
415
416 /// Required. The list of fields to update.
417 pub update_mask: std::option::Option<wkt::FieldMask>,
418
419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
420}
421
422impl UpdateLicensePoolRequest {
423 /// Creates a new default instance.
424 pub fn new() -> Self {
425 std::default::Default::default()
426 }
427
428 /// Sets the value of [license_pool][crate::model::UpdateLicensePoolRequest::license_pool].
429 ///
430 /// # Example
431 /// ```ignore,no_run
432 /// # use google_cloud_commerce_consumer_procurement_v1::model::UpdateLicensePoolRequest;
433 /// use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
434 /// let x = UpdateLicensePoolRequest::new().set_license_pool(LicensePool::default()/* use setters */);
435 /// ```
436 pub fn set_license_pool<T>(mut self, v: T) -> Self
437 where
438 T: std::convert::Into<crate::model::LicensePool>,
439 {
440 self.license_pool = std::option::Option::Some(v.into());
441 self
442 }
443
444 /// Sets or clears the value of [license_pool][crate::model::UpdateLicensePoolRequest::license_pool].
445 ///
446 /// # Example
447 /// ```ignore,no_run
448 /// # use google_cloud_commerce_consumer_procurement_v1::model::UpdateLicensePoolRequest;
449 /// use google_cloud_commerce_consumer_procurement_v1::model::LicensePool;
450 /// let x = UpdateLicensePoolRequest::new().set_or_clear_license_pool(Some(LicensePool::default()/* use setters */));
451 /// let x = UpdateLicensePoolRequest::new().set_or_clear_license_pool(None::<LicensePool>);
452 /// ```
453 pub fn set_or_clear_license_pool<T>(mut self, v: std::option::Option<T>) -> Self
454 where
455 T: std::convert::Into<crate::model::LicensePool>,
456 {
457 self.license_pool = v.map(|x| x.into());
458 self
459 }
460
461 /// Sets the value of [update_mask][crate::model::UpdateLicensePoolRequest::update_mask].
462 ///
463 /// # Example
464 /// ```ignore,no_run
465 /// # use google_cloud_commerce_consumer_procurement_v1::model::UpdateLicensePoolRequest;
466 /// use wkt::FieldMask;
467 /// let x = UpdateLicensePoolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
468 /// ```
469 pub fn set_update_mask<T>(mut self, v: T) -> Self
470 where
471 T: std::convert::Into<wkt::FieldMask>,
472 {
473 self.update_mask = std::option::Option::Some(v.into());
474 self
475 }
476
477 /// Sets or clears the value of [update_mask][crate::model::UpdateLicensePoolRequest::update_mask].
478 ///
479 /// # Example
480 /// ```ignore,no_run
481 /// # use google_cloud_commerce_consumer_procurement_v1::model::UpdateLicensePoolRequest;
482 /// use wkt::FieldMask;
483 /// let x = UpdateLicensePoolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
484 /// let x = UpdateLicensePoolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
485 /// ```
486 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
487 where
488 T: std::convert::Into<wkt::FieldMask>,
489 {
490 self.update_mask = v.map(|x| x.into());
491 self
492 }
493}
494
495impl wkt::message::Message for UpdateLicensePoolRequest {
496 fn typename() -> &'static str {
497 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.UpdateLicensePoolRequest"
498 }
499}
500
501/// Request message for
502/// [LicenseManagementService.Assign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Assign].
503///
504/// [google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Assign]: crate::client::LicenseManagementService::assign
505#[derive(Clone, Default, PartialEq)]
506#[non_exhaustive]
507pub struct AssignRequest {
508 /// Required. License pool name.
509 pub parent: std::string::String,
510
511 /// Required. Username.
512 /// Format: `name@domain.com`.
513 pub usernames: std::vec::Vec<std::string::String>,
514
515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
516}
517
518impl AssignRequest {
519 /// Creates a new default instance.
520 pub fn new() -> Self {
521 std::default::Default::default()
522 }
523
524 /// Sets the value of [parent][crate::model::AssignRequest::parent].
525 ///
526 /// # Example
527 /// ```ignore,no_run
528 /// # use google_cloud_commerce_consumer_procurement_v1::model::AssignRequest;
529 /// let x = AssignRequest::new().set_parent("example");
530 /// ```
531 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
532 self.parent = v.into();
533 self
534 }
535
536 /// Sets the value of [usernames][crate::model::AssignRequest::usernames].
537 ///
538 /// # Example
539 /// ```ignore,no_run
540 /// # use google_cloud_commerce_consumer_procurement_v1::model::AssignRequest;
541 /// let x = AssignRequest::new().set_usernames(["a", "b", "c"]);
542 /// ```
543 pub fn set_usernames<T, V>(mut self, v: T) -> Self
544 where
545 T: std::iter::IntoIterator<Item = V>,
546 V: std::convert::Into<std::string::String>,
547 {
548 use std::iter::Iterator;
549 self.usernames = v.into_iter().map(|i| i.into()).collect();
550 self
551 }
552}
553
554impl wkt::message::Message for AssignRequest {
555 fn typename() -> &'static str {
556 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.AssignRequest"
557 }
558}
559
560/// Response message for
561/// [LicenseManagementService.Assign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Assign].
562///
563/// [google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Assign]: crate::client::LicenseManagementService::assign
564#[derive(Clone, Default, PartialEq)]
565#[non_exhaustive]
566pub struct AssignResponse {
567 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
568}
569
570impl AssignResponse {
571 /// Creates a new default instance.
572 pub fn new() -> Self {
573 std::default::Default::default()
574 }
575}
576
577impl wkt::message::Message for AssignResponse {
578 fn typename() -> &'static str {
579 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.AssignResponse"
580 }
581}
582
583/// Request message for
584/// [LicenseManagementService.Unassign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Unassign].
585///
586/// [google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Unassign]: crate::client::LicenseManagementService::unassign
587#[derive(Clone, Default, PartialEq)]
588#[non_exhaustive]
589pub struct UnassignRequest {
590 /// Required. License pool name.
591 pub parent: std::string::String,
592
593 /// Required. Username.
594 /// Format: `name@domain.com`.
595 pub usernames: std::vec::Vec<std::string::String>,
596
597 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
598}
599
600impl UnassignRequest {
601 /// Creates a new default instance.
602 pub fn new() -> Self {
603 std::default::Default::default()
604 }
605
606 /// Sets the value of [parent][crate::model::UnassignRequest::parent].
607 ///
608 /// # Example
609 /// ```ignore,no_run
610 /// # use google_cloud_commerce_consumer_procurement_v1::model::UnassignRequest;
611 /// let x = UnassignRequest::new().set_parent("example");
612 /// ```
613 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
614 self.parent = v.into();
615 self
616 }
617
618 /// Sets the value of [usernames][crate::model::UnassignRequest::usernames].
619 ///
620 /// # Example
621 /// ```ignore,no_run
622 /// # use google_cloud_commerce_consumer_procurement_v1::model::UnassignRequest;
623 /// let x = UnassignRequest::new().set_usernames(["a", "b", "c"]);
624 /// ```
625 pub fn set_usernames<T, V>(mut self, v: T) -> Self
626 where
627 T: std::iter::IntoIterator<Item = V>,
628 V: std::convert::Into<std::string::String>,
629 {
630 use std::iter::Iterator;
631 self.usernames = v.into_iter().map(|i| i.into()).collect();
632 self
633 }
634}
635
636impl wkt::message::Message for UnassignRequest {
637 fn typename() -> &'static str {
638 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.UnassignRequest"
639 }
640}
641
642/// Response message for
643/// [LicenseManagementService.Unassign][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Unassign].
644///
645/// [google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.Unassign]: crate::client::LicenseManagementService::unassign
646#[derive(Clone, Default, PartialEq)]
647#[non_exhaustive]
648pub struct UnassignResponse {
649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
650}
651
652impl UnassignResponse {
653 /// Creates a new default instance.
654 pub fn new() -> Self {
655 std::default::Default::default()
656 }
657}
658
659impl wkt::message::Message for UnassignResponse {
660 fn typename() -> &'static str {
661 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.UnassignResponse"
662 }
663}
664
665/// Request message for
666/// [LicenseManagementService.EnumerateLicensedUsers][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.EnumerateLicensedUsers].
667///
668/// [google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.EnumerateLicensedUsers]: crate::client::LicenseManagementService::enumerate_licensed_users
669#[derive(Clone, Default, PartialEq)]
670#[non_exhaustive]
671pub struct EnumerateLicensedUsersRequest {
672 /// Required. License pool name.
673 pub parent: std::string::String,
674
675 /// Optional. The maximum number of users to return. The service may return
676 /// fewer than this value.
677 pub page_size: i32,
678
679 /// Optional. A page token, received from a previous `EnumerateLicensedUsers`
680 /// call. Provide this to retrieve the subsequent page.
681 pub page_token: std::string::String,
682
683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
684}
685
686impl EnumerateLicensedUsersRequest {
687 /// Creates a new default instance.
688 pub fn new() -> Self {
689 std::default::Default::default()
690 }
691
692 /// Sets the value of [parent][crate::model::EnumerateLicensedUsersRequest::parent].
693 ///
694 /// # Example
695 /// ```ignore,no_run
696 /// # use google_cloud_commerce_consumer_procurement_v1::model::EnumerateLicensedUsersRequest;
697 /// let x = EnumerateLicensedUsersRequest::new().set_parent("example");
698 /// ```
699 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
700 self.parent = v.into();
701 self
702 }
703
704 /// Sets the value of [page_size][crate::model::EnumerateLicensedUsersRequest::page_size].
705 ///
706 /// # Example
707 /// ```ignore,no_run
708 /// # use google_cloud_commerce_consumer_procurement_v1::model::EnumerateLicensedUsersRequest;
709 /// let x = EnumerateLicensedUsersRequest::new().set_page_size(42);
710 /// ```
711 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
712 self.page_size = v.into();
713 self
714 }
715
716 /// Sets the value of [page_token][crate::model::EnumerateLicensedUsersRequest::page_token].
717 ///
718 /// # Example
719 /// ```ignore,no_run
720 /// # use google_cloud_commerce_consumer_procurement_v1::model::EnumerateLicensedUsersRequest;
721 /// let x = EnumerateLicensedUsersRequest::new().set_page_token("example");
722 /// ```
723 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
724 self.page_token = v.into();
725 self
726 }
727}
728
729impl wkt::message::Message for EnumerateLicensedUsersRequest {
730 fn typename() -> &'static str {
731 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.EnumerateLicensedUsersRequest"
732 }
733}
734
735/// A licensed user.
736#[derive(Clone, Default, PartialEq)]
737#[non_exhaustive]
738pub struct LicensedUser {
739 /// Username.
740 /// Format: `name@domain.com`.
741 pub username: std::string::String,
742
743 /// Output only. Timestamp when the license was assigned.
744 pub assign_time: std::option::Option<wkt::Timestamp>,
745
746 /// Output only. Timestamp when the license was recently used. This may not be
747 /// the most recent usage time, and will be updated regularly (within 24
748 /// hours).
749 pub recent_usage_time: std::option::Option<wkt::Timestamp>,
750
751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
752}
753
754impl LicensedUser {
755 /// Creates a new default instance.
756 pub fn new() -> Self {
757 std::default::Default::default()
758 }
759
760 /// Sets the value of [username][crate::model::LicensedUser::username].
761 ///
762 /// # Example
763 /// ```ignore,no_run
764 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensedUser;
765 /// let x = LicensedUser::new().set_username("example");
766 /// ```
767 pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
768 self.username = v.into();
769 self
770 }
771
772 /// Sets the value of [assign_time][crate::model::LicensedUser::assign_time].
773 ///
774 /// # Example
775 /// ```ignore,no_run
776 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensedUser;
777 /// use wkt::Timestamp;
778 /// let x = LicensedUser::new().set_assign_time(Timestamp::default()/* use setters */);
779 /// ```
780 pub fn set_assign_time<T>(mut self, v: T) -> Self
781 where
782 T: std::convert::Into<wkt::Timestamp>,
783 {
784 self.assign_time = std::option::Option::Some(v.into());
785 self
786 }
787
788 /// Sets or clears the value of [assign_time][crate::model::LicensedUser::assign_time].
789 ///
790 /// # Example
791 /// ```ignore,no_run
792 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensedUser;
793 /// use wkt::Timestamp;
794 /// let x = LicensedUser::new().set_or_clear_assign_time(Some(Timestamp::default()/* use setters */));
795 /// let x = LicensedUser::new().set_or_clear_assign_time(None::<Timestamp>);
796 /// ```
797 pub fn set_or_clear_assign_time<T>(mut self, v: std::option::Option<T>) -> Self
798 where
799 T: std::convert::Into<wkt::Timestamp>,
800 {
801 self.assign_time = v.map(|x| x.into());
802 self
803 }
804
805 /// Sets the value of [recent_usage_time][crate::model::LicensedUser::recent_usage_time].
806 ///
807 /// # Example
808 /// ```ignore,no_run
809 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensedUser;
810 /// use wkt::Timestamp;
811 /// let x = LicensedUser::new().set_recent_usage_time(Timestamp::default()/* use setters */);
812 /// ```
813 pub fn set_recent_usage_time<T>(mut self, v: T) -> Self
814 where
815 T: std::convert::Into<wkt::Timestamp>,
816 {
817 self.recent_usage_time = std::option::Option::Some(v.into());
818 self
819 }
820
821 /// Sets or clears the value of [recent_usage_time][crate::model::LicensedUser::recent_usage_time].
822 ///
823 /// # Example
824 /// ```ignore,no_run
825 /// # use google_cloud_commerce_consumer_procurement_v1::model::LicensedUser;
826 /// use wkt::Timestamp;
827 /// let x = LicensedUser::new().set_or_clear_recent_usage_time(Some(Timestamp::default()/* use setters */));
828 /// let x = LicensedUser::new().set_or_clear_recent_usage_time(None::<Timestamp>);
829 /// ```
830 pub fn set_or_clear_recent_usage_time<T>(mut self, v: std::option::Option<T>) -> Self
831 where
832 T: std::convert::Into<wkt::Timestamp>,
833 {
834 self.recent_usage_time = v.map(|x| x.into());
835 self
836 }
837}
838
839impl wkt::message::Message for LicensedUser {
840 fn typename() -> &'static str {
841 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.LicensedUser"
842 }
843}
844
845/// Response message for
846/// [LicenseManagementService.EnumerateLicensedUsers][google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.EnumerateLicensedUsers].
847///
848/// [google.cloud.commerce.consumer.procurement.v1.LicenseManagementService.EnumerateLicensedUsers]: crate::client::LicenseManagementService::enumerate_licensed_users
849#[derive(Clone, Default, PartialEq)]
850#[non_exhaustive]
851pub struct EnumerateLicensedUsersResponse {
852 /// The list of licensed users.
853 pub licensed_users: std::vec::Vec<crate::model::LicensedUser>,
854
855 /// A token that can be sent as `page_token` to retrieve the next page.
856 /// If this field is omitted, there are no subsequent pages.
857 pub next_page_token: std::string::String,
858
859 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
860}
861
862impl EnumerateLicensedUsersResponse {
863 /// Creates a new default instance.
864 pub fn new() -> Self {
865 std::default::Default::default()
866 }
867
868 /// Sets the value of [licensed_users][crate::model::EnumerateLicensedUsersResponse::licensed_users].
869 ///
870 /// # Example
871 /// ```ignore,no_run
872 /// # use google_cloud_commerce_consumer_procurement_v1::model::EnumerateLicensedUsersResponse;
873 /// use google_cloud_commerce_consumer_procurement_v1::model::LicensedUser;
874 /// let x = EnumerateLicensedUsersResponse::new()
875 /// .set_licensed_users([
876 /// LicensedUser::default()/* use setters */,
877 /// LicensedUser::default()/* use (different) setters */,
878 /// ]);
879 /// ```
880 pub fn set_licensed_users<T, V>(mut self, v: T) -> Self
881 where
882 T: std::iter::IntoIterator<Item = V>,
883 V: std::convert::Into<crate::model::LicensedUser>,
884 {
885 use std::iter::Iterator;
886 self.licensed_users = v.into_iter().map(|i| i.into()).collect();
887 self
888 }
889
890 /// Sets the value of [next_page_token][crate::model::EnumerateLicensedUsersResponse::next_page_token].
891 ///
892 /// # Example
893 /// ```ignore,no_run
894 /// # use google_cloud_commerce_consumer_procurement_v1::model::EnumerateLicensedUsersResponse;
895 /// let x = EnumerateLicensedUsersResponse::new().set_next_page_token("example");
896 /// ```
897 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
898 self.next_page_token = v.into();
899 self
900 }
901}
902
903impl wkt::message::Message for EnumerateLicensedUsersResponse {
904 fn typename() -> &'static str {
905 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.EnumerateLicensedUsersResponse"
906 }
907}
908
909#[doc(hidden)]
910impl google_cloud_gax::paginator::internal::PageableResponse for EnumerateLicensedUsersResponse {
911 type PageItem = crate::model::LicensedUser;
912
913 fn items(self) -> std::vec::Vec<Self::PageItem> {
914 self.licensed_users
915 }
916
917 fn next_page_token(&self) -> std::string::String {
918 use std::clone::Clone;
919 self.next_page_token.clone()
920 }
921}
922
923/// Represents a purchase made by a customer on Cloud Marketplace.
924/// Creating an order makes sure that both the Google backend systems
925/// as well as external service provider's systems (if needed) allow use of
926/// purchased products and ensures the appropriate billing events occur.
927///
928/// An Order can be made against one Product with multiple add-ons (optional) or
929/// one Quote which might reference multiple products.
930///
931/// Customers typically choose a price plan for each Product purchased when
932/// they create an order and can change their plan later, if the product allows.
933#[derive(Clone, Default, PartialEq)]
934#[non_exhaustive]
935pub struct Order {
936 /// Output only. The resource name of the order.
937 /// Has the form
938 /// `billingAccounts/{billing_account}/orders/{order}`.
939 pub name: std::string::String,
940
941 /// Required. The user-specified name of the order.
942 pub display_name: std::string::String,
943
944 /// Output only. The items being purchased.
945 pub line_items: std::vec::Vec<crate::model::LineItem>,
946
947 /// Output only. Line items that were cancelled.
948 pub cancelled_line_items: std::vec::Vec<crate::model::LineItem>,
949
950 /// Output only. The creation timestamp.
951 pub create_time: std::option::Option<wkt::Timestamp>,
952
953 /// Output only. The last update timestamp.
954 pub update_time: std::option::Option<wkt::Timestamp>,
955
956 /// The weak etag of the order.
957 pub etag: std::string::String,
958
959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
960}
961
962impl Order {
963 /// Creates a new default instance.
964 pub fn new() -> Self {
965 std::default::Default::default()
966 }
967
968 /// Sets the value of [name][crate::model::Order::name].
969 ///
970 /// # Example
971 /// ```ignore,no_run
972 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
973 /// # let billing_account_id = "billing_account_id";
974 /// # let order_id = "order_id";
975 /// let x = Order::new().set_name(format!("billingAccounts/{billing_account_id}/orders/{order_id}"));
976 /// ```
977 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
978 self.name = v.into();
979 self
980 }
981
982 /// Sets the value of [display_name][crate::model::Order::display_name].
983 ///
984 /// # Example
985 /// ```ignore,no_run
986 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
987 /// let x = Order::new().set_display_name("example");
988 /// ```
989 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
990 self.display_name = v.into();
991 self
992 }
993
994 /// Sets the value of [line_items][crate::model::Order::line_items].
995 ///
996 /// # Example
997 /// ```ignore,no_run
998 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
999 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1000 /// let x = Order::new()
1001 /// .set_line_items([
1002 /// LineItem::default()/* use setters */,
1003 /// LineItem::default()/* use (different) setters */,
1004 /// ]);
1005 /// ```
1006 pub fn set_line_items<T, V>(mut self, v: T) -> Self
1007 where
1008 T: std::iter::IntoIterator<Item = V>,
1009 V: std::convert::Into<crate::model::LineItem>,
1010 {
1011 use std::iter::Iterator;
1012 self.line_items = v.into_iter().map(|i| i.into()).collect();
1013 self
1014 }
1015
1016 /// Sets the value of [cancelled_line_items][crate::model::Order::cancelled_line_items].
1017 ///
1018 /// # Example
1019 /// ```ignore,no_run
1020 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
1021 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1022 /// let x = Order::new()
1023 /// .set_cancelled_line_items([
1024 /// LineItem::default()/* use setters */,
1025 /// LineItem::default()/* use (different) setters */,
1026 /// ]);
1027 /// ```
1028 pub fn set_cancelled_line_items<T, V>(mut self, v: T) -> Self
1029 where
1030 T: std::iter::IntoIterator<Item = V>,
1031 V: std::convert::Into<crate::model::LineItem>,
1032 {
1033 use std::iter::Iterator;
1034 self.cancelled_line_items = v.into_iter().map(|i| i.into()).collect();
1035 self
1036 }
1037
1038 /// Sets the value of [create_time][crate::model::Order::create_time].
1039 ///
1040 /// # Example
1041 /// ```ignore,no_run
1042 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
1043 /// use wkt::Timestamp;
1044 /// let x = Order::new().set_create_time(Timestamp::default()/* use setters */);
1045 /// ```
1046 pub fn set_create_time<T>(mut self, v: T) -> Self
1047 where
1048 T: std::convert::Into<wkt::Timestamp>,
1049 {
1050 self.create_time = std::option::Option::Some(v.into());
1051 self
1052 }
1053
1054 /// Sets or clears the value of [create_time][crate::model::Order::create_time].
1055 ///
1056 /// # Example
1057 /// ```ignore,no_run
1058 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
1059 /// use wkt::Timestamp;
1060 /// let x = Order::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1061 /// let x = Order::new().set_or_clear_create_time(None::<Timestamp>);
1062 /// ```
1063 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1064 where
1065 T: std::convert::Into<wkt::Timestamp>,
1066 {
1067 self.create_time = v.map(|x| x.into());
1068 self
1069 }
1070
1071 /// Sets the value of [update_time][crate::model::Order::update_time].
1072 ///
1073 /// # Example
1074 /// ```ignore,no_run
1075 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
1076 /// use wkt::Timestamp;
1077 /// let x = Order::new().set_update_time(Timestamp::default()/* use setters */);
1078 /// ```
1079 pub fn set_update_time<T>(mut self, v: T) -> Self
1080 where
1081 T: std::convert::Into<wkt::Timestamp>,
1082 {
1083 self.update_time = std::option::Option::Some(v.into());
1084 self
1085 }
1086
1087 /// Sets or clears the value of [update_time][crate::model::Order::update_time].
1088 ///
1089 /// # Example
1090 /// ```ignore,no_run
1091 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
1092 /// use wkt::Timestamp;
1093 /// let x = Order::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1094 /// let x = Order::new().set_or_clear_update_time(None::<Timestamp>);
1095 /// ```
1096 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1097 where
1098 T: std::convert::Into<wkt::Timestamp>,
1099 {
1100 self.update_time = v.map(|x| x.into());
1101 self
1102 }
1103
1104 /// Sets the value of [etag][crate::model::Order::etag].
1105 ///
1106 /// # Example
1107 /// ```ignore,no_run
1108 /// # use google_cloud_commerce_consumer_procurement_v1::model::Order;
1109 /// let x = Order::new().set_etag("example");
1110 /// ```
1111 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1112 self.etag = v.into();
1113 self
1114 }
1115}
1116
1117impl wkt::message::Message for Order {
1118 fn typename() -> &'static str {
1119 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.Order"
1120 }
1121}
1122
1123/// A single item within an order.
1124#[derive(Clone, Default, PartialEq)]
1125#[non_exhaustive]
1126pub struct LineItem {
1127 /// Output only. Line item ID.
1128 pub line_item_id: std::string::String,
1129
1130 /// Output only. Current state and information of this item. It tells what,
1131 /// e.g. which offer, is currently effective.
1132 pub line_item_info: std::option::Option<crate::model::LineItemInfo>,
1133
1134 /// Output only. A change made on the item which is pending and not yet
1135 /// effective. Absence of this field indicates the line item is not undergoing
1136 /// a change.
1137 pub pending_change: std::option::Option<crate::model::LineItemChange>,
1138
1139 /// Output only. Changes made on the item that are not pending anymore which
1140 /// might be because they already took effect, were reverted by the customer,
1141 /// or were rejected by the partner. No more operations are allowed on these
1142 /// changes.
1143 pub change_history: std::vec::Vec<crate::model::LineItemChange>,
1144
1145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1146}
1147
1148impl LineItem {
1149 /// Creates a new default instance.
1150 pub fn new() -> Self {
1151 std::default::Default::default()
1152 }
1153
1154 /// Sets the value of [line_item_id][crate::model::LineItem::line_item_id].
1155 ///
1156 /// # Example
1157 /// ```ignore,no_run
1158 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1159 /// let x = LineItem::new().set_line_item_id("example");
1160 /// ```
1161 pub fn set_line_item_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1162 self.line_item_id = v.into();
1163 self
1164 }
1165
1166 /// Sets the value of [line_item_info][crate::model::LineItem::line_item_info].
1167 ///
1168 /// # Example
1169 /// ```ignore,no_run
1170 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1171 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1172 /// let x = LineItem::new().set_line_item_info(LineItemInfo::default()/* use setters */);
1173 /// ```
1174 pub fn set_line_item_info<T>(mut self, v: T) -> Self
1175 where
1176 T: std::convert::Into<crate::model::LineItemInfo>,
1177 {
1178 self.line_item_info = std::option::Option::Some(v.into());
1179 self
1180 }
1181
1182 /// Sets or clears the value of [line_item_info][crate::model::LineItem::line_item_info].
1183 ///
1184 /// # Example
1185 /// ```ignore,no_run
1186 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1187 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1188 /// let x = LineItem::new().set_or_clear_line_item_info(Some(LineItemInfo::default()/* use setters */));
1189 /// let x = LineItem::new().set_or_clear_line_item_info(None::<LineItemInfo>);
1190 /// ```
1191 pub fn set_or_clear_line_item_info<T>(mut self, v: std::option::Option<T>) -> Self
1192 where
1193 T: std::convert::Into<crate::model::LineItemInfo>,
1194 {
1195 self.line_item_info = v.map(|x| x.into());
1196 self
1197 }
1198
1199 /// Sets the value of [pending_change][crate::model::LineItem::pending_change].
1200 ///
1201 /// # Example
1202 /// ```ignore,no_run
1203 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1204 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1205 /// let x = LineItem::new().set_pending_change(LineItemChange::default()/* use setters */);
1206 /// ```
1207 pub fn set_pending_change<T>(mut self, v: T) -> Self
1208 where
1209 T: std::convert::Into<crate::model::LineItemChange>,
1210 {
1211 self.pending_change = std::option::Option::Some(v.into());
1212 self
1213 }
1214
1215 /// Sets or clears the value of [pending_change][crate::model::LineItem::pending_change].
1216 ///
1217 /// # Example
1218 /// ```ignore,no_run
1219 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1220 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1221 /// let x = LineItem::new().set_or_clear_pending_change(Some(LineItemChange::default()/* use setters */));
1222 /// let x = LineItem::new().set_or_clear_pending_change(None::<LineItemChange>);
1223 /// ```
1224 pub fn set_or_clear_pending_change<T>(mut self, v: std::option::Option<T>) -> Self
1225 where
1226 T: std::convert::Into<crate::model::LineItemChange>,
1227 {
1228 self.pending_change = v.map(|x| x.into());
1229 self
1230 }
1231
1232 /// Sets the value of [change_history][crate::model::LineItem::change_history].
1233 ///
1234 /// # Example
1235 /// ```ignore,no_run
1236 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItem;
1237 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1238 /// let x = LineItem::new()
1239 /// .set_change_history([
1240 /// LineItemChange::default()/* use setters */,
1241 /// LineItemChange::default()/* use (different) setters */,
1242 /// ]);
1243 /// ```
1244 pub fn set_change_history<T, V>(mut self, v: T) -> Self
1245 where
1246 T: std::iter::IntoIterator<Item = V>,
1247 V: std::convert::Into<crate::model::LineItemChange>,
1248 {
1249 use std::iter::Iterator;
1250 self.change_history = v.into_iter().map(|i| i.into()).collect();
1251 self
1252 }
1253}
1254
1255impl wkt::message::Message for LineItem {
1256 fn typename() -> &'static str {
1257 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.LineItem"
1258 }
1259}
1260
1261/// A change made on a line item.
1262#[derive(Clone, Default, PartialEq)]
1263#[non_exhaustive]
1264pub struct LineItemChange {
1265 /// Output only. Change ID.
1266 /// All changes made within one order update operation have the same change_id.
1267 pub change_id: std::string::String,
1268
1269 /// Required. Type of the change to make.
1270 pub change_type: crate::model::LineItemChangeType,
1271
1272 /// Output only. Line item info before the change.
1273 pub old_line_item_info: std::option::Option<crate::model::LineItemInfo>,
1274
1275 /// Line item info after the change.
1276 pub new_line_item_info: std::option::Option<crate::model::LineItemInfo>,
1277
1278 /// Output only. State of the change.
1279 pub change_state: crate::model::LineItemChangeState,
1280
1281 /// Output only. Provider-supplied message explaining the LineItemChange's
1282 /// state. Mainly used to communicate progress and ETA for provisioning in the
1283 /// case of `PENDING_APPROVAL`, and to explain why the change request was
1284 /// denied or canceled in the case of `REJECTED` and `CANCELED` states.
1285 pub state_reason: std::string::String,
1286
1287 /// Output only. Predefined enum types for why this line item change is in
1288 /// current state. For example, a line item change's state could be
1289 /// `LINE_ITEM_CHANGE_STATE_COMPLETED` because of end-of-term expiration,
1290 /// immediate cancellation initiated by the user, or system-initiated
1291 /// cancellation.
1292 pub change_state_reason_type: crate::model::LineItemChangeStateReasonType,
1293
1294 /// Output only. A time at which the change became or will become (in case of
1295 /// pending change) effective.
1296 pub change_effective_time: std::option::Option<wkt::Timestamp>,
1297
1298 /// Output only. The time when change was initiated.
1299 pub create_time: std::option::Option<wkt::Timestamp>,
1300
1301 /// Output only. The time when change was updated, e.g. approved/rejected by
1302 /// partners or cancelled by the user.
1303 pub update_time: std::option::Option<wkt::Timestamp>,
1304
1305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1306}
1307
1308impl LineItemChange {
1309 /// Creates a new default instance.
1310 pub fn new() -> Self {
1311 std::default::Default::default()
1312 }
1313
1314 /// Sets the value of [change_id][crate::model::LineItemChange::change_id].
1315 ///
1316 /// # Example
1317 /// ```ignore,no_run
1318 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1319 /// let x = LineItemChange::new().set_change_id("example");
1320 /// ```
1321 pub fn set_change_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1322 self.change_id = v.into();
1323 self
1324 }
1325
1326 /// Sets the value of [change_type][crate::model::LineItemChange::change_type].
1327 ///
1328 /// # Example
1329 /// ```ignore,no_run
1330 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1331 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChangeType;
1332 /// let x0 = LineItemChange::new().set_change_type(LineItemChangeType::Create);
1333 /// let x1 = LineItemChange::new().set_change_type(LineItemChangeType::Update);
1334 /// let x2 = LineItemChange::new().set_change_type(LineItemChangeType::Cancel);
1335 /// ```
1336 pub fn set_change_type<T: std::convert::Into<crate::model::LineItemChangeType>>(
1337 mut self,
1338 v: T,
1339 ) -> Self {
1340 self.change_type = v.into();
1341 self
1342 }
1343
1344 /// Sets the value of [old_line_item_info][crate::model::LineItemChange::old_line_item_info].
1345 ///
1346 /// # Example
1347 /// ```ignore,no_run
1348 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1349 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1350 /// let x = LineItemChange::new().set_old_line_item_info(LineItemInfo::default()/* use setters */);
1351 /// ```
1352 pub fn set_old_line_item_info<T>(mut self, v: T) -> Self
1353 where
1354 T: std::convert::Into<crate::model::LineItemInfo>,
1355 {
1356 self.old_line_item_info = std::option::Option::Some(v.into());
1357 self
1358 }
1359
1360 /// Sets or clears the value of [old_line_item_info][crate::model::LineItemChange::old_line_item_info].
1361 ///
1362 /// # Example
1363 /// ```ignore,no_run
1364 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1365 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1366 /// let x = LineItemChange::new().set_or_clear_old_line_item_info(Some(LineItemInfo::default()/* use setters */));
1367 /// let x = LineItemChange::new().set_or_clear_old_line_item_info(None::<LineItemInfo>);
1368 /// ```
1369 pub fn set_or_clear_old_line_item_info<T>(mut self, v: std::option::Option<T>) -> Self
1370 where
1371 T: std::convert::Into<crate::model::LineItemInfo>,
1372 {
1373 self.old_line_item_info = v.map(|x| x.into());
1374 self
1375 }
1376
1377 /// Sets the value of [new_line_item_info][crate::model::LineItemChange::new_line_item_info].
1378 ///
1379 /// # Example
1380 /// ```ignore,no_run
1381 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1382 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1383 /// let x = LineItemChange::new().set_new_line_item_info(LineItemInfo::default()/* use setters */);
1384 /// ```
1385 pub fn set_new_line_item_info<T>(mut self, v: T) -> Self
1386 where
1387 T: std::convert::Into<crate::model::LineItemInfo>,
1388 {
1389 self.new_line_item_info = std::option::Option::Some(v.into());
1390 self
1391 }
1392
1393 /// Sets or clears the value of [new_line_item_info][crate::model::LineItemChange::new_line_item_info].
1394 ///
1395 /// # Example
1396 /// ```ignore,no_run
1397 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1398 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1399 /// let x = LineItemChange::new().set_or_clear_new_line_item_info(Some(LineItemInfo::default()/* use setters */));
1400 /// let x = LineItemChange::new().set_or_clear_new_line_item_info(None::<LineItemInfo>);
1401 /// ```
1402 pub fn set_or_clear_new_line_item_info<T>(mut self, v: std::option::Option<T>) -> Self
1403 where
1404 T: std::convert::Into<crate::model::LineItemInfo>,
1405 {
1406 self.new_line_item_info = v.map(|x| x.into());
1407 self
1408 }
1409
1410 /// Sets the value of [change_state][crate::model::LineItemChange::change_state].
1411 ///
1412 /// # Example
1413 /// ```ignore,no_run
1414 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1415 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChangeState;
1416 /// let x0 = LineItemChange::new().set_change_state(LineItemChangeState::PendingApproval);
1417 /// let x1 = LineItemChange::new().set_change_state(LineItemChangeState::Approved);
1418 /// let x2 = LineItemChange::new().set_change_state(LineItemChangeState::Completed);
1419 /// ```
1420 pub fn set_change_state<T: std::convert::Into<crate::model::LineItemChangeState>>(
1421 mut self,
1422 v: T,
1423 ) -> Self {
1424 self.change_state = v.into();
1425 self
1426 }
1427
1428 /// Sets the value of [state_reason][crate::model::LineItemChange::state_reason].
1429 ///
1430 /// # Example
1431 /// ```ignore,no_run
1432 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1433 /// let x = LineItemChange::new().set_state_reason("example");
1434 /// ```
1435 pub fn set_state_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1436 self.state_reason = v.into();
1437 self
1438 }
1439
1440 /// Sets the value of [change_state_reason_type][crate::model::LineItemChange::change_state_reason_type].
1441 ///
1442 /// # Example
1443 /// ```ignore,no_run
1444 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1445 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChangeStateReasonType;
1446 /// let x0 = LineItemChange::new().set_change_state_reason_type(LineItemChangeStateReasonType::Expired);
1447 /// let x1 = LineItemChange::new().set_change_state_reason_type(LineItemChangeStateReasonType::UserCancelled);
1448 /// let x2 = LineItemChange::new().set_change_state_reason_type(LineItemChangeStateReasonType::SystemCancelled);
1449 /// ```
1450 pub fn set_change_state_reason_type<
1451 T: std::convert::Into<crate::model::LineItemChangeStateReasonType>,
1452 >(
1453 mut self,
1454 v: T,
1455 ) -> Self {
1456 self.change_state_reason_type = v.into();
1457 self
1458 }
1459
1460 /// Sets the value of [change_effective_time][crate::model::LineItemChange::change_effective_time].
1461 ///
1462 /// # Example
1463 /// ```ignore,no_run
1464 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1465 /// use wkt::Timestamp;
1466 /// let x = LineItemChange::new().set_change_effective_time(Timestamp::default()/* use setters */);
1467 /// ```
1468 pub fn set_change_effective_time<T>(mut self, v: T) -> Self
1469 where
1470 T: std::convert::Into<wkt::Timestamp>,
1471 {
1472 self.change_effective_time = std::option::Option::Some(v.into());
1473 self
1474 }
1475
1476 /// Sets or clears the value of [change_effective_time][crate::model::LineItemChange::change_effective_time].
1477 ///
1478 /// # Example
1479 /// ```ignore,no_run
1480 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1481 /// use wkt::Timestamp;
1482 /// let x = LineItemChange::new().set_or_clear_change_effective_time(Some(Timestamp::default()/* use setters */));
1483 /// let x = LineItemChange::new().set_or_clear_change_effective_time(None::<Timestamp>);
1484 /// ```
1485 pub fn set_or_clear_change_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
1486 where
1487 T: std::convert::Into<wkt::Timestamp>,
1488 {
1489 self.change_effective_time = v.map(|x| x.into());
1490 self
1491 }
1492
1493 /// Sets the value of [create_time][crate::model::LineItemChange::create_time].
1494 ///
1495 /// # Example
1496 /// ```ignore,no_run
1497 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1498 /// use wkt::Timestamp;
1499 /// let x = LineItemChange::new().set_create_time(Timestamp::default()/* use setters */);
1500 /// ```
1501 pub fn set_create_time<T>(mut self, v: T) -> Self
1502 where
1503 T: std::convert::Into<wkt::Timestamp>,
1504 {
1505 self.create_time = std::option::Option::Some(v.into());
1506 self
1507 }
1508
1509 /// Sets or clears the value of [create_time][crate::model::LineItemChange::create_time].
1510 ///
1511 /// # Example
1512 /// ```ignore,no_run
1513 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1514 /// use wkt::Timestamp;
1515 /// let x = LineItemChange::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1516 /// let x = LineItemChange::new().set_or_clear_create_time(None::<Timestamp>);
1517 /// ```
1518 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1519 where
1520 T: std::convert::Into<wkt::Timestamp>,
1521 {
1522 self.create_time = v.map(|x| x.into());
1523 self
1524 }
1525
1526 /// Sets the value of [update_time][crate::model::LineItemChange::update_time].
1527 ///
1528 /// # Example
1529 /// ```ignore,no_run
1530 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1531 /// use wkt::Timestamp;
1532 /// let x = LineItemChange::new().set_update_time(Timestamp::default()/* use setters */);
1533 /// ```
1534 pub fn set_update_time<T>(mut self, v: T) -> Self
1535 where
1536 T: std::convert::Into<wkt::Timestamp>,
1537 {
1538 self.update_time = std::option::Option::Some(v.into());
1539 self
1540 }
1541
1542 /// Sets or clears the value of [update_time][crate::model::LineItemChange::update_time].
1543 ///
1544 /// # Example
1545 /// ```ignore,no_run
1546 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemChange;
1547 /// use wkt::Timestamp;
1548 /// let x = LineItemChange::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1549 /// let x = LineItemChange::new().set_or_clear_update_time(None::<Timestamp>);
1550 /// ```
1551 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1552 where
1553 T: std::convert::Into<wkt::Timestamp>,
1554 {
1555 self.update_time = v.map(|x| x.into());
1556 self
1557 }
1558}
1559
1560impl wkt::message::Message for LineItemChange {
1561 fn typename() -> &'static str {
1562 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.LineItemChange"
1563 }
1564}
1565
1566/// Line item information.
1567#[derive(Clone, Default, PartialEq)]
1568#[non_exhaustive]
1569pub struct LineItemInfo {
1570 /// Optional. The name of the offer can have either of these formats:
1571 /// 'billingAccounts/{billing_account}/offers/{offer}',
1572 /// or 'services/{service}/standardOffers/{offer}'.
1573 pub offer: std::string::String,
1574
1575 /// Optional. User-provided parameters.
1576 pub parameters: std::vec::Vec<crate::model::Parameter>,
1577
1578 /// Output only. Information about the subscription created, if applicable.
1579 pub subscription: std::option::Option<crate::model::Subscription>,
1580
1581 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1582}
1583
1584impl LineItemInfo {
1585 /// Creates a new default instance.
1586 pub fn new() -> Self {
1587 std::default::Default::default()
1588 }
1589
1590 /// Sets the value of [offer][crate::model::LineItemInfo::offer].
1591 ///
1592 /// # Example
1593 /// ```ignore,no_run
1594 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1595 /// let x = LineItemInfo::new().set_offer("example");
1596 /// ```
1597 pub fn set_offer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1598 self.offer = v.into();
1599 self
1600 }
1601
1602 /// Sets the value of [parameters][crate::model::LineItemInfo::parameters].
1603 ///
1604 /// # Example
1605 /// ```ignore,no_run
1606 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1607 /// use google_cloud_commerce_consumer_procurement_v1::model::Parameter;
1608 /// let x = LineItemInfo::new()
1609 /// .set_parameters([
1610 /// Parameter::default()/* use setters */,
1611 /// Parameter::default()/* use (different) setters */,
1612 /// ]);
1613 /// ```
1614 pub fn set_parameters<T, V>(mut self, v: T) -> Self
1615 where
1616 T: std::iter::IntoIterator<Item = V>,
1617 V: std::convert::Into<crate::model::Parameter>,
1618 {
1619 use std::iter::Iterator;
1620 self.parameters = v.into_iter().map(|i| i.into()).collect();
1621 self
1622 }
1623
1624 /// Sets the value of [subscription][crate::model::LineItemInfo::subscription].
1625 ///
1626 /// # Example
1627 /// ```ignore,no_run
1628 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1629 /// use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
1630 /// let x = LineItemInfo::new().set_subscription(Subscription::default()/* use setters */);
1631 /// ```
1632 pub fn set_subscription<T>(mut self, v: T) -> Self
1633 where
1634 T: std::convert::Into<crate::model::Subscription>,
1635 {
1636 self.subscription = std::option::Option::Some(v.into());
1637 self
1638 }
1639
1640 /// Sets or clears the value of [subscription][crate::model::LineItemInfo::subscription].
1641 ///
1642 /// # Example
1643 /// ```ignore,no_run
1644 /// # use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
1645 /// use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
1646 /// let x = LineItemInfo::new().set_or_clear_subscription(Some(Subscription::default()/* use setters */));
1647 /// let x = LineItemInfo::new().set_or_clear_subscription(None::<Subscription>);
1648 /// ```
1649 pub fn set_or_clear_subscription<T>(mut self, v: std::option::Option<T>) -> Self
1650 where
1651 T: std::convert::Into<crate::model::Subscription>,
1652 {
1653 self.subscription = v.map(|x| x.into());
1654 self
1655 }
1656}
1657
1658impl wkt::message::Message for LineItemInfo {
1659 fn typename() -> &'static str {
1660 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.LineItemInfo"
1661 }
1662}
1663
1664/// User-provided Parameters.
1665#[derive(Clone, Default, PartialEq)]
1666#[non_exhaustive]
1667pub struct Parameter {
1668 /// Name of the parameter.
1669 pub name: std::string::String,
1670
1671 /// Value of parameter.
1672 pub value: std::option::Option<crate::model::parameter::Value>,
1673
1674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1675}
1676
1677impl Parameter {
1678 /// Creates a new default instance.
1679 pub fn new() -> Self {
1680 std::default::Default::default()
1681 }
1682
1683 /// Sets the value of [name][crate::model::Parameter::name].
1684 ///
1685 /// # Example
1686 /// ```ignore,no_run
1687 /// # use google_cloud_commerce_consumer_procurement_v1::model::Parameter;
1688 /// let x = Parameter::new().set_name("example");
1689 /// ```
1690 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1691 self.name = v.into();
1692 self
1693 }
1694
1695 /// Sets the value of [value][crate::model::Parameter::value].
1696 ///
1697 /// # Example
1698 /// ```ignore,no_run
1699 /// # use google_cloud_commerce_consumer_procurement_v1::model::Parameter;
1700 /// use google_cloud_commerce_consumer_procurement_v1::model::parameter::Value;
1701 /// let x = Parameter::new().set_value(Value::default()/* use setters */);
1702 /// ```
1703 pub fn set_value<T>(mut self, v: T) -> Self
1704 where
1705 T: std::convert::Into<crate::model::parameter::Value>,
1706 {
1707 self.value = std::option::Option::Some(v.into());
1708 self
1709 }
1710
1711 /// Sets or clears the value of [value][crate::model::Parameter::value].
1712 ///
1713 /// # Example
1714 /// ```ignore,no_run
1715 /// # use google_cloud_commerce_consumer_procurement_v1::model::Parameter;
1716 /// use google_cloud_commerce_consumer_procurement_v1::model::parameter::Value;
1717 /// let x = Parameter::new().set_or_clear_value(Some(Value::default()/* use setters */));
1718 /// let x = Parameter::new().set_or_clear_value(None::<Value>);
1719 /// ```
1720 pub fn set_or_clear_value<T>(mut self, v: std::option::Option<T>) -> Self
1721 where
1722 T: std::convert::Into<crate::model::parameter::Value>,
1723 {
1724 self.value = v.map(|x| x.into());
1725 self
1726 }
1727}
1728
1729impl wkt::message::Message for Parameter {
1730 fn typename() -> &'static str {
1731 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.Parameter"
1732 }
1733}
1734
1735/// Defines additional types related to [Parameter].
1736pub mod parameter {
1737 #[allow(unused_imports)]
1738 use super::*;
1739
1740 #[allow(missing_docs)]
1741 #[derive(Clone, Default, PartialEq)]
1742 #[non_exhaustive]
1743 pub struct Value {
1744 /// The kind of value.
1745 pub kind: std::option::Option<crate::model::parameter::value::Kind>,
1746
1747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1748 }
1749
1750 impl Value {
1751 /// Creates a new default instance.
1752 pub fn new() -> Self {
1753 std::default::Default::default()
1754 }
1755
1756 /// Sets the value of [kind][crate::model::parameter::Value::kind].
1757 ///
1758 /// Note that all the setters affecting `kind` are mutually
1759 /// exclusive.
1760 ///
1761 /// # Example
1762 /// ```ignore,no_run
1763 /// # use google_cloud_commerce_consumer_procurement_v1::model::parameter::Value;
1764 /// use google_cloud_commerce_consumer_procurement_v1::model::parameter::value::Kind;
1765 /// let x = Value::new().set_kind(Some(Kind::Int64Value(42)));
1766 /// ```
1767 pub fn set_kind<
1768 T: std::convert::Into<std::option::Option<crate::model::parameter::value::Kind>>,
1769 >(
1770 mut self,
1771 v: T,
1772 ) -> Self {
1773 self.kind = v.into();
1774 self
1775 }
1776
1777 /// The value of [kind][crate::model::parameter::Value::kind]
1778 /// if it holds a `Int64Value`, `None` if the field is not set or
1779 /// holds a different branch.
1780 pub fn int64_value(&self) -> std::option::Option<&i64> {
1781 #[allow(unreachable_patterns)]
1782 self.kind.as_ref().and_then(|v| match v {
1783 crate::model::parameter::value::Kind::Int64Value(v) => std::option::Option::Some(v),
1784 _ => std::option::Option::None,
1785 })
1786 }
1787
1788 /// Sets the value of [kind][crate::model::parameter::Value::kind]
1789 /// to hold a `Int64Value`.
1790 ///
1791 /// Note that all the setters affecting `kind` are
1792 /// mutually exclusive.
1793 ///
1794 /// # Example
1795 /// ```ignore,no_run
1796 /// # use google_cloud_commerce_consumer_procurement_v1::model::parameter::Value;
1797 /// let x = Value::new().set_int64_value(42);
1798 /// assert!(x.int64_value().is_some());
1799 /// assert!(x.string_value().is_none());
1800 /// assert!(x.double_value().is_none());
1801 /// ```
1802 pub fn set_int64_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1803 self.kind = std::option::Option::Some(
1804 crate::model::parameter::value::Kind::Int64Value(v.into()),
1805 );
1806 self
1807 }
1808
1809 /// The value of [kind][crate::model::parameter::Value::kind]
1810 /// if it holds a `StringValue`, `None` if the field is not set or
1811 /// holds a different branch.
1812 pub fn string_value(&self) -> std::option::Option<&std::string::String> {
1813 #[allow(unreachable_patterns)]
1814 self.kind.as_ref().and_then(|v| match v {
1815 crate::model::parameter::value::Kind::StringValue(v) => {
1816 std::option::Option::Some(v)
1817 }
1818 _ => std::option::Option::None,
1819 })
1820 }
1821
1822 /// Sets the value of [kind][crate::model::parameter::Value::kind]
1823 /// to hold a `StringValue`.
1824 ///
1825 /// Note that all the setters affecting `kind` are
1826 /// mutually exclusive.
1827 ///
1828 /// # Example
1829 /// ```ignore,no_run
1830 /// # use google_cloud_commerce_consumer_procurement_v1::model::parameter::Value;
1831 /// let x = Value::new().set_string_value("example");
1832 /// assert!(x.string_value().is_some());
1833 /// assert!(x.int64_value().is_none());
1834 /// assert!(x.double_value().is_none());
1835 /// ```
1836 pub fn set_string_value<T: std::convert::Into<std::string::String>>(
1837 mut self,
1838 v: T,
1839 ) -> Self {
1840 self.kind = std::option::Option::Some(
1841 crate::model::parameter::value::Kind::StringValue(v.into()),
1842 );
1843 self
1844 }
1845
1846 /// The value of [kind][crate::model::parameter::Value::kind]
1847 /// if it holds a `DoubleValue`, `None` if the field is not set or
1848 /// holds a different branch.
1849 pub fn double_value(&self) -> std::option::Option<&f64> {
1850 #[allow(unreachable_patterns)]
1851 self.kind.as_ref().and_then(|v| match v {
1852 crate::model::parameter::value::Kind::DoubleValue(v) => {
1853 std::option::Option::Some(v)
1854 }
1855 _ => std::option::Option::None,
1856 })
1857 }
1858
1859 /// Sets the value of [kind][crate::model::parameter::Value::kind]
1860 /// to hold a `DoubleValue`.
1861 ///
1862 /// Note that all the setters affecting `kind` are
1863 /// mutually exclusive.
1864 ///
1865 /// # Example
1866 /// ```ignore,no_run
1867 /// # use google_cloud_commerce_consumer_procurement_v1::model::parameter::Value;
1868 /// let x = Value::new().set_double_value(42.0);
1869 /// assert!(x.double_value().is_some());
1870 /// assert!(x.int64_value().is_none());
1871 /// assert!(x.string_value().is_none());
1872 /// ```
1873 pub fn set_double_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
1874 self.kind = std::option::Option::Some(
1875 crate::model::parameter::value::Kind::DoubleValue(v.into()),
1876 );
1877 self
1878 }
1879 }
1880
1881 impl wkt::message::Message for Value {
1882 fn typename() -> &'static str {
1883 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.Parameter.Value"
1884 }
1885 }
1886
1887 /// Defines additional types related to [Value].
1888 pub mod value {
1889 #[allow(unused_imports)]
1890 use super::*;
1891
1892 /// The kind of value.
1893 #[derive(Clone, Debug, PartialEq)]
1894 #[non_exhaustive]
1895 pub enum Kind {
1896 /// Represents an int64 value.
1897 Int64Value(i64),
1898 /// Represents a string value.
1899 StringValue(std::string::String),
1900 /// Represents a double value.
1901 DoubleValue(f64),
1902 }
1903 }
1904}
1905
1906/// Subscription information.
1907#[derive(Clone, Default, PartialEq)]
1908#[non_exhaustive]
1909pub struct Subscription {
1910 /// The timestamp when the subscription begins, if applicable.
1911 pub start_time: std::option::Option<wkt::Timestamp>,
1912
1913 /// The timestamp when the subscription ends, if applicable.
1914 pub end_time: std::option::Option<wkt::Timestamp>,
1915
1916 /// Whether auto renewal is enabled by user choice on current subscription.
1917 /// This field indicates order/subscription status after pending plan change is
1918 /// cancelled or rejected.
1919 pub auto_renewal_enabled: bool,
1920
1921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1922}
1923
1924impl Subscription {
1925 /// Creates a new default instance.
1926 pub fn new() -> Self {
1927 std::default::Default::default()
1928 }
1929
1930 /// Sets the value of [start_time][crate::model::Subscription::start_time].
1931 ///
1932 /// # Example
1933 /// ```ignore,no_run
1934 /// # use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
1935 /// use wkt::Timestamp;
1936 /// let x = Subscription::new().set_start_time(Timestamp::default()/* use setters */);
1937 /// ```
1938 pub fn set_start_time<T>(mut self, v: T) -> Self
1939 where
1940 T: std::convert::Into<wkt::Timestamp>,
1941 {
1942 self.start_time = std::option::Option::Some(v.into());
1943 self
1944 }
1945
1946 /// Sets or clears the value of [start_time][crate::model::Subscription::start_time].
1947 ///
1948 /// # Example
1949 /// ```ignore,no_run
1950 /// # use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
1951 /// use wkt::Timestamp;
1952 /// let x = Subscription::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
1953 /// let x = Subscription::new().set_or_clear_start_time(None::<Timestamp>);
1954 /// ```
1955 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
1956 where
1957 T: std::convert::Into<wkt::Timestamp>,
1958 {
1959 self.start_time = v.map(|x| x.into());
1960 self
1961 }
1962
1963 /// Sets the value of [end_time][crate::model::Subscription::end_time].
1964 ///
1965 /// # Example
1966 /// ```ignore,no_run
1967 /// # use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
1968 /// use wkt::Timestamp;
1969 /// let x = Subscription::new().set_end_time(Timestamp::default()/* use setters */);
1970 /// ```
1971 pub fn set_end_time<T>(mut self, v: T) -> Self
1972 where
1973 T: std::convert::Into<wkt::Timestamp>,
1974 {
1975 self.end_time = std::option::Option::Some(v.into());
1976 self
1977 }
1978
1979 /// Sets or clears the value of [end_time][crate::model::Subscription::end_time].
1980 ///
1981 /// # Example
1982 /// ```ignore,no_run
1983 /// # use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
1984 /// use wkt::Timestamp;
1985 /// let x = Subscription::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1986 /// let x = Subscription::new().set_or_clear_end_time(None::<Timestamp>);
1987 /// ```
1988 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1989 where
1990 T: std::convert::Into<wkt::Timestamp>,
1991 {
1992 self.end_time = v.map(|x| x.into());
1993 self
1994 }
1995
1996 /// Sets the value of [auto_renewal_enabled][crate::model::Subscription::auto_renewal_enabled].
1997 ///
1998 /// # Example
1999 /// ```ignore,no_run
2000 /// # use google_cloud_commerce_consumer_procurement_v1::model::Subscription;
2001 /// let x = Subscription::new().set_auto_renewal_enabled(true);
2002 /// ```
2003 pub fn set_auto_renewal_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2004 self.auto_renewal_enabled = v.into();
2005 self
2006 }
2007}
2008
2009impl wkt::message::Message for Subscription {
2010 fn typename() -> &'static str {
2011 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.Subscription"
2012 }
2013}
2014
2015/// Request message for
2016/// [ConsumerProcurementService.PlaceOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.PlaceOrder].
2017///
2018/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.PlaceOrder]: crate::client::ConsumerProcurementService::place_order
2019#[derive(Clone, Default, PartialEq)]
2020#[non_exhaustive]
2021pub struct PlaceOrderRequest {
2022 /// Required. The resource name of the parent resource.
2023 /// This field has the form `billingAccounts/{billing-account-id}`.
2024 pub parent: std::string::String,
2025
2026 /// Required. The user-specified name of the order being placed.
2027 pub display_name: std::string::String,
2028
2029 /// Optional. Places order for offer. Required when an offer-based order is
2030 /// being placed.
2031 pub line_item_info: std::vec::Vec<crate::model::LineItemInfo>,
2032
2033 /// Optional. A unique identifier for this request.
2034 /// The server will ignore subsequent requests that provide a duplicate request
2035 /// ID for at least 24 hours after the first request.
2036 ///
2037 /// The request ID must be a valid
2038 /// [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
2039 pub request_id: std::string::String,
2040
2041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2042}
2043
2044impl PlaceOrderRequest {
2045 /// Creates a new default instance.
2046 pub fn new() -> Self {
2047 std::default::Default::default()
2048 }
2049
2050 /// Sets the value of [parent][crate::model::PlaceOrderRequest::parent].
2051 ///
2052 /// # Example
2053 /// ```ignore,no_run
2054 /// # use google_cloud_commerce_consumer_procurement_v1::model::PlaceOrderRequest;
2055 /// let x = PlaceOrderRequest::new().set_parent("example");
2056 /// ```
2057 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2058 self.parent = v.into();
2059 self
2060 }
2061
2062 /// Sets the value of [display_name][crate::model::PlaceOrderRequest::display_name].
2063 ///
2064 /// # Example
2065 /// ```ignore,no_run
2066 /// # use google_cloud_commerce_consumer_procurement_v1::model::PlaceOrderRequest;
2067 /// let x = PlaceOrderRequest::new().set_display_name("example");
2068 /// ```
2069 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2070 self.display_name = v.into();
2071 self
2072 }
2073
2074 /// Sets the value of [line_item_info][crate::model::PlaceOrderRequest::line_item_info].
2075 ///
2076 /// # Example
2077 /// ```ignore,no_run
2078 /// # use google_cloud_commerce_consumer_procurement_v1::model::PlaceOrderRequest;
2079 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
2080 /// let x = PlaceOrderRequest::new()
2081 /// .set_line_item_info([
2082 /// LineItemInfo::default()/* use setters */,
2083 /// LineItemInfo::default()/* use (different) setters */,
2084 /// ]);
2085 /// ```
2086 pub fn set_line_item_info<T, V>(mut self, v: T) -> Self
2087 where
2088 T: std::iter::IntoIterator<Item = V>,
2089 V: std::convert::Into<crate::model::LineItemInfo>,
2090 {
2091 use std::iter::Iterator;
2092 self.line_item_info = v.into_iter().map(|i| i.into()).collect();
2093 self
2094 }
2095
2096 /// Sets the value of [request_id][crate::model::PlaceOrderRequest::request_id].
2097 ///
2098 /// # Example
2099 /// ```ignore,no_run
2100 /// # use google_cloud_commerce_consumer_procurement_v1::model::PlaceOrderRequest;
2101 /// let x = PlaceOrderRequest::new().set_request_id("example");
2102 /// ```
2103 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2104 self.request_id = v.into();
2105 self
2106 }
2107}
2108
2109impl wkt::message::Message for PlaceOrderRequest {
2110 fn typename() -> &'static str {
2111 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.PlaceOrderRequest"
2112 }
2113}
2114
2115/// Message stored in the metadata field of the Operation returned by
2116/// [ConsumerProcurementService.PlaceOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.PlaceOrder].
2117///
2118/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.PlaceOrder]: crate::client::ConsumerProcurementService::place_order
2119#[derive(Clone, Default, PartialEq)]
2120#[non_exhaustive]
2121pub struct PlaceOrderMetadata {
2122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2123}
2124
2125impl PlaceOrderMetadata {
2126 /// Creates a new default instance.
2127 pub fn new() -> Self {
2128 std::default::Default::default()
2129 }
2130}
2131
2132impl wkt::message::Message for PlaceOrderMetadata {
2133 fn typename() -> &'static str {
2134 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.PlaceOrderMetadata"
2135 }
2136}
2137
2138/// Request message for
2139/// [ConsumerProcurementService.GetOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.GetOrder]
2140///
2141/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.GetOrder]: crate::client::ConsumerProcurementService::get_order
2142#[derive(Clone, Default, PartialEq)]
2143#[non_exhaustive]
2144pub struct GetOrderRequest {
2145 /// Required. The name of the order to retrieve.
2146 pub name: std::string::String,
2147
2148 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2149}
2150
2151impl GetOrderRequest {
2152 /// Creates a new default instance.
2153 pub fn new() -> Self {
2154 std::default::Default::default()
2155 }
2156
2157 /// Sets the value of [name][crate::model::GetOrderRequest::name].
2158 ///
2159 /// # Example
2160 /// ```ignore,no_run
2161 /// # use google_cloud_commerce_consumer_procurement_v1::model::GetOrderRequest;
2162 /// let x = GetOrderRequest::new().set_name("example");
2163 /// ```
2164 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2165 self.name = v.into();
2166 self
2167 }
2168}
2169
2170impl wkt::message::Message for GetOrderRequest {
2171 fn typename() -> &'static str {
2172 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.GetOrderRequest"
2173 }
2174}
2175
2176/// Request message for
2177/// [ConsumerProcurementService.ListOrders][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ListOrders].
2178///
2179/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ListOrders]: crate::client::ConsumerProcurementService::list_orders
2180#[derive(Clone, Default, PartialEq)]
2181#[non_exhaustive]
2182pub struct ListOrdersRequest {
2183 /// Required. The parent resource to query for orders.
2184 /// This field has the form `billingAccounts/{billing-account-id}`.
2185 pub parent: std::string::String,
2186
2187 /// The maximum number of entries requested.
2188 /// The default page size is 25 and the maximum page size is 200.
2189 pub page_size: i32,
2190
2191 /// The token for fetching the next page.
2192 pub page_token: std::string::String,
2193
2194 /// Filter that you can use to limit the list request.
2195 ///
2196 /// A query string that can match a selected set of attributes
2197 /// with string values. For example, `display_name=abc`.
2198 /// Supported query attributes are
2199 ///
2200 /// * `display_name`
2201 ///
2202 /// If the query contains special characters other than letters,
2203 /// underscore, or digits, the phrase must be quoted with double quotes. For
2204 /// example, `display_name="foo:bar"`, where the display name needs to be
2205 /// quoted because it contains special character colon.
2206 ///
2207 /// Queries can be combined with `OR`, and `NOT` to form more complex queries.
2208 /// You can also group them to force a desired evaluation order.
2209 /// For example, `display_name=abc OR display_name=def`.
2210 pub filter: std::string::String,
2211
2212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2213}
2214
2215impl ListOrdersRequest {
2216 /// Creates a new default instance.
2217 pub fn new() -> Self {
2218 std::default::Default::default()
2219 }
2220
2221 /// Sets the value of [parent][crate::model::ListOrdersRequest::parent].
2222 ///
2223 /// # Example
2224 /// ```ignore,no_run
2225 /// # use google_cloud_commerce_consumer_procurement_v1::model::ListOrdersRequest;
2226 /// let x = ListOrdersRequest::new().set_parent("example");
2227 /// ```
2228 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2229 self.parent = v.into();
2230 self
2231 }
2232
2233 /// Sets the value of [page_size][crate::model::ListOrdersRequest::page_size].
2234 ///
2235 /// # Example
2236 /// ```ignore,no_run
2237 /// # use google_cloud_commerce_consumer_procurement_v1::model::ListOrdersRequest;
2238 /// let x = ListOrdersRequest::new().set_page_size(42);
2239 /// ```
2240 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2241 self.page_size = v.into();
2242 self
2243 }
2244
2245 /// Sets the value of [page_token][crate::model::ListOrdersRequest::page_token].
2246 ///
2247 /// # Example
2248 /// ```ignore,no_run
2249 /// # use google_cloud_commerce_consumer_procurement_v1::model::ListOrdersRequest;
2250 /// let x = ListOrdersRequest::new().set_page_token("example");
2251 /// ```
2252 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2253 self.page_token = v.into();
2254 self
2255 }
2256
2257 /// Sets the value of [filter][crate::model::ListOrdersRequest::filter].
2258 ///
2259 /// # Example
2260 /// ```ignore,no_run
2261 /// # use google_cloud_commerce_consumer_procurement_v1::model::ListOrdersRequest;
2262 /// let x = ListOrdersRequest::new().set_filter("example");
2263 /// ```
2264 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2265 self.filter = v.into();
2266 self
2267 }
2268}
2269
2270impl wkt::message::Message for ListOrdersRequest {
2271 fn typename() -> &'static str {
2272 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.ListOrdersRequest"
2273 }
2274}
2275
2276/// Response message for
2277/// [ConsumerProcurementService.ListOrders][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ListOrders].
2278///
2279/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ListOrders]: crate::client::ConsumerProcurementService::list_orders
2280#[derive(Clone, Default, PartialEq)]
2281#[non_exhaustive]
2282pub struct ListOrdersResponse {
2283 /// The list of orders in this response.
2284 pub orders: std::vec::Vec<crate::model::Order>,
2285
2286 /// The token for fetching the next page.
2287 pub next_page_token: std::string::String,
2288
2289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2290}
2291
2292impl ListOrdersResponse {
2293 /// Creates a new default instance.
2294 pub fn new() -> Self {
2295 std::default::Default::default()
2296 }
2297
2298 /// Sets the value of [orders][crate::model::ListOrdersResponse::orders].
2299 ///
2300 /// # Example
2301 /// ```ignore,no_run
2302 /// # use google_cloud_commerce_consumer_procurement_v1::model::ListOrdersResponse;
2303 /// use google_cloud_commerce_consumer_procurement_v1::model::Order;
2304 /// let x = ListOrdersResponse::new()
2305 /// .set_orders([
2306 /// Order::default()/* use setters */,
2307 /// Order::default()/* use (different) setters */,
2308 /// ]);
2309 /// ```
2310 pub fn set_orders<T, V>(mut self, v: T) -> Self
2311 where
2312 T: std::iter::IntoIterator<Item = V>,
2313 V: std::convert::Into<crate::model::Order>,
2314 {
2315 use std::iter::Iterator;
2316 self.orders = v.into_iter().map(|i| i.into()).collect();
2317 self
2318 }
2319
2320 /// Sets the value of [next_page_token][crate::model::ListOrdersResponse::next_page_token].
2321 ///
2322 /// # Example
2323 /// ```ignore,no_run
2324 /// # use google_cloud_commerce_consumer_procurement_v1::model::ListOrdersResponse;
2325 /// let x = ListOrdersResponse::new().set_next_page_token("example");
2326 /// ```
2327 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2328 self.next_page_token = v.into();
2329 self
2330 }
2331}
2332
2333impl wkt::message::Message for ListOrdersResponse {
2334 fn typename() -> &'static str {
2335 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.ListOrdersResponse"
2336 }
2337}
2338
2339#[doc(hidden)]
2340impl google_cloud_gax::paginator::internal::PageableResponse for ListOrdersResponse {
2341 type PageItem = crate::model::Order;
2342
2343 fn items(self) -> std::vec::Vec<Self::PageItem> {
2344 self.orders
2345 }
2346
2347 fn next_page_token(&self) -> std::string::String {
2348 use std::clone::Clone;
2349 self.next_page_token.clone()
2350 }
2351}
2352
2353/// Request message for
2354/// [ConsumerProcurementService.ModifyOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ModifyOrder].
2355///
2356/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ModifyOrder]: crate::client::ConsumerProcurementService::modify_order
2357#[derive(Clone, Default, PartialEq)]
2358#[non_exhaustive]
2359pub struct ModifyOrderRequest {
2360 /// Required. Name of the order to update.
2361 pub name: std::string::String,
2362
2363 /// Optional. Modifications for an existing Order created by an Offer.
2364 /// Required when Offer based Order is being modified, except for when going
2365 /// from an offer to a public plan.
2366 pub modifications: std::vec::Vec<crate::model::modify_order_request::Modification>,
2367
2368 /// Optional. Updated display name of the order, leave as empty if you do not
2369 /// want to update current display name.
2370 pub display_name: std::string::String,
2371
2372 /// Optional. The weak etag, which can be optionally populated, of the order
2373 /// that this modify request is based on. Validation checking will only happen
2374 /// if the invoker supplies this field.
2375 pub etag: std::string::String,
2376
2377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2378}
2379
2380impl ModifyOrderRequest {
2381 /// Creates a new default instance.
2382 pub fn new() -> Self {
2383 std::default::Default::default()
2384 }
2385
2386 /// Sets the value of [name][crate::model::ModifyOrderRequest::name].
2387 ///
2388 /// # Example
2389 /// ```ignore,no_run
2390 /// # use google_cloud_commerce_consumer_procurement_v1::model::ModifyOrderRequest;
2391 /// let x = ModifyOrderRequest::new().set_name("example");
2392 /// ```
2393 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2394 self.name = v.into();
2395 self
2396 }
2397
2398 /// Sets the value of [modifications][crate::model::ModifyOrderRequest::modifications].
2399 ///
2400 /// # Example
2401 /// ```ignore,no_run
2402 /// # use google_cloud_commerce_consumer_procurement_v1::model::ModifyOrderRequest;
2403 /// use google_cloud_commerce_consumer_procurement_v1::model::modify_order_request::Modification;
2404 /// let x = ModifyOrderRequest::new()
2405 /// .set_modifications([
2406 /// Modification::default()/* use setters */,
2407 /// Modification::default()/* use (different) setters */,
2408 /// ]);
2409 /// ```
2410 pub fn set_modifications<T, V>(mut self, v: T) -> Self
2411 where
2412 T: std::iter::IntoIterator<Item = V>,
2413 V: std::convert::Into<crate::model::modify_order_request::Modification>,
2414 {
2415 use std::iter::Iterator;
2416 self.modifications = v.into_iter().map(|i| i.into()).collect();
2417 self
2418 }
2419
2420 /// Sets the value of [display_name][crate::model::ModifyOrderRequest::display_name].
2421 ///
2422 /// # Example
2423 /// ```ignore,no_run
2424 /// # use google_cloud_commerce_consumer_procurement_v1::model::ModifyOrderRequest;
2425 /// let x = ModifyOrderRequest::new().set_display_name("example");
2426 /// ```
2427 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2428 self.display_name = v.into();
2429 self
2430 }
2431
2432 /// Sets the value of [etag][crate::model::ModifyOrderRequest::etag].
2433 ///
2434 /// # Example
2435 /// ```ignore,no_run
2436 /// # use google_cloud_commerce_consumer_procurement_v1::model::ModifyOrderRequest;
2437 /// let x = ModifyOrderRequest::new().set_etag("example");
2438 /// ```
2439 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2440 self.etag = v.into();
2441 self
2442 }
2443}
2444
2445impl wkt::message::Message for ModifyOrderRequest {
2446 fn typename() -> &'static str {
2447 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest"
2448 }
2449}
2450
2451/// Defines additional types related to [ModifyOrderRequest].
2452pub mod modify_order_request {
2453 #[allow(unused_imports)]
2454 use super::*;
2455
2456 /// Modifications to make on the order.
2457 #[derive(Clone, Default, PartialEq)]
2458 #[non_exhaustive]
2459 pub struct Modification {
2460 /// Required. ID of the existing line item to make change to.
2461 /// Required when change type is
2462 /// [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE] or
2463 /// [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CANCEL].
2464 pub line_item_id: std::string::String,
2465
2466 /// Required. Type of change to make.
2467 pub change_type: crate::model::LineItemChangeType,
2468
2469 /// Optional. The line item to update to.
2470 /// Required when change_type is
2471 /// [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CREATE] or
2472 /// [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE].
2473 pub new_line_item_info: std::option::Option<crate::model::LineItemInfo>,
2474
2475 /// Optional. Auto renewal behavior of the subscription for the update.
2476 /// Applied when change_type is
2477 /// [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE]. Follows plan default
2478 /// config when this field is not specified.
2479 pub auto_renewal_behavior: crate::model::AutoRenewalBehavior,
2480
2481 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2482 }
2483
2484 impl Modification {
2485 /// Creates a new default instance.
2486 pub fn new() -> Self {
2487 std::default::Default::default()
2488 }
2489
2490 /// Sets the value of [line_item_id][crate::model::modify_order_request::Modification::line_item_id].
2491 ///
2492 /// # Example
2493 /// ```ignore,no_run
2494 /// # use google_cloud_commerce_consumer_procurement_v1::model::modify_order_request::Modification;
2495 /// let x = Modification::new().set_line_item_id("example");
2496 /// ```
2497 pub fn set_line_item_id<T: std::convert::Into<std::string::String>>(
2498 mut self,
2499 v: T,
2500 ) -> Self {
2501 self.line_item_id = v.into();
2502 self
2503 }
2504
2505 /// Sets the value of [change_type][crate::model::modify_order_request::Modification::change_type].
2506 ///
2507 /// # Example
2508 /// ```ignore,no_run
2509 /// # use google_cloud_commerce_consumer_procurement_v1::model::modify_order_request::Modification;
2510 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemChangeType;
2511 /// let x0 = Modification::new().set_change_type(LineItemChangeType::Create);
2512 /// let x1 = Modification::new().set_change_type(LineItemChangeType::Update);
2513 /// let x2 = Modification::new().set_change_type(LineItemChangeType::Cancel);
2514 /// ```
2515 pub fn set_change_type<T: std::convert::Into<crate::model::LineItemChangeType>>(
2516 mut self,
2517 v: T,
2518 ) -> Self {
2519 self.change_type = v.into();
2520 self
2521 }
2522
2523 /// Sets the value of [new_line_item_info][crate::model::modify_order_request::Modification::new_line_item_info].
2524 ///
2525 /// # Example
2526 /// ```ignore,no_run
2527 /// # use google_cloud_commerce_consumer_procurement_v1::model::modify_order_request::Modification;
2528 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
2529 /// let x = Modification::new().set_new_line_item_info(LineItemInfo::default()/* use setters */);
2530 /// ```
2531 pub fn set_new_line_item_info<T>(mut self, v: T) -> Self
2532 where
2533 T: std::convert::Into<crate::model::LineItemInfo>,
2534 {
2535 self.new_line_item_info = std::option::Option::Some(v.into());
2536 self
2537 }
2538
2539 /// Sets or clears the value of [new_line_item_info][crate::model::modify_order_request::Modification::new_line_item_info].
2540 ///
2541 /// # Example
2542 /// ```ignore,no_run
2543 /// # use google_cloud_commerce_consumer_procurement_v1::model::modify_order_request::Modification;
2544 /// use google_cloud_commerce_consumer_procurement_v1::model::LineItemInfo;
2545 /// let x = Modification::new().set_or_clear_new_line_item_info(Some(LineItemInfo::default()/* use setters */));
2546 /// let x = Modification::new().set_or_clear_new_line_item_info(None::<LineItemInfo>);
2547 /// ```
2548 pub fn set_or_clear_new_line_item_info<T>(mut self, v: std::option::Option<T>) -> Self
2549 where
2550 T: std::convert::Into<crate::model::LineItemInfo>,
2551 {
2552 self.new_line_item_info = v.map(|x| x.into());
2553 self
2554 }
2555
2556 /// Sets the value of [auto_renewal_behavior][crate::model::modify_order_request::Modification::auto_renewal_behavior].
2557 ///
2558 /// # Example
2559 /// ```ignore,no_run
2560 /// # use google_cloud_commerce_consumer_procurement_v1::model::modify_order_request::Modification;
2561 /// use google_cloud_commerce_consumer_procurement_v1::model::AutoRenewalBehavior;
2562 /// let x0 = Modification::new().set_auto_renewal_behavior(AutoRenewalBehavior::Enable);
2563 /// let x1 = Modification::new().set_auto_renewal_behavior(AutoRenewalBehavior::Disable);
2564 /// ```
2565 pub fn set_auto_renewal_behavior<
2566 T: std::convert::Into<crate::model::AutoRenewalBehavior>,
2567 >(
2568 mut self,
2569 v: T,
2570 ) -> Self {
2571 self.auto_renewal_behavior = v.into();
2572 self
2573 }
2574 }
2575
2576 impl wkt::message::Message for Modification {
2577 fn typename() -> &'static str {
2578 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest.Modification"
2579 }
2580 }
2581}
2582
2583/// Message stored in the metadata field of the Operation returned by
2584/// [ConsumerProcurementService.ModifyOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ModifyOrder].
2585///
2586/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.ModifyOrder]: crate::client::ConsumerProcurementService::modify_order
2587#[derive(Clone, Default, PartialEq)]
2588#[non_exhaustive]
2589pub struct ModifyOrderMetadata {
2590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2591}
2592
2593impl ModifyOrderMetadata {
2594 /// Creates a new default instance.
2595 pub fn new() -> Self {
2596 std::default::Default::default()
2597 }
2598}
2599
2600impl wkt::message::Message for ModifyOrderMetadata {
2601 fn typename() -> &'static str {
2602 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.ModifyOrderMetadata"
2603 }
2604}
2605
2606/// Request message for
2607/// [ConsumerProcurementService.CancelOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.CancelOrder].
2608///
2609/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.CancelOrder]: crate::client::ConsumerProcurementService::cancel_order
2610#[derive(Clone, Default, PartialEq)]
2611#[non_exhaustive]
2612pub struct CancelOrderRequest {
2613 /// Required. The resource name of the order.
2614 pub name: std::string::String,
2615
2616 /// Optional. The weak etag, which can be optionally populated, of the order
2617 /// that this cancel request is based on. Validation checking will only happen
2618 /// if the invoker supplies this field.
2619 pub etag: std::string::String,
2620
2621 /// Optional. Cancellation policy of this request.
2622 pub cancellation_policy: crate::model::cancel_order_request::CancellationPolicy,
2623
2624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2625}
2626
2627impl CancelOrderRequest {
2628 /// Creates a new default instance.
2629 pub fn new() -> Self {
2630 std::default::Default::default()
2631 }
2632
2633 /// Sets the value of [name][crate::model::CancelOrderRequest::name].
2634 ///
2635 /// # Example
2636 /// ```ignore,no_run
2637 /// # use google_cloud_commerce_consumer_procurement_v1::model::CancelOrderRequest;
2638 /// let x = CancelOrderRequest::new().set_name("example");
2639 /// ```
2640 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2641 self.name = v.into();
2642 self
2643 }
2644
2645 /// Sets the value of [etag][crate::model::CancelOrderRequest::etag].
2646 ///
2647 /// # Example
2648 /// ```ignore,no_run
2649 /// # use google_cloud_commerce_consumer_procurement_v1::model::CancelOrderRequest;
2650 /// let x = CancelOrderRequest::new().set_etag("example");
2651 /// ```
2652 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2653 self.etag = v.into();
2654 self
2655 }
2656
2657 /// Sets the value of [cancellation_policy][crate::model::CancelOrderRequest::cancellation_policy].
2658 ///
2659 /// # Example
2660 /// ```ignore,no_run
2661 /// # use google_cloud_commerce_consumer_procurement_v1::model::CancelOrderRequest;
2662 /// use google_cloud_commerce_consumer_procurement_v1::model::cancel_order_request::CancellationPolicy;
2663 /// let x0 = CancelOrderRequest::new().set_cancellation_policy(CancellationPolicy::CancelImmediately);
2664 /// let x1 = CancelOrderRequest::new().set_cancellation_policy(CancellationPolicy::CancelAtTermEnd);
2665 /// ```
2666 pub fn set_cancellation_policy<
2667 T: std::convert::Into<crate::model::cancel_order_request::CancellationPolicy>,
2668 >(
2669 mut self,
2670 v: T,
2671 ) -> Self {
2672 self.cancellation_policy = v.into();
2673 self
2674 }
2675}
2676
2677impl wkt::message::Message for CancelOrderRequest {
2678 fn typename() -> &'static str {
2679 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest"
2680 }
2681}
2682
2683/// Defines additional types related to [CancelOrderRequest].
2684pub mod cancel_order_request {
2685 #[allow(unused_imports)]
2686 use super::*;
2687
2688 /// Indicates the cancellation policy the customer uses to cancel the order.
2689 ///
2690 /// # Working with unknown values
2691 ///
2692 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2693 /// additional enum variants at any time. Adding new variants is not considered
2694 /// a breaking change. Applications should write their code in anticipation of:
2695 ///
2696 /// - New values appearing in future releases of the client library, **and**
2697 /// - New values received dynamically, without application changes.
2698 ///
2699 /// Please consult the [Working with enums] section in the user guide for some
2700 /// guidelines.
2701 ///
2702 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2703 #[derive(Clone, Debug, PartialEq)]
2704 #[non_exhaustive]
2705 pub enum CancellationPolicy {
2706 /// If unspecified, cancellation will try to cancel the order, if order
2707 /// cannot be immediately cancelled, auto renewal will be turned off.
2708 /// However, caller should avoid using the value as it will yield a
2709 /// non-deterministic result. This is still supported mainly to maintain
2710 /// existing integrated usages and ensure backwards compatibility.
2711 Unspecified,
2712 /// Request will cancel the whole order immediately, if order cannot be
2713 /// immediately cancelled, the request will fail.
2714 CancelImmediately,
2715 /// Request will cancel the auto renewal, if order is not subscription based,
2716 /// the request will fail.
2717 CancelAtTermEnd,
2718 /// If set, the enum was initialized with an unknown value.
2719 ///
2720 /// Applications can examine the value using [CancellationPolicy::value] or
2721 /// [CancellationPolicy::name].
2722 UnknownValue(cancellation_policy::UnknownValue),
2723 }
2724
2725 #[doc(hidden)]
2726 pub mod cancellation_policy {
2727 #[allow(unused_imports)]
2728 use super::*;
2729 #[derive(Clone, Debug, PartialEq)]
2730 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2731 }
2732
2733 impl CancellationPolicy {
2734 /// Gets the enum value.
2735 ///
2736 /// Returns `None` if the enum contains an unknown value deserialized from
2737 /// the string representation of enums.
2738 pub fn value(&self) -> std::option::Option<i32> {
2739 match self {
2740 Self::Unspecified => std::option::Option::Some(0),
2741 Self::CancelImmediately => std::option::Option::Some(1),
2742 Self::CancelAtTermEnd => std::option::Option::Some(2),
2743 Self::UnknownValue(u) => u.0.value(),
2744 }
2745 }
2746
2747 /// Gets the enum value as a string.
2748 ///
2749 /// Returns `None` if the enum contains an unknown value deserialized from
2750 /// the integer representation of enums.
2751 pub fn name(&self) -> std::option::Option<&str> {
2752 match self {
2753 Self::Unspecified => std::option::Option::Some("CANCELLATION_POLICY_UNSPECIFIED"),
2754 Self::CancelImmediately => {
2755 std::option::Option::Some("CANCELLATION_POLICY_CANCEL_IMMEDIATELY")
2756 }
2757 Self::CancelAtTermEnd => {
2758 std::option::Option::Some("CANCELLATION_POLICY_CANCEL_AT_TERM_END")
2759 }
2760 Self::UnknownValue(u) => u.0.name(),
2761 }
2762 }
2763 }
2764
2765 impl std::default::Default for CancellationPolicy {
2766 fn default() -> Self {
2767 use std::convert::From;
2768 Self::from(0)
2769 }
2770 }
2771
2772 impl std::fmt::Display for CancellationPolicy {
2773 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2774 wkt::internal::display_enum(f, self.name(), self.value())
2775 }
2776 }
2777
2778 impl std::convert::From<i32> for CancellationPolicy {
2779 fn from(value: i32) -> Self {
2780 match value {
2781 0 => Self::Unspecified,
2782 1 => Self::CancelImmediately,
2783 2 => Self::CancelAtTermEnd,
2784 _ => Self::UnknownValue(cancellation_policy::UnknownValue(
2785 wkt::internal::UnknownEnumValue::Integer(value),
2786 )),
2787 }
2788 }
2789 }
2790
2791 impl std::convert::From<&str> for CancellationPolicy {
2792 fn from(value: &str) -> Self {
2793 use std::string::ToString;
2794 match value {
2795 "CANCELLATION_POLICY_UNSPECIFIED" => Self::Unspecified,
2796 "CANCELLATION_POLICY_CANCEL_IMMEDIATELY" => Self::CancelImmediately,
2797 "CANCELLATION_POLICY_CANCEL_AT_TERM_END" => Self::CancelAtTermEnd,
2798 _ => Self::UnknownValue(cancellation_policy::UnknownValue(
2799 wkt::internal::UnknownEnumValue::String(value.to_string()),
2800 )),
2801 }
2802 }
2803 }
2804
2805 impl serde::ser::Serialize for CancellationPolicy {
2806 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2807 where
2808 S: serde::Serializer,
2809 {
2810 match self {
2811 Self::Unspecified => serializer.serialize_i32(0),
2812 Self::CancelImmediately => serializer.serialize_i32(1),
2813 Self::CancelAtTermEnd => serializer.serialize_i32(2),
2814 Self::UnknownValue(u) => u.0.serialize(serializer),
2815 }
2816 }
2817 }
2818
2819 impl<'de> serde::de::Deserialize<'de> for CancellationPolicy {
2820 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2821 where
2822 D: serde::Deserializer<'de>,
2823 {
2824 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CancellationPolicy>::new(
2825 ".google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest.CancellationPolicy"))
2826 }
2827 }
2828}
2829
2830/// Message stored in the metadata field of the Operation returned by
2831/// [ConsumerProcurementService.CancelOrder][google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.CancelOrder].
2832///
2833/// [google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService.CancelOrder]: crate::client::ConsumerProcurementService::cancel_order
2834#[derive(Clone, Default, PartialEq)]
2835#[non_exhaustive]
2836pub struct CancelOrderMetadata {
2837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2838}
2839
2840impl CancelOrderMetadata {
2841 /// Creates a new default instance.
2842 pub fn new() -> Self {
2843 std::default::Default::default()
2844 }
2845}
2846
2847impl wkt::message::Message for CancelOrderMetadata {
2848 fn typename() -> &'static str {
2849 "type.googleapis.com/google.cloud.commerce.consumer.procurement.v1.CancelOrderMetadata"
2850 }
2851}
2852
2853/// Type of a line item change.
2854///
2855/// # Working with unknown values
2856///
2857/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2858/// additional enum variants at any time. Adding new variants is not considered
2859/// a breaking change. Applications should write their code in anticipation of:
2860///
2861/// - New values appearing in future releases of the client library, **and**
2862/// - New values received dynamically, without application changes.
2863///
2864/// Please consult the [Working with enums] section in the user guide for some
2865/// guidelines.
2866///
2867/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2868#[derive(Clone, Debug, PartialEq)]
2869#[non_exhaustive]
2870pub enum LineItemChangeType {
2871 /// Sentinel value. Do not use.
2872 Unspecified,
2873 /// The change is to create a new line item.
2874 Create,
2875 /// The change is to update an existing line item.
2876 Update,
2877 /// The change is to cancel an existing line item.
2878 Cancel,
2879 /// The change is to revert a cancellation.
2880 RevertCancellation,
2881 /// If set, the enum was initialized with an unknown value.
2882 ///
2883 /// Applications can examine the value using [LineItemChangeType::value] or
2884 /// [LineItemChangeType::name].
2885 UnknownValue(line_item_change_type::UnknownValue),
2886}
2887
2888#[doc(hidden)]
2889pub mod line_item_change_type {
2890 #[allow(unused_imports)]
2891 use super::*;
2892 #[derive(Clone, Debug, PartialEq)]
2893 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2894}
2895
2896impl LineItemChangeType {
2897 /// Gets the enum value.
2898 ///
2899 /// Returns `None` if the enum contains an unknown value deserialized from
2900 /// the string representation of enums.
2901 pub fn value(&self) -> std::option::Option<i32> {
2902 match self {
2903 Self::Unspecified => std::option::Option::Some(0),
2904 Self::Create => std::option::Option::Some(1),
2905 Self::Update => std::option::Option::Some(2),
2906 Self::Cancel => std::option::Option::Some(3),
2907 Self::RevertCancellation => std::option::Option::Some(4),
2908 Self::UnknownValue(u) => u.0.value(),
2909 }
2910 }
2911
2912 /// Gets the enum value as a string.
2913 ///
2914 /// Returns `None` if the enum contains an unknown value deserialized from
2915 /// the integer representation of enums.
2916 pub fn name(&self) -> std::option::Option<&str> {
2917 match self {
2918 Self::Unspecified => std::option::Option::Some("LINE_ITEM_CHANGE_TYPE_UNSPECIFIED"),
2919 Self::Create => std::option::Option::Some("LINE_ITEM_CHANGE_TYPE_CREATE"),
2920 Self::Update => std::option::Option::Some("LINE_ITEM_CHANGE_TYPE_UPDATE"),
2921 Self::Cancel => std::option::Option::Some("LINE_ITEM_CHANGE_TYPE_CANCEL"),
2922 Self::RevertCancellation => {
2923 std::option::Option::Some("LINE_ITEM_CHANGE_TYPE_REVERT_CANCELLATION")
2924 }
2925 Self::UnknownValue(u) => u.0.name(),
2926 }
2927 }
2928}
2929
2930impl std::default::Default for LineItemChangeType {
2931 fn default() -> Self {
2932 use std::convert::From;
2933 Self::from(0)
2934 }
2935}
2936
2937impl std::fmt::Display for LineItemChangeType {
2938 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2939 wkt::internal::display_enum(f, self.name(), self.value())
2940 }
2941}
2942
2943impl std::convert::From<i32> for LineItemChangeType {
2944 fn from(value: i32) -> Self {
2945 match value {
2946 0 => Self::Unspecified,
2947 1 => Self::Create,
2948 2 => Self::Update,
2949 3 => Self::Cancel,
2950 4 => Self::RevertCancellation,
2951 _ => Self::UnknownValue(line_item_change_type::UnknownValue(
2952 wkt::internal::UnknownEnumValue::Integer(value),
2953 )),
2954 }
2955 }
2956}
2957
2958impl std::convert::From<&str> for LineItemChangeType {
2959 fn from(value: &str) -> Self {
2960 use std::string::ToString;
2961 match value {
2962 "LINE_ITEM_CHANGE_TYPE_UNSPECIFIED" => Self::Unspecified,
2963 "LINE_ITEM_CHANGE_TYPE_CREATE" => Self::Create,
2964 "LINE_ITEM_CHANGE_TYPE_UPDATE" => Self::Update,
2965 "LINE_ITEM_CHANGE_TYPE_CANCEL" => Self::Cancel,
2966 "LINE_ITEM_CHANGE_TYPE_REVERT_CANCELLATION" => Self::RevertCancellation,
2967 _ => Self::UnknownValue(line_item_change_type::UnknownValue(
2968 wkt::internal::UnknownEnumValue::String(value.to_string()),
2969 )),
2970 }
2971 }
2972}
2973
2974impl serde::ser::Serialize for LineItemChangeType {
2975 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2976 where
2977 S: serde::Serializer,
2978 {
2979 match self {
2980 Self::Unspecified => serializer.serialize_i32(0),
2981 Self::Create => serializer.serialize_i32(1),
2982 Self::Update => serializer.serialize_i32(2),
2983 Self::Cancel => serializer.serialize_i32(3),
2984 Self::RevertCancellation => serializer.serialize_i32(4),
2985 Self::UnknownValue(u) => u.0.serialize(serializer),
2986 }
2987 }
2988}
2989
2990impl<'de> serde::de::Deserialize<'de> for LineItemChangeType {
2991 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2992 where
2993 D: serde::Deserializer<'de>,
2994 {
2995 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LineItemChangeType>::new(
2996 ".google.cloud.commerce.consumer.procurement.v1.LineItemChangeType",
2997 ))
2998 }
2999}
3000
3001/// State of a change.
3002///
3003/// # Working with unknown values
3004///
3005/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3006/// additional enum variants at any time. Adding new variants is not considered
3007/// a breaking change. Applications should write their code in anticipation of:
3008///
3009/// - New values appearing in future releases of the client library, **and**
3010/// - New values received dynamically, without application changes.
3011///
3012/// Please consult the [Working with enums] section in the user guide for some
3013/// guidelines.
3014///
3015/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3016#[derive(Clone, Debug, PartialEq)]
3017#[non_exhaustive]
3018pub enum LineItemChangeState {
3019 /// Sentinel value. Do not use.
3020 Unspecified,
3021 /// Change is in this state when a change is initiated and waiting for partner
3022 /// approval. This state is only applicable for pending change.
3023 PendingApproval,
3024 /// Change is in this state after it's approved by the partner or auto-approved
3025 /// but before it takes effect. The change can be overwritten or cancelled
3026 /// depending on the new line item info property (pending Private Offer change
3027 /// cannot be cancelled and can only be overwritten by another Private Offer).
3028 /// This state is only applicable for pending change.
3029 Approved,
3030 /// Change is in this state after it's been activated. This state is only
3031 /// applicable for change in history.
3032 Completed,
3033 /// Change is in this state if it was rejected by the partner. This state is
3034 /// only applicable for change in history.
3035 Rejected,
3036 /// Change is in this state if it was abandoned by the user. This state is only
3037 /// applicable for change in history.
3038 Abandoned,
3039 /// Change is in this state if it's currently being provisioned downstream. The
3040 /// change can't be overwritten or cancelled when it's in this state. This
3041 /// state is only applicable for pending change.
3042 Activating,
3043 /// If set, the enum was initialized with an unknown value.
3044 ///
3045 /// Applications can examine the value using [LineItemChangeState::value] or
3046 /// [LineItemChangeState::name].
3047 UnknownValue(line_item_change_state::UnknownValue),
3048}
3049
3050#[doc(hidden)]
3051pub mod line_item_change_state {
3052 #[allow(unused_imports)]
3053 use super::*;
3054 #[derive(Clone, Debug, PartialEq)]
3055 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3056}
3057
3058impl LineItemChangeState {
3059 /// Gets the enum value.
3060 ///
3061 /// Returns `None` if the enum contains an unknown value deserialized from
3062 /// the string representation of enums.
3063 pub fn value(&self) -> std::option::Option<i32> {
3064 match self {
3065 Self::Unspecified => std::option::Option::Some(0),
3066 Self::PendingApproval => std::option::Option::Some(1),
3067 Self::Approved => std::option::Option::Some(2),
3068 Self::Completed => std::option::Option::Some(3),
3069 Self::Rejected => std::option::Option::Some(4),
3070 Self::Abandoned => std::option::Option::Some(5),
3071 Self::Activating => std::option::Option::Some(6),
3072 Self::UnknownValue(u) => u.0.value(),
3073 }
3074 }
3075
3076 /// Gets the enum value as a string.
3077 ///
3078 /// Returns `None` if the enum contains an unknown value deserialized from
3079 /// the integer representation of enums.
3080 pub fn name(&self) -> std::option::Option<&str> {
3081 match self {
3082 Self::Unspecified => std::option::Option::Some("LINE_ITEM_CHANGE_STATE_UNSPECIFIED"),
3083 Self::PendingApproval => {
3084 std::option::Option::Some("LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL")
3085 }
3086 Self::Approved => std::option::Option::Some("LINE_ITEM_CHANGE_STATE_APPROVED"),
3087 Self::Completed => std::option::Option::Some("LINE_ITEM_CHANGE_STATE_COMPLETED"),
3088 Self::Rejected => std::option::Option::Some("LINE_ITEM_CHANGE_STATE_REJECTED"),
3089 Self::Abandoned => std::option::Option::Some("LINE_ITEM_CHANGE_STATE_ABANDONED"),
3090 Self::Activating => std::option::Option::Some("LINE_ITEM_CHANGE_STATE_ACTIVATING"),
3091 Self::UnknownValue(u) => u.0.name(),
3092 }
3093 }
3094}
3095
3096impl std::default::Default for LineItemChangeState {
3097 fn default() -> Self {
3098 use std::convert::From;
3099 Self::from(0)
3100 }
3101}
3102
3103impl std::fmt::Display for LineItemChangeState {
3104 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3105 wkt::internal::display_enum(f, self.name(), self.value())
3106 }
3107}
3108
3109impl std::convert::From<i32> for LineItemChangeState {
3110 fn from(value: i32) -> Self {
3111 match value {
3112 0 => Self::Unspecified,
3113 1 => Self::PendingApproval,
3114 2 => Self::Approved,
3115 3 => Self::Completed,
3116 4 => Self::Rejected,
3117 5 => Self::Abandoned,
3118 6 => Self::Activating,
3119 _ => Self::UnknownValue(line_item_change_state::UnknownValue(
3120 wkt::internal::UnknownEnumValue::Integer(value),
3121 )),
3122 }
3123 }
3124}
3125
3126impl std::convert::From<&str> for LineItemChangeState {
3127 fn from(value: &str) -> Self {
3128 use std::string::ToString;
3129 match value {
3130 "LINE_ITEM_CHANGE_STATE_UNSPECIFIED" => Self::Unspecified,
3131 "LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL" => Self::PendingApproval,
3132 "LINE_ITEM_CHANGE_STATE_APPROVED" => Self::Approved,
3133 "LINE_ITEM_CHANGE_STATE_COMPLETED" => Self::Completed,
3134 "LINE_ITEM_CHANGE_STATE_REJECTED" => Self::Rejected,
3135 "LINE_ITEM_CHANGE_STATE_ABANDONED" => Self::Abandoned,
3136 "LINE_ITEM_CHANGE_STATE_ACTIVATING" => Self::Activating,
3137 _ => Self::UnknownValue(line_item_change_state::UnknownValue(
3138 wkt::internal::UnknownEnumValue::String(value.to_string()),
3139 )),
3140 }
3141 }
3142}
3143
3144impl serde::ser::Serialize for LineItemChangeState {
3145 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3146 where
3147 S: serde::Serializer,
3148 {
3149 match self {
3150 Self::Unspecified => serializer.serialize_i32(0),
3151 Self::PendingApproval => serializer.serialize_i32(1),
3152 Self::Approved => serializer.serialize_i32(2),
3153 Self::Completed => serializer.serialize_i32(3),
3154 Self::Rejected => serializer.serialize_i32(4),
3155 Self::Abandoned => serializer.serialize_i32(5),
3156 Self::Activating => serializer.serialize_i32(6),
3157 Self::UnknownValue(u) => u.0.serialize(serializer),
3158 }
3159 }
3160}
3161
3162impl<'de> serde::de::Deserialize<'de> for LineItemChangeState {
3163 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3164 where
3165 D: serde::Deserializer<'de>,
3166 {
3167 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LineItemChangeState>::new(
3168 ".google.cloud.commerce.consumer.procurement.v1.LineItemChangeState",
3169 ))
3170 }
3171}
3172
3173/// Predefined types for line item change state reason.
3174///
3175/// # Working with unknown values
3176///
3177/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3178/// additional enum variants at any time. Adding new variants is not considered
3179/// a breaking change. Applications should write their code in anticipation of:
3180///
3181/// - New values appearing in future releases of the client library, **and**
3182/// - New values received dynamically, without application changes.
3183///
3184/// Please consult the [Working with enums] section in the user guide for some
3185/// guidelines.
3186///
3187/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3188#[derive(Clone, Debug, PartialEq)]
3189#[non_exhaustive]
3190pub enum LineItemChangeStateReasonType {
3191 /// Default value, indicating there's no predefined type for change state
3192 /// reason.
3193 Unspecified,
3194 /// Change is in current state due to term expiration.
3195 Expired,
3196 /// Change is in current state due to user-initiated cancellation.
3197 UserCancelled,
3198 /// Change is in current state due to system-initiated cancellation.
3199 SystemCancelled,
3200 /// If set, the enum was initialized with an unknown value.
3201 ///
3202 /// Applications can examine the value using [LineItemChangeStateReasonType::value] or
3203 /// [LineItemChangeStateReasonType::name].
3204 UnknownValue(line_item_change_state_reason_type::UnknownValue),
3205}
3206
3207#[doc(hidden)]
3208pub mod line_item_change_state_reason_type {
3209 #[allow(unused_imports)]
3210 use super::*;
3211 #[derive(Clone, Debug, PartialEq)]
3212 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3213}
3214
3215impl LineItemChangeStateReasonType {
3216 /// Gets the enum value.
3217 ///
3218 /// Returns `None` if the enum contains an unknown value deserialized from
3219 /// the string representation of enums.
3220 pub fn value(&self) -> std::option::Option<i32> {
3221 match self {
3222 Self::Unspecified => std::option::Option::Some(0),
3223 Self::Expired => std::option::Option::Some(1),
3224 Self::UserCancelled => std::option::Option::Some(2),
3225 Self::SystemCancelled => std::option::Option::Some(3),
3226 Self::UnknownValue(u) => u.0.value(),
3227 }
3228 }
3229
3230 /// Gets the enum value as a string.
3231 ///
3232 /// Returns `None` if the enum contains an unknown value deserialized from
3233 /// the integer representation of enums.
3234 pub fn name(&self) -> std::option::Option<&str> {
3235 match self {
3236 Self::Unspecified => {
3237 std::option::Option::Some("LINE_ITEM_CHANGE_STATE_REASON_TYPE_UNSPECIFIED")
3238 }
3239 Self::Expired => {
3240 std::option::Option::Some("LINE_ITEM_CHANGE_STATE_REASON_TYPE_EXPIRED")
3241 }
3242 Self::UserCancelled => {
3243 std::option::Option::Some("LINE_ITEM_CHANGE_STATE_REASON_TYPE_USER_CANCELLED")
3244 }
3245 Self::SystemCancelled => {
3246 std::option::Option::Some("LINE_ITEM_CHANGE_STATE_REASON_TYPE_SYSTEM_CANCELLED")
3247 }
3248 Self::UnknownValue(u) => u.0.name(),
3249 }
3250 }
3251}
3252
3253impl std::default::Default for LineItemChangeStateReasonType {
3254 fn default() -> Self {
3255 use std::convert::From;
3256 Self::from(0)
3257 }
3258}
3259
3260impl std::fmt::Display for LineItemChangeStateReasonType {
3261 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3262 wkt::internal::display_enum(f, self.name(), self.value())
3263 }
3264}
3265
3266impl std::convert::From<i32> for LineItemChangeStateReasonType {
3267 fn from(value: i32) -> Self {
3268 match value {
3269 0 => Self::Unspecified,
3270 1 => Self::Expired,
3271 2 => Self::UserCancelled,
3272 3 => Self::SystemCancelled,
3273 _ => Self::UnknownValue(line_item_change_state_reason_type::UnknownValue(
3274 wkt::internal::UnknownEnumValue::Integer(value),
3275 )),
3276 }
3277 }
3278}
3279
3280impl std::convert::From<&str> for LineItemChangeStateReasonType {
3281 fn from(value: &str) -> Self {
3282 use std::string::ToString;
3283 match value {
3284 "LINE_ITEM_CHANGE_STATE_REASON_TYPE_UNSPECIFIED" => Self::Unspecified,
3285 "LINE_ITEM_CHANGE_STATE_REASON_TYPE_EXPIRED" => Self::Expired,
3286 "LINE_ITEM_CHANGE_STATE_REASON_TYPE_USER_CANCELLED" => Self::UserCancelled,
3287 "LINE_ITEM_CHANGE_STATE_REASON_TYPE_SYSTEM_CANCELLED" => Self::SystemCancelled,
3288 _ => Self::UnknownValue(line_item_change_state_reason_type::UnknownValue(
3289 wkt::internal::UnknownEnumValue::String(value.to_string()),
3290 )),
3291 }
3292 }
3293}
3294
3295impl serde::ser::Serialize for LineItemChangeStateReasonType {
3296 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3297 where
3298 S: serde::Serializer,
3299 {
3300 match self {
3301 Self::Unspecified => serializer.serialize_i32(0),
3302 Self::Expired => serializer.serialize_i32(1),
3303 Self::UserCancelled => serializer.serialize_i32(2),
3304 Self::SystemCancelled => serializer.serialize_i32(3),
3305 Self::UnknownValue(u) => u.0.serialize(serializer),
3306 }
3307 }
3308}
3309
3310impl<'de> serde::de::Deserialize<'de> for LineItemChangeStateReasonType {
3311 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3312 where
3313 D: serde::Deserializer<'de>,
3314 {
3315 deserializer.deserialize_any(
3316 wkt::internal::EnumVisitor::<LineItemChangeStateReasonType>::new(
3317 ".google.cloud.commerce.consumer.procurement.v1.LineItemChangeStateReasonType",
3318 ),
3319 )
3320 }
3321}
3322
3323/// Indicates the auto renewal behavior customer specifies on subscription.
3324///
3325/// # Working with unknown values
3326///
3327/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3328/// additional enum variants at any time. Adding new variants is not considered
3329/// a breaking change. Applications should write their code in anticipation of:
3330///
3331/// - New values appearing in future releases of the client library, **and**
3332/// - New values received dynamically, without application changes.
3333///
3334/// Please consult the [Working with enums] section in the user guide for some
3335/// guidelines.
3336///
3337/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3338#[derive(Clone, Debug, PartialEq)]
3339#[non_exhaustive]
3340pub enum AutoRenewalBehavior {
3341 /// If unspecified, the auto renewal behavior will follow the default config.
3342 Unspecified,
3343 /// Auto Renewal will be enabled on subscription.
3344 Enable,
3345 /// Auto Renewal will be disabled on subscription.
3346 Disable,
3347 /// If set, the enum was initialized with an unknown value.
3348 ///
3349 /// Applications can examine the value using [AutoRenewalBehavior::value] or
3350 /// [AutoRenewalBehavior::name].
3351 UnknownValue(auto_renewal_behavior::UnknownValue),
3352}
3353
3354#[doc(hidden)]
3355pub mod auto_renewal_behavior {
3356 #[allow(unused_imports)]
3357 use super::*;
3358 #[derive(Clone, Debug, PartialEq)]
3359 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3360}
3361
3362impl AutoRenewalBehavior {
3363 /// Gets the enum value.
3364 ///
3365 /// Returns `None` if the enum contains an unknown value deserialized from
3366 /// the string representation of enums.
3367 pub fn value(&self) -> std::option::Option<i32> {
3368 match self {
3369 Self::Unspecified => std::option::Option::Some(0),
3370 Self::Enable => std::option::Option::Some(1),
3371 Self::Disable => std::option::Option::Some(2),
3372 Self::UnknownValue(u) => u.0.value(),
3373 }
3374 }
3375
3376 /// Gets the enum value as a string.
3377 ///
3378 /// Returns `None` if the enum contains an unknown value deserialized from
3379 /// the integer representation of enums.
3380 pub fn name(&self) -> std::option::Option<&str> {
3381 match self {
3382 Self::Unspecified => std::option::Option::Some("AUTO_RENEWAL_BEHAVIOR_UNSPECIFIED"),
3383 Self::Enable => std::option::Option::Some("AUTO_RENEWAL_BEHAVIOR_ENABLE"),
3384 Self::Disable => std::option::Option::Some("AUTO_RENEWAL_BEHAVIOR_DISABLE"),
3385 Self::UnknownValue(u) => u.0.name(),
3386 }
3387 }
3388}
3389
3390impl std::default::Default for AutoRenewalBehavior {
3391 fn default() -> Self {
3392 use std::convert::From;
3393 Self::from(0)
3394 }
3395}
3396
3397impl std::fmt::Display for AutoRenewalBehavior {
3398 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3399 wkt::internal::display_enum(f, self.name(), self.value())
3400 }
3401}
3402
3403impl std::convert::From<i32> for AutoRenewalBehavior {
3404 fn from(value: i32) -> Self {
3405 match value {
3406 0 => Self::Unspecified,
3407 1 => Self::Enable,
3408 2 => Self::Disable,
3409 _ => Self::UnknownValue(auto_renewal_behavior::UnknownValue(
3410 wkt::internal::UnknownEnumValue::Integer(value),
3411 )),
3412 }
3413 }
3414}
3415
3416impl std::convert::From<&str> for AutoRenewalBehavior {
3417 fn from(value: &str) -> Self {
3418 use std::string::ToString;
3419 match value {
3420 "AUTO_RENEWAL_BEHAVIOR_UNSPECIFIED" => Self::Unspecified,
3421 "AUTO_RENEWAL_BEHAVIOR_ENABLE" => Self::Enable,
3422 "AUTO_RENEWAL_BEHAVIOR_DISABLE" => Self::Disable,
3423 _ => Self::UnknownValue(auto_renewal_behavior::UnknownValue(
3424 wkt::internal::UnknownEnumValue::String(value.to_string()),
3425 )),
3426 }
3427 }
3428}
3429
3430impl serde::ser::Serialize for AutoRenewalBehavior {
3431 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3432 where
3433 S: serde::Serializer,
3434 {
3435 match self {
3436 Self::Unspecified => serializer.serialize_i32(0),
3437 Self::Enable => serializer.serialize_i32(1),
3438 Self::Disable => serializer.serialize_i32(2),
3439 Self::UnknownValue(u) => u.0.serialize(serializer),
3440 }
3441 }
3442}
3443
3444impl<'de> serde::de::Deserialize<'de> for AutoRenewalBehavior {
3445 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3446 where
3447 D: serde::Deserializer<'de>,
3448 {
3449 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AutoRenewalBehavior>::new(
3450 ".google.cloud.commerce.consumer.procurement.v1.AutoRenewalBehavior",
3451 ))
3452 }
3453}