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