google_cloud_osconfig_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#![allow(rustdoc::bare_urls)]
20#![allow(rustdoc::invalid_html_tags)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_type;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// This API resource represents the available inventory data for a
41/// Compute Engine virtual machine (VM) instance at a given point in time.
42///
43/// You can use this API resource to determine the inventory data of your VM.
44///
45/// For more information, see [Information provided by OS inventory
46/// management](https://cloud.google.com/compute/docs/instances/os-inventory-management#data-collected).
47#[derive(Clone, Default, PartialEq)]
48#[non_exhaustive]
49pub struct Inventory {
50 /// Output only. The `Inventory` API resource name.
51 ///
52 /// Format:
53 /// `projects/{project_number}/locations/{location}/instances/{instance_id}/inventory`
54 pub name: std::string::String,
55
56 /// Base level operating system information for the VM.
57 pub os_info: std::option::Option<crate::model::inventory::OsInfo>,
58
59 /// Inventory items related to the VM keyed by an opaque unique identifier for
60 /// each inventory item. The identifier is unique to each distinct and
61 /// addressable inventory item and will change, when there is a new package
62 /// version.
63 pub items: std::collections::HashMap<std::string::String, crate::model::inventory::Item>,
64
65 /// Output only. Timestamp of the last reported inventory for the VM.
66 pub update_time: std::option::Option<wkt::Timestamp>,
67
68 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
69}
70
71impl Inventory {
72 /// Creates a new default instance.
73 pub fn new() -> Self {
74 std::default::Default::default()
75 }
76
77 /// Sets the value of [name][crate::model::Inventory::name].
78 ///
79 /// # Example
80 /// ```ignore,no_run
81 /// # use google_cloud_osconfig_v1::model::Inventory;
82 /// let x = Inventory::new().set_name("example");
83 /// ```
84 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
85 self.name = v.into();
86 self
87 }
88
89 /// Sets the value of [os_info][crate::model::Inventory::os_info].
90 ///
91 /// # Example
92 /// ```ignore,no_run
93 /// # use google_cloud_osconfig_v1::model::Inventory;
94 /// use google_cloud_osconfig_v1::model::inventory::OsInfo;
95 /// let x = Inventory::new().set_os_info(OsInfo::default()/* use setters */);
96 /// ```
97 pub fn set_os_info<T>(mut self, v: T) -> Self
98 where
99 T: std::convert::Into<crate::model::inventory::OsInfo>,
100 {
101 self.os_info = std::option::Option::Some(v.into());
102 self
103 }
104
105 /// Sets or clears the value of [os_info][crate::model::Inventory::os_info].
106 ///
107 /// # Example
108 /// ```ignore,no_run
109 /// # use google_cloud_osconfig_v1::model::Inventory;
110 /// use google_cloud_osconfig_v1::model::inventory::OsInfo;
111 /// let x = Inventory::new().set_or_clear_os_info(Some(OsInfo::default()/* use setters */));
112 /// let x = Inventory::new().set_or_clear_os_info(None::<OsInfo>);
113 /// ```
114 pub fn set_or_clear_os_info<T>(mut self, v: std::option::Option<T>) -> Self
115 where
116 T: std::convert::Into<crate::model::inventory::OsInfo>,
117 {
118 self.os_info = v.map(|x| x.into());
119 self
120 }
121
122 /// Sets the value of [items][crate::model::Inventory::items].
123 ///
124 /// # Example
125 /// ```ignore,no_run
126 /// # use google_cloud_osconfig_v1::model::Inventory;
127 /// use google_cloud_osconfig_v1::model::inventory::Item;
128 /// let x = Inventory::new().set_items([
129 /// ("key0", Item::default()/* use setters */),
130 /// ("key1", Item::default()/* use (different) setters */),
131 /// ]);
132 /// ```
133 pub fn set_items<T, K, V>(mut self, v: T) -> Self
134 where
135 T: std::iter::IntoIterator<Item = (K, V)>,
136 K: std::convert::Into<std::string::String>,
137 V: std::convert::Into<crate::model::inventory::Item>,
138 {
139 use std::iter::Iterator;
140 self.items = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
141 self
142 }
143
144 /// Sets the value of [update_time][crate::model::Inventory::update_time].
145 ///
146 /// # Example
147 /// ```ignore,no_run
148 /// # use google_cloud_osconfig_v1::model::Inventory;
149 /// use wkt::Timestamp;
150 /// let x = Inventory::new().set_update_time(Timestamp::default()/* use setters */);
151 /// ```
152 pub fn set_update_time<T>(mut self, v: T) -> Self
153 where
154 T: std::convert::Into<wkt::Timestamp>,
155 {
156 self.update_time = std::option::Option::Some(v.into());
157 self
158 }
159
160 /// Sets or clears the value of [update_time][crate::model::Inventory::update_time].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_osconfig_v1::model::Inventory;
165 /// use wkt::Timestamp;
166 /// let x = Inventory::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
167 /// let x = Inventory::new().set_or_clear_update_time(None::<Timestamp>);
168 /// ```
169 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
170 where
171 T: std::convert::Into<wkt::Timestamp>,
172 {
173 self.update_time = v.map(|x| x.into());
174 self
175 }
176}
177
178impl wkt::message::Message for Inventory {
179 fn typename() -> &'static str {
180 "type.googleapis.com/google.cloud.osconfig.v1.Inventory"
181 }
182}
183
184/// Defines additional types related to [Inventory].
185pub mod inventory {
186 #[allow(unused_imports)]
187 use super::*;
188
189 /// Operating system information for the VM.
190 #[derive(Clone, Default, PartialEq)]
191 #[non_exhaustive]
192 pub struct OsInfo {
193 /// The VM hostname.
194 pub hostname: std::string::String,
195
196 /// The operating system long name.
197 /// For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019
198 /// Datacenter'.
199 pub long_name: std::string::String,
200
201 /// The operating system short name.
202 /// For example, 'windows' or 'debian'.
203 pub short_name: std::string::String,
204
205 /// The version of the operating system.
206 pub version: std::string::String,
207
208 /// The system architecture of the operating system.
209 pub architecture: std::string::String,
210
211 /// The kernel version of the operating system.
212 pub kernel_version: std::string::String,
213
214 /// The kernel release of the operating system.
215 pub kernel_release: std::string::String,
216
217 /// The current version of the OS Config agent running on the VM.
218 pub osconfig_agent_version: std::string::String,
219
220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
221 }
222
223 impl OsInfo {
224 /// Creates a new default instance.
225 pub fn new() -> Self {
226 std::default::Default::default()
227 }
228
229 /// Sets the value of [hostname][crate::model::inventory::OsInfo::hostname].
230 ///
231 /// # Example
232 /// ```ignore,no_run
233 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
234 /// let x = OsInfo::new().set_hostname("example");
235 /// ```
236 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
237 self.hostname = v.into();
238 self
239 }
240
241 /// Sets the value of [long_name][crate::model::inventory::OsInfo::long_name].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
246 /// let x = OsInfo::new().set_long_name("example");
247 /// ```
248 pub fn set_long_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249 self.long_name = v.into();
250 self
251 }
252
253 /// Sets the value of [short_name][crate::model::inventory::OsInfo::short_name].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
258 /// let x = OsInfo::new().set_short_name("example");
259 /// ```
260 pub fn set_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
261 self.short_name = v.into();
262 self
263 }
264
265 /// Sets the value of [version][crate::model::inventory::OsInfo::version].
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
270 /// let x = OsInfo::new().set_version("example");
271 /// ```
272 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
273 self.version = v.into();
274 self
275 }
276
277 /// Sets the value of [architecture][crate::model::inventory::OsInfo::architecture].
278 ///
279 /// # Example
280 /// ```ignore,no_run
281 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
282 /// let x = OsInfo::new().set_architecture("example");
283 /// ```
284 pub fn set_architecture<T: std::convert::Into<std::string::String>>(
285 mut self,
286 v: T,
287 ) -> Self {
288 self.architecture = v.into();
289 self
290 }
291
292 /// Sets the value of [kernel_version][crate::model::inventory::OsInfo::kernel_version].
293 ///
294 /// # Example
295 /// ```ignore,no_run
296 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
297 /// let x = OsInfo::new().set_kernel_version("example");
298 /// ```
299 pub fn set_kernel_version<T: std::convert::Into<std::string::String>>(
300 mut self,
301 v: T,
302 ) -> Self {
303 self.kernel_version = v.into();
304 self
305 }
306
307 /// Sets the value of [kernel_release][crate::model::inventory::OsInfo::kernel_release].
308 ///
309 /// # Example
310 /// ```ignore,no_run
311 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
312 /// let x = OsInfo::new().set_kernel_release("example");
313 /// ```
314 pub fn set_kernel_release<T: std::convert::Into<std::string::String>>(
315 mut self,
316 v: T,
317 ) -> Self {
318 self.kernel_release = v.into();
319 self
320 }
321
322 /// Sets the value of [osconfig_agent_version][crate::model::inventory::OsInfo::osconfig_agent_version].
323 ///
324 /// # Example
325 /// ```ignore,no_run
326 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
327 /// let x = OsInfo::new().set_osconfig_agent_version("example");
328 /// ```
329 pub fn set_osconfig_agent_version<T: std::convert::Into<std::string::String>>(
330 mut self,
331 v: T,
332 ) -> Self {
333 self.osconfig_agent_version = v.into();
334 self
335 }
336 }
337
338 impl wkt::message::Message for OsInfo {
339 fn typename() -> &'static str {
340 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.OsInfo"
341 }
342 }
343
344 /// A single piece of inventory on a VM.
345 #[derive(Clone, Default, PartialEq)]
346 #[non_exhaustive]
347 pub struct Item {
348 /// Identifier for this item, unique across items for this VM.
349 pub id: std::string::String,
350
351 /// The origin of this inventory item.
352 pub origin_type: crate::model::inventory::item::OriginType,
353
354 /// When this inventory item was first detected.
355 pub create_time: std::option::Option<wkt::Timestamp>,
356
357 /// When this inventory item was last modified.
358 pub update_time: std::option::Option<wkt::Timestamp>,
359
360 /// The specific type of inventory, correlating to its specific details.
361 pub r#type: crate::model::inventory::item::Type,
362
363 /// Specific details of this inventory item based on its type.
364 pub details: std::option::Option<crate::model::inventory::item::Details>,
365
366 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
367 }
368
369 impl Item {
370 /// Creates a new default instance.
371 pub fn new() -> Self {
372 std::default::Default::default()
373 }
374
375 /// Sets the value of [id][crate::model::inventory::Item::id].
376 ///
377 /// # Example
378 /// ```ignore,no_run
379 /// # use google_cloud_osconfig_v1::model::inventory::Item;
380 /// let x = Item::new().set_id("example");
381 /// ```
382 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
383 self.id = v.into();
384 self
385 }
386
387 /// Sets the value of [origin_type][crate::model::inventory::Item::origin_type].
388 ///
389 /// # Example
390 /// ```ignore,no_run
391 /// # use google_cloud_osconfig_v1::model::inventory::Item;
392 /// use google_cloud_osconfig_v1::model::inventory::item::OriginType;
393 /// let x0 = Item::new().set_origin_type(OriginType::InventoryReport);
394 /// ```
395 pub fn set_origin_type<T: std::convert::Into<crate::model::inventory::item::OriginType>>(
396 mut self,
397 v: T,
398 ) -> Self {
399 self.origin_type = v.into();
400 self
401 }
402
403 /// Sets the value of [create_time][crate::model::inventory::Item::create_time].
404 ///
405 /// # Example
406 /// ```ignore,no_run
407 /// # use google_cloud_osconfig_v1::model::inventory::Item;
408 /// use wkt::Timestamp;
409 /// let x = Item::new().set_create_time(Timestamp::default()/* use setters */);
410 /// ```
411 pub fn set_create_time<T>(mut self, v: T) -> Self
412 where
413 T: std::convert::Into<wkt::Timestamp>,
414 {
415 self.create_time = std::option::Option::Some(v.into());
416 self
417 }
418
419 /// Sets or clears the value of [create_time][crate::model::inventory::Item::create_time].
420 ///
421 /// # Example
422 /// ```ignore,no_run
423 /// # use google_cloud_osconfig_v1::model::inventory::Item;
424 /// use wkt::Timestamp;
425 /// let x = Item::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
426 /// let x = Item::new().set_or_clear_create_time(None::<Timestamp>);
427 /// ```
428 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
429 where
430 T: std::convert::Into<wkt::Timestamp>,
431 {
432 self.create_time = v.map(|x| x.into());
433 self
434 }
435
436 /// Sets the value of [update_time][crate::model::inventory::Item::update_time].
437 ///
438 /// # Example
439 /// ```ignore,no_run
440 /// # use google_cloud_osconfig_v1::model::inventory::Item;
441 /// use wkt::Timestamp;
442 /// let x = Item::new().set_update_time(Timestamp::default()/* use setters */);
443 /// ```
444 pub fn set_update_time<T>(mut self, v: T) -> Self
445 where
446 T: std::convert::Into<wkt::Timestamp>,
447 {
448 self.update_time = std::option::Option::Some(v.into());
449 self
450 }
451
452 /// Sets or clears the value of [update_time][crate::model::inventory::Item::update_time].
453 ///
454 /// # Example
455 /// ```ignore,no_run
456 /// # use google_cloud_osconfig_v1::model::inventory::Item;
457 /// use wkt::Timestamp;
458 /// let x = Item::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
459 /// let x = Item::new().set_or_clear_update_time(None::<Timestamp>);
460 /// ```
461 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
462 where
463 T: std::convert::Into<wkt::Timestamp>,
464 {
465 self.update_time = v.map(|x| x.into());
466 self
467 }
468
469 /// Sets the value of [r#type][crate::model::inventory::Item::type].
470 ///
471 /// # Example
472 /// ```ignore,no_run
473 /// # use google_cloud_osconfig_v1::model::inventory::Item;
474 /// use google_cloud_osconfig_v1::model::inventory::item::Type;
475 /// let x0 = Item::new().set_type(Type::InstalledPackage);
476 /// let x1 = Item::new().set_type(Type::AvailablePackage);
477 /// ```
478 pub fn set_type<T: std::convert::Into<crate::model::inventory::item::Type>>(
479 mut self,
480 v: T,
481 ) -> Self {
482 self.r#type = v.into();
483 self
484 }
485
486 /// Sets the value of [details][crate::model::inventory::Item::details].
487 ///
488 /// Note that all the setters affecting `details` are mutually
489 /// exclusive.
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_osconfig_v1::model::inventory::Item;
494 /// use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
495 /// let x = Item::new().set_details(Some(
496 /// google_cloud_osconfig_v1::model::inventory::item::Details::InstalledPackage(SoftwarePackage::default().into())));
497 /// ```
498 pub fn set_details<
499 T: std::convert::Into<std::option::Option<crate::model::inventory::item::Details>>,
500 >(
501 mut self,
502 v: T,
503 ) -> Self {
504 self.details = v.into();
505 self
506 }
507
508 /// The value of [details][crate::model::inventory::Item::details]
509 /// if it holds a `InstalledPackage`, `None` if the field is not set or
510 /// holds a different branch.
511 pub fn installed_package(
512 &self,
513 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::SoftwarePackage>>
514 {
515 #[allow(unreachable_patterns)]
516 self.details.as_ref().and_then(|v| match v {
517 crate::model::inventory::item::Details::InstalledPackage(v) => {
518 std::option::Option::Some(v)
519 }
520 _ => std::option::Option::None,
521 })
522 }
523
524 /// Sets the value of [details][crate::model::inventory::Item::details]
525 /// to hold a `InstalledPackage`.
526 ///
527 /// Note that all the setters affecting `details` are
528 /// mutually exclusive.
529 ///
530 /// # Example
531 /// ```ignore,no_run
532 /// # use google_cloud_osconfig_v1::model::inventory::Item;
533 /// use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
534 /// let x = Item::new().set_installed_package(SoftwarePackage::default()/* use setters */);
535 /// assert!(x.installed_package().is_some());
536 /// assert!(x.available_package().is_none());
537 /// ```
538 pub fn set_installed_package<
539 T: std::convert::Into<std::boxed::Box<crate::model::inventory::SoftwarePackage>>,
540 >(
541 mut self,
542 v: T,
543 ) -> Self {
544 self.details = std::option::Option::Some(
545 crate::model::inventory::item::Details::InstalledPackage(v.into()),
546 );
547 self
548 }
549
550 /// The value of [details][crate::model::inventory::Item::details]
551 /// if it holds a `AvailablePackage`, `None` if the field is not set or
552 /// holds a different branch.
553 pub fn available_package(
554 &self,
555 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::SoftwarePackage>>
556 {
557 #[allow(unreachable_patterns)]
558 self.details.as_ref().and_then(|v| match v {
559 crate::model::inventory::item::Details::AvailablePackage(v) => {
560 std::option::Option::Some(v)
561 }
562 _ => std::option::Option::None,
563 })
564 }
565
566 /// Sets the value of [details][crate::model::inventory::Item::details]
567 /// to hold a `AvailablePackage`.
568 ///
569 /// Note that all the setters affecting `details` are
570 /// mutually exclusive.
571 ///
572 /// # Example
573 /// ```ignore,no_run
574 /// # use google_cloud_osconfig_v1::model::inventory::Item;
575 /// use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
576 /// let x = Item::new().set_available_package(SoftwarePackage::default()/* use setters */);
577 /// assert!(x.available_package().is_some());
578 /// assert!(x.installed_package().is_none());
579 /// ```
580 pub fn set_available_package<
581 T: std::convert::Into<std::boxed::Box<crate::model::inventory::SoftwarePackage>>,
582 >(
583 mut self,
584 v: T,
585 ) -> Self {
586 self.details = std::option::Option::Some(
587 crate::model::inventory::item::Details::AvailablePackage(v.into()),
588 );
589 self
590 }
591 }
592
593 impl wkt::message::Message for Item {
594 fn typename() -> &'static str {
595 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.Item"
596 }
597 }
598
599 /// Defines additional types related to [Item].
600 pub mod item {
601 #[allow(unused_imports)]
602 use super::*;
603
604 /// The origin of a specific inventory item.
605 ///
606 /// # Working with unknown values
607 ///
608 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
609 /// additional enum variants at any time. Adding new variants is not considered
610 /// a breaking change. Applications should write their code in anticipation of:
611 ///
612 /// - New values appearing in future releases of the client library, **and**
613 /// - New values received dynamically, without application changes.
614 ///
615 /// Please consult the [Working with enums] section in the user guide for some
616 /// guidelines.
617 ///
618 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
619 #[derive(Clone, Debug, PartialEq)]
620 #[non_exhaustive]
621 pub enum OriginType {
622 /// Invalid. An origin type must be specified.
623 Unspecified,
624 /// This inventory item was discovered as the result of the agent
625 /// reporting inventory via the reporting API.
626 InventoryReport,
627 /// If set, the enum was initialized with an unknown value.
628 ///
629 /// Applications can examine the value using [OriginType::value] or
630 /// [OriginType::name].
631 UnknownValue(origin_type::UnknownValue),
632 }
633
634 #[doc(hidden)]
635 pub mod origin_type {
636 #[allow(unused_imports)]
637 use super::*;
638 #[derive(Clone, Debug, PartialEq)]
639 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
640 }
641
642 impl OriginType {
643 /// Gets the enum value.
644 ///
645 /// Returns `None` if the enum contains an unknown value deserialized from
646 /// the string representation of enums.
647 pub fn value(&self) -> std::option::Option<i32> {
648 match self {
649 Self::Unspecified => std::option::Option::Some(0),
650 Self::InventoryReport => std::option::Option::Some(1),
651 Self::UnknownValue(u) => u.0.value(),
652 }
653 }
654
655 /// Gets the enum value as a string.
656 ///
657 /// Returns `None` if the enum contains an unknown value deserialized from
658 /// the integer representation of enums.
659 pub fn name(&self) -> std::option::Option<&str> {
660 match self {
661 Self::Unspecified => std::option::Option::Some("ORIGIN_TYPE_UNSPECIFIED"),
662 Self::InventoryReport => std::option::Option::Some("INVENTORY_REPORT"),
663 Self::UnknownValue(u) => u.0.name(),
664 }
665 }
666 }
667
668 impl std::default::Default for OriginType {
669 fn default() -> Self {
670 use std::convert::From;
671 Self::from(0)
672 }
673 }
674
675 impl std::fmt::Display for OriginType {
676 fn fmt(
677 &self,
678 f: &mut std::fmt::Formatter<'_>,
679 ) -> std::result::Result<(), std::fmt::Error> {
680 wkt::internal::display_enum(f, self.name(), self.value())
681 }
682 }
683
684 impl std::convert::From<i32> for OriginType {
685 fn from(value: i32) -> Self {
686 match value {
687 0 => Self::Unspecified,
688 1 => Self::InventoryReport,
689 _ => Self::UnknownValue(origin_type::UnknownValue(
690 wkt::internal::UnknownEnumValue::Integer(value),
691 )),
692 }
693 }
694 }
695
696 impl std::convert::From<&str> for OriginType {
697 fn from(value: &str) -> Self {
698 use std::string::ToString;
699 match value {
700 "ORIGIN_TYPE_UNSPECIFIED" => Self::Unspecified,
701 "INVENTORY_REPORT" => Self::InventoryReport,
702 _ => Self::UnknownValue(origin_type::UnknownValue(
703 wkt::internal::UnknownEnumValue::String(value.to_string()),
704 )),
705 }
706 }
707 }
708
709 impl serde::ser::Serialize for OriginType {
710 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
711 where
712 S: serde::Serializer,
713 {
714 match self {
715 Self::Unspecified => serializer.serialize_i32(0),
716 Self::InventoryReport => serializer.serialize_i32(1),
717 Self::UnknownValue(u) => u.0.serialize(serializer),
718 }
719 }
720 }
721
722 impl<'de> serde::de::Deserialize<'de> for OriginType {
723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
724 where
725 D: serde::Deserializer<'de>,
726 {
727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OriginType>::new(
728 ".google.cloud.osconfig.v1.Inventory.Item.OriginType",
729 ))
730 }
731 }
732
733 /// The different types of inventory that are tracked on a VM.
734 ///
735 /// # Working with unknown values
736 ///
737 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
738 /// additional enum variants at any time. Adding new variants is not considered
739 /// a breaking change. Applications should write their code in anticipation of:
740 ///
741 /// - New values appearing in future releases of the client library, **and**
742 /// - New values received dynamically, without application changes.
743 ///
744 /// Please consult the [Working with enums] section in the user guide for some
745 /// guidelines.
746 ///
747 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
748 #[derive(Clone, Debug, PartialEq)]
749 #[non_exhaustive]
750 pub enum Type {
751 /// Invalid. An type must be specified.
752 Unspecified,
753 /// This represents a package that is installed on the VM.
754 InstalledPackage,
755 /// This represents an update that is available for a package.
756 AvailablePackage,
757 /// If set, the enum was initialized with an unknown value.
758 ///
759 /// Applications can examine the value using [Type::value] or
760 /// [Type::name].
761 UnknownValue(r#type::UnknownValue),
762 }
763
764 #[doc(hidden)]
765 pub mod r#type {
766 #[allow(unused_imports)]
767 use super::*;
768 #[derive(Clone, Debug, PartialEq)]
769 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
770 }
771
772 impl Type {
773 /// Gets the enum value.
774 ///
775 /// Returns `None` if the enum contains an unknown value deserialized from
776 /// the string representation of enums.
777 pub fn value(&self) -> std::option::Option<i32> {
778 match self {
779 Self::Unspecified => std::option::Option::Some(0),
780 Self::InstalledPackage => std::option::Option::Some(1),
781 Self::AvailablePackage => std::option::Option::Some(2),
782 Self::UnknownValue(u) => u.0.value(),
783 }
784 }
785
786 /// Gets the enum value as a string.
787 ///
788 /// Returns `None` if the enum contains an unknown value deserialized from
789 /// the integer representation of enums.
790 pub fn name(&self) -> std::option::Option<&str> {
791 match self {
792 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
793 Self::InstalledPackage => std::option::Option::Some("INSTALLED_PACKAGE"),
794 Self::AvailablePackage => std::option::Option::Some("AVAILABLE_PACKAGE"),
795 Self::UnknownValue(u) => u.0.name(),
796 }
797 }
798 }
799
800 impl std::default::Default for Type {
801 fn default() -> Self {
802 use std::convert::From;
803 Self::from(0)
804 }
805 }
806
807 impl std::fmt::Display for Type {
808 fn fmt(
809 &self,
810 f: &mut std::fmt::Formatter<'_>,
811 ) -> std::result::Result<(), std::fmt::Error> {
812 wkt::internal::display_enum(f, self.name(), self.value())
813 }
814 }
815
816 impl std::convert::From<i32> for Type {
817 fn from(value: i32) -> Self {
818 match value {
819 0 => Self::Unspecified,
820 1 => Self::InstalledPackage,
821 2 => Self::AvailablePackage,
822 _ => Self::UnknownValue(r#type::UnknownValue(
823 wkt::internal::UnknownEnumValue::Integer(value),
824 )),
825 }
826 }
827 }
828
829 impl std::convert::From<&str> for Type {
830 fn from(value: &str) -> Self {
831 use std::string::ToString;
832 match value {
833 "TYPE_UNSPECIFIED" => Self::Unspecified,
834 "INSTALLED_PACKAGE" => Self::InstalledPackage,
835 "AVAILABLE_PACKAGE" => Self::AvailablePackage,
836 _ => Self::UnknownValue(r#type::UnknownValue(
837 wkt::internal::UnknownEnumValue::String(value.to_string()),
838 )),
839 }
840 }
841 }
842
843 impl serde::ser::Serialize for Type {
844 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
845 where
846 S: serde::Serializer,
847 {
848 match self {
849 Self::Unspecified => serializer.serialize_i32(0),
850 Self::InstalledPackage => serializer.serialize_i32(1),
851 Self::AvailablePackage => serializer.serialize_i32(2),
852 Self::UnknownValue(u) => u.0.serialize(serializer),
853 }
854 }
855 }
856
857 impl<'de> serde::de::Deserialize<'de> for Type {
858 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
859 where
860 D: serde::Deserializer<'de>,
861 {
862 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
863 ".google.cloud.osconfig.v1.Inventory.Item.Type",
864 ))
865 }
866 }
867
868 /// Specific details of this inventory item based on its type.
869 #[derive(Clone, Debug, PartialEq)]
870 #[non_exhaustive]
871 pub enum Details {
872 /// Software package present on the VM instance.
873 InstalledPackage(std::boxed::Box<crate::model::inventory::SoftwarePackage>),
874 /// Software package available to be installed on the VM instance.
875 AvailablePackage(std::boxed::Box<crate::model::inventory::SoftwarePackage>),
876 }
877 }
878
879 /// Software package information of the operating system.
880 #[derive(Clone, Default, PartialEq)]
881 #[non_exhaustive]
882 pub struct SoftwarePackage {
883 /// Information about the different types of software packages.
884 pub details: std::option::Option<crate::model::inventory::software_package::Details>,
885
886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
887 }
888
889 impl SoftwarePackage {
890 /// Creates a new default instance.
891 pub fn new() -> Self {
892 std::default::Default::default()
893 }
894
895 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details].
896 ///
897 /// Note that all the setters affecting `details` are mutually
898 /// exclusive.
899 ///
900 /// # Example
901 /// ```ignore,no_run
902 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
903 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
904 /// let x = SoftwarePackage::new().set_details(Some(
905 /// google_cloud_osconfig_v1::model::inventory::software_package::Details::YumPackage(VersionedPackage::default().into())));
906 /// ```
907 pub fn set_details<
908 T: std::convert::Into<
909 std::option::Option<crate::model::inventory::software_package::Details>,
910 >,
911 >(
912 mut self,
913 v: T,
914 ) -> Self {
915 self.details = v.into();
916 self
917 }
918
919 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
920 /// if it holds a `YumPackage`, `None` if the field is not set or
921 /// holds a different branch.
922 pub fn yum_package(
923 &self,
924 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
925 {
926 #[allow(unreachable_patterns)]
927 self.details.as_ref().and_then(|v| match v {
928 crate::model::inventory::software_package::Details::YumPackage(v) => {
929 std::option::Option::Some(v)
930 }
931 _ => std::option::Option::None,
932 })
933 }
934
935 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
936 /// to hold a `YumPackage`.
937 ///
938 /// Note that all the setters affecting `details` are
939 /// mutually exclusive.
940 ///
941 /// # Example
942 /// ```ignore,no_run
943 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
944 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
945 /// let x = SoftwarePackage::new().set_yum_package(VersionedPackage::default()/* use setters */);
946 /// assert!(x.yum_package().is_some());
947 /// assert!(x.apt_package().is_none());
948 /// assert!(x.zypper_package().is_none());
949 /// assert!(x.googet_package().is_none());
950 /// assert!(x.zypper_patch().is_none());
951 /// assert!(x.wua_package().is_none());
952 /// assert!(x.qfe_package().is_none());
953 /// assert!(x.cos_package().is_none());
954 /// assert!(x.windows_application().is_none());
955 /// ```
956 pub fn set_yum_package<
957 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
958 >(
959 mut self,
960 v: T,
961 ) -> Self {
962 self.details = std::option::Option::Some(
963 crate::model::inventory::software_package::Details::YumPackage(v.into()),
964 );
965 self
966 }
967
968 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
969 /// if it holds a `AptPackage`, `None` if the field is not set or
970 /// holds a different branch.
971 pub fn apt_package(
972 &self,
973 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
974 {
975 #[allow(unreachable_patterns)]
976 self.details.as_ref().and_then(|v| match v {
977 crate::model::inventory::software_package::Details::AptPackage(v) => {
978 std::option::Option::Some(v)
979 }
980 _ => std::option::Option::None,
981 })
982 }
983
984 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
985 /// to hold a `AptPackage`.
986 ///
987 /// Note that all the setters affecting `details` are
988 /// mutually exclusive.
989 ///
990 /// # Example
991 /// ```ignore,no_run
992 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
993 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
994 /// let x = SoftwarePackage::new().set_apt_package(VersionedPackage::default()/* use setters */);
995 /// assert!(x.apt_package().is_some());
996 /// assert!(x.yum_package().is_none());
997 /// assert!(x.zypper_package().is_none());
998 /// assert!(x.googet_package().is_none());
999 /// assert!(x.zypper_patch().is_none());
1000 /// assert!(x.wua_package().is_none());
1001 /// assert!(x.qfe_package().is_none());
1002 /// assert!(x.cos_package().is_none());
1003 /// assert!(x.windows_application().is_none());
1004 /// ```
1005 pub fn set_apt_package<
1006 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1007 >(
1008 mut self,
1009 v: T,
1010 ) -> Self {
1011 self.details = std::option::Option::Some(
1012 crate::model::inventory::software_package::Details::AptPackage(v.into()),
1013 );
1014 self
1015 }
1016
1017 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1018 /// if it holds a `ZypperPackage`, `None` if the field is not set or
1019 /// holds a different branch.
1020 pub fn zypper_package(
1021 &self,
1022 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
1023 {
1024 #[allow(unreachable_patterns)]
1025 self.details.as_ref().and_then(|v| match v {
1026 crate::model::inventory::software_package::Details::ZypperPackage(v) => {
1027 std::option::Option::Some(v)
1028 }
1029 _ => std::option::Option::None,
1030 })
1031 }
1032
1033 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1034 /// to hold a `ZypperPackage`.
1035 ///
1036 /// Note that all the setters affecting `details` are
1037 /// mutually exclusive.
1038 ///
1039 /// # Example
1040 /// ```ignore,no_run
1041 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1042 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1043 /// let x = SoftwarePackage::new().set_zypper_package(VersionedPackage::default()/* use setters */);
1044 /// assert!(x.zypper_package().is_some());
1045 /// assert!(x.yum_package().is_none());
1046 /// assert!(x.apt_package().is_none());
1047 /// assert!(x.googet_package().is_none());
1048 /// assert!(x.zypper_patch().is_none());
1049 /// assert!(x.wua_package().is_none());
1050 /// assert!(x.qfe_package().is_none());
1051 /// assert!(x.cos_package().is_none());
1052 /// assert!(x.windows_application().is_none());
1053 /// ```
1054 pub fn set_zypper_package<
1055 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1056 >(
1057 mut self,
1058 v: T,
1059 ) -> Self {
1060 self.details = std::option::Option::Some(
1061 crate::model::inventory::software_package::Details::ZypperPackage(v.into()),
1062 );
1063 self
1064 }
1065
1066 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1067 /// if it holds a `GoogetPackage`, `None` if the field is not set or
1068 /// holds a different branch.
1069 pub fn googet_package(
1070 &self,
1071 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
1072 {
1073 #[allow(unreachable_patterns)]
1074 self.details.as_ref().and_then(|v| match v {
1075 crate::model::inventory::software_package::Details::GoogetPackage(v) => {
1076 std::option::Option::Some(v)
1077 }
1078 _ => std::option::Option::None,
1079 })
1080 }
1081
1082 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1083 /// to hold a `GoogetPackage`.
1084 ///
1085 /// Note that all the setters affecting `details` are
1086 /// mutually exclusive.
1087 ///
1088 /// # Example
1089 /// ```ignore,no_run
1090 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1091 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1092 /// let x = SoftwarePackage::new().set_googet_package(VersionedPackage::default()/* use setters */);
1093 /// assert!(x.googet_package().is_some());
1094 /// assert!(x.yum_package().is_none());
1095 /// assert!(x.apt_package().is_none());
1096 /// assert!(x.zypper_package().is_none());
1097 /// assert!(x.zypper_patch().is_none());
1098 /// assert!(x.wua_package().is_none());
1099 /// assert!(x.qfe_package().is_none());
1100 /// assert!(x.cos_package().is_none());
1101 /// assert!(x.windows_application().is_none());
1102 /// ```
1103 pub fn set_googet_package<
1104 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1105 >(
1106 mut self,
1107 v: T,
1108 ) -> Self {
1109 self.details = std::option::Option::Some(
1110 crate::model::inventory::software_package::Details::GoogetPackage(v.into()),
1111 );
1112 self
1113 }
1114
1115 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1116 /// if it holds a `ZypperPatch`, `None` if the field is not set or
1117 /// holds a different branch.
1118 pub fn zypper_patch(
1119 &self,
1120 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::ZypperPatch>> {
1121 #[allow(unreachable_patterns)]
1122 self.details.as_ref().and_then(|v| match v {
1123 crate::model::inventory::software_package::Details::ZypperPatch(v) => {
1124 std::option::Option::Some(v)
1125 }
1126 _ => std::option::Option::None,
1127 })
1128 }
1129
1130 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1131 /// to hold a `ZypperPatch`.
1132 ///
1133 /// Note that all the setters affecting `details` are
1134 /// mutually exclusive.
1135 ///
1136 /// # Example
1137 /// ```ignore,no_run
1138 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1139 /// use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1140 /// let x = SoftwarePackage::new().set_zypper_patch(ZypperPatch::default()/* use setters */);
1141 /// assert!(x.zypper_patch().is_some());
1142 /// assert!(x.yum_package().is_none());
1143 /// assert!(x.apt_package().is_none());
1144 /// assert!(x.zypper_package().is_none());
1145 /// assert!(x.googet_package().is_none());
1146 /// assert!(x.wua_package().is_none());
1147 /// assert!(x.qfe_package().is_none());
1148 /// assert!(x.cos_package().is_none());
1149 /// assert!(x.windows_application().is_none());
1150 /// ```
1151 pub fn set_zypper_patch<
1152 T: std::convert::Into<std::boxed::Box<crate::model::inventory::ZypperPatch>>,
1153 >(
1154 mut self,
1155 v: T,
1156 ) -> Self {
1157 self.details = std::option::Option::Some(
1158 crate::model::inventory::software_package::Details::ZypperPatch(v.into()),
1159 );
1160 self
1161 }
1162
1163 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1164 /// if it holds a `WuaPackage`, `None` if the field is not set or
1165 /// holds a different branch.
1166 pub fn wua_package(
1167 &self,
1168 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::WindowsUpdatePackage>>
1169 {
1170 #[allow(unreachable_patterns)]
1171 self.details.as_ref().and_then(|v| match v {
1172 crate::model::inventory::software_package::Details::WuaPackage(v) => {
1173 std::option::Option::Some(v)
1174 }
1175 _ => std::option::Option::None,
1176 })
1177 }
1178
1179 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1180 /// to hold a `WuaPackage`.
1181 ///
1182 /// Note that all the setters affecting `details` are
1183 /// mutually exclusive.
1184 ///
1185 /// # Example
1186 /// ```ignore,no_run
1187 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1188 /// use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1189 /// let x = SoftwarePackage::new().set_wua_package(WindowsUpdatePackage::default()/* use setters */);
1190 /// assert!(x.wua_package().is_some());
1191 /// assert!(x.yum_package().is_none());
1192 /// assert!(x.apt_package().is_none());
1193 /// assert!(x.zypper_package().is_none());
1194 /// assert!(x.googet_package().is_none());
1195 /// assert!(x.zypper_patch().is_none());
1196 /// assert!(x.qfe_package().is_none());
1197 /// assert!(x.cos_package().is_none());
1198 /// assert!(x.windows_application().is_none());
1199 /// ```
1200 pub fn set_wua_package<
1201 T: std::convert::Into<std::boxed::Box<crate::model::inventory::WindowsUpdatePackage>>,
1202 >(
1203 mut self,
1204 v: T,
1205 ) -> Self {
1206 self.details = std::option::Option::Some(
1207 crate::model::inventory::software_package::Details::WuaPackage(v.into()),
1208 );
1209 self
1210 }
1211
1212 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1213 /// if it holds a `QfePackage`, `None` if the field is not set or
1214 /// holds a different branch.
1215 pub fn qfe_package(
1216 &self,
1217 ) -> std::option::Option<
1218 &std::boxed::Box<crate::model::inventory::WindowsQuickFixEngineeringPackage>,
1219 > {
1220 #[allow(unreachable_patterns)]
1221 self.details.as_ref().and_then(|v| match v {
1222 crate::model::inventory::software_package::Details::QfePackage(v) => {
1223 std::option::Option::Some(v)
1224 }
1225 _ => std::option::Option::None,
1226 })
1227 }
1228
1229 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1230 /// to hold a `QfePackage`.
1231 ///
1232 /// Note that all the setters affecting `details` are
1233 /// mutually exclusive.
1234 ///
1235 /// # Example
1236 /// ```ignore,no_run
1237 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1238 /// use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1239 /// let x = SoftwarePackage::new().set_qfe_package(WindowsQuickFixEngineeringPackage::default()/* use setters */);
1240 /// assert!(x.qfe_package().is_some());
1241 /// assert!(x.yum_package().is_none());
1242 /// assert!(x.apt_package().is_none());
1243 /// assert!(x.zypper_package().is_none());
1244 /// assert!(x.googet_package().is_none());
1245 /// assert!(x.zypper_patch().is_none());
1246 /// assert!(x.wua_package().is_none());
1247 /// assert!(x.cos_package().is_none());
1248 /// assert!(x.windows_application().is_none());
1249 /// ```
1250 pub fn set_qfe_package<
1251 T: std::convert::Into<
1252 std::boxed::Box<crate::model::inventory::WindowsQuickFixEngineeringPackage>,
1253 >,
1254 >(
1255 mut self,
1256 v: T,
1257 ) -> Self {
1258 self.details = std::option::Option::Some(
1259 crate::model::inventory::software_package::Details::QfePackage(v.into()),
1260 );
1261 self
1262 }
1263
1264 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1265 /// if it holds a `CosPackage`, `None` if the field is not set or
1266 /// holds a different branch.
1267 pub fn cos_package(
1268 &self,
1269 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
1270 {
1271 #[allow(unreachable_patterns)]
1272 self.details.as_ref().and_then(|v| match v {
1273 crate::model::inventory::software_package::Details::CosPackage(v) => {
1274 std::option::Option::Some(v)
1275 }
1276 _ => std::option::Option::None,
1277 })
1278 }
1279
1280 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1281 /// to hold a `CosPackage`.
1282 ///
1283 /// Note that all the setters affecting `details` are
1284 /// mutually exclusive.
1285 ///
1286 /// # Example
1287 /// ```ignore,no_run
1288 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1289 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1290 /// let x = SoftwarePackage::new().set_cos_package(VersionedPackage::default()/* use setters */);
1291 /// assert!(x.cos_package().is_some());
1292 /// assert!(x.yum_package().is_none());
1293 /// assert!(x.apt_package().is_none());
1294 /// assert!(x.zypper_package().is_none());
1295 /// assert!(x.googet_package().is_none());
1296 /// assert!(x.zypper_patch().is_none());
1297 /// assert!(x.wua_package().is_none());
1298 /// assert!(x.qfe_package().is_none());
1299 /// assert!(x.windows_application().is_none());
1300 /// ```
1301 pub fn set_cos_package<
1302 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1303 >(
1304 mut self,
1305 v: T,
1306 ) -> Self {
1307 self.details = std::option::Option::Some(
1308 crate::model::inventory::software_package::Details::CosPackage(v.into()),
1309 );
1310 self
1311 }
1312
1313 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1314 /// if it holds a `WindowsApplication`, `None` if the field is not set or
1315 /// holds a different branch.
1316 pub fn windows_application(
1317 &self,
1318 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::WindowsApplication>>
1319 {
1320 #[allow(unreachable_patterns)]
1321 self.details.as_ref().and_then(|v| match v {
1322 crate::model::inventory::software_package::Details::WindowsApplication(v) => {
1323 std::option::Option::Some(v)
1324 }
1325 _ => std::option::Option::None,
1326 })
1327 }
1328
1329 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1330 /// to hold a `WindowsApplication`.
1331 ///
1332 /// Note that all the setters affecting `details` are
1333 /// mutually exclusive.
1334 ///
1335 /// # Example
1336 /// ```ignore,no_run
1337 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1338 /// use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
1339 /// let x = SoftwarePackage::new().set_windows_application(WindowsApplication::default()/* use setters */);
1340 /// assert!(x.windows_application().is_some());
1341 /// assert!(x.yum_package().is_none());
1342 /// assert!(x.apt_package().is_none());
1343 /// assert!(x.zypper_package().is_none());
1344 /// assert!(x.googet_package().is_none());
1345 /// assert!(x.zypper_patch().is_none());
1346 /// assert!(x.wua_package().is_none());
1347 /// assert!(x.qfe_package().is_none());
1348 /// assert!(x.cos_package().is_none());
1349 /// ```
1350 pub fn set_windows_application<
1351 T: std::convert::Into<std::boxed::Box<crate::model::inventory::WindowsApplication>>,
1352 >(
1353 mut self,
1354 v: T,
1355 ) -> Self {
1356 self.details = std::option::Option::Some(
1357 crate::model::inventory::software_package::Details::WindowsApplication(v.into()),
1358 );
1359 self
1360 }
1361 }
1362
1363 impl wkt::message::Message for SoftwarePackage {
1364 fn typename() -> &'static str {
1365 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.SoftwarePackage"
1366 }
1367 }
1368
1369 /// Defines additional types related to [SoftwarePackage].
1370 pub mod software_package {
1371 #[allow(unused_imports)]
1372 use super::*;
1373
1374 /// Information about the different types of software packages.
1375 #[derive(Clone, Debug, PartialEq)]
1376 #[non_exhaustive]
1377 pub enum Details {
1378 /// Yum package info.
1379 /// For details about the yum package manager, see
1380 /// <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum>.
1381 YumPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1382 /// Details of an APT package.
1383 /// For details about the apt package manager, see
1384 /// <https://wiki.debian.org/Apt>.
1385 AptPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1386 /// Details of a Zypper package.
1387 /// For details about the Zypper package manager, see
1388 /// <https://en.opensuse.org/SDB:Zypper_manual>.
1389 ZypperPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1390 /// Details of a Googet package.
1391 /// For details about the googet package manager, see
1392 /// <https://github.com/google/googet>.
1393 GoogetPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1394 /// Details of a Zypper patch.
1395 /// For details about the Zypper package manager, see
1396 /// <https://en.opensuse.org/SDB:Zypper_manual>.
1397 ZypperPatch(std::boxed::Box<crate::model::inventory::ZypperPatch>),
1398 /// Details of a Windows Update package.
1399 /// See <https://docs.microsoft.com/en-us/windows/win32/api/_wua/> for
1400 /// information about Windows Update.
1401 WuaPackage(std::boxed::Box<crate::model::inventory::WindowsUpdatePackage>),
1402 /// Details of a Windows Quick Fix engineering package.
1403 /// See
1404 /// <https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering>
1405 /// for info in Windows Quick Fix Engineering.
1406 QfePackage(std::boxed::Box<crate::model::inventory::WindowsQuickFixEngineeringPackage>),
1407 /// Details of a COS package.
1408 CosPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1409 /// Details of Windows Application.
1410 WindowsApplication(std::boxed::Box<crate::model::inventory::WindowsApplication>),
1411 }
1412 }
1413
1414 /// Information related to the a standard versioned package. This includes
1415 /// package info for APT, Yum, Zypper, and Googet package managers.
1416 #[derive(Clone, Default, PartialEq)]
1417 #[non_exhaustive]
1418 pub struct VersionedPackage {
1419 /// The name of the package.
1420 pub package_name: std::string::String,
1421
1422 /// The system architecture this package is intended for.
1423 pub architecture: std::string::String,
1424
1425 /// The version of the package.
1426 pub version: std::string::String,
1427
1428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1429 }
1430
1431 impl VersionedPackage {
1432 /// Creates a new default instance.
1433 pub fn new() -> Self {
1434 std::default::Default::default()
1435 }
1436
1437 /// Sets the value of [package_name][crate::model::inventory::VersionedPackage::package_name].
1438 ///
1439 /// # Example
1440 /// ```ignore,no_run
1441 /// # use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1442 /// let x = VersionedPackage::new().set_package_name("example");
1443 /// ```
1444 pub fn set_package_name<T: std::convert::Into<std::string::String>>(
1445 mut self,
1446 v: T,
1447 ) -> Self {
1448 self.package_name = v.into();
1449 self
1450 }
1451
1452 /// Sets the value of [architecture][crate::model::inventory::VersionedPackage::architecture].
1453 ///
1454 /// # Example
1455 /// ```ignore,no_run
1456 /// # use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1457 /// let x = VersionedPackage::new().set_architecture("example");
1458 /// ```
1459 pub fn set_architecture<T: std::convert::Into<std::string::String>>(
1460 mut self,
1461 v: T,
1462 ) -> Self {
1463 self.architecture = v.into();
1464 self
1465 }
1466
1467 /// Sets the value of [version][crate::model::inventory::VersionedPackage::version].
1468 ///
1469 /// # Example
1470 /// ```ignore,no_run
1471 /// # use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1472 /// let x = VersionedPackage::new().set_version("example");
1473 /// ```
1474 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1475 self.version = v.into();
1476 self
1477 }
1478 }
1479
1480 impl wkt::message::Message for VersionedPackage {
1481 fn typename() -> &'static str {
1482 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.VersionedPackage"
1483 }
1484 }
1485
1486 /// Details related to a Zypper Patch.
1487 #[derive(Clone, Default, PartialEq)]
1488 #[non_exhaustive]
1489 pub struct ZypperPatch {
1490 /// The name of the patch.
1491 pub patch_name: std::string::String,
1492
1493 /// The category of the patch.
1494 pub category: std::string::String,
1495
1496 /// The severity specified for this patch
1497 pub severity: std::string::String,
1498
1499 /// Any summary information provided about this patch.
1500 pub summary: std::string::String,
1501
1502 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1503 }
1504
1505 impl ZypperPatch {
1506 /// Creates a new default instance.
1507 pub fn new() -> Self {
1508 std::default::Default::default()
1509 }
1510
1511 /// Sets the value of [patch_name][crate::model::inventory::ZypperPatch::patch_name].
1512 ///
1513 /// # Example
1514 /// ```ignore,no_run
1515 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1516 /// let x = ZypperPatch::new().set_patch_name("example");
1517 /// ```
1518 pub fn set_patch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1519 self.patch_name = v.into();
1520 self
1521 }
1522
1523 /// Sets the value of [category][crate::model::inventory::ZypperPatch::category].
1524 ///
1525 /// # Example
1526 /// ```ignore,no_run
1527 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1528 /// let x = ZypperPatch::new().set_category("example");
1529 /// ```
1530 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1531 self.category = v.into();
1532 self
1533 }
1534
1535 /// Sets the value of [severity][crate::model::inventory::ZypperPatch::severity].
1536 ///
1537 /// # Example
1538 /// ```ignore,no_run
1539 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1540 /// let x = ZypperPatch::new().set_severity("example");
1541 /// ```
1542 pub fn set_severity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1543 self.severity = v.into();
1544 self
1545 }
1546
1547 /// Sets the value of [summary][crate::model::inventory::ZypperPatch::summary].
1548 ///
1549 /// # Example
1550 /// ```ignore,no_run
1551 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1552 /// let x = ZypperPatch::new().set_summary("example");
1553 /// ```
1554 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1555 self.summary = v.into();
1556 self
1557 }
1558 }
1559
1560 impl wkt::message::Message for ZypperPatch {
1561 fn typename() -> &'static str {
1562 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.ZypperPatch"
1563 }
1564 }
1565
1566 /// Details related to a Windows Update package.
1567 /// Field data and names are taken from Windows Update API IUpdate Interface:
1568 /// <https://docs.microsoft.com/en-us/windows/win32/api/_wua/>
1569 /// Descriptive fields like title, and description are localized based on
1570 /// the locale of the VM being updated.
1571 #[derive(Clone, Default, PartialEq)]
1572 #[non_exhaustive]
1573 pub struct WindowsUpdatePackage {
1574 /// The localized title of the update package.
1575 pub title: std::string::String,
1576
1577 /// The localized description of the update package.
1578 pub description: std::string::String,
1579
1580 /// The categories that are associated with this update package.
1581 pub categories:
1582 std::vec::Vec<crate::model::inventory::windows_update_package::WindowsUpdateCategory>,
1583
1584 /// A collection of Microsoft Knowledge Base article IDs that are associated
1585 /// with the update package.
1586 pub kb_article_ids: std::vec::Vec<std::string::String>,
1587
1588 /// A hyperlink to the language-specific support information for the update.
1589 pub support_url: std::string::String,
1590
1591 /// A collection of URLs that provide more information about the update
1592 /// package.
1593 pub more_info_urls: std::vec::Vec<std::string::String>,
1594
1595 /// Gets the identifier of an update package. Stays the same across
1596 /// revisions.
1597 pub update_id: std::string::String,
1598
1599 /// The revision number of this update package.
1600 pub revision_number: i32,
1601
1602 /// The last published date of the update, in (UTC) date and time.
1603 pub last_deployment_change_time: std::option::Option<wkt::Timestamp>,
1604
1605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1606 }
1607
1608 impl WindowsUpdatePackage {
1609 /// Creates a new default instance.
1610 pub fn new() -> Self {
1611 std::default::Default::default()
1612 }
1613
1614 /// Sets the value of [title][crate::model::inventory::WindowsUpdatePackage::title].
1615 ///
1616 /// # Example
1617 /// ```ignore,no_run
1618 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1619 /// let x = WindowsUpdatePackage::new().set_title("example");
1620 /// ```
1621 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1622 self.title = v.into();
1623 self
1624 }
1625
1626 /// Sets the value of [description][crate::model::inventory::WindowsUpdatePackage::description].
1627 ///
1628 /// # Example
1629 /// ```ignore,no_run
1630 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1631 /// let x = WindowsUpdatePackage::new().set_description("example");
1632 /// ```
1633 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1634 self.description = v.into();
1635 self
1636 }
1637
1638 /// Sets the value of [categories][crate::model::inventory::WindowsUpdatePackage::categories].
1639 ///
1640 /// # Example
1641 /// ```ignore,no_run
1642 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1643 /// use google_cloud_osconfig_v1::model::inventory::windows_update_package::WindowsUpdateCategory;
1644 /// let x = WindowsUpdatePackage::new()
1645 /// .set_categories([
1646 /// WindowsUpdateCategory::default()/* use setters */,
1647 /// WindowsUpdateCategory::default()/* use (different) setters */,
1648 /// ]);
1649 /// ```
1650 pub fn set_categories<T, V>(mut self, v: T) -> Self
1651 where
1652 T: std::iter::IntoIterator<Item = V>,
1653 V: std::convert::Into<
1654 crate::model::inventory::windows_update_package::WindowsUpdateCategory,
1655 >,
1656 {
1657 use std::iter::Iterator;
1658 self.categories = v.into_iter().map(|i| i.into()).collect();
1659 self
1660 }
1661
1662 /// Sets the value of [kb_article_ids][crate::model::inventory::WindowsUpdatePackage::kb_article_ids].
1663 ///
1664 /// # Example
1665 /// ```ignore,no_run
1666 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1667 /// let x = WindowsUpdatePackage::new().set_kb_article_ids(["a", "b", "c"]);
1668 /// ```
1669 pub fn set_kb_article_ids<T, V>(mut self, v: T) -> Self
1670 where
1671 T: std::iter::IntoIterator<Item = V>,
1672 V: std::convert::Into<std::string::String>,
1673 {
1674 use std::iter::Iterator;
1675 self.kb_article_ids = v.into_iter().map(|i| i.into()).collect();
1676 self
1677 }
1678
1679 /// Sets the value of [support_url][crate::model::inventory::WindowsUpdatePackage::support_url].
1680 ///
1681 /// # Example
1682 /// ```ignore,no_run
1683 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1684 /// let x = WindowsUpdatePackage::new().set_support_url("example");
1685 /// ```
1686 pub fn set_support_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1687 self.support_url = v.into();
1688 self
1689 }
1690
1691 /// Sets the value of [more_info_urls][crate::model::inventory::WindowsUpdatePackage::more_info_urls].
1692 ///
1693 /// # Example
1694 /// ```ignore,no_run
1695 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1696 /// let x = WindowsUpdatePackage::new().set_more_info_urls(["a", "b", "c"]);
1697 /// ```
1698 pub fn set_more_info_urls<T, V>(mut self, v: T) -> Self
1699 where
1700 T: std::iter::IntoIterator<Item = V>,
1701 V: std::convert::Into<std::string::String>,
1702 {
1703 use std::iter::Iterator;
1704 self.more_info_urls = v.into_iter().map(|i| i.into()).collect();
1705 self
1706 }
1707
1708 /// Sets the value of [update_id][crate::model::inventory::WindowsUpdatePackage::update_id].
1709 ///
1710 /// # Example
1711 /// ```ignore,no_run
1712 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1713 /// let x = WindowsUpdatePackage::new().set_update_id("example");
1714 /// ```
1715 pub fn set_update_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1716 self.update_id = v.into();
1717 self
1718 }
1719
1720 /// Sets the value of [revision_number][crate::model::inventory::WindowsUpdatePackage::revision_number].
1721 ///
1722 /// # Example
1723 /// ```ignore,no_run
1724 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1725 /// let x = WindowsUpdatePackage::new().set_revision_number(42);
1726 /// ```
1727 pub fn set_revision_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1728 self.revision_number = v.into();
1729 self
1730 }
1731
1732 /// Sets the value of [last_deployment_change_time][crate::model::inventory::WindowsUpdatePackage::last_deployment_change_time].
1733 ///
1734 /// # Example
1735 /// ```ignore,no_run
1736 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1737 /// use wkt::Timestamp;
1738 /// let x = WindowsUpdatePackage::new().set_last_deployment_change_time(Timestamp::default()/* use setters */);
1739 /// ```
1740 pub fn set_last_deployment_change_time<T>(mut self, v: T) -> Self
1741 where
1742 T: std::convert::Into<wkt::Timestamp>,
1743 {
1744 self.last_deployment_change_time = std::option::Option::Some(v.into());
1745 self
1746 }
1747
1748 /// Sets or clears the value of [last_deployment_change_time][crate::model::inventory::WindowsUpdatePackage::last_deployment_change_time].
1749 ///
1750 /// # Example
1751 /// ```ignore,no_run
1752 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1753 /// use wkt::Timestamp;
1754 /// let x = WindowsUpdatePackage::new().set_or_clear_last_deployment_change_time(Some(Timestamp::default()/* use setters */));
1755 /// let x = WindowsUpdatePackage::new().set_or_clear_last_deployment_change_time(None::<Timestamp>);
1756 /// ```
1757 pub fn set_or_clear_last_deployment_change_time<T>(
1758 mut self,
1759 v: std::option::Option<T>,
1760 ) -> Self
1761 where
1762 T: std::convert::Into<wkt::Timestamp>,
1763 {
1764 self.last_deployment_change_time = v.map(|x| x.into());
1765 self
1766 }
1767 }
1768
1769 impl wkt::message::Message for WindowsUpdatePackage {
1770 fn typename() -> &'static str {
1771 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsUpdatePackage"
1772 }
1773 }
1774
1775 /// Defines additional types related to [WindowsUpdatePackage].
1776 pub mod windows_update_package {
1777 #[allow(unused_imports)]
1778 use super::*;
1779
1780 /// Categories specified by the Windows Update.
1781 #[derive(Clone, Default, PartialEq)]
1782 #[non_exhaustive]
1783 pub struct WindowsUpdateCategory {
1784 /// The identifier of the windows update category.
1785 pub id: std::string::String,
1786
1787 /// The name of the windows update category.
1788 pub name: std::string::String,
1789
1790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1791 }
1792
1793 impl WindowsUpdateCategory {
1794 /// Creates a new default instance.
1795 pub fn new() -> Self {
1796 std::default::Default::default()
1797 }
1798
1799 /// Sets the value of [id][crate::model::inventory::windows_update_package::WindowsUpdateCategory::id].
1800 ///
1801 /// # Example
1802 /// ```ignore,no_run
1803 /// # use google_cloud_osconfig_v1::model::inventory::windows_update_package::WindowsUpdateCategory;
1804 /// let x = WindowsUpdateCategory::new().set_id("example");
1805 /// ```
1806 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1807 self.id = v.into();
1808 self
1809 }
1810
1811 /// Sets the value of [name][crate::model::inventory::windows_update_package::WindowsUpdateCategory::name].
1812 ///
1813 /// # Example
1814 /// ```ignore,no_run
1815 /// # use google_cloud_osconfig_v1::model::inventory::windows_update_package::WindowsUpdateCategory;
1816 /// let x = WindowsUpdateCategory::new().set_name("example");
1817 /// ```
1818 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1819 self.name = v.into();
1820 self
1821 }
1822 }
1823
1824 impl wkt::message::Message for WindowsUpdateCategory {
1825 fn typename() -> &'static str {
1826 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsUpdatePackage.WindowsUpdateCategory"
1827 }
1828 }
1829 }
1830
1831 /// Information related to a Quick Fix Engineering package.
1832 /// Fields are taken from Windows QuickFixEngineering Interface and match
1833 /// the source names:
1834 /// <https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering>
1835 #[derive(Clone, Default, PartialEq)]
1836 #[non_exhaustive]
1837 pub struct WindowsQuickFixEngineeringPackage {
1838 /// A short textual description of the QFE update.
1839 pub caption: std::string::String,
1840
1841 /// A textual description of the QFE update.
1842 pub description: std::string::String,
1843
1844 /// Unique identifier associated with a particular QFE update.
1845 pub hot_fix_id: std::string::String,
1846
1847 /// Date that the QFE update was installed. Mapped from installed_on field.
1848 pub install_time: std::option::Option<wkt::Timestamp>,
1849
1850 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1851 }
1852
1853 impl WindowsQuickFixEngineeringPackage {
1854 /// Creates a new default instance.
1855 pub fn new() -> Self {
1856 std::default::Default::default()
1857 }
1858
1859 /// Sets the value of [caption][crate::model::inventory::WindowsQuickFixEngineeringPackage::caption].
1860 ///
1861 /// # Example
1862 /// ```ignore,no_run
1863 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1864 /// let x = WindowsQuickFixEngineeringPackage::new().set_caption("example");
1865 /// ```
1866 pub fn set_caption<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1867 self.caption = v.into();
1868 self
1869 }
1870
1871 /// Sets the value of [description][crate::model::inventory::WindowsQuickFixEngineeringPackage::description].
1872 ///
1873 /// # Example
1874 /// ```ignore,no_run
1875 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1876 /// let x = WindowsQuickFixEngineeringPackage::new().set_description("example");
1877 /// ```
1878 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1879 self.description = v.into();
1880 self
1881 }
1882
1883 /// Sets the value of [hot_fix_id][crate::model::inventory::WindowsQuickFixEngineeringPackage::hot_fix_id].
1884 ///
1885 /// # Example
1886 /// ```ignore,no_run
1887 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1888 /// let x = WindowsQuickFixEngineeringPackage::new().set_hot_fix_id("example");
1889 /// ```
1890 pub fn set_hot_fix_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1891 self.hot_fix_id = v.into();
1892 self
1893 }
1894
1895 /// Sets the value of [install_time][crate::model::inventory::WindowsQuickFixEngineeringPackage::install_time].
1896 ///
1897 /// # Example
1898 /// ```ignore,no_run
1899 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1900 /// use wkt::Timestamp;
1901 /// let x = WindowsQuickFixEngineeringPackage::new().set_install_time(Timestamp::default()/* use setters */);
1902 /// ```
1903 pub fn set_install_time<T>(mut self, v: T) -> Self
1904 where
1905 T: std::convert::Into<wkt::Timestamp>,
1906 {
1907 self.install_time = std::option::Option::Some(v.into());
1908 self
1909 }
1910
1911 /// Sets or clears the value of [install_time][crate::model::inventory::WindowsQuickFixEngineeringPackage::install_time].
1912 ///
1913 /// # Example
1914 /// ```ignore,no_run
1915 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1916 /// use wkt::Timestamp;
1917 /// let x = WindowsQuickFixEngineeringPackage::new().set_or_clear_install_time(Some(Timestamp::default()/* use setters */));
1918 /// let x = WindowsQuickFixEngineeringPackage::new().set_or_clear_install_time(None::<Timestamp>);
1919 /// ```
1920 pub fn set_or_clear_install_time<T>(mut self, v: std::option::Option<T>) -> Self
1921 where
1922 T: std::convert::Into<wkt::Timestamp>,
1923 {
1924 self.install_time = v.map(|x| x.into());
1925 self
1926 }
1927 }
1928
1929 impl wkt::message::Message for WindowsQuickFixEngineeringPackage {
1930 fn typename() -> &'static str {
1931 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsQuickFixEngineeringPackage"
1932 }
1933 }
1934
1935 /// Contains information about a Windows application that is retrieved from the
1936 /// Windows Registry. For more information about these fields, see:
1937 /// <https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key>
1938 #[derive(Clone, Default, PartialEq)]
1939 #[non_exhaustive]
1940 pub struct WindowsApplication {
1941 /// The name of the application or product.
1942 pub display_name: std::string::String,
1943
1944 /// The version of the product or application in string format.
1945 pub display_version: std::string::String,
1946
1947 /// The name of the manufacturer for the product or application.
1948 pub publisher: std::string::String,
1949
1950 /// The last time this product received service. The value of this property
1951 /// is replaced each time a patch is applied or removed from the product or
1952 /// the command-line option is used to repair the product.
1953 pub install_date: std::option::Option<google_cloud_type::model::Date>,
1954
1955 /// The internet address for technical support.
1956 pub help_link: std::string::String,
1957
1958 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1959 }
1960
1961 impl WindowsApplication {
1962 /// Creates a new default instance.
1963 pub fn new() -> Self {
1964 std::default::Default::default()
1965 }
1966
1967 /// Sets the value of [display_name][crate::model::inventory::WindowsApplication::display_name].
1968 ///
1969 /// # Example
1970 /// ```ignore,no_run
1971 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
1972 /// let x = WindowsApplication::new().set_display_name("example");
1973 /// ```
1974 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
1975 mut self,
1976 v: T,
1977 ) -> Self {
1978 self.display_name = v.into();
1979 self
1980 }
1981
1982 /// Sets the value of [display_version][crate::model::inventory::WindowsApplication::display_version].
1983 ///
1984 /// # Example
1985 /// ```ignore,no_run
1986 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
1987 /// let x = WindowsApplication::new().set_display_version("example");
1988 /// ```
1989 pub fn set_display_version<T: std::convert::Into<std::string::String>>(
1990 mut self,
1991 v: T,
1992 ) -> Self {
1993 self.display_version = v.into();
1994 self
1995 }
1996
1997 /// Sets the value of [publisher][crate::model::inventory::WindowsApplication::publisher].
1998 ///
1999 /// # Example
2000 /// ```ignore,no_run
2001 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2002 /// let x = WindowsApplication::new().set_publisher("example");
2003 /// ```
2004 pub fn set_publisher<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2005 self.publisher = v.into();
2006 self
2007 }
2008
2009 /// Sets the value of [install_date][crate::model::inventory::WindowsApplication::install_date].
2010 ///
2011 /// # Example
2012 /// ```ignore,no_run
2013 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2014 /// use google_cloud_type::model::Date;
2015 /// let x = WindowsApplication::new().set_install_date(Date::default()/* use setters */);
2016 /// ```
2017 pub fn set_install_date<T>(mut self, v: T) -> Self
2018 where
2019 T: std::convert::Into<google_cloud_type::model::Date>,
2020 {
2021 self.install_date = std::option::Option::Some(v.into());
2022 self
2023 }
2024
2025 /// Sets or clears the value of [install_date][crate::model::inventory::WindowsApplication::install_date].
2026 ///
2027 /// # Example
2028 /// ```ignore,no_run
2029 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2030 /// use google_cloud_type::model::Date;
2031 /// let x = WindowsApplication::new().set_or_clear_install_date(Some(Date::default()/* use setters */));
2032 /// let x = WindowsApplication::new().set_or_clear_install_date(None::<Date>);
2033 /// ```
2034 pub fn set_or_clear_install_date<T>(mut self, v: std::option::Option<T>) -> Self
2035 where
2036 T: std::convert::Into<google_cloud_type::model::Date>,
2037 {
2038 self.install_date = v.map(|x| x.into());
2039 self
2040 }
2041
2042 /// Sets the value of [help_link][crate::model::inventory::WindowsApplication::help_link].
2043 ///
2044 /// # Example
2045 /// ```ignore,no_run
2046 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2047 /// let x = WindowsApplication::new().set_help_link("example");
2048 /// ```
2049 pub fn set_help_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2050 self.help_link = v.into();
2051 self
2052 }
2053 }
2054
2055 impl wkt::message::Message for WindowsApplication {
2056 fn typename() -> &'static str {
2057 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsApplication"
2058 }
2059 }
2060}
2061
2062/// A request message for getting inventory data for the specified VM.
2063#[derive(Clone, Default, PartialEq)]
2064#[non_exhaustive]
2065pub struct GetInventoryRequest {
2066 /// Required. API resource name for inventory resource.
2067 ///
2068 /// Format:
2069 /// `projects/{project}/locations/{location}/instances/{instance}/inventory`
2070 ///
2071 /// For `{project}`, either `project-number` or `project-id` can be provided.
2072 /// For `{instance}`, either Compute Engine `instance-id` or `instance-name`
2073 /// can be provided.
2074 pub name: std::string::String,
2075
2076 /// Inventory view indicating what information should be included in the
2077 /// inventory resource. If unspecified, the default view is BASIC.
2078 pub view: crate::model::InventoryView,
2079
2080 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2081}
2082
2083impl GetInventoryRequest {
2084 /// Creates a new default instance.
2085 pub fn new() -> Self {
2086 std::default::Default::default()
2087 }
2088
2089 /// Sets the value of [name][crate::model::GetInventoryRequest::name].
2090 ///
2091 /// # Example
2092 /// ```ignore,no_run
2093 /// # use google_cloud_osconfig_v1::model::GetInventoryRequest;
2094 /// let x = GetInventoryRequest::new().set_name("example");
2095 /// ```
2096 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2097 self.name = v.into();
2098 self
2099 }
2100
2101 /// Sets the value of [view][crate::model::GetInventoryRequest::view].
2102 ///
2103 /// # Example
2104 /// ```ignore,no_run
2105 /// # use google_cloud_osconfig_v1::model::GetInventoryRequest;
2106 /// use google_cloud_osconfig_v1::model::InventoryView;
2107 /// let x0 = GetInventoryRequest::new().set_view(InventoryView::Basic);
2108 /// let x1 = GetInventoryRequest::new().set_view(InventoryView::Full);
2109 /// ```
2110 pub fn set_view<T: std::convert::Into<crate::model::InventoryView>>(mut self, v: T) -> Self {
2111 self.view = v.into();
2112 self
2113 }
2114}
2115
2116impl wkt::message::Message for GetInventoryRequest {
2117 fn typename() -> &'static str {
2118 "type.googleapis.com/google.cloud.osconfig.v1.GetInventoryRequest"
2119 }
2120}
2121
2122/// A request message for listing inventory data for all VMs in the specified
2123/// location.
2124#[derive(Clone, Default, PartialEq)]
2125#[non_exhaustive]
2126pub struct ListInventoriesRequest {
2127 /// Required. The parent resource name.
2128 ///
2129 /// Format: `projects/{project}/locations/{location}/instances/-`
2130 ///
2131 /// For `{project}`, either `project-number` or `project-id` can be provided.
2132 pub parent: std::string::String,
2133
2134 /// Inventory view indicating what information should be included in the
2135 /// inventory resource. If unspecified, the default view is BASIC.
2136 pub view: crate::model::InventoryView,
2137
2138 /// The maximum number of results to return.
2139 pub page_size: i32,
2140
2141 /// A pagination token returned from a previous call to
2142 /// `ListInventories` that indicates where this listing
2143 /// should continue from.
2144 pub page_token: std::string::String,
2145
2146 /// If provided, this field specifies the criteria that must be met by a
2147 /// `Inventory` API resource to be included in the response.
2148 pub filter: std::string::String,
2149
2150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2151}
2152
2153impl ListInventoriesRequest {
2154 /// Creates a new default instance.
2155 pub fn new() -> Self {
2156 std::default::Default::default()
2157 }
2158
2159 /// Sets the value of [parent][crate::model::ListInventoriesRequest::parent].
2160 ///
2161 /// # Example
2162 /// ```ignore,no_run
2163 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2164 /// let x = ListInventoriesRequest::new().set_parent("example");
2165 /// ```
2166 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2167 self.parent = v.into();
2168 self
2169 }
2170
2171 /// Sets the value of [view][crate::model::ListInventoriesRequest::view].
2172 ///
2173 /// # Example
2174 /// ```ignore,no_run
2175 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2176 /// use google_cloud_osconfig_v1::model::InventoryView;
2177 /// let x0 = ListInventoriesRequest::new().set_view(InventoryView::Basic);
2178 /// let x1 = ListInventoriesRequest::new().set_view(InventoryView::Full);
2179 /// ```
2180 pub fn set_view<T: std::convert::Into<crate::model::InventoryView>>(mut self, v: T) -> Self {
2181 self.view = v.into();
2182 self
2183 }
2184
2185 /// Sets the value of [page_size][crate::model::ListInventoriesRequest::page_size].
2186 ///
2187 /// # Example
2188 /// ```ignore,no_run
2189 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2190 /// let x = ListInventoriesRequest::new().set_page_size(42);
2191 /// ```
2192 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2193 self.page_size = v.into();
2194 self
2195 }
2196
2197 /// Sets the value of [page_token][crate::model::ListInventoriesRequest::page_token].
2198 ///
2199 /// # Example
2200 /// ```ignore,no_run
2201 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2202 /// let x = ListInventoriesRequest::new().set_page_token("example");
2203 /// ```
2204 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2205 self.page_token = v.into();
2206 self
2207 }
2208
2209 /// Sets the value of [filter][crate::model::ListInventoriesRequest::filter].
2210 ///
2211 /// # Example
2212 /// ```ignore,no_run
2213 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2214 /// let x = ListInventoriesRequest::new().set_filter("example");
2215 /// ```
2216 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2217 self.filter = v.into();
2218 self
2219 }
2220}
2221
2222impl wkt::message::Message for ListInventoriesRequest {
2223 fn typename() -> &'static str {
2224 "type.googleapis.com/google.cloud.osconfig.v1.ListInventoriesRequest"
2225 }
2226}
2227
2228/// A response message for listing inventory data for all VMs in a specified
2229/// location.
2230#[derive(Clone, Default, PartialEq)]
2231#[non_exhaustive]
2232pub struct ListInventoriesResponse {
2233 /// List of inventory objects.
2234 pub inventories: std::vec::Vec<crate::model::Inventory>,
2235
2236 /// The pagination token to retrieve the next page of inventory objects.
2237 pub next_page_token: std::string::String,
2238
2239 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2240}
2241
2242impl ListInventoriesResponse {
2243 /// Creates a new default instance.
2244 pub fn new() -> Self {
2245 std::default::Default::default()
2246 }
2247
2248 /// Sets the value of [inventories][crate::model::ListInventoriesResponse::inventories].
2249 ///
2250 /// # Example
2251 /// ```ignore,no_run
2252 /// # use google_cloud_osconfig_v1::model::ListInventoriesResponse;
2253 /// use google_cloud_osconfig_v1::model::Inventory;
2254 /// let x = ListInventoriesResponse::new()
2255 /// .set_inventories([
2256 /// Inventory::default()/* use setters */,
2257 /// Inventory::default()/* use (different) setters */,
2258 /// ]);
2259 /// ```
2260 pub fn set_inventories<T, V>(mut self, v: T) -> Self
2261 where
2262 T: std::iter::IntoIterator<Item = V>,
2263 V: std::convert::Into<crate::model::Inventory>,
2264 {
2265 use std::iter::Iterator;
2266 self.inventories = v.into_iter().map(|i| i.into()).collect();
2267 self
2268 }
2269
2270 /// Sets the value of [next_page_token][crate::model::ListInventoriesResponse::next_page_token].
2271 ///
2272 /// # Example
2273 /// ```ignore,no_run
2274 /// # use google_cloud_osconfig_v1::model::ListInventoriesResponse;
2275 /// let x = ListInventoriesResponse::new().set_next_page_token("example");
2276 /// ```
2277 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2278 self.next_page_token = v.into();
2279 self
2280 }
2281}
2282
2283impl wkt::message::Message for ListInventoriesResponse {
2284 fn typename() -> &'static str {
2285 "type.googleapis.com/google.cloud.osconfig.v1.ListInventoriesResponse"
2286 }
2287}
2288
2289#[doc(hidden)]
2290impl google_cloud_gax::paginator::internal::PageableResponse for ListInventoriesResponse {
2291 type PageItem = crate::model::Inventory;
2292
2293 fn items(self) -> std::vec::Vec<Self::PageItem> {
2294 self.inventories
2295 }
2296
2297 fn next_page_token(&self) -> std::string::String {
2298 use std::clone::Clone;
2299 self.next_page_token.clone()
2300 }
2301}
2302
2303/// An OS policy defines the desired state configuration for a VM.
2304#[derive(Clone, Default, PartialEq)]
2305#[non_exhaustive]
2306pub struct OSPolicy {
2307 /// Required. The id of the OS policy with the following restrictions:
2308 ///
2309 /// * Must contain only lowercase letters, numbers, and hyphens.
2310 /// * Must start with a letter.
2311 /// * Must be between 1-63 characters.
2312 /// * Must end with a number or a letter.
2313 /// * Must be unique within the assignment.
2314 pub id: std::string::String,
2315
2316 /// Policy description.
2317 /// Length of the description is limited to 1024 characters.
2318 pub description: std::string::String,
2319
2320 /// Required. Policy mode
2321 pub mode: crate::model::os_policy::Mode,
2322
2323 /// Required. List of resource groups for the policy.
2324 /// For a particular VM, resource groups are evaluated in the order specified
2325 /// and the first resource group that is applicable is selected and the rest
2326 /// are ignored.
2327 ///
2328 /// If none of the resource groups are applicable for a VM, the VM is
2329 /// considered to be non-compliant w.r.t this policy. This behavior can be
2330 /// toggled by the flag `allow_no_resource_group_match`
2331 pub resource_groups: std::vec::Vec<crate::model::os_policy::ResourceGroup>,
2332
2333 /// This flag determines the OS policy compliance status when none of the
2334 /// resource groups within the policy are applicable for a VM. Set this value
2335 /// to `true` if the policy needs to be reported as compliant even if the
2336 /// policy has nothing to validate or enforce.
2337 pub allow_no_resource_group_match: bool,
2338
2339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2340}
2341
2342impl OSPolicy {
2343 /// Creates a new default instance.
2344 pub fn new() -> Self {
2345 std::default::Default::default()
2346 }
2347
2348 /// Sets the value of [id][crate::model::OSPolicy::id].
2349 ///
2350 /// # Example
2351 /// ```ignore,no_run
2352 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2353 /// let x = OSPolicy::new().set_id("example");
2354 /// ```
2355 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2356 self.id = v.into();
2357 self
2358 }
2359
2360 /// Sets the value of [description][crate::model::OSPolicy::description].
2361 ///
2362 /// # Example
2363 /// ```ignore,no_run
2364 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2365 /// let x = OSPolicy::new().set_description("example");
2366 /// ```
2367 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2368 self.description = v.into();
2369 self
2370 }
2371
2372 /// Sets the value of [mode][crate::model::OSPolicy::mode].
2373 ///
2374 /// # Example
2375 /// ```ignore,no_run
2376 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2377 /// use google_cloud_osconfig_v1::model::os_policy::Mode;
2378 /// let x0 = OSPolicy::new().set_mode(Mode::Validation);
2379 /// let x1 = OSPolicy::new().set_mode(Mode::Enforcement);
2380 /// ```
2381 pub fn set_mode<T: std::convert::Into<crate::model::os_policy::Mode>>(mut self, v: T) -> Self {
2382 self.mode = v.into();
2383 self
2384 }
2385
2386 /// Sets the value of [resource_groups][crate::model::OSPolicy::resource_groups].
2387 ///
2388 /// # Example
2389 /// ```ignore,no_run
2390 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2391 /// use google_cloud_osconfig_v1::model::os_policy::ResourceGroup;
2392 /// let x = OSPolicy::new()
2393 /// .set_resource_groups([
2394 /// ResourceGroup::default()/* use setters */,
2395 /// ResourceGroup::default()/* use (different) setters */,
2396 /// ]);
2397 /// ```
2398 pub fn set_resource_groups<T, V>(mut self, v: T) -> Self
2399 where
2400 T: std::iter::IntoIterator<Item = V>,
2401 V: std::convert::Into<crate::model::os_policy::ResourceGroup>,
2402 {
2403 use std::iter::Iterator;
2404 self.resource_groups = v.into_iter().map(|i| i.into()).collect();
2405 self
2406 }
2407
2408 /// Sets the value of [allow_no_resource_group_match][crate::model::OSPolicy::allow_no_resource_group_match].
2409 ///
2410 /// # Example
2411 /// ```ignore,no_run
2412 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2413 /// let x = OSPolicy::new().set_allow_no_resource_group_match(true);
2414 /// ```
2415 pub fn set_allow_no_resource_group_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2416 self.allow_no_resource_group_match = v.into();
2417 self
2418 }
2419}
2420
2421impl wkt::message::Message for OSPolicy {
2422 fn typename() -> &'static str {
2423 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy"
2424 }
2425}
2426
2427/// Defines additional types related to [OSPolicy].
2428pub mod os_policy {
2429 #[allow(unused_imports)]
2430 use super::*;
2431
2432 /// Filtering criteria to select VMs based on inventory details.
2433 #[derive(Clone, Default, PartialEq)]
2434 #[non_exhaustive]
2435 pub struct InventoryFilter {
2436 /// Required. The OS short name
2437 pub os_short_name: std::string::String,
2438
2439 /// The OS version
2440 ///
2441 /// Prefix matches are supported if asterisk(*) is provided as the
2442 /// last character. For example, to match all versions with a major
2443 /// version of `7`, specify the following value for this field `7.*`
2444 ///
2445 /// An empty string matches all OS versions.
2446 pub os_version: std::string::String,
2447
2448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2449 }
2450
2451 impl InventoryFilter {
2452 /// Creates a new default instance.
2453 pub fn new() -> Self {
2454 std::default::Default::default()
2455 }
2456
2457 /// Sets the value of [os_short_name][crate::model::os_policy::InventoryFilter::os_short_name].
2458 ///
2459 /// # Example
2460 /// ```ignore,no_run
2461 /// # use google_cloud_osconfig_v1::model::os_policy::InventoryFilter;
2462 /// let x = InventoryFilter::new().set_os_short_name("example");
2463 /// ```
2464 pub fn set_os_short_name<T: std::convert::Into<std::string::String>>(
2465 mut self,
2466 v: T,
2467 ) -> Self {
2468 self.os_short_name = v.into();
2469 self
2470 }
2471
2472 /// Sets the value of [os_version][crate::model::os_policy::InventoryFilter::os_version].
2473 ///
2474 /// # Example
2475 /// ```ignore,no_run
2476 /// # use google_cloud_osconfig_v1::model::os_policy::InventoryFilter;
2477 /// let x = InventoryFilter::new().set_os_version("example");
2478 /// ```
2479 pub fn set_os_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2480 self.os_version = v.into();
2481 self
2482 }
2483 }
2484
2485 impl wkt::message::Message for InventoryFilter {
2486 fn typename() -> &'static str {
2487 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.InventoryFilter"
2488 }
2489 }
2490
2491 /// An OS policy resource is used to define the desired state configuration
2492 /// and provides a specific functionality like installing/removing packages,
2493 /// executing a script etc.
2494 ///
2495 /// The system ensures that resources are always in their desired state by
2496 /// taking necessary actions if they have drifted from their desired state.
2497 #[derive(Clone, Default, PartialEq)]
2498 #[non_exhaustive]
2499 pub struct Resource {
2500 /// Required. The id of the resource with the following restrictions:
2501 ///
2502 /// * Must contain only lowercase letters, numbers, and hyphens.
2503 /// * Must start with a letter.
2504 /// * Must be between 1-63 characters.
2505 /// * Must end with a number or a letter.
2506 /// * Must be unique within the OS policy.
2507 pub id: std::string::String,
2508
2509 /// Resource type.
2510 pub resource_type: std::option::Option<crate::model::os_policy::resource::ResourceType>,
2511
2512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2513 }
2514
2515 impl Resource {
2516 /// Creates a new default instance.
2517 pub fn new() -> Self {
2518 std::default::Default::default()
2519 }
2520
2521 /// Sets the value of [id][crate::model::os_policy::Resource::id].
2522 ///
2523 /// # Example
2524 /// ```ignore,no_run
2525 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2526 /// let x = Resource::new().set_id("example");
2527 /// ```
2528 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2529 self.id = v.into();
2530 self
2531 }
2532
2533 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type].
2534 ///
2535 /// Note that all the setters affecting `resource_type` are mutually
2536 /// exclusive.
2537 ///
2538 /// # Example
2539 /// ```ignore,no_run
2540 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2541 /// use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
2542 /// let x = Resource::new().set_resource_type(Some(
2543 /// google_cloud_osconfig_v1::model::os_policy::resource::ResourceType::Pkg(PackageResource::default().into())));
2544 /// ```
2545 pub fn set_resource_type<
2546 T: std::convert::Into<
2547 std::option::Option<crate::model::os_policy::resource::ResourceType>,
2548 >,
2549 >(
2550 mut self,
2551 v: T,
2552 ) -> Self {
2553 self.resource_type = v.into();
2554 self
2555 }
2556
2557 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2558 /// if it holds a `Pkg`, `None` if the field is not set or
2559 /// holds a different branch.
2560 pub fn pkg(
2561 &self,
2562 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::PackageResource>>
2563 {
2564 #[allow(unreachable_patterns)]
2565 self.resource_type.as_ref().and_then(|v| match v {
2566 crate::model::os_policy::resource::ResourceType::Pkg(v) => {
2567 std::option::Option::Some(v)
2568 }
2569 _ => std::option::Option::None,
2570 })
2571 }
2572
2573 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2574 /// to hold a `Pkg`.
2575 ///
2576 /// Note that all the setters affecting `resource_type` are
2577 /// mutually exclusive.
2578 ///
2579 /// # Example
2580 /// ```ignore,no_run
2581 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2582 /// use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
2583 /// let x = Resource::new().set_pkg(PackageResource::default()/* use setters */);
2584 /// assert!(x.pkg().is_some());
2585 /// assert!(x.repository().is_none());
2586 /// assert!(x.exec().is_none());
2587 /// assert!(x.file().is_none());
2588 /// ```
2589 pub fn set_pkg<
2590 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::PackageResource>>,
2591 >(
2592 mut self,
2593 v: T,
2594 ) -> Self {
2595 self.resource_type = std::option::Option::Some(
2596 crate::model::os_policy::resource::ResourceType::Pkg(v.into()),
2597 );
2598 self
2599 }
2600
2601 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2602 /// if it holds a `Repository`, `None` if the field is not set or
2603 /// holds a different branch.
2604 pub fn repository(
2605 &self,
2606 ) -> std::option::Option<
2607 &std::boxed::Box<crate::model::os_policy::resource::RepositoryResource>,
2608 > {
2609 #[allow(unreachable_patterns)]
2610 self.resource_type.as_ref().and_then(|v| match v {
2611 crate::model::os_policy::resource::ResourceType::Repository(v) => {
2612 std::option::Option::Some(v)
2613 }
2614 _ => std::option::Option::None,
2615 })
2616 }
2617
2618 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2619 /// to hold a `Repository`.
2620 ///
2621 /// Note that all the setters affecting `resource_type` are
2622 /// mutually exclusive.
2623 ///
2624 /// # Example
2625 /// ```ignore,no_run
2626 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2627 /// use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
2628 /// let x = Resource::new().set_repository(RepositoryResource::default()/* use setters */);
2629 /// assert!(x.repository().is_some());
2630 /// assert!(x.pkg().is_none());
2631 /// assert!(x.exec().is_none());
2632 /// assert!(x.file().is_none());
2633 /// ```
2634 pub fn set_repository<
2635 T: std::convert::Into<
2636 std::boxed::Box<crate::model::os_policy::resource::RepositoryResource>,
2637 >,
2638 >(
2639 mut self,
2640 v: T,
2641 ) -> Self {
2642 self.resource_type = std::option::Option::Some(
2643 crate::model::os_policy::resource::ResourceType::Repository(v.into()),
2644 );
2645 self
2646 }
2647
2648 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2649 /// if it holds a `Exec`, `None` if the field is not set or
2650 /// holds a different branch.
2651 pub fn exec(
2652 &self,
2653 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::ExecResource>>
2654 {
2655 #[allow(unreachable_patterns)]
2656 self.resource_type.as_ref().and_then(|v| match v {
2657 crate::model::os_policy::resource::ResourceType::Exec(v) => {
2658 std::option::Option::Some(v)
2659 }
2660 _ => std::option::Option::None,
2661 })
2662 }
2663
2664 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2665 /// to hold a `Exec`.
2666 ///
2667 /// Note that all the setters affecting `resource_type` are
2668 /// mutually exclusive.
2669 ///
2670 /// # Example
2671 /// ```ignore,no_run
2672 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2673 /// use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
2674 /// let x = Resource::new().set_exec(ExecResource::default()/* use setters */);
2675 /// assert!(x.exec().is_some());
2676 /// assert!(x.pkg().is_none());
2677 /// assert!(x.repository().is_none());
2678 /// assert!(x.file().is_none());
2679 /// ```
2680 pub fn set_exec<
2681 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::ExecResource>>,
2682 >(
2683 mut self,
2684 v: T,
2685 ) -> Self {
2686 self.resource_type = std::option::Option::Some(
2687 crate::model::os_policy::resource::ResourceType::Exec(v.into()),
2688 );
2689 self
2690 }
2691
2692 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2693 /// if it holds a `File`, `None` if the field is not set or
2694 /// holds a different branch.
2695 pub fn file(
2696 &self,
2697 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::FileResource>>
2698 {
2699 #[allow(unreachable_patterns)]
2700 self.resource_type.as_ref().and_then(|v| match v {
2701 crate::model::os_policy::resource::ResourceType::File(v) => {
2702 std::option::Option::Some(v)
2703 }
2704 _ => std::option::Option::None,
2705 })
2706 }
2707
2708 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2709 /// to hold a `File`.
2710 ///
2711 /// Note that all the setters affecting `resource_type` are
2712 /// mutually exclusive.
2713 ///
2714 /// # Example
2715 /// ```ignore,no_run
2716 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2717 /// use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
2718 /// let x = Resource::new().set_file(FileResource::default()/* use setters */);
2719 /// assert!(x.file().is_some());
2720 /// assert!(x.pkg().is_none());
2721 /// assert!(x.repository().is_none());
2722 /// assert!(x.exec().is_none());
2723 /// ```
2724 pub fn set_file<
2725 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::FileResource>>,
2726 >(
2727 mut self,
2728 v: T,
2729 ) -> Self {
2730 self.resource_type = std::option::Option::Some(
2731 crate::model::os_policy::resource::ResourceType::File(v.into()),
2732 );
2733 self
2734 }
2735 }
2736
2737 impl wkt::message::Message for Resource {
2738 fn typename() -> &'static str {
2739 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource"
2740 }
2741 }
2742
2743 /// Defines additional types related to [Resource].
2744 pub mod resource {
2745 #[allow(unused_imports)]
2746 use super::*;
2747
2748 /// A remote or local file.
2749 #[derive(Clone, Default, PartialEq)]
2750 #[non_exhaustive]
2751 pub struct File {
2752 /// Defaults to false. When false, files are subject to validations
2753 /// based on the file type:
2754 ///
2755 /// Remote: A checksum must be specified.
2756 /// Cloud Storage: An object generation number must be specified.
2757 pub allow_insecure: bool,
2758
2759 /// A specific type of file.
2760 pub r#type: std::option::Option<crate::model::os_policy::resource::file::Type>,
2761
2762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2763 }
2764
2765 impl File {
2766 /// Creates a new default instance.
2767 pub fn new() -> Self {
2768 std::default::Default::default()
2769 }
2770
2771 /// Sets the value of [allow_insecure][crate::model::os_policy::resource::File::allow_insecure].
2772 ///
2773 /// # Example
2774 /// ```ignore,no_run
2775 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2776 /// let x = File::new().set_allow_insecure(true);
2777 /// ```
2778 pub fn set_allow_insecure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2779 self.allow_insecure = v.into();
2780 self
2781 }
2782
2783 /// Sets the value of [r#type][crate::model::os_policy::resource::File::type].
2784 ///
2785 /// Note that all the setters affecting `r#type` are mutually
2786 /// exclusive.
2787 ///
2788 /// # Example
2789 /// ```ignore,no_run
2790 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2791 /// use google_cloud_osconfig_v1::model::os_policy::resource::file::Type;
2792 /// let x = File::new().set_type(Some(Type::LocalPath("example".to_string())));
2793 /// ```
2794 pub fn set_type<
2795 T: std::convert::Into<
2796 std::option::Option<crate::model::os_policy::resource::file::Type>,
2797 >,
2798 >(
2799 mut self,
2800 v: T,
2801 ) -> Self {
2802 self.r#type = v.into();
2803 self
2804 }
2805
2806 /// The value of [r#type][crate::model::os_policy::resource::File::r#type]
2807 /// if it holds a `Remote`, `None` if the field is not set or
2808 /// holds a different branch.
2809 pub fn remote(
2810 &self,
2811 ) -> std::option::Option<
2812 &std::boxed::Box<crate::model::os_policy::resource::file::Remote>,
2813 > {
2814 #[allow(unreachable_patterns)]
2815 self.r#type.as_ref().and_then(|v| match v {
2816 crate::model::os_policy::resource::file::Type::Remote(v) => {
2817 std::option::Option::Some(v)
2818 }
2819 _ => std::option::Option::None,
2820 })
2821 }
2822
2823 /// Sets the value of [r#type][crate::model::os_policy::resource::File::r#type]
2824 /// to hold a `Remote`.
2825 ///
2826 /// Note that all the setters affecting `r#type` are
2827 /// mutually exclusive.
2828 ///
2829 /// # Example
2830 /// ```ignore,no_run
2831 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2832 /// use google_cloud_osconfig_v1::model::os_policy::resource::file::Remote;
2833 /// let x = File::new().set_remote(Remote::default()/* use setters */);
2834 /// assert!(x.remote().is_some());
2835 /// assert!(x.gcs().is_none());
2836 /// assert!(x.local_path().is_none());
2837 /// ```
2838 pub fn set_remote<
2839 T: std::convert::Into<
2840 std::boxed::Box<crate::model::os_policy::resource::file::Remote>,
2841 >,
2842 >(
2843 mut self,
2844 v: T,
2845 ) -> Self {
2846 self.r#type = std::option::Option::Some(
2847 crate::model::os_policy::resource::file::Type::Remote(v.into()),
2848 );
2849 self
2850 }
2851
2852 /// The value of [r#type][crate::model::os_policy::resource::File::r#type]
2853 /// if it holds a `Gcs`, `None` if the field is not set or
2854 /// holds a different branch.
2855 pub fn gcs(
2856 &self,
2857 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::file::Gcs>>
2858 {
2859 #[allow(unreachable_patterns)]
2860 self.r#type.as_ref().and_then(|v| match v {
2861 crate::model::os_policy::resource::file::Type::Gcs(v) => {
2862 std::option::Option::Some(v)
2863 }
2864 _ => std::option::Option::None,
2865 })
2866 }
2867
2868 /// Sets the value of [r#type][crate::model::os_policy::resource::File::r#type]
2869 /// to hold a `Gcs`.
2870 ///
2871 /// Note that all the setters affecting `r#type` are
2872 /// mutually exclusive.
2873 ///
2874 /// # Example
2875 /// ```ignore,no_run
2876 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2877 /// use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
2878 /// let x = File::new().set_gcs(Gcs::default()/* use setters */);
2879 /// assert!(x.gcs().is_some());
2880 /// assert!(x.remote().is_none());
2881 /// assert!(x.local_path().is_none());
2882 /// ```
2883 pub fn set_gcs<
2884 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::file::Gcs>>,
2885 >(
2886 mut self,
2887 v: T,
2888 ) -> Self {
2889 self.r#type = std::option::Option::Some(
2890 crate::model::os_policy::resource::file::Type::Gcs(v.into()),
2891 );
2892 self
2893 }
2894
2895 /// The value of [r#type][crate::model::os_policy::resource::File::r#type]
2896 /// if it holds a `LocalPath`, `None` if the field is not set or
2897 /// holds a different branch.
2898 pub fn local_path(&self) -> std::option::Option<&std::string::String> {
2899 #[allow(unreachable_patterns)]
2900 self.r#type.as_ref().and_then(|v| match v {
2901 crate::model::os_policy::resource::file::Type::LocalPath(v) => {
2902 std::option::Option::Some(v)
2903 }
2904 _ => std::option::Option::None,
2905 })
2906 }
2907
2908 /// Sets the value of [r#type][crate::model::os_policy::resource::File::r#type]
2909 /// to hold a `LocalPath`.
2910 ///
2911 /// Note that all the setters affecting `r#type` are
2912 /// mutually exclusive.
2913 ///
2914 /// # Example
2915 /// ```ignore,no_run
2916 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2917 /// let x = File::new().set_local_path("example");
2918 /// assert!(x.local_path().is_some());
2919 /// assert!(x.remote().is_none());
2920 /// assert!(x.gcs().is_none());
2921 /// ```
2922 pub fn set_local_path<T: std::convert::Into<std::string::String>>(
2923 mut self,
2924 v: T,
2925 ) -> Self {
2926 self.r#type = std::option::Option::Some(
2927 crate::model::os_policy::resource::file::Type::LocalPath(v.into()),
2928 );
2929 self
2930 }
2931 }
2932
2933 impl wkt::message::Message for File {
2934 fn typename() -> &'static str {
2935 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.File"
2936 }
2937 }
2938
2939 /// Defines additional types related to [File].
2940 pub mod file {
2941 #[allow(unused_imports)]
2942 use super::*;
2943
2944 /// Specifies a file available via some URI.
2945 #[derive(Clone, Default, PartialEq)]
2946 #[non_exhaustive]
2947 pub struct Remote {
2948 /// Required. URI from which to fetch the object. It should contain both
2949 /// the protocol and path following the format `{protocol}://{location}`.
2950 pub uri: std::string::String,
2951
2952 /// SHA256 checksum of the remote file.
2953 pub sha256_checksum: std::string::String,
2954
2955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2956 }
2957
2958 impl Remote {
2959 /// Creates a new default instance.
2960 pub fn new() -> Self {
2961 std::default::Default::default()
2962 }
2963
2964 /// Sets the value of [uri][crate::model::os_policy::resource::file::Remote::uri].
2965 ///
2966 /// # Example
2967 /// ```ignore,no_run
2968 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Remote;
2969 /// let x = Remote::new().set_uri("example");
2970 /// ```
2971 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2972 self.uri = v.into();
2973 self
2974 }
2975
2976 /// Sets the value of [sha256_checksum][crate::model::os_policy::resource::file::Remote::sha256_checksum].
2977 ///
2978 /// # Example
2979 /// ```ignore,no_run
2980 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Remote;
2981 /// let x = Remote::new().set_sha256_checksum("example");
2982 /// ```
2983 pub fn set_sha256_checksum<T: std::convert::Into<std::string::String>>(
2984 mut self,
2985 v: T,
2986 ) -> Self {
2987 self.sha256_checksum = v.into();
2988 self
2989 }
2990 }
2991
2992 impl wkt::message::Message for Remote {
2993 fn typename() -> &'static str {
2994 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.File.Remote"
2995 }
2996 }
2997
2998 /// Specifies a file available as a Cloud Storage Object.
2999 #[derive(Clone, Default, PartialEq)]
3000 #[non_exhaustive]
3001 pub struct Gcs {
3002 /// Required. Bucket of the Cloud Storage object.
3003 pub bucket: std::string::String,
3004
3005 /// Required. Name of the Cloud Storage object.
3006 pub object: std::string::String,
3007
3008 /// Generation number of the Cloud Storage object.
3009 pub generation: i64,
3010
3011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3012 }
3013
3014 impl Gcs {
3015 /// Creates a new default instance.
3016 pub fn new() -> Self {
3017 std::default::Default::default()
3018 }
3019
3020 /// Sets the value of [bucket][crate::model::os_policy::resource::file::Gcs::bucket].
3021 ///
3022 /// # Example
3023 /// ```ignore,no_run
3024 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
3025 /// let x = Gcs::new().set_bucket("example");
3026 /// ```
3027 pub fn set_bucket<T: std::convert::Into<std::string::String>>(
3028 mut self,
3029 v: T,
3030 ) -> Self {
3031 self.bucket = v.into();
3032 self
3033 }
3034
3035 /// Sets the value of [object][crate::model::os_policy::resource::file::Gcs::object].
3036 ///
3037 /// # Example
3038 /// ```ignore,no_run
3039 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
3040 /// let x = Gcs::new().set_object("example");
3041 /// ```
3042 pub fn set_object<T: std::convert::Into<std::string::String>>(
3043 mut self,
3044 v: T,
3045 ) -> Self {
3046 self.object = v.into();
3047 self
3048 }
3049
3050 /// Sets the value of [generation][crate::model::os_policy::resource::file::Gcs::generation].
3051 ///
3052 /// # Example
3053 /// ```ignore,no_run
3054 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
3055 /// let x = Gcs::new().set_generation(42);
3056 /// ```
3057 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3058 self.generation = v.into();
3059 self
3060 }
3061 }
3062
3063 impl wkt::message::Message for Gcs {
3064 fn typename() -> &'static str {
3065 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.File.Gcs"
3066 }
3067 }
3068
3069 /// A specific type of file.
3070 #[derive(Clone, Debug, PartialEq)]
3071 #[non_exhaustive]
3072 pub enum Type {
3073 /// A generic remote file.
3074 Remote(std::boxed::Box<crate::model::os_policy::resource::file::Remote>),
3075 /// A Cloud Storage object.
3076 Gcs(std::boxed::Box<crate::model::os_policy::resource::file::Gcs>),
3077 /// A local path within the VM to use.
3078 LocalPath(std::string::String),
3079 }
3080 }
3081
3082 /// A resource that manages a system package.
3083 #[derive(Clone, Default, PartialEq)]
3084 #[non_exhaustive]
3085 pub struct PackageResource {
3086 /// Required. The desired state the agent should maintain for this package.
3087 pub desired_state: crate::model::os_policy::resource::package_resource::DesiredState,
3088
3089 /// A system package.
3090 pub system_package: std::option::Option<
3091 crate::model::os_policy::resource::package_resource::SystemPackage,
3092 >,
3093
3094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3095 }
3096
3097 impl PackageResource {
3098 /// Creates a new default instance.
3099 pub fn new() -> Self {
3100 std::default::Default::default()
3101 }
3102
3103 /// Sets the value of [desired_state][crate::model::os_policy::resource::PackageResource::desired_state].
3104 ///
3105 /// # Example
3106 /// ```ignore,no_run
3107 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3108 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::DesiredState;
3109 /// let x0 = PackageResource::new().set_desired_state(DesiredState::Installed);
3110 /// let x1 = PackageResource::new().set_desired_state(DesiredState::Removed);
3111 /// ```
3112 pub fn set_desired_state<
3113 T: std::convert::Into<
3114 crate::model::os_policy::resource::package_resource::DesiredState,
3115 >,
3116 >(
3117 mut self,
3118 v: T,
3119 ) -> Self {
3120 self.desired_state = v.into();
3121 self
3122 }
3123
3124 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package].
3125 ///
3126 /// Note that all the setters affecting `system_package` are mutually
3127 /// exclusive.
3128 ///
3129 /// # Example
3130 /// ```ignore,no_run
3131 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3132 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Apt;
3133 /// let x = PackageResource::new().set_system_package(Some(
3134 /// google_cloud_osconfig_v1::model::os_policy::resource::package_resource::SystemPackage::Apt(Apt::default().into())));
3135 /// ```
3136 pub fn set_system_package<
3137 T: std::convert::Into<
3138 std::option::Option<
3139 crate::model::os_policy::resource::package_resource::SystemPackage,
3140 >,
3141 >,
3142 >(
3143 mut self,
3144 v: T,
3145 ) -> Self {
3146 self.system_package = v.into();
3147 self
3148 }
3149
3150 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3151 /// if it holds a `Apt`, `None` if the field is not set or
3152 /// holds a different branch.
3153 pub fn apt(
3154 &self,
3155 ) -> std::option::Option<
3156 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Apt>,
3157 > {
3158 #[allow(unreachable_patterns)]
3159 self.system_package.as_ref().and_then(|v| match v {
3160 crate::model::os_policy::resource::package_resource::SystemPackage::Apt(v) => {
3161 std::option::Option::Some(v)
3162 }
3163 _ => std::option::Option::None,
3164 })
3165 }
3166
3167 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3168 /// to hold a `Apt`.
3169 ///
3170 /// Note that all the setters affecting `system_package` are
3171 /// mutually exclusive.
3172 ///
3173 /// # Example
3174 /// ```ignore,no_run
3175 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3176 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Apt;
3177 /// let x = PackageResource::new().set_apt(Apt::default()/* use setters */);
3178 /// assert!(x.apt().is_some());
3179 /// assert!(x.deb().is_none());
3180 /// assert!(x.yum().is_none());
3181 /// assert!(x.zypper().is_none());
3182 /// assert!(x.rpm().is_none());
3183 /// assert!(x.googet().is_none());
3184 /// assert!(x.msi().is_none());
3185 /// ```
3186 pub fn set_apt<
3187 T: std::convert::Into<
3188 std::boxed::Box<crate::model::os_policy::resource::package_resource::Apt>,
3189 >,
3190 >(
3191 mut self,
3192 v: T,
3193 ) -> Self {
3194 self.system_package = std::option::Option::Some(
3195 crate::model::os_policy::resource::package_resource::SystemPackage::Apt(
3196 v.into(),
3197 ),
3198 );
3199 self
3200 }
3201
3202 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3203 /// if it holds a `Deb`, `None` if the field is not set or
3204 /// holds a different branch.
3205 pub fn deb(
3206 &self,
3207 ) -> std::option::Option<
3208 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Deb>,
3209 > {
3210 #[allow(unreachable_patterns)]
3211 self.system_package.as_ref().and_then(|v| match v {
3212 crate::model::os_policy::resource::package_resource::SystemPackage::Deb(v) => {
3213 std::option::Option::Some(v)
3214 }
3215 _ => std::option::Option::None,
3216 })
3217 }
3218
3219 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3220 /// to hold a `Deb`.
3221 ///
3222 /// Note that all the setters affecting `system_package` are
3223 /// mutually exclusive.
3224 ///
3225 /// # Example
3226 /// ```ignore,no_run
3227 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3228 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3229 /// let x = PackageResource::new().set_deb(Deb::default()/* use setters */);
3230 /// assert!(x.deb().is_some());
3231 /// assert!(x.apt().is_none());
3232 /// assert!(x.yum().is_none());
3233 /// assert!(x.zypper().is_none());
3234 /// assert!(x.rpm().is_none());
3235 /// assert!(x.googet().is_none());
3236 /// assert!(x.msi().is_none());
3237 /// ```
3238 pub fn set_deb<
3239 T: std::convert::Into<
3240 std::boxed::Box<crate::model::os_policy::resource::package_resource::Deb>,
3241 >,
3242 >(
3243 mut self,
3244 v: T,
3245 ) -> Self {
3246 self.system_package = std::option::Option::Some(
3247 crate::model::os_policy::resource::package_resource::SystemPackage::Deb(
3248 v.into(),
3249 ),
3250 );
3251 self
3252 }
3253
3254 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3255 /// if it holds a `Yum`, `None` if the field is not set or
3256 /// holds a different branch.
3257 pub fn yum(
3258 &self,
3259 ) -> std::option::Option<
3260 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Yum>,
3261 > {
3262 #[allow(unreachable_patterns)]
3263 self.system_package.as_ref().and_then(|v| match v {
3264 crate::model::os_policy::resource::package_resource::SystemPackage::Yum(v) => {
3265 std::option::Option::Some(v)
3266 }
3267 _ => std::option::Option::None,
3268 })
3269 }
3270
3271 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3272 /// to hold a `Yum`.
3273 ///
3274 /// Note that all the setters affecting `system_package` are
3275 /// mutually exclusive.
3276 ///
3277 /// # Example
3278 /// ```ignore,no_run
3279 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3280 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Yum;
3281 /// let x = PackageResource::new().set_yum(Yum::default()/* use setters */);
3282 /// assert!(x.yum().is_some());
3283 /// assert!(x.apt().is_none());
3284 /// assert!(x.deb().is_none());
3285 /// assert!(x.zypper().is_none());
3286 /// assert!(x.rpm().is_none());
3287 /// assert!(x.googet().is_none());
3288 /// assert!(x.msi().is_none());
3289 /// ```
3290 pub fn set_yum<
3291 T: std::convert::Into<
3292 std::boxed::Box<crate::model::os_policy::resource::package_resource::Yum>,
3293 >,
3294 >(
3295 mut self,
3296 v: T,
3297 ) -> Self {
3298 self.system_package = std::option::Option::Some(
3299 crate::model::os_policy::resource::package_resource::SystemPackage::Yum(
3300 v.into(),
3301 ),
3302 );
3303 self
3304 }
3305
3306 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3307 /// if it holds a `Zypper`, `None` if the field is not set or
3308 /// holds a different branch.
3309 pub fn zypper(
3310 &self,
3311 ) -> std::option::Option<
3312 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Zypper>,
3313 > {
3314 #[allow(unreachable_patterns)]
3315 self.system_package.as_ref().and_then(|v| match v {
3316 crate::model::os_policy::resource::package_resource::SystemPackage::Zypper(
3317 v,
3318 ) => std::option::Option::Some(v),
3319 _ => std::option::Option::None,
3320 })
3321 }
3322
3323 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3324 /// to hold a `Zypper`.
3325 ///
3326 /// Note that all the setters affecting `system_package` are
3327 /// mutually exclusive.
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3332 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Zypper;
3333 /// let x = PackageResource::new().set_zypper(Zypper::default()/* use setters */);
3334 /// assert!(x.zypper().is_some());
3335 /// assert!(x.apt().is_none());
3336 /// assert!(x.deb().is_none());
3337 /// assert!(x.yum().is_none());
3338 /// assert!(x.rpm().is_none());
3339 /// assert!(x.googet().is_none());
3340 /// assert!(x.msi().is_none());
3341 /// ```
3342 pub fn set_zypper<
3343 T: std::convert::Into<
3344 std::boxed::Box<
3345 crate::model::os_policy::resource::package_resource::Zypper,
3346 >,
3347 >,
3348 >(
3349 mut self,
3350 v: T,
3351 ) -> Self {
3352 self.system_package = std::option::Option::Some(
3353 crate::model::os_policy::resource::package_resource::SystemPackage::Zypper(
3354 v.into(),
3355 ),
3356 );
3357 self
3358 }
3359
3360 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3361 /// if it holds a `Rpm`, `None` if the field is not set or
3362 /// holds a different branch.
3363 pub fn rpm(
3364 &self,
3365 ) -> std::option::Option<
3366 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Rpm>,
3367 > {
3368 #[allow(unreachable_patterns)]
3369 self.system_package.as_ref().and_then(|v| match v {
3370 crate::model::os_policy::resource::package_resource::SystemPackage::Rpm(v) => {
3371 std::option::Option::Some(v)
3372 }
3373 _ => std::option::Option::None,
3374 })
3375 }
3376
3377 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3378 /// to hold a `Rpm`.
3379 ///
3380 /// Note that all the setters affecting `system_package` are
3381 /// mutually exclusive.
3382 ///
3383 /// # Example
3384 /// ```ignore,no_run
3385 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3386 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3387 /// let x = PackageResource::new().set_rpm(Rpm::default()/* use setters */);
3388 /// assert!(x.rpm().is_some());
3389 /// assert!(x.apt().is_none());
3390 /// assert!(x.deb().is_none());
3391 /// assert!(x.yum().is_none());
3392 /// assert!(x.zypper().is_none());
3393 /// assert!(x.googet().is_none());
3394 /// assert!(x.msi().is_none());
3395 /// ```
3396 pub fn set_rpm<
3397 T: std::convert::Into<
3398 std::boxed::Box<crate::model::os_policy::resource::package_resource::Rpm>,
3399 >,
3400 >(
3401 mut self,
3402 v: T,
3403 ) -> Self {
3404 self.system_package = std::option::Option::Some(
3405 crate::model::os_policy::resource::package_resource::SystemPackage::Rpm(
3406 v.into(),
3407 ),
3408 );
3409 self
3410 }
3411
3412 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3413 /// if it holds a `Googet`, `None` if the field is not set or
3414 /// holds a different branch.
3415 pub fn googet(
3416 &self,
3417 ) -> std::option::Option<
3418 &std::boxed::Box<crate::model::os_policy::resource::package_resource::GooGet>,
3419 > {
3420 #[allow(unreachable_patterns)]
3421 self.system_package.as_ref().and_then(|v| match v {
3422 crate::model::os_policy::resource::package_resource::SystemPackage::Googet(
3423 v,
3424 ) => std::option::Option::Some(v),
3425 _ => std::option::Option::None,
3426 })
3427 }
3428
3429 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3430 /// to hold a `Googet`.
3431 ///
3432 /// Note that all the setters affecting `system_package` are
3433 /// mutually exclusive.
3434 ///
3435 /// # Example
3436 /// ```ignore,no_run
3437 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3438 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::GooGet;
3439 /// let x = PackageResource::new().set_googet(GooGet::default()/* use setters */);
3440 /// assert!(x.googet().is_some());
3441 /// assert!(x.apt().is_none());
3442 /// assert!(x.deb().is_none());
3443 /// assert!(x.yum().is_none());
3444 /// assert!(x.zypper().is_none());
3445 /// assert!(x.rpm().is_none());
3446 /// assert!(x.msi().is_none());
3447 /// ```
3448 pub fn set_googet<
3449 T: std::convert::Into<
3450 std::boxed::Box<
3451 crate::model::os_policy::resource::package_resource::GooGet,
3452 >,
3453 >,
3454 >(
3455 mut self,
3456 v: T,
3457 ) -> Self {
3458 self.system_package = std::option::Option::Some(
3459 crate::model::os_policy::resource::package_resource::SystemPackage::Googet(
3460 v.into(),
3461 ),
3462 );
3463 self
3464 }
3465
3466 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3467 /// if it holds a `Msi`, `None` if the field is not set or
3468 /// holds a different branch.
3469 pub fn msi(
3470 &self,
3471 ) -> std::option::Option<
3472 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Msi>,
3473 > {
3474 #[allow(unreachable_patterns)]
3475 self.system_package.as_ref().and_then(|v| match v {
3476 crate::model::os_policy::resource::package_resource::SystemPackage::Msi(v) => {
3477 std::option::Option::Some(v)
3478 }
3479 _ => std::option::Option::None,
3480 })
3481 }
3482
3483 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3484 /// to hold a `Msi`.
3485 ///
3486 /// Note that all the setters affecting `system_package` are
3487 /// mutually exclusive.
3488 ///
3489 /// # Example
3490 /// ```ignore,no_run
3491 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3492 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3493 /// let x = PackageResource::new().set_msi(Msi::default()/* use setters */);
3494 /// assert!(x.msi().is_some());
3495 /// assert!(x.apt().is_none());
3496 /// assert!(x.deb().is_none());
3497 /// assert!(x.yum().is_none());
3498 /// assert!(x.zypper().is_none());
3499 /// assert!(x.rpm().is_none());
3500 /// assert!(x.googet().is_none());
3501 /// ```
3502 pub fn set_msi<
3503 T: std::convert::Into<
3504 std::boxed::Box<crate::model::os_policy::resource::package_resource::Msi>,
3505 >,
3506 >(
3507 mut self,
3508 v: T,
3509 ) -> Self {
3510 self.system_package = std::option::Option::Some(
3511 crate::model::os_policy::resource::package_resource::SystemPackage::Msi(
3512 v.into(),
3513 ),
3514 );
3515 self
3516 }
3517 }
3518
3519 impl wkt::message::Message for PackageResource {
3520 fn typename() -> &'static str {
3521 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource"
3522 }
3523 }
3524
3525 /// Defines additional types related to [PackageResource].
3526 pub mod package_resource {
3527 #[allow(unused_imports)]
3528 use super::*;
3529
3530 /// A deb package file. dpkg packages only support INSTALLED state.
3531 #[derive(Clone, Default, PartialEq)]
3532 #[non_exhaustive]
3533 pub struct Deb {
3534 /// Required. A deb package.
3535 pub source: std::option::Option<crate::model::os_policy::resource::File>,
3536
3537 /// Whether dependencies should also be installed.
3538 ///
3539 /// - install when false: `dpkg -i package`
3540 /// - install when true: `apt-get update && apt-get -y install
3541 /// package.deb`
3542 pub pull_deps: bool,
3543
3544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3545 }
3546
3547 impl Deb {
3548 /// Creates a new default instance.
3549 pub fn new() -> Self {
3550 std::default::Default::default()
3551 }
3552
3553 /// Sets the value of [source][crate::model::os_policy::resource::package_resource::Deb::source].
3554 ///
3555 /// # Example
3556 /// ```ignore,no_run
3557 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3558 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3559 /// let x = Deb::new().set_source(File::default()/* use setters */);
3560 /// ```
3561 pub fn set_source<T>(mut self, v: T) -> Self
3562 where
3563 T: std::convert::Into<crate::model::os_policy::resource::File>,
3564 {
3565 self.source = std::option::Option::Some(v.into());
3566 self
3567 }
3568
3569 /// Sets or clears the value of [source][crate::model::os_policy::resource::package_resource::Deb::source].
3570 ///
3571 /// # Example
3572 /// ```ignore,no_run
3573 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3574 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3575 /// let x = Deb::new().set_or_clear_source(Some(File::default()/* use setters */));
3576 /// let x = Deb::new().set_or_clear_source(None::<File>);
3577 /// ```
3578 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3579 where
3580 T: std::convert::Into<crate::model::os_policy::resource::File>,
3581 {
3582 self.source = v.map(|x| x.into());
3583 self
3584 }
3585
3586 /// Sets the value of [pull_deps][crate::model::os_policy::resource::package_resource::Deb::pull_deps].
3587 ///
3588 /// # Example
3589 /// ```ignore,no_run
3590 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3591 /// let x = Deb::new().set_pull_deps(true);
3592 /// ```
3593 pub fn set_pull_deps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3594 self.pull_deps = v.into();
3595 self
3596 }
3597 }
3598
3599 impl wkt::message::Message for Deb {
3600 fn typename() -> &'static str {
3601 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.Deb"
3602 }
3603 }
3604
3605 /// A package managed by APT.
3606 ///
3607 /// - install: `apt-get update && apt-get -y install [name]`
3608 /// - remove: `apt-get -y remove [name]`
3609 #[derive(Clone, Default, PartialEq)]
3610 #[non_exhaustive]
3611 pub struct Apt {
3612 /// Required. Package name.
3613 pub name: std::string::String,
3614
3615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3616 }
3617
3618 impl Apt {
3619 /// Creates a new default instance.
3620 pub fn new() -> Self {
3621 std::default::Default::default()
3622 }
3623
3624 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::Apt::name].
3625 ///
3626 /// # Example
3627 /// ```ignore,no_run
3628 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Apt;
3629 /// let x = Apt::new().set_name("example");
3630 /// ```
3631 pub fn set_name<T: std::convert::Into<std::string::String>>(
3632 mut self,
3633 v: T,
3634 ) -> Self {
3635 self.name = v.into();
3636 self
3637 }
3638 }
3639
3640 impl wkt::message::Message for Apt {
3641 fn typename() -> &'static str {
3642 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.APT"
3643 }
3644 }
3645
3646 /// An RPM package file. RPM packages only support INSTALLED state.
3647 #[derive(Clone, Default, PartialEq)]
3648 #[non_exhaustive]
3649 pub struct Rpm {
3650 /// Required. An rpm package.
3651 pub source: std::option::Option<crate::model::os_policy::resource::File>,
3652
3653 /// Whether dependencies should also be installed.
3654 ///
3655 /// - install when false: `rpm --upgrade --replacepkgs package.rpm`
3656 /// - install when true: `yum -y install package.rpm` or
3657 /// `zypper -y install package.rpm`
3658 pub pull_deps: bool,
3659
3660 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3661 }
3662
3663 impl Rpm {
3664 /// Creates a new default instance.
3665 pub fn new() -> Self {
3666 std::default::Default::default()
3667 }
3668
3669 /// Sets the value of [source][crate::model::os_policy::resource::package_resource::Rpm::source].
3670 ///
3671 /// # Example
3672 /// ```ignore,no_run
3673 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3674 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3675 /// let x = Rpm::new().set_source(File::default()/* use setters */);
3676 /// ```
3677 pub fn set_source<T>(mut self, v: T) -> Self
3678 where
3679 T: std::convert::Into<crate::model::os_policy::resource::File>,
3680 {
3681 self.source = std::option::Option::Some(v.into());
3682 self
3683 }
3684
3685 /// Sets or clears the value of [source][crate::model::os_policy::resource::package_resource::Rpm::source].
3686 ///
3687 /// # Example
3688 /// ```ignore,no_run
3689 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3690 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3691 /// let x = Rpm::new().set_or_clear_source(Some(File::default()/* use setters */));
3692 /// let x = Rpm::new().set_or_clear_source(None::<File>);
3693 /// ```
3694 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3695 where
3696 T: std::convert::Into<crate::model::os_policy::resource::File>,
3697 {
3698 self.source = v.map(|x| x.into());
3699 self
3700 }
3701
3702 /// Sets the value of [pull_deps][crate::model::os_policy::resource::package_resource::Rpm::pull_deps].
3703 ///
3704 /// # Example
3705 /// ```ignore,no_run
3706 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3707 /// let x = Rpm::new().set_pull_deps(true);
3708 /// ```
3709 pub fn set_pull_deps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3710 self.pull_deps = v.into();
3711 self
3712 }
3713 }
3714
3715 impl wkt::message::Message for Rpm {
3716 fn typename() -> &'static str {
3717 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.RPM"
3718 }
3719 }
3720
3721 /// A package managed by YUM.
3722 ///
3723 /// - install: `yum -y install package`
3724 /// - remove: `yum -y remove package`
3725 #[derive(Clone, Default, PartialEq)]
3726 #[non_exhaustive]
3727 pub struct Yum {
3728 /// Required. Package name.
3729 pub name: std::string::String,
3730
3731 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3732 }
3733
3734 impl Yum {
3735 /// Creates a new default instance.
3736 pub fn new() -> Self {
3737 std::default::Default::default()
3738 }
3739
3740 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::Yum::name].
3741 ///
3742 /// # Example
3743 /// ```ignore,no_run
3744 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Yum;
3745 /// let x = Yum::new().set_name("example");
3746 /// ```
3747 pub fn set_name<T: std::convert::Into<std::string::String>>(
3748 mut self,
3749 v: T,
3750 ) -> Self {
3751 self.name = v.into();
3752 self
3753 }
3754 }
3755
3756 impl wkt::message::Message for Yum {
3757 fn typename() -> &'static str {
3758 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.YUM"
3759 }
3760 }
3761
3762 /// A package managed by Zypper.
3763 ///
3764 /// - install: `zypper -y install package`
3765 /// - remove: `zypper -y rm package`
3766 #[derive(Clone, Default, PartialEq)]
3767 #[non_exhaustive]
3768 pub struct Zypper {
3769 /// Required. Package name.
3770 pub name: std::string::String,
3771
3772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3773 }
3774
3775 impl Zypper {
3776 /// Creates a new default instance.
3777 pub fn new() -> Self {
3778 std::default::Default::default()
3779 }
3780
3781 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::Zypper::name].
3782 ///
3783 /// # Example
3784 /// ```ignore,no_run
3785 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Zypper;
3786 /// let x = Zypper::new().set_name("example");
3787 /// ```
3788 pub fn set_name<T: std::convert::Into<std::string::String>>(
3789 mut self,
3790 v: T,
3791 ) -> Self {
3792 self.name = v.into();
3793 self
3794 }
3795 }
3796
3797 impl wkt::message::Message for Zypper {
3798 fn typename() -> &'static str {
3799 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.Zypper"
3800 }
3801 }
3802
3803 /// A package managed by GooGet.
3804 ///
3805 /// - install: `googet -noconfirm install package`
3806 /// - remove: `googet -noconfirm remove package`
3807 #[derive(Clone, Default, PartialEq)]
3808 #[non_exhaustive]
3809 pub struct GooGet {
3810 /// Required. Package name.
3811 pub name: std::string::String,
3812
3813 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3814 }
3815
3816 impl GooGet {
3817 /// Creates a new default instance.
3818 pub fn new() -> Self {
3819 std::default::Default::default()
3820 }
3821
3822 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::GooGet::name].
3823 ///
3824 /// # Example
3825 /// ```ignore,no_run
3826 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::GooGet;
3827 /// let x = GooGet::new().set_name("example");
3828 /// ```
3829 pub fn set_name<T: std::convert::Into<std::string::String>>(
3830 mut self,
3831 v: T,
3832 ) -> Self {
3833 self.name = v.into();
3834 self
3835 }
3836 }
3837
3838 impl wkt::message::Message for GooGet {
3839 fn typename() -> &'static str {
3840 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.GooGet"
3841 }
3842 }
3843
3844 /// An MSI package. MSI packages only support INSTALLED state.
3845 #[derive(Clone, Default, PartialEq)]
3846 #[non_exhaustive]
3847 pub struct Msi {
3848 /// Required. The MSI package.
3849 pub source: std::option::Option<crate::model::os_policy::resource::File>,
3850
3851 /// Additional properties to use during installation.
3852 /// This should be in the format of Property=Setting.
3853 /// Appended to the defaults of `ACTION=INSTALL
3854 /// REBOOT=ReallySuppress`.
3855 pub properties: std::vec::Vec<std::string::String>,
3856
3857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3858 }
3859
3860 impl Msi {
3861 /// Creates a new default instance.
3862 pub fn new() -> Self {
3863 std::default::Default::default()
3864 }
3865
3866 /// Sets the value of [source][crate::model::os_policy::resource::package_resource::Msi::source].
3867 ///
3868 /// # Example
3869 /// ```ignore,no_run
3870 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3871 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3872 /// let x = Msi::new().set_source(File::default()/* use setters */);
3873 /// ```
3874 pub fn set_source<T>(mut self, v: T) -> Self
3875 where
3876 T: std::convert::Into<crate::model::os_policy::resource::File>,
3877 {
3878 self.source = std::option::Option::Some(v.into());
3879 self
3880 }
3881
3882 /// Sets or clears the value of [source][crate::model::os_policy::resource::package_resource::Msi::source].
3883 ///
3884 /// # Example
3885 /// ```ignore,no_run
3886 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3887 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3888 /// let x = Msi::new().set_or_clear_source(Some(File::default()/* use setters */));
3889 /// let x = Msi::new().set_or_clear_source(None::<File>);
3890 /// ```
3891 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3892 where
3893 T: std::convert::Into<crate::model::os_policy::resource::File>,
3894 {
3895 self.source = v.map(|x| x.into());
3896 self
3897 }
3898
3899 /// Sets the value of [properties][crate::model::os_policy::resource::package_resource::Msi::properties].
3900 ///
3901 /// # Example
3902 /// ```ignore,no_run
3903 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3904 /// let x = Msi::new().set_properties(["a", "b", "c"]);
3905 /// ```
3906 pub fn set_properties<T, V>(mut self, v: T) -> Self
3907 where
3908 T: std::iter::IntoIterator<Item = V>,
3909 V: std::convert::Into<std::string::String>,
3910 {
3911 use std::iter::Iterator;
3912 self.properties = v.into_iter().map(|i| i.into()).collect();
3913 self
3914 }
3915 }
3916
3917 impl wkt::message::Message for Msi {
3918 fn typename() -> &'static str {
3919 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.MSI"
3920 }
3921 }
3922
3923 /// The desired state that the OS Config agent maintains on the VM.
3924 ///
3925 /// # Working with unknown values
3926 ///
3927 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3928 /// additional enum variants at any time. Adding new variants is not considered
3929 /// a breaking change. Applications should write their code in anticipation of:
3930 ///
3931 /// - New values appearing in future releases of the client library, **and**
3932 /// - New values received dynamically, without application changes.
3933 ///
3934 /// Please consult the [Working with enums] section in the user guide for some
3935 /// guidelines.
3936 ///
3937 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3938 #[derive(Clone, Debug, PartialEq)]
3939 #[non_exhaustive]
3940 pub enum DesiredState {
3941 /// Unspecified is invalid.
3942 Unspecified,
3943 /// Ensure that the package is installed.
3944 Installed,
3945 /// The agent ensures that the package is not installed and
3946 /// uninstalls it if detected.
3947 Removed,
3948 /// If set, the enum was initialized with an unknown value.
3949 ///
3950 /// Applications can examine the value using [DesiredState::value] or
3951 /// [DesiredState::name].
3952 UnknownValue(desired_state::UnknownValue),
3953 }
3954
3955 #[doc(hidden)]
3956 pub mod desired_state {
3957 #[allow(unused_imports)]
3958 use super::*;
3959 #[derive(Clone, Debug, PartialEq)]
3960 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3961 }
3962
3963 impl DesiredState {
3964 /// Gets the enum value.
3965 ///
3966 /// Returns `None` if the enum contains an unknown value deserialized from
3967 /// the string representation of enums.
3968 pub fn value(&self) -> std::option::Option<i32> {
3969 match self {
3970 Self::Unspecified => std::option::Option::Some(0),
3971 Self::Installed => std::option::Option::Some(1),
3972 Self::Removed => std::option::Option::Some(2),
3973 Self::UnknownValue(u) => u.0.value(),
3974 }
3975 }
3976
3977 /// Gets the enum value as a string.
3978 ///
3979 /// Returns `None` if the enum contains an unknown value deserialized from
3980 /// the integer representation of enums.
3981 pub fn name(&self) -> std::option::Option<&str> {
3982 match self {
3983 Self::Unspecified => std::option::Option::Some("DESIRED_STATE_UNSPECIFIED"),
3984 Self::Installed => std::option::Option::Some("INSTALLED"),
3985 Self::Removed => std::option::Option::Some("REMOVED"),
3986 Self::UnknownValue(u) => u.0.name(),
3987 }
3988 }
3989 }
3990
3991 impl std::default::Default for DesiredState {
3992 fn default() -> Self {
3993 use std::convert::From;
3994 Self::from(0)
3995 }
3996 }
3997
3998 impl std::fmt::Display for DesiredState {
3999 fn fmt(
4000 &self,
4001 f: &mut std::fmt::Formatter<'_>,
4002 ) -> std::result::Result<(), std::fmt::Error> {
4003 wkt::internal::display_enum(f, self.name(), self.value())
4004 }
4005 }
4006
4007 impl std::convert::From<i32> for DesiredState {
4008 fn from(value: i32) -> Self {
4009 match value {
4010 0 => Self::Unspecified,
4011 1 => Self::Installed,
4012 2 => Self::Removed,
4013 _ => Self::UnknownValue(desired_state::UnknownValue(
4014 wkt::internal::UnknownEnumValue::Integer(value),
4015 )),
4016 }
4017 }
4018 }
4019
4020 impl std::convert::From<&str> for DesiredState {
4021 fn from(value: &str) -> Self {
4022 use std::string::ToString;
4023 match value {
4024 "DESIRED_STATE_UNSPECIFIED" => Self::Unspecified,
4025 "INSTALLED" => Self::Installed,
4026 "REMOVED" => Self::Removed,
4027 _ => Self::UnknownValue(desired_state::UnknownValue(
4028 wkt::internal::UnknownEnumValue::String(value.to_string()),
4029 )),
4030 }
4031 }
4032 }
4033
4034 impl serde::ser::Serialize for DesiredState {
4035 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4036 where
4037 S: serde::Serializer,
4038 {
4039 match self {
4040 Self::Unspecified => serializer.serialize_i32(0),
4041 Self::Installed => serializer.serialize_i32(1),
4042 Self::Removed => serializer.serialize_i32(2),
4043 Self::UnknownValue(u) => u.0.serialize(serializer),
4044 }
4045 }
4046 }
4047
4048 impl<'de> serde::de::Deserialize<'de> for DesiredState {
4049 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4050 where
4051 D: serde::Deserializer<'de>,
4052 {
4053 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DesiredState>::new(
4054 ".google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.DesiredState",
4055 ))
4056 }
4057 }
4058
4059 /// A system package.
4060 #[derive(Clone, Debug, PartialEq)]
4061 #[non_exhaustive]
4062 pub enum SystemPackage {
4063 /// A package managed by Apt.
4064 Apt(std::boxed::Box<crate::model::os_policy::resource::package_resource::Apt>),
4065 /// A deb package file.
4066 Deb(std::boxed::Box<crate::model::os_policy::resource::package_resource::Deb>),
4067 /// A package managed by YUM.
4068 Yum(std::boxed::Box<crate::model::os_policy::resource::package_resource::Yum>),
4069 /// A package managed by Zypper.
4070 Zypper(
4071 std::boxed::Box<crate::model::os_policy::resource::package_resource::Zypper>,
4072 ),
4073 /// An rpm package file.
4074 Rpm(std::boxed::Box<crate::model::os_policy::resource::package_resource::Rpm>),
4075 /// A package managed by GooGet.
4076 Googet(
4077 std::boxed::Box<crate::model::os_policy::resource::package_resource::GooGet>,
4078 ),
4079 /// An MSI package.
4080 Msi(std::boxed::Box<crate::model::os_policy::resource::package_resource::Msi>),
4081 }
4082 }
4083
4084 /// A resource that manages a package repository.
4085 #[derive(Clone, Default, PartialEq)]
4086 #[non_exhaustive]
4087 pub struct RepositoryResource {
4088 /// A specific type of repository.
4089 pub repository: std::option::Option<
4090 crate::model::os_policy::resource::repository_resource::Repository,
4091 >,
4092
4093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4094 }
4095
4096 impl RepositoryResource {
4097 /// Creates a new default instance.
4098 pub fn new() -> Self {
4099 std::default::Default::default()
4100 }
4101
4102 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository].
4103 ///
4104 /// Note that all the setters affecting `repository` are mutually
4105 /// exclusive.
4106 ///
4107 /// # Example
4108 /// ```ignore,no_run
4109 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4110 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4111 /// let x = RepositoryResource::new().set_repository(Some(
4112 /// google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::Repository::Apt(AptRepository::default().into())));
4113 /// ```
4114 pub fn set_repository<
4115 T: std::convert::Into<
4116 std::option::Option<
4117 crate::model::os_policy::resource::repository_resource::Repository,
4118 >,
4119 >,
4120 >(
4121 mut self,
4122 v: T,
4123 ) -> Self {
4124 self.repository = v.into();
4125 self
4126 }
4127
4128 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4129 /// if it holds a `Apt`, `None` if the field is not set or
4130 /// holds a different branch.
4131 pub fn apt(
4132 &self,
4133 ) -> std::option::Option<
4134 &std::boxed::Box<
4135 crate::model::os_policy::resource::repository_resource::AptRepository,
4136 >,
4137 > {
4138 #[allow(unreachable_patterns)]
4139 self.repository.as_ref().and_then(|v| match v {
4140 crate::model::os_policy::resource::repository_resource::Repository::Apt(v) => {
4141 std::option::Option::Some(v)
4142 }
4143 _ => std::option::Option::None,
4144 })
4145 }
4146
4147 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4148 /// to hold a `Apt`.
4149 ///
4150 /// Note that all the setters affecting `repository` are
4151 /// mutually exclusive.
4152 ///
4153 /// # Example
4154 /// ```ignore,no_run
4155 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4156 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4157 /// let x = RepositoryResource::new().set_apt(AptRepository::default()/* use setters */);
4158 /// assert!(x.apt().is_some());
4159 /// assert!(x.yum().is_none());
4160 /// assert!(x.zypper().is_none());
4161 /// assert!(x.goo().is_none());
4162 /// ```
4163 pub fn set_apt<
4164 T: std::convert::Into<
4165 std::boxed::Box<
4166 crate::model::os_policy::resource::repository_resource::AptRepository,
4167 >,
4168 >,
4169 >(
4170 mut self,
4171 v: T,
4172 ) -> Self {
4173 self.repository = std::option::Option::Some(
4174 crate::model::os_policy::resource::repository_resource::Repository::Apt(
4175 v.into(),
4176 ),
4177 );
4178 self
4179 }
4180
4181 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4182 /// if it holds a `Yum`, `None` if the field is not set or
4183 /// holds a different branch.
4184 pub fn yum(
4185 &self,
4186 ) -> std::option::Option<
4187 &std::boxed::Box<
4188 crate::model::os_policy::resource::repository_resource::YumRepository,
4189 >,
4190 > {
4191 #[allow(unreachable_patterns)]
4192 self.repository.as_ref().and_then(|v| match v {
4193 crate::model::os_policy::resource::repository_resource::Repository::Yum(v) => {
4194 std::option::Option::Some(v)
4195 }
4196 _ => std::option::Option::None,
4197 })
4198 }
4199
4200 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4201 /// to hold a `Yum`.
4202 ///
4203 /// Note that all the setters affecting `repository` are
4204 /// mutually exclusive.
4205 ///
4206 /// # Example
4207 /// ```ignore,no_run
4208 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4209 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4210 /// let x = RepositoryResource::new().set_yum(YumRepository::default()/* use setters */);
4211 /// assert!(x.yum().is_some());
4212 /// assert!(x.apt().is_none());
4213 /// assert!(x.zypper().is_none());
4214 /// assert!(x.goo().is_none());
4215 /// ```
4216 pub fn set_yum<
4217 T: std::convert::Into<
4218 std::boxed::Box<
4219 crate::model::os_policy::resource::repository_resource::YumRepository,
4220 >,
4221 >,
4222 >(
4223 mut self,
4224 v: T,
4225 ) -> Self {
4226 self.repository = std::option::Option::Some(
4227 crate::model::os_policy::resource::repository_resource::Repository::Yum(
4228 v.into(),
4229 ),
4230 );
4231 self
4232 }
4233
4234 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4235 /// if it holds a `Zypper`, `None` if the field is not set or
4236 /// holds a different branch.
4237 pub fn zypper(
4238 &self,
4239 ) -> std::option::Option<
4240 &std::boxed::Box<
4241 crate::model::os_policy::resource::repository_resource::ZypperRepository,
4242 >,
4243 > {
4244 #[allow(unreachable_patterns)]
4245 self.repository.as_ref().and_then(|v| match v {
4246 crate::model::os_policy::resource::repository_resource::Repository::Zypper(
4247 v,
4248 ) => std::option::Option::Some(v),
4249 _ => std::option::Option::None,
4250 })
4251 }
4252
4253 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4254 /// to hold a `Zypper`.
4255 ///
4256 /// Note that all the setters affecting `repository` are
4257 /// mutually exclusive.
4258 ///
4259 /// # Example
4260 /// ```ignore,no_run
4261 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4262 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4263 /// let x = RepositoryResource::new().set_zypper(ZypperRepository::default()/* use setters */);
4264 /// assert!(x.zypper().is_some());
4265 /// assert!(x.apt().is_none());
4266 /// assert!(x.yum().is_none());
4267 /// assert!(x.goo().is_none());
4268 /// ```
4269 pub fn set_zypper<T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::repository_resource::ZypperRepository>>>(mut self, v: T) -> Self{
4270 self.repository = std::option::Option::Some(
4271 crate::model::os_policy::resource::repository_resource::Repository::Zypper(
4272 v.into(),
4273 ),
4274 );
4275 self
4276 }
4277
4278 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4279 /// if it holds a `Goo`, `None` if the field is not set or
4280 /// holds a different branch.
4281 pub fn goo(
4282 &self,
4283 ) -> std::option::Option<
4284 &std::boxed::Box<
4285 crate::model::os_policy::resource::repository_resource::GooRepository,
4286 >,
4287 > {
4288 #[allow(unreachable_patterns)]
4289 self.repository.as_ref().and_then(|v| match v {
4290 crate::model::os_policy::resource::repository_resource::Repository::Goo(v) => {
4291 std::option::Option::Some(v)
4292 }
4293 _ => std::option::Option::None,
4294 })
4295 }
4296
4297 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4298 /// to hold a `Goo`.
4299 ///
4300 /// Note that all the setters affecting `repository` are
4301 /// mutually exclusive.
4302 ///
4303 /// # Example
4304 /// ```ignore,no_run
4305 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4306 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::GooRepository;
4307 /// let x = RepositoryResource::new().set_goo(GooRepository::default()/* use setters */);
4308 /// assert!(x.goo().is_some());
4309 /// assert!(x.apt().is_none());
4310 /// assert!(x.yum().is_none());
4311 /// assert!(x.zypper().is_none());
4312 /// ```
4313 pub fn set_goo<
4314 T: std::convert::Into<
4315 std::boxed::Box<
4316 crate::model::os_policy::resource::repository_resource::GooRepository,
4317 >,
4318 >,
4319 >(
4320 mut self,
4321 v: T,
4322 ) -> Self {
4323 self.repository = std::option::Option::Some(
4324 crate::model::os_policy::resource::repository_resource::Repository::Goo(
4325 v.into(),
4326 ),
4327 );
4328 self
4329 }
4330 }
4331
4332 impl wkt::message::Message for RepositoryResource {
4333 fn typename() -> &'static str {
4334 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource"
4335 }
4336 }
4337
4338 /// Defines additional types related to [RepositoryResource].
4339 pub mod repository_resource {
4340 #[allow(unused_imports)]
4341 use super::*;
4342
4343 /// Represents a single apt package repository. These will be added to
4344 /// a repo file that will be managed at
4345 /// `/etc/apt/sources.list.d/google_osconfig.list`.
4346 #[derive(Clone, Default, PartialEq)]
4347 #[non_exhaustive]
4348 pub struct AptRepository {
4349
4350 /// Required. Type of archive files in this repository.
4351 pub archive_type: crate::model::os_policy::resource::repository_resource::apt_repository::ArchiveType,
4352
4353 /// Required. URI for this repository.
4354 pub uri: std::string::String,
4355
4356 /// Required. Distribution of this repository.
4357 pub distribution: std::string::String,
4358
4359 /// Required. List of components for this repository. Must contain at
4360 /// least one item.
4361 pub components: std::vec::Vec<std::string::String>,
4362
4363 /// URI of the key file for this repository. The agent maintains a
4364 /// keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`.
4365 pub gpg_key: std::string::String,
4366
4367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4368 }
4369
4370 impl AptRepository {
4371 /// Creates a new default instance.
4372 pub fn new() -> Self {
4373 std::default::Default::default()
4374 }
4375
4376 /// Sets the value of [archive_type][crate::model::os_policy::resource::repository_resource::AptRepository::archive_type].
4377 ///
4378 /// # Example
4379 /// ```ignore,no_run
4380 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4381 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::apt_repository::ArchiveType;
4382 /// let x0 = AptRepository::new().set_archive_type(ArchiveType::Deb);
4383 /// let x1 = AptRepository::new().set_archive_type(ArchiveType::DebSrc);
4384 /// ```
4385 pub fn set_archive_type<T: std::convert::Into<crate::model::os_policy::resource::repository_resource::apt_repository::ArchiveType>>(mut self, v: T) -> Self{
4386 self.archive_type = v.into();
4387 self
4388 }
4389
4390 /// Sets the value of [uri][crate::model::os_policy::resource::repository_resource::AptRepository::uri].
4391 ///
4392 /// # Example
4393 /// ```ignore,no_run
4394 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4395 /// let x = AptRepository::new().set_uri("example");
4396 /// ```
4397 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4398 self.uri = v.into();
4399 self
4400 }
4401
4402 /// Sets the value of [distribution][crate::model::os_policy::resource::repository_resource::AptRepository::distribution].
4403 ///
4404 /// # Example
4405 /// ```ignore,no_run
4406 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4407 /// let x = AptRepository::new().set_distribution("example");
4408 /// ```
4409 pub fn set_distribution<T: std::convert::Into<std::string::String>>(
4410 mut self,
4411 v: T,
4412 ) -> Self {
4413 self.distribution = v.into();
4414 self
4415 }
4416
4417 /// Sets the value of [components][crate::model::os_policy::resource::repository_resource::AptRepository::components].
4418 ///
4419 /// # Example
4420 /// ```ignore,no_run
4421 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4422 /// let x = AptRepository::new().set_components(["a", "b", "c"]);
4423 /// ```
4424 pub fn set_components<T, V>(mut self, v: T) -> Self
4425 where
4426 T: std::iter::IntoIterator<Item = V>,
4427 V: std::convert::Into<std::string::String>,
4428 {
4429 use std::iter::Iterator;
4430 self.components = v.into_iter().map(|i| i.into()).collect();
4431 self
4432 }
4433
4434 /// Sets the value of [gpg_key][crate::model::os_policy::resource::repository_resource::AptRepository::gpg_key].
4435 ///
4436 /// # Example
4437 /// ```ignore,no_run
4438 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4439 /// let x = AptRepository::new().set_gpg_key("example");
4440 /// ```
4441 pub fn set_gpg_key<T: std::convert::Into<std::string::String>>(
4442 mut self,
4443 v: T,
4444 ) -> Self {
4445 self.gpg_key = v.into();
4446 self
4447 }
4448 }
4449
4450 impl wkt::message::Message for AptRepository {
4451 fn typename() -> &'static str {
4452 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.AptRepository"
4453 }
4454 }
4455
4456 /// Defines additional types related to [AptRepository].
4457 pub mod apt_repository {
4458 #[allow(unused_imports)]
4459 use super::*;
4460
4461 /// Type of archive.
4462 ///
4463 /// # Working with unknown values
4464 ///
4465 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4466 /// additional enum variants at any time. Adding new variants is not considered
4467 /// a breaking change. Applications should write their code in anticipation of:
4468 ///
4469 /// - New values appearing in future releases of the client library, **and**
4470 /// - New values received dynamically, without application changes.
4471 ///
4472 /// Please consult the [Working with enums] section in the user guide for some
4473 /// guidelines.
4474 ///
4475 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4476 #[derive(Clone, Debug, PartialEq)]
4477 #[non_exhaustive]
4478 pub enum ArchiveType {
4479 /// Unspecified is invalid.
4480 Unspecified,
4481 /// Deb indicates that the archive contains binary files.
4482 Deb,
4483 /// Deb-src indicates that the archive contains source files.
4484 DebSrc,
4485 /// If set, the enum was initialized with an unknown value.
4486 ///
4487 /// Applications can examine the value using [ArchiveType::value] or
4488 /// [ArchiveType::name].
4489 UnknownValue(archive_type::UnknownValue),
4490 }
4491
4492 #[doc(hidden)]
4493 pub mod archive_type {
4494 #[allow(unused_imports)]
4495 use super::*;
4496 #[derive(Clone, Debug, PartialEq)]
4497 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4498 }
4499
4500 impl ArchiveType {
4501 /// Gets the enum value.
4502 ///
4503 /// Returns `None` if the enum contains an unknown value deserialized from
4504 /// the string representation of enums.
4505 pub fn value(&self) -> std::option::Option<i32> {
4506 match self {
4507 Self::Unspecified => std::option::Option::Some(0),
4508 Self::Deb => std::option::Option::Some(1),
4509 Self::DebSrc => std::option::Option::Some(2),
4510 Self::UnknownValue(u) => u.0.value(),
4511 }
4512 }
4513
4514 /// Gets the enum value as a string.
4515 ///
4516 /// Returns `None` if the enum contains an unknown value deserialized from
4517 /// the integer representation of enums.
4518 pub fn name(&self) -> std::option::Option<&str> {
4519 match self {
4520 Self::Unspecified => {
4521 std::option::Option::Some("ARCHIVE_TYPE_UNSPECIFIED")
4522 }
4523 Self::Deb => std::option::Option::Some("DEB"),
4524 Self::DebSrc => std::option::Option::Some("DEB_SRC"),
4525 Self::UnknownValue(u) => u.0.name(),
4526 }
4527 }
4528 }
4529
4530 impl std::default::Default for ArchiveType {
4531 fn default() -> Self {
4532 use std::convert::From;
4533 Self::from(0)
4534 }
4535 }
4536
4537 impl std::fmt::Display for ArchiveType {
4538 fn fmt(
4539 &self,
4540 f: &mut std::fmt::Formatter<'_>,
4541 ) -> std::result::Result<(), std::fmt::Error> {
4542 wkt::internal::display_enum(f, self.name(), self.value())
4543 }
4544 }
4545
4546 impl std::convert::From<i32> for ArchiveType {
4547 fn from(value: i32) -> Self {
4548 match value {
4549 0 => Self::Unspecified,
4550 1 => Self::Deb,
4551 2 => Self::DebSrc,
4552 _ => Self::UnknownValue(archive_type::UnknownValue(
4553 wkt::internal::UnknownEnumValue::Integer(value),
4554 )),
4555 }
4556 }
4557 }
4558
4559 impl std::convert::From<&str> for ArchiveType {
4560 fn from(value: &str) -> Self {
4561 use std::string::ToString;
4562 match value {
4563 "ARCHIVE_TYPE_UNSPECIFIED" => Self::Unspecified,
4564 "DEB" => Self::Deb,
4565 "DEB_SRC" => Self::DebSrc,
4566 _ => Self::UnknownValue(archive_type::UnknownValue(
4567 wkt::internal::UnknownEnumValue::String(value.to_string()),
4568 )),
4569 }
4570 }
4571 }
4572
4573 impl serde::ser::Serialize for ArchiveType {
4574 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4575 where
4576 S: serde::Serializer,
4577 {
4578 match self {
4579 Self::Unspecified => serializer.serialize_i32(0),
4580 Self::Deb => serializer.serialize_i32(1),
4581 Self::DebSrc => serializer.serialize_i32(2),
4582 Self::UnknownValue(u) => u.0.serialize(serializer),
4583 }
4584 }
4585 }
4586
4587 impl<'de> serde::de::Deserialize<'de> for ArchiveType {
4588 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4589 where
4590 D: serde::Deserializer<'de>,
4591 {
4592 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ArchiveType>::new(
4593 ".google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.AptRepository.ArchiveType"))
4594 }
4595 }
4596 }
4597
4598 /// Represents a single yum package repository. These are added to a
4599 /// repo file that is managed at
4600 /// `/etc/yum.repos.d/google_osconfig.repo`.
4601 #[derive(Clone, Default, PartialEq)]
4602 #[non_exhaustive]
4603 pub struct YumRepository {
4604 /// Required. A one word, unique name for this repository. This is the
4605 /// `repo id` in the yum config file and also the `display_name` if
4606 /// `display_name` is omitted. This id is also used as the unique
4607 /// identifier when checking for resource conflicts.
4608 pub id: std::string::String,
4609
4610 /// The display name of the repository.
4611 pub display_name: std::string::String,
4612
4613 /// Required. The location of the repository directory.
4614 pub base_url: std::string::String,
4615
4616 /// URIs of GPG keys.
4617 pub gpg_keys: std::vec::Vec<std::string::String>,
4618
4619 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4620 }
4621
4622 impl YumRepository {
4623 /// Creates a new default instance.
4624 pub fn new() -> Self {
4625 std::default::Default::default()
4626 }
4627
4628 /// Sets the value of [id][crate::model::os_policy::resource::repository_resource::YumRepository::id].
4629 ///
4630 /// # Example
4631 /// ```ignore,no_run
4632 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4633 /// let x = YumRepository::new().set_id("example");
4634 /// ```
4635 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4636 self.id = v.into();
4637 self
4638 }
4639
4640 /// Sets the value of [display_name][crate::model::os_policy::resource::repository_resource::YumRepository::display_name].
4641 ///
4642 /// # Example
4643 /// ```ignore,no_run
4644 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4645 /// let x = YumRepository::new().set_display_name("example");
4646 /// ```
4647 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
4648 mut self,
4649 v: T,
4650 ) -> Self {
4651 self.display_name = v.into();
4652 self
4653 }
4654
4655 /// Sets the value of [base_url][crate::model::os_policy::resource::repository_resource::YumRepository::base_url].
4656 ///
4657 /// # Example
4658 /// ```ignore,no_run
4659 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4660 /// let x = YumRepository::new().set_base_url("example");
4661 /// ```
4662 pub fn set_base_url<T: std::convert::Into<std::string::String>>(
4663 mut self,
4664 v: T,
4665 ) -> Self {
4666 self.base_url = v.into();
4667 self
4668 }
4669
4670 /// Sets the value of [gpg_keys][crate::model::os_policy::resource::repository_resource::YumRepository::gpg_keys].
4671 ///
4672 /// # Example
4673 /// ```ignore,no_run
4674 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4675 /// let x = YumRepository::new().set_gpg_keys(["a", "b", "c"]);
4676 /// ```
4677 pub fn set_gpg_keys<T, V>(mut self, v: T) -> Self
4678 where
4679 T: std::iter::IntoIterator<Item = V>,
4680 V: std::convert::Into<std::string::String>,
4681 {
4682 use std::iter::Iterator;
4683 self.gpg_keys = v.into_iter().map(|i| i.into()).collect();
4684 self
4685 }
4686 }
4687
4688 impl wkt::message::Message for YumRepository {
4689 fn typename() -> &'static str {
4690 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.YumRepository"
4691 }
4692 }
4693
4694 /// Represents a single zypper package repository. These are added to a
4695 /// repo file that is managed at
4696 /// `/etc/zypp/repos.d/google_osconfig.repo`.
4697 #[derive(Clone, Default, PartialEq)]
4698 #[non_exhaustive]
4699 pub struct ZypperRepository {
4700 /// Required. A one word, unique name for this repository. This is the
4701 /// `repo id` in the zypper config file and also the `display_name` if
4702 /// `display_name` is omitted. This id is also used as the unique
4703 /// identifier when checking for GuestPolicy conflicts.
4704 pub id: std::string::String,
4705
4706 /// The display name of the repository.
4707 pub display_name: std::string::String,
4708
4709 /// Required. The location of the repository directory.
4710 pub base_url: std::string::String,
4711
4712 /// URIs of GPG keys.
4713 pub gpg_keys: std::vec::Vec<std::string::String>,
4714
4715 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4716 }
4717
4718 impl ZypperRepository {
4719 /// Creates a new default instance.
4720 pub fn new() -> Self {
4721 std::default::Default::default()
4722 }
4723
4724 /// Sets the value of [id][crate::model::os_policy::resource::repository_resource::ZypperRepository::id].
4725 ///
4726 /// # Example
4727 /// ```ignore,no_run
4728 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4729 /// let x = ZypperRepository::new().set_id("example");
4730 /// ```
4731 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4732 self.id = v.into();
4733 self
4734 }
4735
4736 /// Sets the value of [display_name][crate::model::os_policy::resource::repository_resource::ZypperRepository::display_name].
4737 ///
4738 /// # Example
4739 /// ```ignore,no_run
4740 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4741 /// let x = ZypperRepository::new().set_display_name("example");
4742 /// ```
4743 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
4744 mut self,
4745 v: T,
4746 ) -> Self {
4747 self.display_name = v.into();
4748 self
4749 }
4750
4751 /// Sets the value of [base_url][crate::model::os_policy::resource::repository_resource::ZypperRepository::base_url].
4752 ///
4753 /// # Example
4754 /// ```ignore,no_run
4755 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4756 /// let x = ZypperRepository::new().set_base_url("example");
4757 /// ```
4758 pub fn set_base_url<T: std::convert::Into<std::string::String>>(
4759 mut self,
4760 v: T,
4761 ) -> Self {
4762 self.base_url = v.into();
4763 self
4764 }
4765
4766 /// Sets the value of [gpg_keys][crate::model::os_policy::resource::repository_resource::ZypperRepository::gpg_keys].
4767 ///
4768 /// # Example
4769 /// ```ignore,no_run
4770 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4771 /// let x = ZypperRepository::new().set_gpg_keys(["a", "b", "c"]);
4772 /// ```
4773 pub fn set_gpg_keys<T, V>(mut self, v: T) -> Self
4774 where
4775 T: std::iter::IntoIterator<Item = V>,
4776 V: std::convert::Into<std::string::String>,
4777 {
4778 use std::iter::Iterator;
4779 self.gpg_keys = v.into_iter().map(|i| i.into()).collect();
4780 self
4781 }
4782 }
4783
4784 impl wkt::message::Message for ZypperRepository {
4785 fn typename() -> &'static str {
4786 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.ZypperRepository"
4787 }
4788 }
4789
4790 /// Represents a Goo package repository. These are added to a repo file
4791 /// that is managed at
4792 /// `C:/ProgramData/GooGet/repos/google_osconfig.repo`.
4793 #[derive(Clone, Default, PartialEq)]
4794 #[non_exhaustive]
4795 pub struct GooRepository {
4796 /// Required. The name of the repository.
4797 pub name: std::string::String,
4798
4799 /// Required. The url of the repository.
4800 pub url: std::string::String,
4801
4802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4803 }
4804
4805 impl GooRepository {
4806 /// Creates a new default instance.
4807 pub fn new() -> Self {
4808 std::default::Default::default()
4809 }
4810
4811 /// Sets the value of [name][crate::model::os_policy::resource::repository_resource::GooRepository::name].
4812 ///
4813 /// # Example
4814 /// ```ignore,no_run
4815 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::GooRepository;
4816 /// let x = GooRepository::new().set_name("example");
4817 /// ```
4818 pub fn set_name<T: std::convert::Into<std::string::String>>(
4819 mut self,
4820 v: T,
4821 ) -> Self {
4822 self.name = v.into();
4823 self
4824 }
4825
4826 /// Sets the value of [url][crate::model::os_policy::resource::repository_resource::GooRepository::url].
4827 ///
4828 /// # Example
4829 /// ```ignore,no_run
4830 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::GooRepository;
4831 /// let x = GooRepository::new().set_url("example");
4832 /// ```
4833 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4834 self.url = v.into();
4835 self
4836 }
4837 }
4838
4839 impl wkt::message::Message for GooRepository {
4840 fn typename() -> &'static str {
4841 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.GooRepository"
4842 }
4843 }
4844
4845 /// A specific type of repository.
4846 #[derive(Clone, Debug, PartialEq)]
4847 #[non_exhaustive]
4848 pub enum Repository {
4849 /// An Apt Repository.
4850 Apt(
4851 std::boxed::Box<
4852 crate::model::os_policy::resource::repository_resource::AptRepository,
4853 >,
4854 ),
4855 /// A Yum Repository.
4856 Yum(
4857 std::boxed::Box<
4858 crate::model::os_policy::resource::repository_resource::YumRepository,
4859 >,
4860 ),
4861 /// A Zypper Repository.
4862 Zypper(
4863 std::boxed::Box<
4864 crate::model::os_policy::resource::repository_resource::ZypperRepository,
4865 >,
4866 ),
4867 /// A Goo Repository.
4868 Goo(
4869 std::boxed::Box<
4870 crate::model::os_policy::resource::repository_resource::GooRepository,
4871 >,
4872 ),
4873 }
4874 }
4875
4876 /// A resource that allows executing scripts on the VM.
4877 ///
4878 /// The `ExecResource` has 2 stages: `validate` and `enforce` and both stages
4879 /// accept a script as an argument to execute.
4880 ///
4881 /// When the `ExecResource` is applied by the agent, it first executes the
4882 /// script in the `validate` stage. The `validate` stage can signal that the
4883 /// `ExecResource` is already in the desired state by returning an exit code
4884 /// of `100`. If the `ExecResource` is not in the desired state, it should
4885 /// return an exit code of `101`. Any other exit code returned by this stage
4886 /// is considered an error.
4887 ///
4888 /// If the `ExecResource` is not in the desired state based on the exit code
4889 /// from the `validate` stage, the agent proceeds to execute the script from
4890 /// the `enforce` stage. If the `ExecResource` is already in the desired
4891 /// state, the `enforce` stage will not be run.
4892 /// Similar to `validate` stage, the `enforce` stage should return an exit
4893 /// code of `100` to indicate that the resource in now in its desired state.
4894 /// Any other exit code is considered an error.
4895 ///
4896 /// NOTE: An exit code of `100` was chosen over `0` (and `101` vs `1`) to
4897 /// have an explicit indicator of `in desired state`, `not in desired state`
4898 /// and errors. Because, for example, Powershell will always return an exit
4899 /// code of `0` unless an `exit` statement is provided in the script. So, for
4900 /// reasons of consistency and being explicit, exit codes `100` and `101`
4901 /// were chosen.
4902 #[derive(Clone, Default, PartialEq)]
4903 #[non_exhaustive]
4904 pub struct ExecResource {
4905 /// Required. What to run to validate this resource is in the desired
4906 /// state. An exit code of 100 indicates "in desired state", and exit code
4907 /// of 101 indicates "not in desired state". Any other exit code indicates
4908 /// a failure running validate.
4909 pub validate:
4910 std::option::Option<crate::model::os_policy::resource::exec_resource::Exec>,
4911
4912 /// What to run to bring this resource into the desired state.
4913 /// An exit code of 100 indicates "success", any other exit code indicates
4914 /// a failure running enforce.
4915 pub enforce:
4916 std::option::Option<crate::model::os_policy::resource::exec_resource::Exec>,
4917
4918 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4919 }
4920
4921 impl ExecResource {
4922 /// Creates a new default instance.
4923 pub fn new() -> Self {
4924 std::default::Default::default()
4925 }
4926
4927 /// Sets the value of [validate][crate::model::os_policy::resource::ExecResource::validate].
4928 ///
4929 /// # Example
4930 /// ```ignore,no_run
4931 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4932 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4933 /// let x = ExecResource::new().set_validate(Exec::default()/* use setters */);
4934 /// ```
4935 pub fn set_validate<T>(mut self, v: T) -> Self
4936 where
4937 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4938 {
4939 self.validate = std::option::Option::Some(v.into());
4940 self
4941 }
4942
4943 /// Sets or clears the value of [validate][crate::model::os_policy::resource::ExecResource::validate].
4944 ///
4945 /// # Example
4946 /// ```ignore,no_run
4947 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4948 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4949 /// let x = ExecResource::new().set_or_clear_validate(Some(Exec::default()/* use setters */));
4950 /// let x = ExecResource::new().set_or_clear_validate(None::<Exec>);
4951 /// ```
4952 pub fn set_or_clear_validate<T>(mut self, v: std::option::Option<T>) -> Self
4953 where
4954 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4955 {
4956 self.validate = v.map(|x| x.into());
4957 self
4958 }
4959
4960 /// Sets the value of [enforce][crate::model::os_policy::resource::ExecResource::enforce].
4961 ///
4962 /// # Example
4963 /// ```ignore,no_run
4964 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4965 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4966 /// let x = ExecResource::new().set_enforce(Exec::default()/* use setters */);
4967 /// ```
4968 pub fn set_enforce<T>(mut self, v: T) -> Self
4969 where
4970 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4971 {
4972 self.enforce = std::option::Option::Some(v.into());
4973 self
4974 }
4975
4976 /// Sets or clears the value of [enforce][crate::model::os_policy::resource::ExecResource::enforce].
4977 ///
4978 /// # Example
4979 /// ```ignore,no_run
4980 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4981 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4982 /// let x = ExecResource::new().set_or_clear_enforce(Some(Exec::default()/* use setters */));
4983 /// let x = ExecResource::new().set_or_clear_enforce(None::<Exec>);
4984 /// ```
4985 pub fn set_or_clear_enforce<T>(mut self, v: std::option::Option<T>) -> Self
4986 where
4987 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4988 {
4989 self.enforce = v.map(|x| x.into());
4990 self
4991 }
4992 }
4993
4994 impl wkt::message::Message for ExecResource {
4995 fn typename() -> &'static str {
4996 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.ExecResource"
4997 }
4998 }
4999
5000 /// Defines additional types related to [ExecResource].
5001 pub mod exec_resource {
5002 #[allow(unused_imports)]
5003 use super::*;
5004
5005 /// A file or script to execute.
5006 #[derive(Clone, Default, PartialEq)]
5007 #[non_exhaustive]
5008 pub struct Exec {
5009 /// Optional arguments to pass to the source during execution.
5010 pub args: std::vec::Vec<std::string::String>,
5011
5012 /// Required. The script interpreter to use.
5013 pub interpreter:
5014 crate::model::os_policy::resource::exec_resource::exec::Interpreter,
5015
5016 /// Only recorded for enforce Exec.
5017 /// Path to an output file (that is created by this Exec) whose
5018 /// content will be recorded in OSPolicyResourceCompliance after a
5019 /// successful run. Absence or failure to read this file will result in
5020 /// this ExecResource being non-compliant. Output file size is limited to
5021 /// 100K bytes.
5022 pub output_file_path: std::string::String,
5023
5024 /// What to execute.
5025 pub source: std::option::Option<
5026 crate::model::os_policy::resource::exec_resource::exec::Source,
5027 >,
5028
5029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5030 }
5031
5032 impl Exec {
5033 /// Creates a new default instance.
5034 pub fn new() -> Self {
5035 std::default::Default::default()
5036 }
5037
5038 /// Sets the value of [args][crate::model::os_policy::resource::exec_resource::Exec::args].
5039 ///
5040 /// # Example
5041 /// ```ignore,no_run
5042 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5043 /// let x = Exec::new().set_args(["a", "b", "c"]);
5044 /// ```
5045 pub fn set_args<T, V>(mut self, v: T) -> Self
5046 where
5047 T: std::iter::IntoIterator<Item = V>,
5048 V: std::convert::Into<std::string::String>,
5049 {
5050 use std::iter::Iterator;
5051 self.args = v.into_iter().map(|i| i.into()).collect();
5052 self
5053 }
5054
5055 /// Sets the value of [interpreter][crate::model::os_policy::resource::exec_resource::Exec::interpreter].
5056 ///
5057 /// # Example
5058 /// ```ignore,no_run
5059 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5060 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::exec::Interpreter;
5061 /// let x0 = Exec::new().set_interpreter(Interpreter::None);
5062 /// let x1 = Exec::new().set_interpreter(Interpreter::Shell);
5063 /// let x2 = Exec::new().set_interpreter(Interpreter::Powershell);
5064 /// ```
5065 pub fn set_interpreter<
5066 T: std::convert::Into<
5067 crate::model::os_policy::resource::exec_resource::exec::Interpreter,
5068 >,
5069 >(
5070 mut self,
5071 v: T,
5072 ) -> Self {
5073 self.interpreter = v.into();
5074 self
5075 }
5076
5077 /// Sets the value of [output_file_path][crate::model::os_policy::resource::exec_resource::Exec::output_file_path].
5078 ///
5079 /// # Example
5080 /// ```ignore,no_run
5081 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5082 /// let x = Exec::new().set_output_file_path("example");
5083 /// ```
5084 pub fn set_output_file_path<T: std::convert::Into<std::string::String>>(
5085 mut self,
5086 v: T,
5087 ) -> Self {
5088 self.output_file_path = v.into();
5089 self
5090 }
5091
5092 /// Sets the value of [source][crate::model::os_policy::resource::exec_resource::Exec::source].
5093 ///
5094 /// Note that all the setters affecting `source` are mutually
5095 /// exclusive.
5096 ///
5097 /// # Example
5098 /// ```ignore,no_run
5099 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5100 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::exec::Source;
5101 /// let x = Exec::new().set_source(Some(Source::Script("example".to_string())));
5102 /// ```
5103 pub fn set_source<
5104 T: std::convert::Into<
5105 std::option::Option<
5106 crate::model::os_policy::resource::exec_resource::exec::Source,
5107 >,
5108 >,
5109 >(
5110 mut self,
5111 v: T,
5112 ) -> Self {
5113 self.source = v.into();
5114 self
5115 }
5116
5117 /// The value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5118 /// if it holds a `File`, `None` if the field is not set or
5119 /// holds a different branch.
5120 pub fn file(
5121 &self,
5122 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::File>>
5123 {
5124 #[allow(unreachable_patterns)]
5125 self.source.as_ref().and_then(|v| match v {
5126 crate::model::os_policy::resource::exec_resource::exec::Source::File(v) => {
5127 std::option::Option::Some(v)
5128 }
5129 _ => std::option::Option::None,
5130 })
5131 }
5132
5133 /// Sets the value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5134 /// to hold a `File`.
5135 ///
5136 /// Note that all the setters affecting `source` are
5137 /// mutually exclusive.
5138 ///
5139 /// # Example
5140 /// ```ignore,no_run
5141 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5142 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
5143 /// let x = Exec::new().set_file(File::default()/* use setters */);
5144 /// assert!(x.file().is_some());
5145 /// assert!(x.script().is_none());
5146 /// ```
5147 pub fn set_file<
5148 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::File>>,
5149 >(
5150 mut self,
5151 v: T,
5152 ) -> Self {
5153 self.source = std::option::Option::Some(
5154 crate::model::os_policy::resource::exec_resource::exec::Source::File(
5155 v.into(),
5156 ),
5157 );
5158 self
5159 }
5160
5161 /// The value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5162 /// if it holds a `Script`, `None` if the field is not set or
5163 /// holds a different branch.
5164 pub fn script(&self) -> std::option::Option<&std::string::String> {
5165 #[allow(unreachable_patterns)]
5166 self.source.as_ref().and_then(|v| match v {
5167 crate::model::os_policy::resource::exec_resource::exec::Source::Script(
5168 v,
5169 ) => std::option::Option::Some(v),
5170 _ => std::option::Option::None,
5171 })
5172 }
5173
5174 /// Sets the value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5175 /// to hold a `Script`.
5176 ///
5177 /// Note that all the setters affecting `source` are
5178 /// mutually exclusive.
5179 ///
5180 /// # Example
5181 /// ```ignore,no_run
5182 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5183 /// let x = Exec::new().set_script("example");
5184 /// assert!(x.script().is_some());
5185 /// assert!(x.file().is_none());
5186 /// ```
5187 pub fn set_script<T: std::convert::Into<std::string::String>>(
5188 mut self,
5189 v: T,
5190 ) -> Self {
5191 self.source = std::option::Option::Some(
5192 crate::model::os_policy::resource::exec_resource::exec::Source::Script(
5193 v.into(),
5194 ),
5195 );
5196 self
5197 }
5198 }
5199
5200 impl wkt::message::Message for Exec {
5201 fn typename() -> &'static str {
5202 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.ExecResource.Exec"
5203 }
5204 }
5205
5206 /// Defines additional types related to [Exec].
5207 pub mod exec {
5208 #[allow(unused_imports)]
5209 use super::*;
5210
5211 /// The interpreter to use.
5212 ///
5213 /// # Working with unknown values
5214 ///
5215 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5216 /// additional enum variants at any time. Adding new variants is not considered
5217 /// a breaking change. Applications should write their code in anticipation of:
5218 ///
5219 /// - New values appearing in future releases of the client library, **and**
5220 /// - New values received dynamically, without application changes.
5221 ///
5222 /// Please consult the [Working with enums] section in the user guide for some
5223 /// guidelines.
5224 ///
5225 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5226 #[derive(Clone, Debug, PartialEq)]
5227 #[non_exhaustive]
5228 pub enum Interpreter {
5229 /// Invalid value, the request will return validation error.
5230 Unspecified,
5231 /// If an interpreter is not specified, the
5232 /// source is executed directly. This execution, without an
5233 /// interpreter, only succeeds for executables and scripts that have <a
5234 /// href="https://en.wikipedia.org/wiki/Shebang_(Unix)"
5235 /// class="external"\>shebang lines</a>.
5236 None,
5237 /// Indicates that the script runs with `/bin/sh` on Linux and
5238 /// `cmd.exe` on Windows.
5239 Shell,
5240 /// Indicates that the script runs with PowerShell.
5241 Powershell,
5242 /// If set, the enum was initialized with an unknown value.
5243 ///
5244 /// Applications can examine the value using [Interpreter::value] or
5245 /// [Interpreter::name].
5246 UnknownValue(interpreter::UnknownValue),
5247 }
5248
5249 #[doc(hidden)]
5250 pub mod interpreter {
5251 #[allow(unused_imports)]
5252 use super::*;
5253 #[derive(Clone, Debug, PartialEq)]
5254 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5255 }
5256
5257 impl Interpreter {
5258 /// Gets the enum value.
5259 ///
5260 /// Returns `None` if the enum contains an unknown value deserialized from
5261 /// the string representation of enums.
5262 pub fn value(&self) -> std::option::Option<i32> {
5263 match self {
5264 Self::Unspecified => std::option::Option::Some(0),
5265 Self::None => std::option::Option::Some(1),
5266 Self::Shell => std::option::Option::Some(2),
5267 Self::Powershell => std::option::Option::Some(3),
5268 Self::UnknownValue(u) => u.0.value(),
5269 }
5270 }
5271
5272 /// Gets the enum value as a string.
5273 ///
5274 /// Returns `None` if the enum contains an unknown value deserialized from
5275 /// the integer representation of enums.
5276 pub fn name(&self) -> std::option::Option<&str> {
5277 match self {
5278 Self::Unspecified => {
5279 std::option::Option::Some("INTERPRETER_UNSPECIFIED")
5280 }
5281 Self::None => std::option::Option::Some("NONE"),
5282 Self::Shell => std::option::Option::Some("SHELL"),
5283 Self::Powershell => std::option::Option::Some("POWERSHELL"),
5284 Self::UnknownValue(u) => u.0.name(),
5285 }
5286 }
5287 }
5288
5289 impl std::default::Default for Interpreter {
5290 fn default() -> Self {
5291 use std::convert::From;
5292 Self::from(0)
5293 }
5294 }
5295
5296 impl std::fmt::Display for Interpreter {
5297 fn fmt(
5298 &self,
5299 f: &mut std::fmt::Formatter<'_>,
5300 ) -> std::result::Result<(), std::fmt::Error> {
5301 wkt::internal::display_enum(f, self.name(), self.value())
5302 }
5303 }
5304
5305 impl std::convert::From<i32> for Interpreter {
5306 fn from(value: i32) -> Self {
5307 match value {
5308 0 => Self::Unspecified,
5309 1 => Self::None,
5310 2 => Self::Shell,
5311 3 => Self::Powershell,
5312 _ => Self::UnknownValue(interpreter::UnknownValue(
5313 wkt::internal::UnknownEnumValue::Integer(value),
5314 )),
5315 }
5316 }
5317 }
5318
5319 impl std::convert::From<&str> for Interpreter {
5320 fn from(value: &str) -> Self {
5321 use std::string::ToString;
5322 match value {
5323 "INTERPRETER_UNSPECIFIED" => Self::Unspecified,
5324 "NONE" => Self::None,
5325 "SHELL" => Self::Shell,
5326 "POWERSHELL" => Self::Powershell,
5327 _ => Self::UnknownValue(interpreter::UnknownValue(
5328 wkt::internal::UnknownEnumValue::String(value.to_string()),
5329 )),
5330 }
5331 }
5332 }
5333
5334 impl serde::ser::Serialize for Interpreter {
5335 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5336 where
5337 S: serde::Serializer,
5338 {
5339 match self {
5340 Self::Unspecified => serializer.serialize_i32(0),
5341 Self::None => serializer.serialize_i32(1),
5342 Self::Shell => serializer.serialize_i32(2),
5343 Self::Powershell => serializer.serialize_i32(3),
5344 Self::UnknownValue(u) => u.0.serialize(serializer),
5345 }
5346 }
5347 }
5348
5349 impl<'de> serde::de::Deserialize<'de> for Interpreter {
5350 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5351 where
5352 D: serde::Deserializer<'de>,
5353 {
5354 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Interpreter>::new(
5355 ".google.cloud.osconfig.v1.OSPolicy.Resource.ExecResource.Exec.Interpreter"))
5356 }
5357 }
5358
5359 /// What to execute.
5360 #[derive(Clone, Debug, PartialEq)]
5361 #[non_exhaustive]
5362 pub enum Source {
5363 /// A remote or local file.
5364 File(std::boxed::Box<crate::model::os_policy::resource::File>),
5365 /// An inline script.
5366 /// The size of the script is limited to 1024 characters.
5367 Script(std::string::String),
5368 }
5369 }
5370 }
5371
5372 /// A resource that manages the state of a file.
5373 #[derive(Clone, Default, PartialEq)]
5374 #[non_exhaustive]
5375 pub struct FileResource {
5376 /// Required. The absolute path of the file within the VM.
5377 pub path: std::string::String,
5378
5379 /// Required. Desired state of the file.
5380 pub state: crate::model::os_policy::resource::file_resource::DesiredState,
5381
5382 /// Consists of three octal digits which represent, in
5383 /// order, the permissions of the owner, group, and other users for the
5384 /// file (similarly to the numeric mode used in the linux chmod
5385 /// utility). Each digit represents a three bit number with the 4 bit
5386 /// corresponding to the read permissions, the 2 bit corresponds to the
5387 /// write bit, and the one bit corresponds to the execute permission.
5388 /// Default behavior is 755.
5389 ///
5390 /// Below are some examples of permissions and their associated values:
5391 /// read, write, and execute: 7
5392 /// read and execute: 5
5393 /// read and write: 6
5394 /// read only: 4
5395 pub permissions: std::string::String,
5396
5397 /// The source for the contents of the file.
5398 pub source:
5399 std::option::Option<crate::model::os_policy::resource::file_resource::Source>,
5400
5401 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5402 }
5403
5404 impl FileResource {
5405 /// Creates a new default instance.
5406 pub fn new() -> Self {
5407 std::default::Default::default()
5408 }
5409
5410 /// Sets the value of [path][crate::model::os_policy::resource::FileResource::path].
5411 ///
5412 /// # Example
5413 /// ```ignore,no_run
5414 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5415 /// let x = FileResource::new().set_path("example");
5416 /// ```
5417 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5418 self.path = v.into();
5419 self
5420 }
5421
5422 /// Sets the value of [state][crate::model::os_policy::resource::FileResource::state].
5423 ///
5424 /// # Example
5425 /// ```ignore,no_run
5426 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5427 /// use google_cloud_osconfig_v1::model::os_policy::resource::file_resource::DesiredState;
5428 /// let x0 = FileResource::new().set_state(DesiredState::Present);
5429 /// let x1 = FileResource::new().set_state(DesiredState::Absent);
5430 /// let x2 = FileResource::new().set_state(DesiredState::ContentsMatch);
5431 /// ```
5432 pub fn set_state<
5433 T: std::convert::Into<crate::model::os_policy::resource::file_resource::DesiredState>,
5434 >(
5435 mut self,
5436 v: T,
5437 ) -> Self {
5438 self.state = v.into();
5439 self
5440 }
5441
5442 /// Sets the value of [permissions][crate::model::os_policy::resource::FileResource::permissions].
5443 ///
5444 /// # Example
5445 /// ```ignore,no_run
5446 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5447 /// let x = FileResource::new().set_permissions("example");
5448 /// ```
5449 pub fn set_permissions<T: std::convert::Into<std::string::String>>(
5450 mut self,
5451 v: T,
5452 ) -> Self {
5453 self.permissions = v.into();
5454 self
5455 }
5456
5457 /// Sets the value of [source][crate::model::os_policy::resource::FileResource::source].
5458 ///
5459 /// Note that all the setters affecting `source` are mutually
5460 /// exclusive.
5461 ///
5462 /// # Example
5463 /// ```ignore,no_run
5464 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5465 /// use google_cloud_osconfig_v1::model::os_policy::resource::file_resource::Source;
5466 /// let x = FileResource::new().set_source(Some(Source::Content("example".to_string())));
5467 /// ```
5468 pub fn set_source<
5469 T: std::convert::Into<
5470 std::option::Option<
5471 crate::model::os_policy::resource::file_resource::Source,
5472 >,
5473 >,
5474 >(
5475 mut self,
5476 v: T,
5477 ) -> Self {
5478 self.source = v.into();
5479 self
5480 }
5481
5482 /// The value of [source][crate::model::os_policy::resource::FileResource::source]
5483 /// if it holds a `File`, `None` if the field is not set or
5484 /// holds a different branch.
5485 pub fn file(
5486 &self,
5487 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::File>>
5488 {
5489 #[allow(unreachable_patterns)]
5490 self.source.as_ref().and_then(|v| match v {
5491 crate::model::os_policy::resource::file_resource::Source::File(v) => {
5492 std::option::Option::Some(v)
5493 }
5494 _ => std::option::Option::None,
5495 })
5496 }
5497
5498 /// Sets the value of [source][crate::model::os_policy::resource::FileResource::source]
5499 /// to hold a `File`.
5500 ///
5501 /// Note that all the setters affecting `source` are
5502 /// mutually exclusive.
5503 ///
5504 /// # Example
5505 /// ```ignore,no_run
5506 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5507 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
5508 /// let x = FileResource::new().set_file(File::default()/* use setters */);
5509 /// assert!(x.file().is_some());
5510 /// assert!(x.content().is_none());
5511 /// ```
5512 pub fn set_file<
5513 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::File>>,
5514 >(
5515 mut self,
5516 v: T,
5517 ) -> Self {
5518 self.source = std::option::Option::Some(
5519 crate::model::os_policy::resource::file_resource::Source::File(v.into()),
5520 );
5521 self
5522 }
5523
5524 /// The value of [source][crate::model::os_policy::resource::FileResource::source]
5525 /// if it holds a `Content`, `None` if the field is not set or
5526 /// holds a different branch.
5527 pub fn content(&self) -> std::option::Option<&std::string::String> {
5528 #[allow(unreachable_patterns)]
5529 self.source.as_ref().and_then(|v| match v {
5530 crate::model::os_policy::resource::file_resource::Source::Content(v) => {
5531 std::option::Option::Some(v)
5532 }
5533 _ => std::option::Option::None,
5534 })
5535 }
5536
5537 /// Sets the value of [source][crate::model::os_policy::resource::FileResource::source]
5538 /// to hold a `Content`.
5539 ///
5540 /// Note that all the setters affecting `source` are
5541 /// mutually exclusive.
5542 ///
5543 /// # Example
5544 /// ```ignore,no_run
5545 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5546 /// let x = FileResource::new().set_content("example");
5547 /// assert!(x.content().is_some());
5548 /// assert!(x.file().is_none());
5549 /// ```
5550 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5551 self.source = std::option::Option::Some(
5552 crate::model::os_policy::resource::file_resource::Source::Content(v.into()),
5553 );
5554 self
5555 }
5556 }
5557
5558 impl wkt::message::Message for FileResource {
5559 fn typename() -> &'static str {
5560 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.FileResource"
5561 }
5562 }
5563
5564 /// Defines additional types related to [FileResource].
5565 pub mod file_resource {
5566 #[allow(unused_imports)]
5567 use super::*;
5568
5569 /// Desired state of the file.
5570 ///
5571 /// # Working with unknown values
5572 ///
5573 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5574 /// additional enum variants at any time. Adding new variants is not considered
5575 /// a breaking change. Applications should write their code in anticipation of:
5576 ///
5577 /// - New values appearing in future releases of the client library, **and**
5578 /// - New values received dynamically, without application changes.
5579 ///
5580 /// Please consult the [Working with enums] section in the user guide for some
5581 /// guidelines.
5582 ///
5583 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5584 #[derive(Clone, Debug, PartialEq)]
5585 #[non_exhaustive]
5586 pub enum DesiredState {
5587 /// Unspecified is invalid.
5588 Unspecified,
5589 /// Ensure file at path is present.
5590 Present,
5591 /// Ensure file at path is absent.
5592 Absent,
5593 /// Ensure the contents of the file at path matches. If the file does
5594 /// not exist it will be created.
5595 ContentsMatch,
5596 /// If set, the enum was initialized with an unknown value.
5597 ///
5598 /// Applications can examine the value using [DesiredState::value] or
5599 /// [DesiredState::name].
5600 UnknownValue(desired_state::UnknownValue),
5601 }
5602
5603 #[doc(hidden)]
5604 pub mod desired_state {
5605 #[allow(unused_imports)]
5606 use super::*;
5607 #[derive(Clone, Debug, PartialEq)]
5608 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5609 }
5610
5611 impl DesiredState {
5612 /// Gets the enum value.
5613 ///
5614 /// Returns `None` if the enum contains an unknown value deserialized from
5615 /// the string representation of enums.
5616 pub fn value(&self) -> std::option::Option<i32> {
5617 match self {
5618 Self::Unspecified => std::option::Option::Some(0),
5619 Self::Present => std::option::Option::Some(1),
5620 Self::Absent => std::option::Option::Some(2),
5621 Self::ContentsMatch => std::option::Option::Some(3),
5622 Self::UnknownValue(u) => u.0.value(),
5623 }
5624 }
5625
5626 /// Gets the enum value as a string.
5627 ///
5628 /// Returns `None` if the enum contains an unknown value deserialized from
5629 /// the integer representation of enums.
5630 pub fn name(&self) -> std::option::Option<&str> {
5631 match self {
5632 Self::Unspecified => std::option::Option::Some("DESIRED_STATE_UNSPECIFIED"),
5633 Self::Present => std::option::Option::Some("PRESENT"),
5634 Self::Absent => std::option::Option::Some("ABSENT"),
5635 Self::ContentsMatch => std::option::Option::Some("CONTENTS_MATCH"),
5636 Self::UnknownValue(u) => u.0.name(),
5637 }
5638 }
5639 }
5640
5641 impl std::default::Default for DesiredState {
5642 fn default() -> Self {
5643 use std::convert::From;
5644 Self::from(0)
5645 }
5646 }
5647
5648 impl std::fmt::Display for DesiredState {
5649 fn fmt(
5650 &self,
5651 f: &mut std::fmt::Formatter<'_>,
5652 ) -> std::result::Result<(), std::fmt::Error> {
5653 wkt::internal::display_enum(f, self.name(), self.value())
5654 }
5655 }
5656
5657 impl std::convert::From<i32> for DesiredState {
5658 fn from(value: i32) -> Self {
5659 match value {
5660 0 => Self::Unspecified,
5661 1 => Self::Present,
5662 2 => Self::Absent,
5663 3 => Self::ContentsMatch,
5664 _ => Self::UnknownValue(desired_state::UnknownValue(
5665 wkt::internal::UnknownEnumValue::Integer(value),
5666 )),
5667 }
5668 }
5669 }
5670
5671 impl std::convert::From<&str> for DesiredState {
5672 fn from(value: &str) -> Self {
5673 use std::string::ToString;
5674 match value {
5675 "DESIRED_STATE_UNSPECIFIED" => Self::Unspecified,
5676 "PRESENT" => Self::Present,
5677 "ABSENT" => Self::Absent,
5678 "CONTENTS_MATCH" => Self::ContentsMatch,
5679 _ => Self::UnknownValue(desired_state::UnknownValue(
5680 wkt::internal::UnknownEnumValue::String(value.to_string()),
5681 )),
5682 }
5683 }
5684 }
5685
5686 impl serde::ser::Serialize for DesiredState {
5687 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5688 where
5689 S: serde::Serializer,
5690 {
5691 match self {
5692 Self::Unspecified => serializer.serialize_i32(0),
5693 Self::Present => serializer.serialize_i32(1),
5694 Self::Absent => serializer.serialize_i32(2),
5695 Self::ContentsMatch => serializer.serialize_i32(3),
5696 Self::UnknownValue(u) => u.0.serialize(serializer),
5697 }
5698 }
5699 }
5700
5701 impl<'de> serde::de::Deserialize<'de> for DesiredState {
5702 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5703 where
5704 D: serde::Deserializer<'de>,
5705 {
5706 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DesiredState>::new(
5707 ".google.cloud.osconfig.v1.OSPolicy.Resource.FileResource.DesiredState",
5708 ))
5709 }
5710 }
5711
5712 /// The source for the contents of the file.
5713 #[derive(Clone, Debug, PartialEq)]
5714 #[non_exhaustive]
5715 pub enum Source {
5716 /// A remote or local source.
5717 File(std::boxed::Box<crate::model::os_policy::resource::File>),
5718 /// A a file with this content.
5719 /// The size of the content is limited to 1024 characters.
5720 Content(std::string::String),
5721 }
5722 }
5723
5724 /// Resource type.
5725 #[derive(Clone, Debug, PartialEq)]
5726 #[non_exhaustive]
5727 pub enum ResourceType {
5728 /// Package resource
5729 Pkg(std::boxed::Box<crate::model::os_policy::resource::PackageResource>),
5730 /// Package repository resource
5731 Repository(std::boxed::Box<crate::model::os_policy::resource::RepositoryResource>),
5732 /// Exec resource
5733 Exec(std::boxed::Box<crate::model::os_policy::resource::ExecResource>),
5734 /// File resource
5735 File(std::boxed::Box<crate::model::os_policy::resource::FileResource>),
5736 }
5737 }
5738
5739 /// Resource groups provide a mechanism to group OS policy resources.
5740 ///
5741 /// Resource groups enable OS policy authors to create a single OS policy
5742 /// to be applied to VMs running different operating Systems.
5743 ///
5744 /// When the OS policy is applied to a target VM, the appropriate resource
5745 /// group within the OS policy is selected based on the `OSFilter` specified
5746 /// within the resource group.
5747 #[derive(Clone, Default, PartialEq)]
5748 #[non_exhaustive]
5749 pub struct ResourceGroup {
5750 /// List of inventory filters for the resource group.
5751 ///
5752 /// The resources in this resource group are applied to the target VM if it
5753 /// satisfies at least one of the following inventory filters.
5754 ///
5755 /// For example, to apply this resource group to VMs running either `RHEL` or
5756 /// `CentOS` operating systems, specify 2 items for the list with following
5757 /// values:
5758 /// inventory_filters[0].os_short_name='rhel' and
5759 /// inventory_filters[1].os_short_name='centos'
5760 ///
5761 /// If the list is empty, this resource group will be applied to the target
5762 /// VM unconditionally.
5763 pub inventory_filters: std::vec::Vec<crate::model::os_policy::InventoryFilter>,
5764
5765 /// Required. List of resources configured for this resource group.
5766 /// The resources are executed in the exact order specified here.
5767 pub resources: std::vec::Vec<crate::model::os_policy::Resource>,
5768
5769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5770 }
5771
5772 impl ResourceGroup {
5773 /// Creates a new default instance.
5774 pub fn new() -> Self {
5775 std::default::Default::default()
5776 }
5777
5778 /// Sets the value of [inventory_filters][crate::model::os_policy::ResourceGroup::inventory_filters].
5779 ///
5780 /// # Example
5781 /// ```ignore,no_run
5782 /// # use google_cloud_osconfig_v1::model::os_policy::ResourceGroup;
5783 /// use google_cloud_osconfig_v1::model::os_policy::InventoryFilter;
5784 /// let x = ResourceGroup::new()
5785 /// .set_inventory_filters([
5786 /// InventoryFilter::default()/* use setters */,
5787 /// InventoryFilter::default()/* use (different) setters */,
5788 /// ]);
5789 /// ```
5790 pub fn set_inventory_filters<T, V>(mut self, v: T) -> Self
5791 where
5792 T: std::iter::IntoIterator<Item = V>,
5793 V: std::convert::Into<crate::model::os_policy::InventoryFilter>,
5794 {
5795 use std::iter::Iterator;
5796 self.inventory_filters = v.into_iter().map(|i| i.into()).collect();
5797 self
5798 }
5799
5800 /// Sets the value of [resources][crate::model::os_policy::ResourceGroup::resources].
5801 ///
5802 /// # Example
5803 /// ```ignore,no_run
5804 /// # use google_cloud_osconfig_v1::model::os_policy::ResourceGroup;
5805 /// use google_cloud_osconfig_v1::model::os_policy::Resource;
5806 /// let x = ResourceGroup::new()
5807 /// .set_resources([
5808 /// Resource::default()/* use setters */,
5809 /// Resource::default()/* use (different) setters */,
5810 /// ]);
5811 /// ```
5812 pub fn set_resources<T, V>(mut self, v: T) -> Self
5813 where
5814 T: std::iter::IntoIterator<Item = V>,
5815 V: std::convert::Into<crate::model::os_policy::Resource>,
5816 {
5817 use std::iter::Iterator;
5818 self.resources = v.into_iter().map(|i| i.into()).collect();
5819 self
5820 }
5821 }
5822
5823 impl wkt::message::Message for ResourceGroup {
5824 fn typename() -> &'static str {
5825 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.ResourceGroup"
5826 }
5827 }
5828
5829 /// Policy mode
5830 ///
5831 /// # Working with unknown values
5832 ///
5833 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5834 /// additional enum variants at any time. Adding new variants is not considered
5835 /// a breaking change. Applications should write their code in anticipation of:
5836 ///
5837 /// - New values appearing in future releases of the client library, **and**
5838 /// - New values received dynamically, without application changes.
5839 ///
5840 /// Please consult the [Working with enums] section in the user guide for some
5841 /// guidelines.
5842 ///
5843 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5844 #[derive(Clone, Debug, PartialEq)]
5845 #[non_exhaustive]
5846 pub enum Mode {
5847 /// Invalid mode
5848 Unspecified,
5849 /// This mode checks if the configuration resources in the policy are in
5850 /// their desired state. No actions are performed if they are not in the
5851 /// desired state. This mode is used for reporting purposes.
5852 Validation,
5853 /// This mode checks if the configuration resources in the policy are in
5854 /// their desired state, and if not, enforces the desired state.
5855 Enforcement,
5856 /// If set, the enum was initialized with an unknown value.
5857 ///
5858 /// Applications can examine the value using [Mode::value] or
5859 /// [Mode::name].
5860 UnknownValue(mode::UnknownValue),
5861 }
5862
5863 #[doc(hidden)]
5864 pub mod mode {
5865 #[allow(unused_imports)]
5866 use super::*;
5867 #[derive(Clone, Debug, PartialEq)]
5868 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5869 }
5870
5871 impl Mode {
5872 /// Gets the enum value.
5873 ///
5874 /// Returns `None` if the enum contains an unknown value deserialized from
5875 /// the string representation of enums.
5876 pub fn value(&self) -> std::option::Option<i32> {
5877 match self {
5878 Self::Unspecified => std::option::Option::Some(0),
5879 Self::Validation => std::option::Option::Some(1),
5880 Self::Enforcement => std::option::Option::Some(2),
5881 Self::UnknownValue(u) => u.0.value(),
5882 }
5883 }
5884
5885 /// Gets the enum value as a string.
5886 ///
5887 /// Returns `None` if the enum contains an unknown value deserialized from
5888 /// the integer representation of enums.
5889 pub fn name(&self) -> std::option::Option<&str> {
5890 match self {
5891 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
5892 Self::Validation => std::option::Option::Some("VALIDATION"),
5893 Self::Enforcement => std::option::Option::Some("ENFORCEMENT"),
5894 Self::UnknownValue(u) => u.0.name(),
5895 }
5896 }
5897 }
5898
5899 impl std::default::Default for Mode {
5900 fn default() -> Self {
5901 use std::convert::From;
5902 Self::from(0)
5903 }
5904 }
5905
5906 impl std::fmt::Display for Mode {
5907 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5908 wkt::internal::display_enum(f, self.name(), self.value())
5909 }
5910 }
5911
5912 impl std::convert::From<i32> for Mode {
5913 fn from(value: i32) -> Self {
5914 match value {
5915 0 => Self::Unspecified,
5916 1 => Self::Validation,
5917 2 => Self::Enforcement,
5918 _ => Self::UnknownValue(mode::UnknownValue(
5919 wkt::internal::UnknownEnumValue::Integer(value),
5920 )),
5921 }
5922 }
5923 }
5924
5925 impl std::convert::From<&str> for Mode {
5926 fn from(value: &str) -> Self {
5927 use std::string::ToString;
5928 match value {
5929 "MODE_UNSPECIFIED" => Self::Unspecified,
5930 "VALIDATION" => Self::Validation,
5931 "ENFORCEMENT" => Self::Enforcement,
5932 _ => Self::UnknownValue(mode::UnknownValue(
5933 wkt::internal::UnknownEnumValue::String(value.to_string()),
5934 )),
5935 }
5936 }
5937 }
5938
5939 impl serde::ser::Serialize for Mode {
5940 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5941 where
5942 S: serde::Serializer,
5943 {
5944 match self {
5945 Self::Unspecified => serializer.serialize_i32(0),
5946 Self::Validation => serializer.serialize_i32(1),
5947 Self::Enforcement => serializer.serialize_i32(2),
5948 Self::UnknownValue(u) => u.0.serialize(serializer),
5949 }
5950 }
5951 }
5952
5953 impl<'de> serde::de::Deserialize<'de> for Mode {
5954 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5955 where
5956 D: serde::Deserializer<'de>,
5957 {
5958 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
5959 ".google.cloud.osconfig.v1.OSPolicy.Mode",
5960 ))
5961 }
5962 }
5963}
5964
5965/// Get a report of the OS policy assignment for a VM instance.
5966#[derive(Clone, Default, PartialEq)]
5967#[non_exhaustive]
5968pub struct GetOSPolicyAssignmentReportRequest {
5969 /// Required. API resource name for OS policy assignment report.
5970 ///
5971 /// Format:
5972 /// `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`
5973 ///
5974 /// For `{project}`, either `project-number` or `project-id` can be provided.
5975 /// For `{instance_id}`, either Compute Engine `instance-id` or `instance-name`
5976 /// can be provided.
5977 /// For `{assignment_id}`, the OSPolicyAssignment id must be provided.
5978 pub name: std::string::String,
5979
5980 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5981}
5982
5983impl GetOSPolicyAssignmentReportRequest {
5984 /// Creates a new default instance.
5985 pub fn new() -> Self {
5986 std::default::Default::default()
5987 }
5988
5989 /// Sets the value of [name][crate::model::GetOSPolicyAssignmentReportRequest::name].
5990 ///
5991 /// # Example
5992 /// ```ignore,no_run
5993 /// # use google_cloud_osconfig_v1::model::GetOSPolicyAssignmentReportRequest;
5994 /// let x = GetOSPolicyAssignmentReportRequest::new().set_name("example");
5995 /// ```
5996 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5997 self.name = v.into();
5998 self
5999 }
6000}
6001
6002impl wkt::message::Message for GetOSPolicyAssignmentReportRequest {
6003 fn typename() -> &'static str {
6004 "type.googleapis.com/google.cloud.osconfig.v1.GetOSPolicyAssignmentReportRequest"
6005 }
6006}
6007
6008/// List the OS policy assignment reports for VM instances.
6009#[derive(Clone, Default, PartialEq)]
6010#[non_exhaustive]
6011pub struct ListOSPolicyAssignmentReportsRequest {
6012 /// Required. The parent resource name.
6013 ///
6014 /// Format:
6015 /// `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`
6016 ///
6017 /// For `{project}`, either `project-number` or `project-id` can be provided.
6018 /// For `{instance}`, either `instance-name`, `instance-id`, or `-` can be
6019 /// provided. If '-' is provided, the response will include
6020 /// OSPolicyAssignmentReports for all instances in the project/location.
6021 /// For `{assignment}`, either `assignment-id` or `-` can be provided. If '-'
6022 /// is provided, the response will include OSPolicyAssignmentReports for all
6023 /// OSPolicyAssignments in the project/location.
6024 /// Either {instance} or {assignment} must be `-`.
6025 ///
6026 /// For example:
6027 /// `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports`
6028 /// returns all reports for the instance
6029 /// `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports`
6030 /// returns all the reports for the given assignment across all instances.
6031 /// `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports`
6032 /// returns all the reports for all assignments across all instances.
6033 pub parent: std::string::String,
6034
6035 /// The maximum number of results to return.
6036 pub page_size: i32,
6037
6038 /// If provided, this field specifies the criteria that must be met by the
6039 /// `OSPolicyAssignmentReport` API resource that is included in the response.
6040 pub filter: std::string::String,
6041
6042 /// A pagination token returned from a previous call to the
6043 /// `ListOSPolicyAssignmentReports` method that indicates where this listing
6044 /// should continue from.
6045 pub page_token: std::string::String,
6046
6047 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6048}
6049
6050impl ListOSPolicyAssignmentReportsRequest {
6051 /// Creates a new default instance.
6052 pub fn new() -> Self {
6053 std::default::Default::default()
6054 }
6055
6056 /// Sets the value of [parent][crate::model::ListOSPolicyAssignmentReportsRequest::parent].
6057 ///
6058 /// # Example
6059 /// ```ignore,no_run
6060 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6061 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_parent("example");
6062 /// ```
6063 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6064 self.parent = v.into();
6065 self
6066 }
6067
6068 /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentReportsRequest::page_size].
6069 ///
6070 /// # Example
6071 /// ```ignore,no_run
6072 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6073 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_page_size(42);
6074 /// ```
6075 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6076 self.page_size = v.into();
6077 self
6078 }
6079
6080 /// Sets the value of [filter][crate::model::ListOSPolicyAssignmentReportsRequest::filter].
6081 ///
6082 /// # Example
6083 /// ```ignore,no_run
6084 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6085 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_filter("example");
6086 /// ```
6087 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6088 self.filter = v.into();
6089 self
6090 }
6091
6092 /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentReportsRequest::page_token].
6093 ///
6094 /// # Example
6095 /// ```ignore,no_run
6096 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6097 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_page_token("example");
6098 /// ```
6099 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6100 self.page_token = v.into();
6101 self
6102 }
6103}
6104
6105impl wkt::message::Message for ListOSPolicyAssignmentReportsRequest {
6106 fn typename() -> &'static str {
6107 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest"
6108 }
6109}
6110
6111/// A response message for listing OS Policy assignment reports including the
6112/// page of results and page token.
6113#[derive(Clone, Default, PartialEq)]
6114#[non_exhaustive]
6115pub struct ListOSPolicyAssignmentReportsResponse {
6116 /// List of OS policy assignment reports.
6117 pub os_policy_assignment_reports: std::vec::Vec<crate::model::OSPolicyAssignmentReport>,
6118
6119 /// The pagination token to retrieve the next page of OS policy assignment
6120 /// report objects.
6121 pub next_page_token: std::string::String,
6122
6123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6124}
6125
6126impl ListOSPolicyAssignmentReportsResponse {
6127 /// Creates a new default instance.
6128 pub fn new() -> Self {
6129 std::default::Default::default()
6130 }
6131
6132 /// Sets the value of [os_policy_assignment_reports][crate::model::ListOSPolicyAssignmentReportsResponse::os_policy_assignment_reports].
6133 ///
6134 /// # Example
6135 /// ```ignore,no_run
6136 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsResponse;
6137 /// use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6138 /// let x = ListOSPolicyAssignmentReportsResponse::new()
6139 /// .set_os_policy_assignment_reports([
6140 /// OSPolicyAssignmentReport::default()/* use setters */,
6141 /// OSPolicyAssignmentReport::default()/* use (different) setters */,
6142 /// ]);
6143 /// ```
6144 pub fn set_os_policy_assignment_reports<T, V>(mut self, v: T) -> Self
6145 where
6146 T: std::iter::IntoIterator<Item = V>,
6147 V: std::convert::Into<crate::model::OSPolicyAssignmentReport>,
6148 {
6149 use std::iter::Iterator;
6150 self.os_policy_assignment_reports = v.into_iter().map(|i| i.into()).collect();
6151 self
6152 }
6153
6154 /// Sets the value of [next_page_token][crate::model::ListOSPolicyAssignmentReportsResponse::next_page_token].
6155 ///
6156 /// # Example
6157 /// ```ignore,no_run
6158 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsResponse;
6159 /// let x = ListOSPolicyAssignmentReportsResponse::new().set_next_page_token("example");
6160 /// ```
6161 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6162 self.next_page_token = v.into();
6163 self
6164 }
6165}
6166
6167impl wkt::message::Message for ListOSPolicyAssignmentReportsResponse {
6168 fn typename() -> &'static str {
6169 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsResponse"
6170 }
6171}
6172
6173#[doc(hidden)]
6174impl google_cloud_gax::paginator::internal::PageableResponse
6175 for ListOSPolicyAssignmentReportsResponse
6176{
6177 type PageItem = crate::model::OSPolicyAssignmentReport;
6178
6179 fn items(self) -> std::vec::Vec<Self::PageItem> {
6180 self.os_policy_assignment_reports
6181 }
6182
6183 fn next_page_token(&self) -> std::string::String {
6184 use std::clone::Clone;
6185 self.next_page_token.clone()
6186 }
6187}
6188
6189/// A report of the OS policy assignment status for a given instance.
6190#[derive(Clone, Default, PartialEq)]
6191#[non_exhaustive]
6192pub struct OSPolicyAssignmentReport {
6193 /// The `OSPolicyAssignmentReport` API resource name.
6194 ///
6195 /// Format:
6196 /// `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report`
6197 pub name: std::string::String,
6198
6199 /// The Compute Engine VM instance name.
6200 pub instance: std::string::String,
6201
6202 /// Reference to the `OSPolicyAssignment` API resource that the `OSPolicy`
6203 /// belongs to.
6204 ///
6205 /// Format:
6206 /// `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
6207 pub os_policy_assignment: std::string::String,
6208
6209 /// Compliance data for each `OSPolicy` that is applied to the VM.
6210 pub os_policy_compliances:
6211 std::vec::Vec<crate::model::os_policy_assignment_report::OSPolicyCompliance>,
6212
6213 /// Timestamp for when the report was last generated.
6214 pub update_time: std::option::Option<wkt::Timestamp>,
6215
6216 /// Unique identifier of the last attempted run to apply the OS policies
6217 /// associated with this assignment on the VM.
6218 ///
6219 /// This ID is logged by the OS Config agent while applying the OS
6220 /// policies associated with this assignment on the VM.
6221 /// NOTE: If the service is unable to successfully connect to the agent for
6222 /// this run, then this id will not be available in the agent logs.
6223 pub last_run_id: std::string::String,
6224
6225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6226}
6227
6228impl OSPolicyAssignmentReport {
6229 /// Creates a new default instance.
6230 pub fn new() -> Self {
6231 std::default::Default::default()
6232 }
6233
6234 /// Sets the value of [name][crate::model::OSPolicyAssignmentReport::name].
6235 ///
6236 /// # Example
6237 /// ```ignore,no_run
6238 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6239 /// let x = OSPolicyAssignmentReport::new().set_name("example");
6240 /// ```
6241 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6242 self.name = v.into();
6243 self
6244 }
6245
6246 /// Sets the value of [instance][crate::model::OSPolicyAssignmentReport::instance].
6247 ///
6248 /// # Example
6249 /// ```ignore,no_run
6250 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6251 /// let x = OSPolicyAssignmentReport::new().set_instance("example");
6252 /// ```
6253 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6254 self.instance = v.into();
6255 self
6256 }
6257
6258 /// Sets the value of [os_policy_assignment][crate::model::OSPolicyAssignmentReport::os_policy_assignment].
6259 ///
6260 /// # Example
6261 /// ```ignore,no_run
6262 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6263 /// let x = OSPolicyAssignmentReport::new().set_os_policy_assignment("example");
6264 /// ```
6265 pub fn set_os_policy_assignment<T: std::convert::Into<std::string::String>>(
6266 mut self,
6267 v: T,
6268 ) -> Self {
6269 self.os_policy_assignment = v.into();
6270 self
6271 }
6272
6273 /// Sets the value of [os_policy_compliances][crate::model::OSPolicyAssignmentReport::os_policy_compliances].
6274 ///
6275 /// # Example
6276 /// ```ignore,no_run
6277 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6278 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6279 /// let x = OSPolicyAssignmentReport::new()
6280 /// .set_os_policy_compliances([
6281 /// OSPolicyCompliance::default()/* use setters */,
6282 /// OSPolicyCompliance::default()/* use (different) setters */,
6283 /// ]);
6284 /// ```
6285 pub fn set_os_policy_compliances<T, V>(mut self, v: T) -> Self
6286 where
6287 T: std::iter::IntoIterator<Item = V>,
6288 V: std::convert::Into<crate::model::os_policy_assignment_report::OSPolicyCompliance>,
6289 {
6290 use std::iter::Iterator;
6291 self.os_policy_compliances = v.into_iter().map(|i| i.into()).collect();
6292 self
6293 }
6294
6295 /// Sets the value of [update_time][crate::model::OSPolicyAssignmentReport::update_time].
6296 ///
6297 /// # Example
6298 /// ```ignore,no_run
6299 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6300 /// use wkt::Timestamp;
6301 /// let x = OSPolicyAssignmentReport::new().set_update_time(Timestamp::default()/* use setters */);
6302 /// ```
6303 pub fn set_update_time<T>(mut self, v: T) -> Self
6304 where
6305 T: std::convert::Into<wkt::Timestamp>,
6306 {
6307 self.update_time = std::option::Option::Some(v.into());
6308 self
6309 }
6310
6311 /// Sets or clears the value of [update_time][crate::model::OSPolicyAssignmentReport::update_time].
6312 ///
6313 /// # Example
6314 /// ```ignore,no_run
6315 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6316 /// use wkt::Timestamp;
6317 /// let x = OSPolicyAssignmentReport::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6318 /// let x = OSPolicyAssignmentReport::new().set_or_clear_update_time(None::<Timestamp>);
6319 /// ```
6320 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6321 where
6322 T: std::convert::Into<wkt::Timestamp>,
6323 {
6324 self.update_time = v.map(|x| x.into());
6325 self
6326 }
6327
6328 /// Sets the value of [last_run_id][crate::model::OSPolicyAssignmentReport::last_run_id].
6329 ///
6330 /// # Example
6331 /// ```ignore,no_run
6332 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6333 /// let x = OSPolicyAssignmentReport::new().set_last_run_id("example");
6334 /// ```
6335 pub fn set_last_run_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6336 self.last_run_id = v.into();
6337 self
6338 }
6339}
6340
6341impl wkt::message::Message for OSPolicyAssignmentReport {
6342 fn typename() -> &'static str {
6343 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport"
6344 }
6345}
6346
6347/// Defines additional types related to [OSPolicyAssignmentReport].
6348pub mod os_policy_assignment_report {
6349 #[allow(unused_imports)]
6350 use super::*;
6351
6352 /// Compliance data for an OS policy
6353 #[derive(Clone, Default, PartialEq)]
6354 #[non_exhaustive]
6355 pub struct OSPolicyCompliance {
6356
6357 /// The OS policy id
6358 pub os_policy_id: std::string::String,
6359
6360 /// The compliance state of the OS policy.
6361 pub compliance_state: crate::model::os_policy_assignment_report::os_policy_compliance::ComplianceState,
6362
6363 /// The reason for the OS policy to be in an unknown compliance state.
6364 /// This field is always populated when `compliance_state` is `UNKNOWN`.
6365 ///
6366 /// If populated, the field can contain one of the following values:
6367 ///
6368 /// * `vm-not-running`: The VM was not running.
6369 /// * `os-policies-not-supported-by-agent`: The version of the OS Config
6370 /// agent running on the VM does not support running OS policies.
6371 /// * `no-agent-detected`: The OS Config agent is not detected for the VM.
6372 /// * `resource-execution-errors`: The OS Config agent encountered errors
6373 /// while executing one or more resources in the policy. See
6374 /// `os_policy_resource_compliances` for details.
6375 /// * `task-timeout`: The task sent to the agent to apply the policy timed
6376 /// out.
6377 /// * `unexpected-agent-state`: The OS Config agent did not report the final
6378 /// status of the task that attempted to apply the policy. Instead, the agent
6379 /// unexpectedly started working on a different task. This mostly happens
6380 /// when the agent or VM unexpectedly restarts while applying OS policies.
6381 /// * `internal-service-errors`: Internal service errors were encountered
6382 /// while attempting to apply the policy.
6383 pub compliance_state_reason: std::string::String,
6384
6385 /// Compliance data for each resource within the policy that is applied to
6386 /// the VM.
6387 pub os_policy_resource_compliances: std::vec::Vec<crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance>,
6388
6389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6390 }
6391
6392 impl OSPolicyCompliance {
6393 /// Creates a new default instance.
6394 pub fn new() -> Self {
6395 std::default::Default::default()
6396 }
6397
6398 /// Sets the value of [os_policy_id][crate::model::os_policy_assignment_report::OSPolicyCompliance::os_policy_id].
6399 ///
6400 /// # Example
6401 /// ```ignore,no_run
6402 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6403 /// let x = OSPolicyCompliance::new().set_os_policy_id("example");
6404 /// ```
6405 pub fn set_os_policy_id<T: std::convert::Into<std::string::String>>(
6406 mut self,
6407 v: T,
6408 ) -> Self {
6409 self.os_policy_id = v.into();
6410 self
6411 }
6412
6413 /// Sets the value of [compliance_state][crate::model::os_policy_assignment_report::OSPolicyCompliance::compliance_state].
6414 ///
6415 /// # Example
6416 /// ```ignore,no_run
6417 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6418 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::ComplianceState;
6419 /// let x0 = OSPolicyCompliance::new().set_compliance_state(ComplianceState::Compliant);
6420 /// let x1 = OSPolicyCompliance::new().set_compliance_state(ComplianceState::NonCompliant);
6421 /// ```
6422 pub fn set_compliance_state<T: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::ComplianceState>>(mut self, v: T) -> Self{
6423 self.compliance_state = v.into();
6424 self
6425 }
6426
6427 /// Sets the value of [compliance_state_reason][crate::model::os_policy_assignment_report::OSPolicyCompliance::compliance_state_reason].
6428 ///
6429 /// # Example
6430 /// ```ignore,no_run
6431 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6432 /// let x = OSPolicyCompliance::new().set_compliance_state_reason("example");
6433 /// ```
6434 pub fn set_compliance_state_reason<T: std::convert::Into<std::string::String>>(
6435 mut self,
6436 v: T,
6437 ) -> Self {
6438 self.compliance_state_reason = v.into();
6439 self
6440 }
6441
6442 /// Sets the value of [os_policy_resource_compliances][crate::model::os_policy_assignment_report::OSPolicyCompliance::os_policy_resource_compliances].
6443 ///
6444 /// # Example
6445 /// ```ignore,no_run
6446 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6447 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6448 /// let x = OSPolicyCompliance::new()
6449 /// .set_os_policy_resource_compliances([
6450 /// OSPolicyResourceCompliance::default()/* use setters */,
6451 /// OSPolicyResourceCompliance::default()/* use (different) setters */,
6452 /// ]);
6453 /// ```
6454 pub fn set_os_policy_resource_compliances<T, V>(mut self, v: T) -> Self
6455 where
6456 T: std::iter::IntoIterator<Item = V>,
6457 V: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance>
6458 {
6459 use std::iter::Iterator;
6460 self.os_policy_resource_compliances = v.into_iter().map(|i| i.into()).collect();
6461 self
6462 }
6463 }
6464
6465 impl wkt::message::Message for OSPolicyCompliance {
6466 fn typename() -> &'static str {
6467 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance"
6468 }
6469 }
6470
6471 /// Defines additional types related to [OSPolicyCompliance].
6472 pub mod os_policy_compliance {
6473 #[allow(unused_imports)]
6474 use super::*;
6475
6476 /// Compliance data for an OS policy resource.
6477 #[derive(Clone, Default, PartialEq)]
6478 #[non_exhaustive]
6479 pub struct OSPolicyResourceCompliance {
6480
6481 /// The ID of the OS policy resource.
6482 pub os_policy_resource_id: std::string::String,
6483
6484 /// Ordered list of configuration completed by the agent for the OS policy
6485 /// resource.
6486 pub config_steps: std::vec::Vec<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep>,
6487
6488 /// The compliance state of the resource.
6489 pub compliance_state: crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ComplianceState,
6490
6491 /// A reason for the resource to be in the given compliance state.
6492 /// This field is always populated when `compliance_state` is `UNKNOWN`.
6493 ///
6494 /// The following values are supported when `compliance_state == UNKNOWN`
6495 ///
6496 /// * `execution-errors`: Errors were encountered by the agent while
6497 /// executing the resource and the compliance state couldn't be
6498 /// determined.
6499 /// * `execution-skipped-by-agent`: Resource execution was skipped by the
6500 /// agent because errors were encountered while executing prior resources
6501 /// in the OS policy.
6502 /// * `os-policy-execution-attempt-failed`: The execution of the OS policy
6503 /// containing this resource failed and the compliance state couldn't be
6504 /// determined.
6505 pub compliance_state_reason: std::string::String,
6506
6507 /// Resource specific output.
6508 pub output: std::option::Option<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output>,
6509
6510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6511 }
6512
6513 impl OSPolicyResourceCompliance {
6514 /// Creates a new default instance.
6515 pub fn new() -> Self {
6516 std::default::Default::default()
6517 }
6518
6519 /// Sets the value of [os_policy_resource_id][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::os_policy_resource_id].
6520 ///
6521 /// # Example
6522 /// ```ignore,no_run
6523 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6524 /// let x = OSPolicyResourceCompliance::new().set_os_policy_resource_id("example");
6525 /// ```
6526 pub fn set_os_policy_resource_id<T: std::convert::Into<std::string::String>>(
6527 mut self,
6528 v: T,
6529 ) -> Self {
6530 self.os_policy_resource_id = v.into();
6531 self
6532 }
6533
6534 /// Sets the value of [config_steps][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::config_steps].
6535 ///
6536 /// # Example
6537 /// ```ignore,no_run
6538 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6539 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep;
6540 /// let x = OSPolicyResourceCompliance::new()
6541 /// .set_config_steps([
6542 /// OSPolicyResourceConfigStep::default()/* use setters */,
6543 /// OSPolicyResourceConfigStep::default()/* use (different) setters */,
6544 /// ]);
6545 /// ```
6546 pub fn set_config_steps<T, V>(mut self, v: T) -> Self
6547 where
6548 T: std::iter::IntoIterator<Item = V>,
6549 V: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep>
6550 {
6551 use std::iter::Iterator;
6552 self.config_steps = v.into_iter().map(|i| i.into()).collect();
6553 self
6554 }
6555
6556 /// Sets the value of [compliance_state][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::compliance_state].
6557 ///
6558 /// # Example
6559 /// ```ignore,no_run
6560 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6561 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ComplianceState;
6562 /// let x0 = OSPolicyResourceCompliance::new().set_compliance_state(ComplianceState::Compliant);
6563 /// let x1 = OSPolicyResourceCompliance::new().set_compliance_state(ComplianceState::NonCompliant);
6564 /// ```
6565 pub fn set_compliance_state<T: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ComplianceState>>(mut self, v: T) -> Self{
6566 self.compliance_state = v.into();
6567 self
6568 }
6569
6570 /// Sets the value of [compliance_state_reason][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::compliance_state_reason].
6571 ///
6572 /// # Example
6573 /// ```ignore,no_run
6574 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6575 /// let x = OSPolicyResourceCompliance::new().set_compliance_state_reason("example");
6576 /// ```
6577 pub fn set_compliance_state_reason<T: std::convert::Into<std::string::String>>(
6578 mut self,
6579 v: T,
6580 ) -> Self {
6581 self.compliance_state_reason = v.into();
6582 self
6583 }
6584
6585 /// Sets the value of [output][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::output].
6586 ///
6587 /// Note that all the setters affecting `output` are mutually
6588 /// exclusive.
6589 ///
6590 /// # Example
6591 /// ```ignore,no_run
6592 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6593 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput;
6594 /// let x = OSPolicyResourceCompliance::new().set_output(Some(
6595 /// google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output::ExecResourceOutput(ExecResourceOutput::default().into())));
6596 /// ```
6597 pub fn set_output<T: std::convert::Into<std::option::Option<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output>>>(mut self, v: T) -> Self
6598 {
6599 self.output = v.into();
6600 self
6601 }
6602
6603 /// The value of [output][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::output]
6604 /// if it holds a `ExecResourceOutput`, `None` if the field is not set or
6605 /// holds a different branch.
6606 pub fn exec_resource_output(&self) -> std::option::Option<&std::boxed::Box<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput>>{
6607 #[allow(unreachable_patterns)]
6608 self.output.as_ref().and_then(|v| match v {
6609 crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output::ExecResourceOutput(v) => std::option::Option::Some(v),
6610 _ => std::option::Option::None,
6611 })
6612 }
6613
6614 /// Sets the value of [output][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::output]
6615 /// to hold a `ExecResourceOutput`.
6616 ///
6617 /// Note that all the setters affecting `output` are
6618 /// mutually exclusive.
6619 ///
6620 /// # Example
6621 /// ```ignore,no_run
6622 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6623 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput;
6624 /// let x = OSPolicyResourceCompliance::new().set_exec_resource_output(ExecResourceOutput::default()/* use setters */);
6625 /// assert!(x.exec_resource_output().is_some());
6626 /// ```
6627 pub fn set_exec_resource_output<T: std::convert::Into<std::boxed::Box<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput>>>(mut self, v: T) -> Self{
6628 self.output = std::option::Option::Some(
6629 crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output::ExecResourceOutput(
6630 v.into()
6631 )
6632 );
6633 self
6634 }
6635 }
6636
6637 impl wkt::message::Message for OSPolicyResourceCompliance {
6638 fn typename() -> &'static str {
6639 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance"
6640 }
6641 }
6642
6643 /// Defines additional types related to [OSPolicyResourceCompliance].
6644 pub mod os_policy_resource_compliance {
6645 #[allow(unused_imports)]
6646 use super::*;
6647
6648 /// Step performed by the OS Config agent for configuring an
6649 /// `OSPolicy` resource to its desired state.
6650 #[derive(Clone, Default, PartialEq)]
6651 #[non_exhaustive]
6652 pub struct OSPolicyResourceConfigStep {
6653
6654 /// Configuration step type.
6655 pub r#type: crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::os_policy_resource_config_step::Type,
6656
6657 /// An error message recorded during the execution of this step.
6658 /// Only populated if errors were encountered during this step execution.
6659 pub error_message: std::string::String,
6660
6661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6662 }
6663
6664 impl OSPolicyResourceConfigStep {
6665 /// Creates a new default instance.
6666 pub fn new() -> Self {
6667 std::default::Default::default()
6668 }
6669
6670 /// Sets the value of [r#type][crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep::type].
6671 ///
6672 /// # Example
6673 /// ```ignore,no_run
6674 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep;
6675 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::os_policy_resource_config_step::Type;
6676 /// let x0 = OSPolicyResourceConfigStep::new().set_type(Type::Validation);
6677 /// let x1 = OSPolicyResourceConfigStep::new().set_type(Type::DesiredStateCheck);
6678 /// let x2 = OSPolicyResourceConfigStep::new().set_type(Type::DesiredStateEnforcement);
6679 /// ```
6680 pub fn set_type<T: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::os_policy_resource_config_step::Type>>(mut self, v: T) -> Self{
6681 self.r#type = v.into();
6682 self
6683 }
6684
6685 /// Sets the value of [error_message][crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep::error_message].
6686 ///
6687 /// # Example
6688 /// ```ignore,no_run
6689 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep;
6690 /// let x = OSPolicyResourceConfigStep::new().set_error_message("example");
6691 /// ```
6692 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
6693 mut self,
6694 v: T,
6695 ) -> Self {
6696 self.error_message = v.into();
6697 self
6698 }
6699 }
6700
6701 impl wkt::message::Message for OSPolicyResourceConfigStep {
6702 fn typename() -> &'static str {
6703 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.OSPolicyResourceConfigStep"
6704 }
6705 }
6706
6707 /// Defines additional types related to [OSPolicyResourceConfigStep].
6708 pub mod os_policy_resource_config_step {
6709 #[allow(unused_imports)]
6710 use super::*;
6711
6712 /// Supported configuration step types
6713 ///
6714 /// # Working with unknown values
6715 ///
6716 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6717 /// additional enum variants at any time. Adding new variants is not considered
6718 /// a breaking change. Applications should write their code in anticipation of:
6719 ///
6720 /// - New values appearing in future releases of the client library, **and**
6721 /// - New values received dynamically, without application changes.
6722 ///
6723 /// Please consult the [Working with enums] section in the user guide for some
6724 /// guidelines.
6725 ///
6726 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6727 #[derive(Clone, Debug, PartialEq)]
6728 #[non_exhaustive]
6729 pub enum Type {
6730 /// Default value. This value is unused.
6731 Unspecified,
6732 /// Checks for resource conflicts such as schema errors.
6733 Validation,
6734 /// Checks the current status of the desired state for a resource.
6735 DesiredStateCheck,
6736 /// Enforces the desired state for a resource that is not in desired
6737 /// state.
6738 DesiredStateEnforcement,
6739 /// Re-checks the status of the desired state. This check is done
6740 /// for a resource after the enforcement of all OS policies.
6741 ///
6742 /// This step is used to determine the final desired state status for
6743 /// the resource. It accounts for any resources that might have drifted
6744 /// from their desired state due to side effects from executing other
6745 /// resources.
6746 DesiredStateCheckPostEnforcement,
6747 /// If set, the enum was initialized with an unknown value.
6748 ///
6749 /// Applications can examine the value using [Type::value] or
6750 /// [Type::name].
6751 UnknownValue(r#type::UnknownValue),
6752 }
6753
6754 #[doc(hidden)]
6755 pub mod r#type {
6756 #[allow(unused_imports)]
6757 use super::*;
6758 #[derive(Clone, Debug, PartialEq)]
6759 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6760 }
6761
6762 impl Type {
6763 /// Gets the enum value.
6764 ///
6765 /// Returns `None` if the enum contains an unknown value deserialized from
6766 /// the string representation of enums.
6767 pub fn value(&self) -> std::option::Option<i32> {
6768 match self {
6769 Self::Unspecified => std::option::Option::Some(0),
6770 Self::Validation => std::option::Option::Some(1),
6771 Self::DesiredStateCheck => std::option::Option::Some(2),
6772 Self::DesiredStateEnforcement => std::option::Option::Some(3),
6773 Self::DesiredStateCheckPostEnforcement => std::option::Option::Some(4),
6774 Self::UnknownValue(u) => u.0.value(),
6775 }
6776 }
6777
6778 /// Gets the enum value as a string.
6779 ///
6780 /// Returns `None` if the enum contains an unknown value deserialized from
6781 /// the integer representation of enums.
6782 pub fn name(&self) -> std::option::Option<&str> {
6783 match self {
6784 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
6785 Self::Validation => std::option::Option::Some("VALIDATION"),
6786 Self::DesiredStateCheck => {
6787 std::option::Option::Some("DESIRED_STATE_CHECK")
6788 }
6789 Self::DesiredStateEnforcement => {
6790 std::option::Option::Some("DESIRED_STATE_ENFORCEMENT")
6791 }
6792 Self::DesiredStateCheckPostEnforcement => {
6793 std::option::Option::Some("DESIRED_STATE_CHECK_POST_ENFORCEMENT")
6794 }
6795 Self::UnknownValue(u) => u.0.name(),
6796 }
6797 }
6798 }
6799
6800 impl std::default::Default for Type {
6801 fn default() -> Self {
6802 use std::convert::From;
6803 Self::from(0)
6804 }
6805 }
6806
6807 impl std::fmt::Display for Type {
6808 fn fmt(
6809 &self,
6810 f: &mut std::fmt::Formatter<'_>,
6811 ) -> std::result::Result<(), std::fmt::Error> {
6812 wkt::internal::display_enum(f, self.name(), self.value())
6813 }
6814 }
6815
6816 impl std::convert::From<i32> for Type {
6817 fn from(value: i32) -> Self {
6818 match value {
6819 0 => Self::Unspecified,
6820 1 => Self::Validation,
6821 2 => Self::DesiredStateCheck,
6822 3 => Self::DesiredStateEnforcement,
6823 4 => Self::DesiredStateCheckPostEnforcement,
6824 _ => Self::UnknownValue(r#type::UnknownValue(
6825 wkt::internal::UnknownEnumValue::Integer(value),
6826 )),
6827 }
6828 }
6829 }
6830
6831 impl std::convert::From<&str> for Type {
6832 fn from(value: &str) -> Self {
6833 use std::string::ToString;
6834 match value {
6835 "TYPE_UNSPECIFIED" => Self::Unspecified,
6836 "VALIDATION" => Self::Validation,
6837 "DESIRED_STATE_CHECK" => Self::DesiredStateCheck,
6838 "DESIRED_STATE_ENFORCEMENT" => Self::DesiredStateEnforcement,
6839 "DESIRED_STATE_CHECK_POST_ENFORCEMENT" => {
6840 Self::DesiredStateCheckPostEnforcement
6841 }
6842 _ => Self::UnknownValue(r#type::UnknownValue(
6843 wkt::internal::UnknownEnumValue::String(value.to_string()),
6844 )),
6845 }
6846 }
6847 }
6848
6849 impl serde::ser::Serialize for Type {
6850 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6851 where
6852 S: serde::Serializer,
6853 {
6854 match self {
6855 Self::Unspecified => serializer.serialize_i32(0),
6856 Self::Validation => serializer.serialize_i32(1),
6857 Self::DesiredStateCheck => serializer.serialize_i32(2),
6858 Self::DesiredStateEnforcement => serializer.serialize_i32(3),
6859 Self::DesiredStateCheckPostEnforcement => serializer.serialize_i32(4),
6860 Self::UnknownValue(u) => u.0.serialize(serializer),
6861 }
6862 }
6863 }
6864
6865 impl<'de> serde::de::Deserialize<'de> for Type {
6866 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6867 where
6868 D: serde::Deserializer<'de>,
6869 {
6870 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
6871 ".google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.OSPolicyResourceConfigStep.Type"))
6872 }
6873 }
6874 }
6875
6876 /// ExecResource specific output.
6877 #[derive(Clone, Default, PartialEq)]
6878 #[non_exhaustive]
6879 pub struct ExecResourceOutput {
6880 /// Output from enforcement phase output file (if run).
6881 /// Output size is limited to 100K bytes.
6882 pub enforcement_output: ::bytes::Bytes,
6883
6884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6885 }
6886
6887 impl ExecResourceOutput {
6888 /// Creates a new default instance.
6889 pub fn new() -> Self {
6890 std::default::Default::default()
6891 }
6892
6893 /// Sets the value of [enforcement_output][crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput::enforcement_output].
6894 ///
6895 /// # Example
6896 /// ```ignore,no_run
6897 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput;
6898 /// let x = ExecResourceOutput::new().set_enforcement_output(bytes::Bytes::from_static(b"example"));
6899 /// ```
6900 pub fn set_enforcement_output<T: std::convert::Into<::bytes::Bytes>>(
6901 mut self,
6902 v: T,
6903 ) -> Self {
6904 self.enforcement_output = v.into();
6905 self
6906 }
6907 }
6908
6909 impl wkt::message::Message for ExecResourceOutput {
6910 fn typename() -> &'static str {
6911 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.ExecResourceOutput"
6912 }
6913 }
6914
6915 /// Possible compliance states for a resource.
6916 ///
6917 /// # Working with unknown values
6918 ///
6919 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6920 /// additional enum variants at any time. Adding new variants is not considered
6921 /// a breaking change. Applications should write their code in anticipation of:
6922 ///
6923 /// - New values appearing in future releases of the client library, **and**
6924 /// - New values received dynamically, without application changes.
6925 ///
6926 /// Please consult the [Working with enums] section in the user guide for some
6927 /// guidelines.
6928 ///
6929 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6930 #[derive(Clone, Debug, PartialEq)]
6931 #[non_exhaustive]
6932 pub enum ComplianceState {
6933 /// The resource is in an unknown compliance state.
6934 ///
6935 /// To get more details about why the policy is in this state, review
6936 /// the output of the `compliance_state_reason` field.
6937 Unknown,
6938 /// Resource is compliant.
6939 Compliant,
6940 /// Resource is non-compliant.
6941 NonCompliant,
6942 /// If set, the enum was initialized with an unknown value.
6943 ///
6944 /// Applications can examine the value using [ComplianceState::value] or
6945 /// [ComplianceState::name].
6946 UnknownValue(compliance_state::UnknownValue),
6947 }
6948
6949 #[doc(hidden)]
6950 pub mod compliance_state {
6951 #[allow(unused_imports)]
6952 use super::*;
6953 #[derive(Clone, Debug, PartialEq)]
6954 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6955 }
6956
6957 impl ComplianceState {
6958 /// Gets the enum value.
6959 ///
6960 /// Returns `None` if the enum contains an unknown value deserialized from
6961 /// the string representation of enums.
6962 pub fn value(&self) -> std::option::Option<i32> {
6963 match self {
6964 Self::Unknown => std::option::Option::Some(0),
6965 Self::Compliant => std::option::Option::Some(1),
6966 Self::NonCompliant => std::option::Option::Some(2),
6967 Self::UnknownValue(u) => u.0.value(),
6968 }
6969 }
6970
6971 /// Gets the enum value as a string.
6972 ///
6973 /// Returns `None` if the enum contains an unknown value deserialized from
6974 /// the integer representation of enums.
6975 pub fn name(&self) -> std::option::Option<&str> {
6976 match self {
6977 Self::Unknown => std::option::Option::Some("UNKNOWN"),
6978 Self::Compliant => std::option::Option::Some("COMPLIANT"),
6979 Self::NonCompliant => std::option::Option::Some("NON_COMPLIANT"),
6980 Self::UnknownValue(u) => u.0.name(),
6981 }
6982 }
6983 }
6984
6985 impl std::default::Default for ComplianceState {
6986 fn default() -> Self {
6987 use std::convert::From;
6988 Self::from(0)
6989 }
6990 }
6991
6992 impl std::fmt::Display for ComplianceState {
6993 fn fmt(
6994 &self,
6995 f: &mut std::fmt::Formatter<'_>,
6996 ) -> std::result::Result<(), std::fmt::Error> {
6997 wkt::internal::display_enum(f, self.name(), self.value())
6998 }
6999 }
7000
7001 impl std::convert::From<i32> for ComplianceState {
7002 fn from(value: i32) -> Self {
7003 match value {
7004 0 => Self::Unknown,
7005 1 => Self::Compliant,
7006 2 => Self::NonCompliant,
7007 _ => Self::UnknownValue(compliance_state::UnknownValue(
7008 wkt::internal::UnknownEnumValue::Integer(value),
7009 )),
7010 }
7011 }
7012 }
7013
7014 impl std::convert::From<&str> for ComplianceState {
7015 fn from(value: &str) -> Self {
7016 use std::string::ToString;
7017 match value {
7018 "UNKNOWN" => Self::Unknown,
7019 "COMPLIANT" => Self::Compliant,
7020 "NON_COMPLIANT" => Self::NonCompliant,
7021 _ => Self::UnknownValue(compliance_state::UnknownValue(
7022 wkt::internal::UnknownEnumValue::String(value.to_string()),
7023 )),
7024 }
7025 }
7026 }
7027
7028 impl serde::ser::Serialize for ComplianceState {
7029 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7030 where
7031 S: serde::Serializer,
7032 {
7033 match self {
7034 Self::Unknown => serializer.serialize_i32(0),
7035 Self::Compliant => serializer.serialize_i32(1),
7036 Self::NonCompliant => serializer.serialize_i32(2),
7037 Self::UnknownValue(u) => u.0.serialize(serializer),
7038 }
7039 }
7040 }
7041
7042 impl<'de> serde::de::Deserialize<'de> for ComplianceState {
7043 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7044 where
7045 D: serde::Deserializer<'de>,
7046 {
7047 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComplianceState>::new(
7048 ".google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.ComplianceState"))
7049 }
7050 }
7051
7052 /// Resource specific output.
7053 #[derive(Clone, Debug, PartialEq)]
7054 #[non_exhaustive]
7055 pub enum Output {
7056 /// ExecResource specific output.
7057 ExecResourceOutput(std::boxed::Box<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput>),
7058 }
7059 }
7060
7061 /// Possible compliance states for an os policy.
7062 ///
7063 /// # Working with unknown values
7064 ///
7065 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7066 /// additional enum variants at any time. Adding new variants is not considered
7067 /// a breaking change. Applications should write their code in anticipation of:
7068 ///
7069 /// - New values appearing in future releases of the client library, **and**
7070 /// - New values received dynamically, without application changes.
7071 ///
7072 /// Please consult the [Working with enums] section in the user guide for some
7073 /// guidelines.
7074 ///
7075 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7076 #[derive(Clone, Debug, PartialEq)]
7077 #[non_exhaustive]
7078 pub enum ComplianceState {
7079 /// The policy is in an unknown compliance state.
7080 ///
7081 /// Refer to the field `compliance_state_reason` to learn the exact reason
7082 /// for the policy to be in this compliance state.
7083 Unknown,
7084 /// Policy is compliant.
7085 ///
7086 /// The policy is compliant if all the underlying resources are also
7087 /// compliant.
7088 Compliant,
7089 /// Policy is non-compliant.
7090 ///
7091 /// The policy is non-compliant if one or more underlying resources are
7092 /// non-compliant.
7093 NonCompliant,
7094 /// If set, the enum was initialized with an unknown value.
7095 ///
7096 /// Applications can examine the value using [ComplianceState::value] or
7097 /// [ComplianceState::name].
7098 UnknownValue(compliance_state::UnknownValue),
7099 }
7100
7101 #[doc(hidden)]
7102 pub mod compliance_state {
7103 #[allow(unused_imports)]
7104 use super::*;
7105 #[derive(Clone, Debug, PartialEq)]
7106 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7107 }
7108
7109 impl ComplianceState {
7110 /// Gets the enum value.
7111 ///
7112 /// Returns `None` if the enum contains an unknown value deserialized from
7113 /// the string representation of enums.
7114 pub fn value(&self) -> std::option::Option<i32> {
7115 match self {
7116 Self::Unknown => std::option::Option::Some(0),
7117 Self::Compliant => std::option::Option::Some(1),
7118 Self::NonCompliant => std::option::Option::Some(2),
7119 Self::UnknownValue(u) => u.0.value(),
7120 }
7121 }
7122
7123 /// Gets the enum value as a string.
7124 ///
7125 /// Returns `None` if the enum contains an unknown value deserialized from
7126 /// the integer representation of enums.
7127 pub fn name(&self) -> std::option::Option<&str> {
7128 match self {
7129 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7130 Self::Compliant => std::option::Option::Some("COMPLIANT"),
7131 Self::NonCompliant => std::option::Option::Some("NON_COMPLIANT"),
7132 Self::UnknownValue(u) => u.0.name(),
7133 }
7134 }
7135 }
7136
7137 impl std::default::Default for ComplianceState {
7138 fn default() -> Self {
7139 use std::convert::From;
7140 Self::from(0)
7141 }
7142 }
7143
7144 impl std::fmt::Display for ComplianceState {
7145 fn fmt(
7146 &self,
7147 f: &mut std::fmt::Formatter<'_>,
7148 ) -> std::result::Result<(), std::fmt::Error> {
7149 wkt::internal::display_enum(f, self.name(), self.value())
7150 }
7151 }
7152
7153 impl std::convert::From<i32> for ComplianceState {
7154 fn from(value: i32) -> Self {
7155 match value {
7156 0 => Self::Unknown,
7157 1 => Self::Compliant,
7158 2 => Self::NonCompliant,
7159 _ => Self::UnknownValue(compliance_state::UnknownValue(
7160 wkt::internal::UnknownEnumValue::Integer(value),
7161 )),
7162 }
7163 }
7164 }
7165
7166 impl std::convert::From<&str> for ComplianceState {
7167 fn from(value: &str) -> Self {
7168 use std::string::ToString;
7169 match value {
7170 "UNKNOWN" => Self::Unknown,
7171 "COMPLIANT" => Self::Compliant,
7172 "NON_COMPLIANT" => Self::NonCompliant,
7173 _ => Self::UnknownValue(compliance_state::UnknownValue(
7174 wkt::internal::UnknownEnumValue::String(value.to_string()),
7175 )),
7176 }
7177 }
7178 }
7179
7180 impl serde::ser::Serialize for ComplianceState {
7181 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7182 where
7183 S: serde::Serializer,
7184 {
7185 match self {
7186 Self::Unknown => serializer.serialize_i32(0),
7187 Self::Compliant => serializer.serialize_i32(1),
7188 Self::NonCompliant => serializer.serialize_i32(2),
7189 Self::UnknownValue(u) => u.0.serialize(serializer),
7190 }
7191 }
7192 }
7193
7194 impl<'de> serde::de::Deserialize<'de> for ComplianceState {
7195 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7196 where
7197 D: serde::Deserializer<'de>,
7198 {
7199 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComplianceState>::new(
7200 ".google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.ComplianceState"))
7201 }
7202 }
7203 }
7204}
7205
7206/// OS policy assignment is an API resource that is used to
7207/// apply a set of OS policies to a dynamically targeted group of Compute Engine
7208/// VM instances.
7209///
7210/// An OS policy is used to define the desired state configuration for a
7211/// Compute Engine VM instance through a set of configuration resources that
7212/// provide capabilities such as installing or removing software packages, or
7213/// executing a script.
7214///
7215/// For more information, see [OS policy and OS policy
7216/// assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).
7217#[derive(Clone, Default, PartialEq)]
7218#[non_exhaustive]
7219pub struct OSPolicyAssignment {
7220 /// Resource name.
7221 ///
7222 /// Format:
7223 /// `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`
7224 ///
7225 /// This field is ignored when you create an OS policy assignment.
7226 pub name: std::string::String,
7227
7228 /// OS policy assignment description.
7229 /// Length of the description is limited to 1024 characters.
7230 pub description: std::string::String,
7231
7232 /// Required. List of OS policies to be applied to the VMs.
7233 pub os_policies: std::vec::Vec<crate::model::OSPolicy>,
7234
7235 /// Required. Filter to select VMs.
7236 pub instance_filter: std::option::Option<crate::model::os_policy_assignment::InstanceFilter>,
7237
7238 /// Required. Rollout to deploy the OS policy assignment.
7239 /// A rollout is triggered in the following situations:
7240 ///
7241 /// 1. OSPolicyAssignment is created.
7242 /// 1. OSPolicyAssignment is updated and the update contains changes to one of
7243 /// the following fields:
7244 /// - instance_filter
7245 /// - os_policies
7246 /// 1. OSPolicyAssignment is deleted.
7247 pub rollout: std::option::Option<crate::model::os_policy_assignment::Rollout>,
7248
7249 /// Output only. The assignment revision ID
7250 /// A new revision is committed whenever a rollout is triggered for a OS policy
7251 /// assignment
7252 pub revision_id: std::string::String,
7253
7254 /// Output only. The timestamp that the revision was created.
7255 pub revision_create_time: std::option::Option<wkt::Timestamp>,
7256
7257 /// The etag for this OS policy assignment.
7258 /// If this is provided on update, it must match the server's etag.
7259 pub etag: std::string::String,
7260
7261 /// Output only. OS policy assignment rollout state
7262 pub rollout_state: crate::model::os_policy_assignment::RolloutState,
7263
7264 /// Output only. Indicates that this revision has been successfully rolled out
7265 /// in this zone and new VMs will be assigned OS policies from this revision.
7266 ///
7267 /// For a given OS policy assignment, there is only one revision with a value
7268 /// of `true` for this field.
7269 pub baseline: bool,
7270
7271 /// Output only. Indicates that this revision deletes the OS policy assignment.
7272 pub deleted: bool,
7273
7274 /// Output only. Indicates that reconciliation is in progress for the revision.
7275 /// This value is `true` when the `rollout_state` is one of:
7276 ///
7277 /// * IN_PROGRESS
7278 /// * CANCELLING
7279 pub reconciling: bool,
7280
7281 /// Output only. Server generated unique id for the OS policy assignment
7282 /// resource.
7283 pub uid: std::string::String,
7284
7285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7286}
7287
7288impl OSPolicyAssignment {
7289 /// Creates a new default instance.
7290 pub fn new() -> Self {
7291 std::default::Default::default()
7292 }
7293
7294 /// Sets the value of [name][crate::model::OSPolicyAssignment::name].
7295 ///
7296 /// # Example
7297 /// ```ignore,no_run
7298 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7299 /// let x = OSPolicyAssignment::new().set_name("example");
7300 /// ```
7301 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7302 self.name = v.into();
7303 self
7304 }
7305
7306 /// Sets the value of [description][crate::model::OSPolicyAssignment::description].
7307 ///
7308 /// # Example
7309 /// ```ignore,no_run
7310 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7311 /// let x = OSPolicyAssignment::new().set_description("example");
7312 /// ```
7313 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7314 self.description = v.into();
7315 self
7316 }
7317
7318 /// Sets the value of [os_policies][crate::model::OSPolicyAssignment::os_policies].
7319 ///
7320 /// # Example
7321 /// ```ignore,no_run
7322 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7323 /// use google_cloud_osconfig_v1::model::OSPolicy;
7324 /// let x = OSPolicyAssignment::new()
7325 /// .set_os_policies([
7326 /// OSPolicy::default()/* use setters */,
7327 /// OSPolicy::default()/* use (different) setters */,
7328 /// ]);
7329 /// ```
7330 pub fn set_os_policies<T, V>(mut self, v: T) -> Self
7331 where
7332 T: std::iter::IntoIterator<Item = V>,
7333 V: std::convert::Into<crate::model::OSPolicy>,
7334 {
7335 use std::iter::Iterator;
7336 self.os_policies = v.into_iter().map(|i| i.into()).collect();
7337 self
7338 }
7339
7340 /// Sets the value of [instance_filter][crate::model::OSPolicyAssignment::instance_filter].
7341 ///
7342 /// # Example
7343 /// ```ignore,no_run
7344 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7345 /// use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7346 /// let x = OSPolicyAssignment::new().set_instance_filter(InstanceFilter::default()/* use setters */);
7347 /// ```
7348 pub fn set_instance_filter<T>(mut self, v: T) -> Self
7349 where
7350 T: std::convert::Into<crate::model::os_policy_assignment::InstanceFilter>,
7351 {
7352 self.instance_filter = std::option::Option::Some(v.into());
7353 self
7354 }
7355
7356 /// Sets or clears the value of [instance_filter][crate::model::OSPolicyAssignment::instance_filter].
7357 ///
7358 /// # Example
7359 /// ```ignore,no_run
7360 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7361 /// use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7362 /// let x = OSPolicyAssignment::new().set_or_clear_instance_filter(Some(InstanceFilter::default()/* use setters */));
7363 /// let x = OSPolicyAssignment::new().set_or_clear_instance_filter(None::<InstanceFilter>);
7364 /// ```
7365 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
7366 where
7367 T: std::convert::Into<crate::model::os_policy_assignment::InstanceFilter>,
7368 {
7369 self.instance_filter = v.map(|x| x.into());
7370 self
7371 }
7372
7373 /// Sets the value of [rollout][crate::model::OSPolicyAssignment::rollout].
7374 ///
7375 /// # Example
7376 /// ```ignore,no_run
7377 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7378 /// use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7379 /// let x = OSPolicyAssignment::new().set_rollout(Rollout::default()/* use setters */);
7380 /// ```
7381 pub fn set_rollout<T>(mut self, v: T) -> Self
7382 where
7383 T: std::convert::Into<crate::model::os_policy_assignment::Rollout>,
7384 {
7385 self.rollout = std::option::Option::Some(v.into());
7386 self
7387 }
7388
7389 /// Sets or clears the value of [rollout][crate::model::OSPolicyAssignment::rollout].
7390 ///
7391 /// # Example
7392 /// ```ignore,no_run
7393 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7394 /// use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7395 /// let x = OSPolicyAssignment::new().set_or_clear_rollout(Some(Rollout::default()/* use setters */));
7396 /// let x = OSPolicyAssignment::new().set_or_clear_rollout(None::<Rollout>);
7397 /// ```
7398 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
7399 where
7400 T: std::convert::Into<crate::model::os_policy_assignment::Rollout>,
7401 {
7402 self.rollout = v.map(|x| x.into());
7403 self
7404 }
7405
7406 /// Sets the value of [revision_id][crate::model::OSPolicyAssignment::revision_id].
7407 ///
7408 /// # Example
7409 /// ```ignore,no_run
7410 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7411 /// let x = OSPolicyAssignment::new().set_revision_id("example");
7412 /// ```
7413 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7414 self.revision_id = v.into();
7415 self
7416 }
7417
7418 /// Sets the value of [revision_create_time][crate::model::OSPolicyAssignment::revision_create_time].
7419 ///
7420 /// # Example
7421 /// ```ignore,no_run
7422 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7423 /// use wkt::Timestamp;
7424 /// let x = OSPolicyAssignment::new().set_revision_create_time(Timestamp::default()/* use setters */);
7425 /// ```
7426 pub fn set_revision_create_time<T>(mut self, v: T) -> Self
7427 where
7428 T: std::convert::Into<wkt::Timestamp>,
7429 {
7430 self.revision_create_time = std::option::Option::Some(v.into());
7431 self
7432 }
7433
7434 /// Sets or clears the value of [revision_create_time][crate::model::OSPolicyAssignment::revision_create_time].
7435 ///
7436 /// # Example
7437 /// ```ignore,no_run
7438 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7439 /// use wkt::Timestamp;
7440 /// let x = OSPolicyAssignment::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
7441 /// let x = OSPolicyAssignment::new().set_or_clear_revision_create_time(None::<Timestamp>);
7442 /// ```
7443 pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7444 where
7445 T: std::convert::Into<wkt::Timestamp>,
7446 {
7447 self.revision_create_time = v.map(|x| x.into());
7448 self
7449 }
7450
7451 /// Sets the value of [etag][crate::model::OSPolicyAssignment::etag].
7452 ///
7453 /// # Example
7454 /// ```ignore,no_run
7455 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7456 /// let x = OSPolicyAssignment::new().set_etag("example");
7457 /// ```
7458 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7459 self.etag = v.into();
7460 self
7461 }
7462
7463 /// Sets the value of [rollout_state][crate::model::OSPolicyAssignment::rollout_state].
7464 ///
7465 /// # Example
7466 /// ```ignore,no_run
7467 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7468 /// use google_cloud_osconfig_v1::model::os_policy_assignment::RolloutState;
7469 /// let x0 = OSPolicyAssignment::new().set_rollout_state(RolloutState::InProgress);
7470 /// let x1 = OSPolicyAssignment::new().set_rollout_state(RolloutState::Cancelling);
7471 /// let x2 = OSPolicyAssignment::new().set_rollout_state(RolloutState::Cancelled);
7472 /// ```
7473 pub fn set_rollout_state<
7474 T: std::convert::Into<crate::model::os_policy_assignment::RolloutState>,
7475 >(
7476 mut self,
7477 v: T,
7478 ) -> Self {
7479 self.rollout_state = v.into();
7480 self
7481 }
7482
7483 /// Sets the value of [baseline][crate::model::OSPolicyAssignment::baseline].
7484 ///
7485 /// # Example
7486 /// ```ignore,no_run
7487 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7488 /// let x = OSPolicyAssignment::new().set_baseline(true);
7489 /// ```
7490 pub fn set_baseline<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7491 self.baseline = v.into();
7492 self
7493 }
7494
7495 /// Sets the value of [deleted][crate::model::OSPolicyAssignment::deleted].
7496 ///
7497 /// # Example
7498 /// ```ignore,no_run
7499 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7500 /// let x = OSPolicyAssignment::new().set_deleted(true);
7501 /// ```
7502 pub fn set_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7503 self.deleted = v.into();
7504 self
7505 }
7506
7507 /// Sets the value of [reconciling][crate::model::OSPolicyAssignment::reconciling].
7508 ///
7509 /// # Example
7510 /// ```ignore,no_run
7511 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7512 /// let x = OSPolicyAssignment::new().set_reconciling(true);
7513 /// ```
7514 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7515 self.reconciling = v.into();
7516 self
7517 }
7518
7519 /// Sets the value of [uid][crate::model::OSPolicyAssignment::uid].
7520 ///
7521 /// # Example
7522 /// ```ignore,no_run
7523 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7524 /// let x = OSPolicyAssignment::new().set_uid("example");
7525 /// ```
7526 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7527 self.uid = v.into();
7528 self
7529 }
7530}
7531
7532impl wkt::message::Message for OSPolicyAssignment {
7533 fn typename() -> &'static str {
7534 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment"
7535 }
7536}
7537
7538/// Defines additional types related to [OSPolicyAssignment].
7539pub mod os_policy_assignment {
7540 #[allow(unused_imports)]
7541 use super::*;
7542
7543 /// Message representing label set.
7544 ///
7545 /// * A label is a key value pair set for a VM.
7546 /// * A LabelSet is a set of labels.
7547 /// * Labels within a LabelSet are ANDed. In other words, a LabelSet is
7548 /// applicable for a VM only if it matches all the labels in the
7549 /// LabelSet.
7550 /// * Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will
7551 /// only be applicable for those VMs with both labels
7552 /// present.
7553 #[derive(Clone, Default, PartialEq)]
7554 #[non_exhaustive]
7555 pub struct LabelSet {
7556 /// Labels are identified by key/value pairs in this map.
7557 /// A VM should contain all the key/value pairs specified in this
7558 /// map to be selected.
7559 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7560
7561 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7562 }
7563
7564 impl LabelSet {
7565 /// Creates a new default instance.
7566 pub fn new() -> Self {
7567 std::default::Default::default()
7568 }
7569
7570 /// Sets the value of [labels][crate::model::os_policy_assignment::LabelSet::labels].
7571 ///
7572 /// # Example
7573 /// ```ignore,no_run
7574 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::LabelSet;
7575 /// let x = LabelSet::new().set_labels([
7576 /// ("key0", "abc"),
7577 /// ("key1", "xyz"),
7578 /// ]);
7579 /// ```
7580 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7581 where
7582 T: std::iter::IntoIterator<Item = (K, V)>,
7583 K: std::convert::Into<std::string::String>,
7584 V: std::convert::Into<std::string::String>,
7585 {
7586 use std::iter::Iterator;
7587 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7588 self
7589 }
7590 }
7591
7592 impl wkt::message::Message for LabelSet {
7593 fn typename() -> &'static str {
7594 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.LabelSet"
7595 }
7596 }
7597
7598 /// Filters to select target VMs for an assignment.
7599 ///
7600 /// If more than one filter criteria is specified below, a VM will be selected
7601 /// if and only if it satisfies all of them.
7602 #[derive(Clone, Default, PartialEq)]
7603 #[non_exhaustive]
7604 pub struct InstanceFilter {
7605 /// Target all VMs in the project. If true, no other criteria is
7606 /// permitted.
7607 pub all: bool,
7608
7609 /// List of label sets used for VM inclusion.
7610 ///
7611 /// If the list has more than one `LabelSet`, the VM is included if any
7612 /// of the label sets are applicable for the VM.
7613 pub inclusion_labels: std::vec::Vec<crate::model::os_policy_assignment::LabelSet>,
7614
7615 /// List of label sets used for VM exclusion.
7616 ///
7617 /// If the list has more than one label set, the VM is excluded if any
7618 /// of the label sets are applicable for the VM.
7619 pub exclusion_labels: std::vec::Vec<crate::model::os_policy_assignment::LabelSet>,
7620
7621 /// List of inventories to select VMs.
7622 ///
7623 /// A VM is selected if its inventory data matches at least one of the
7624 /// following inventories.
7625 pub inventories:
7626 std::vec::Vec<crate::model::os_policy_assignment::instance_filter::Inventory>,
7627
7628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7629 }
7630
7631 impl InstanceFilter {
7632 /// Creates a new default instance.
7633 pub fn new() -> Self {
7634 std::default::Default::default()
7635 }
7636
7637 /// Sets the value of [all][crate::model::os_policy_assignment::InstanceFilter::all].
7638 ///
7639 /// # Example
7640 /// ```ignore,no_run
7641 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7642 /// let x = InstanceFilter::new().set_all(true);
7643 /// ```
7644 pub fn set_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7645 self.all = v.into();
7646 self
7647 }
7648
7649 /// Sets the value of [inclusion_labels][crate::model::os_policy_assignment::InstanceFilter::inclusion_labels].
7650 ///
7651 /// # Example
7652 /// ```ignore,no_run
7653 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7654 /// use google_cloud_osconfig_v1::model::os_policy_assignment::LabelSet;
7655 /// let x = InstanceFilter::new()
7656 /// .set_inclusion_labels([
7657 /// LabelSet::default()/* use setters */,
7658 /// LabelSet::default()/* use (different) setters */,
7659 /// ]);
7660 /// ```
7661 pub fn set_inclusion_labels<T, V>(mut self, v: T) -> Self
7662 where
7663 T: std::iter::IntoIterator<Item = V>,
7664 V: std::convert::Into<crate::model::os_policy_assignment::LabelSet>,
7665 {
7666 use std::iter::Iterator;
7667 self.inclusion_labels = v.into_iter().map(|i| i.into()).collect();
7668 self
7669 }
7670
7671 /// Sets the value of [exclusion_labels][crate::model::os_policy_assignment::InstanceFilter::exclusion_labels].
7672 ///
7673 /// # Example
7674 /// ```ignore,no_run
7675 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7676 /// use google_cloud_osconfig_v1::model::os_policy_assignment::LabelSet;
7677 /// let x = InstanceFilter::new()
7678 /// .set_exclusion_labels([
7679 /// LabelSet::default()/* use setters */,
7680 /// LabelSet::default()/* use (different) setters */,
7681 /// ]);
7682 /// ```
7683 pub fn set_exclusion_labels<T, V>(mut self, v: T) -> Self
7684 where
7685 T: std::iter::IntoIterator<Item = V>,
7686 V: std::convert::Into<crate::model::os_policy_assignment::LabelSet>,
7687 {
7688 use std::iter::Iterator;
7689 self.exclusion_labels = v.into_iter().map(|i| i.into()).collect();
7690 self
7691 }
7692
7693 /// Sets the value of [inventories][crate::model::os_policy_assignment::InstanceFilter::inventories].
7694 ///
7695 /// # Example
7696 /// ```ignore,no_run
7697 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7698 /// use google_cloud_osconfig_v1::model::os_policy_assignment::instance_filter::Inventory;
7699 /// let x = InstanceFilter::new()
7700 /// .set_inventories([
7701 /// Inventory::default()/* use setters */,
7702 /// Inventory::default()/* use (different) setters */,
7703 /// ]);
7704 /// ```
7705 pub fn set_inventories<T, V>(mut self, v: T) -> Self
7706 where
7707 T: std::iter::IntoIterator<Item = V>,
7708 V: std::convert::Into<crate::model::os_policy_assignment::instance_filter::Inventory>,
7709 {
7710 use std::iter::Iterator;
7711 self.inventories = v.into_iter().map(|i| i.into()).collect();
7712 self
7713 }
7714 }
7715
7716 impl wkt::message::Message for InstanceFilter {
7717 fn typename() -> &'static str {
7718 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.InstanceFilter"
7719 }
7720 }
7721
7722 /// Defines additional types related to [InstanceFilter].
7723 pub mod instance_filter {
7724 #[allow(unused_imports)]
7725 use super::*;
7726
7727 /// VM inventory details.
7728 #[derive(Clone, Default, PartialEq)]
7729 #[non_exhaustive]
7730 pub struct Inventory {
7731 /// Required. The OS short name
7732 pub os_short_name: std::string::String,
7733
7734 /// The OS version
7735 ///
7736 /// Prefix matches are supported if asterisk(*) is provided as the
7737 /// last character. For example, to match all versions with a major
7738 /// version of `7`, specify the following value for this field `7.*`
7739 ///
7740 /// An empty string matches all OS versions.
7741 pub os_version: std::string::String,
7742
7743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7744 }
7745
7746 impl Inventory {
7747 /// Creates a new default instance.
7748 pub fn new() -> Self {
7749 std::default::Default::default()
7750 }
7751
7752 /// Sets the value of [os_short_name][crate::model::os_policy_assignment::instance_filter::Inventory::os_short_name].
7753 ///
7754 /// # Example
7755 /// ```ignore,no_run
7756 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::instance_filter::Inventory;
7757 /// let x = Inventory::new().set_os_short_name("example");
7758 /// ```
7759 pub fn set_os_short_name<T: std::convert::Into<std::string::String>>(
7760 mut self,
7761 v: T,
7762 ) -> Self {
7763 self.os_short_name = v.into();
7764 self
7765 }
7766
7767 /// Sets the value of [os_version][crate::model::os_policy_assignment::instance_filter::Inventory::os_version].
7768 ///
7769 /// # Example
7770 /// ```ignore,no_run
7771 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::instance_filter::Inventory;
7772 /// let x = Inventory::new().set_os_version("example");
7773 /// ```
7774 pub fn set_os_version<T: std::convert::Into<std::string::String>>(
7775 mut self,
7776 v: T,
7777 ) -> Self {
7778 self.os_version = v.into();
7779 self
7780 }
7781 }
7782
7783 impl wkt::message::Message for Inventory {
7784 fn typename() -> &'static str {
7785 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.InstanceFilter.Inventory"
7786 }
7787 }
7788 }
7789
7790 /// Message to configure the rollout at the zonal level for the OS policy
7791 /// assignment.
7792 #[derive(Clone, Default, PartialEq)]
7793 #[non_exhaustive]
7794 pub struct Rollout {
7795 /// Required. The maximum number (or percentage) of VMs per zone to disrupt
7796 /// at any given moment.
7797 pub disruption_budget: std::option::Option<crate::model::FixedOrPercent>,
7798
7799 /// Required. This determines the minimum duration of time to wait after the
7800 /// configuration changes are applied through the current rollout. A
7801 /// VM continues to count towards the `disruption_budget` at least
7802 /// until this duration of time has passed after configuration changes are
7803 /// applied.
7804 pub min_wait_duration: std::option::Option<wkt::Duration>,
7805
7806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7807 }
7808
7809 impl Rollout {
7810 /// Creates a new default instance.
7811 pub fn new() -> Self {
7812 std::default::Default::default()
7813 }
7814
7815 /// Sets the value of [disruption_budget][crate::model::os_policy_assignment::Rollout::disruption_budget].
7816 ///
7817 /// # Example
7818 /// ```ignore,no_run
7819 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7820 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
7821 /// let x = Rollout::new().set_disruption_budget(FixedOrPercent::default()/* use setters */);
7822 /// ```
7823 pub fn set_disruption_budget<T>(mut self, v: T) -> Self
7824 where
7825 T: std::convert::Into<crate::model::FixedOrPercent>,
7826 {
7827 self.disruption_budget = std::option::Option::Some(v.into());
7828 self
7829 }
7830
7831 /// Sets or clears the value of [disruption_budget][crate::model::os_policy_assignment::Rollout::disruption_budget].
7832 ///
7833 /// # Example
7834 /// ```ignore,no_run
7835 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7836 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
7837 /// let x = Rollout::new().set_or_clear_disruption_budget(Some(FixedOrPercent::default()/* use setters */));
7838 /// let x = Rollout::new().set_or_clear_disruption_budget(None::<FixedOrPercent>);
7839 /// ```
7840 pub fn set_or_clear_disruption_budget<T>(mut self, v: std::option::Option<T>) -> Self
7841 where
7842 T: std::convert::Into<crate::model::FixedOrPercent>,
7843 {
7844 self.disruption_budget = v.map(|x| x.into());
7845 self
7846 }
7847
7848 /// Sets the value of [min_wait_duration][crate::model::os_policy_assignment::Rollout::min_wait_duration].
7849 ///
7850 /// # Example
7851 /// ```ignore,no_run
7852 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7853 /// use wkt::Duration;
7854 /// let x = Rollout::new().set_min_wait_duration(Duration::default()/* use setters */);
7855 /// ```
7856 pub fn set_min_wait_duration<T>(mut self, v: T) -> Self
7857 where
7858 T: std::convert::Into<wkt::Duration>,
7859 {
7860 self.min_wait_duration = std::option::Option::Some(v.into());
7861 self
7862 }
7863
7864 /// Sets or clears the value of [min_wait_duration][crate::model::os_policy_assignment::Rollout::min_wait_duration].
7865 ///
7866 /// # Example
7867 /// ```ignore,no_run
7868 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7869 /// use wkt::Duration;
7870 /// let x = Rollout::new().set_or_clear_min_wait_duration(Some(Duration::default()/* use setters */));
7871 /// let x = Rollout::new().set_or_clear_min_wait_duration(None::<Duration>);
7872 /// ```
7873 pub fn set_or_clear_min_wait_duration<T>(mut self, v: std::option::Option<T>) -> Self
7874 where
7875 T: std::convert::Into<wkt::Duration>,
7876 {
7877 self.min_wait_duration = v.map(|x| x.into());
7878 self
7879 }
7880 }
7881
7882 impl wkt::message::Message for Rollout {
7883 fn typename() -> &'static str {
7884 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.Rollout"
7885 }
7886 }
7887
7888 /// OS policy assignment rollout state
7889 ///
7890 /// # Working with unknown values
7891 ///
7892 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7893 /// additional enum variants at any time. Adding new variants is not considered
7894 /// a breaking change. Applications should write their code in anticipation of:
7895 ///
7896 /// - New values appearing in future releases of the client library, **and**
7897 /// - New values received dynamically, without application changes.
7898 ///
7899 /// Please consult the [Working with enums] section in the user guide for some
7900 /// guidelines.
7901 ///
7902 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7903 #[derive(Clone, Debug, PartialEq)]
7904 #[non_exhaustive]
7905 pub enum RolloutState {
7906 /// Invalid value
7907 Unspecified,
7908 /// The rollout is in progress.
7909 InProgress,
7910 /// The rollout is being cancelled.
7911 Cancelling,
7912 /// The rollout is cancelled.
7913 Cancelled,
7914 /// The rollout has completed successfully.
7915 Succeeded,
7916 /// If set, the enum was initialized with an unknown value.
7917 ///
7918 /// Applications can examine the value using [RolloutState::value] or
7919 /// [RolloutState::name].
7920 UnknownValue(rollout_state::UnknownValue),
7921 }
7922
7923 #[doc(hidden)]
7924 pub mod rollout_state {
7925 #[allow(unused_imports)]
7926 use super::*;
7927 #[derive(Clone, Debug, PartialEq)]
7928 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7929 }
7930
7931 impl RolloutState {
7932 /// Gets the enum value.
7933 ///
7934 /// Returns `None` if the enum contains an unknown value deserialized from
7935 /// the string representation of enums.
7936 pub fn value(&self) -> std::option::Option<i32> {
7937 match self {
7938 Self::Unspecified => std::option::Option::Some(0),
7939 Self::InProgress => std::option::Option::Some(1),
7940 Self::Cancelling => std::option::Option::Some(2),
7941 Self::Cancelled => std::option::Option::Some(3),
7942 Self::Succeeded => std::option::Option::Some(4),
7943 Self::UnknownValue(u) => u.0.value(),
7944 }
7945 }
7946
7947 /// Gets the enum value as a string.
7948 ///
7949 /// Returns `None` if the enum contains an unknown value deserialized from
7950 /// the integer representation of enums.
7951 pub fn name(&self) -> std::option::Option<&str> {
7952 match self {
7953 Self::Unspecified => std::option::Option::Some("ROLLOUT_STATE_UNSPECIFIED"),
7954 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
7955 Self::Cancelling => std::option::Option::Some("CANCELLING"),
7956 Self::Cancelled => std::option::Option::Some("CANCELLED"),
7957 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
7958 Self::UnknownValue(u) => u.0.name(),
7959 }
7960 }
7961 }
7962
7963 impl std::default::Default for RolloutState {
7964 fn default() -> Self {
7965 use std::convert::From;
7966 Self::from(0)
7967 }
7968 }
7969
7970 impl std::fmt::Display for RolloutState {
7971 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7972 wkt::internal::display_enum(f, self.name(), self.value())
7973 }
7974 }
7975
7976 impl std::convert::From<i32> for RolloutState {
7977 fn from(value: i32) -> Self {
7978 match value {
7979 0 => Self::Unspecified,
7980 1 => Self::InProgress,
7981 2 => Self::Cancelling,
7982 3 => Self::Cancelled,
7983 4 => Self::Succeeded,
7984 _ => Self::UnknownValue(rollout_state::UnknownValue(
7985 wkt::internal::UnknownEnumValue::Integer(value),
7986 )),
7987 }
7988 }
7989 }
7990
7991 impl std::convert::From<&str> for RolloutState {
7992 fn from(value: &str) -> Self {
7993 use std::string::ToString;
7994 match value {
7995 "ROLLOUT_STATE_UNSPECIFIED" => Self::Unspecified,
7996 "IN_PROGRESS" => Self::InProgress,
7997 "CANCELLING" => Self::Cancelling,
7998 "CANCELLED" => Self::Cancelled,
7999 "SUCCEEDED" => Self::Succeeded,
8000 _ => Self::UnknownValue(rollout_state::UnknownValue(
8001 wkt::internal::UnknownEnumValue::String(value.to_string()),
8002 )),
8003 }
8004 }
8005 }
8006
8007 impl serde::ser::Serialize for RolloutState {
8008 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8009 where
8010 S: serde::Serializer,
8011 {
8012 match self {
8013 Self::Unspecified => serializer.serialize_i32(0),
8014 Self::InProgress => serializer.serialize_i32(1),
8015 Self::Cancelling => serializer.serialize_i32(2),
8016 Self::Cancelled => serializer.serialize_i32(3),
8017 Self::Succeeded => serializer.serialize_i32(4),
8018 Self::UnknownValue(u) => u.0.serialize(serializer),
8019 }
8020 }
8021 }
8022
8023 impl<'de> serde::de::Deserialize<'de> for RolloutState {
8024 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8025 where
8026 D: serde::Deserializer<'de>,
8027 {
8028 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RolloutState>::new(
8029 ".google.cloud.osconfig.v1.OSPolicyAssignment.RolloutState",
8030 ))
8031 }
8032 }
8033}
8034
8035/// OS policy assignment operation metadata provided by OS policy assignment API
8036/// methods that return long running operations.
8037#[derive(Clone, Default, PartialEq)]
8038#[non_exhaustive]
8039pub struct OSPolicyAssignmentOperationMetadata {
8040 /// Reference to the `OSPolicyAssignment` API resource.
8041 ///
8042 /// Format:
8043 /// `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
8044 pub os_policy_assignment: std::string::String,
8045
8046 /// The OS policy assignment API method.
8047 pub api_method: crate::model::os_policy_assignment_operation_metadata::APIMethod,
8048
8049 /// State of the rollout
8050 pub rollout_state: crate::model::os_policy_assignment_operation_metadata::RolloutState,
8051
8052 /// Rollout start time
8053 pub rollout_start_time: std::option::Option<wkt::Timestamp>,
8054
8055 /// Rollout update time
8056 pub rollout_update_time: std::option::Option<wkt::Timestamp>,
8057
8058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8059}
8060
8061impl OSPolicyAssignmentOperationMetadata {
8062 /// Creates a new default instance.
8063 pub fn new() -> Self {
8064 std::default::Default::default()
8065 }
8066
8067 /// Sets the value of [os_policy_assignment][crate::model::OSPolicyAssignmentOperationMetadata::os_policy_assignment].
8068 ///
8069 /// # Example
8070 /// ```ignore,no_run
8071 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8072 /// let x = OSPolicyAssignmentOperationMetadata::new().set_os_policy_assignment("example");
8073 /// ```
8074 pub fn set_os_policy_assignment<T: std::convert::Into<std::string::String>>(
8075 mut self,
8076 v: T,
8077 ) -> Self {
8078 self.os_policy_assignment = v.into();
8079 self
8080 }
8081
8082 /// Sets the value of [api_method][crate::model::OSPolicyAssignmentOperationMetadata::api_method].
8083 ///
8084 /// # Example
8085 /// ```ignore,no_run
8086 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8087 /// use google_cloud_osconfig_v1::model::os_policy_assignment_operation_metadata::APIMethod;
8088 /// let x0 = OSPolicyAssignmentOperationMetadata::new().set_api_method(APIMethod::Create);
8089 /// let x1 = OSPolicyAssignmentOperationMetadata::new().set_api_method(APIMethod::Update);
8090 /// let x2 = OSPolicyAssignmentOperationMetadata::new().set_api_method(APIMethod::Delete);
8091 /// ```
8092 pub fn set_api_method<
8093 T: std::convert::Into<crate::model::os_policy_assignment_operation_metadata::APIMethod>,
8094 >(
8095 mut self,
8096 v: T,
8097 ) -> Self {
8098 self.api_method = v.into();
8099 self
8100 }
8101
8102 /// Sets the value of [rollout_state][crate::model::OSPolicyAssignmentOperationMetadata::rollout_state].
8103 ///
8104 /// # Example
8105 /// ```ignore,no_run
8106 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8107 /// use google_cloud_osconfig_v1::model::os_policy_assignment_operation_metadata::RolloutState;
8108 /// let x0 = OSPolicyAssignmentOperationMetadata::new().set_rollout_state(RolloutState::InProgress);
8109 /// let x1 = OSPolicyAssignmentOperationMetadata::new().set_rollout_state(RolloutState::Cancelling);
8110 /// let x2 = OSPolicyAssignmentOperationMetadata::new().set_rollout_state(RolloutState::Cancelled);
8111 /// ```
8112 pub fn set_rollout_state<
8113 T: std::convert::Into<crate::model::os_policy_assignment_operation_metadata::RolloutState>,
8114 >(
8115 mut self,
8116 v: T,
8117 ) -> Self {
8118 self.rollout_state = v.into();
8119 self
8120 }
8121
8122 /// Sets the value of [rollout_start_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_start_time].
8123 ///
8124 /// # Example
8125 /// ```ignore,no_run
8126 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8127 /// use wkt::Timestamp;
8128 /// let x = OSPolicyAssignmentOperationMetadata::new().set_rollout_start_time(Timestamp::default()/* use setters */);
8129 /// ```
8130 pub fn set_rollout_start_time<T>(mut self, v: T) -> Self
8131 where
8132 T: std::convert::Into<wkt::Timestamp>,
8133 {
8134 self.rollout_start_time = std::option::Option::Some(v.into());
8135 self
8136 }
8137
8138 /// Sets or clears the value of [rollout_start_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_start_time].
8139 ///
8140 /// # Example
8141 /// ```ignore,no_run
8142 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8143 /// use wkt::Timestamp;
8144 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_start_time(Some(Timestamp::default()/* use setters */));
8145 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_start_time(None::<Timestamp>);
8146 /// ```
8147 pub fn set_or_clear_rollout_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8148 where
8149 T: std::convert::Into<wkt::Timestamp>,
8150 {
8151 self.rollout_start_time = v.map(|x| x.into());
8152 self
8153 }
8154
8155 /// Sets the value of [rollout_update_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_update_time].
8156 ///
8157 /// # Example
8158 /// ```ignore,no_run
8159 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8160 /// use wkt::Timestamp;
8161 /// let x = OSPolicyAssignmentOperationMetadata::new().set_rollout_update_time(Timestamp::default()/* use setters */);
8162 /// ```
8163 pub fn set_rollout_update_time<T>(mut self, v: T) -> Self
8164 where
8165 T: std::convert::Into<wkt::Timestamp>,
8166 {
8167 self.rollout_update_time = std::option::Option::Some(v.into());
8168 self
8169 }
8170
8171 /// Sets or clears the value of [rollout_update_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_update_time].
8172 ///
8173 /// # Example
8174 /// ```ignore,no_run
8175 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8176 /// use wkt::Timestamp;
8177 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_update_time(Some(Timestamp::default()/* use setters */));
8178 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_update_time(None::<Timestamp>);
8179 /// ```
8180 pub fn set_or_clear_rollout_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8181 where
8182 T: std::convert::Into<wkt::Timestamp>,
8183 {
8184 self.rollout_update_time = v.map(|x| x.into());
8185 self
8186 }
8187}
8188
8189impl wkt::message::Message for OSPolicyAssignmentOperationMetadata {
8190 fn typename() -> &'static str {
8191 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata"
8192 }
8193}
8194
8195/// Defines additional types related to [OSPolicyAssignmentOperationMetadata].
8196pub mod os_policy_assignment_operation_metadata {
8197 #[allow(unused_imports)]
8198 use super::*;
8199
8200 /// The OS policy assignment API method.
8201 ///
8202 /// # Working with unknown values
8203 ///
8204 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8205 /// additional enum variants at any time. Adding new variants is not considered
8206 /// a breaking change. Applications should write their code in anticipation of:
8207 ///
8208 /// - New values appearing in future releases of the client library, **and**
8209 /// - New values received dynamically, without application changes.
8210 ///
8211 /// Please consult the [Working with enums] section in the user guide for some
8212 /// guidelines.
8213 ///
8214 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8215 #[derive(Clone, Debug, PartialEq)]
8216 #[non_exhaustive]
8217 pub enum APIMethod {
8218 /// Invalid value
8219 Unspecified,
8220 /// Create OS policy assignment API method
8221 Create,
8222 /// Update OS policy assignment API method
8223 Update,
8224 /// Delete OS policy assignment API method
8225 Delete,
8226 /// If set, the enum was initialized with an unknown value.
8227 ///
8228 /// Applications can examine the value using [APIMethod::value] or
8229 /// [APIMethod::name].
8230 UnknownValue(api_method::UnknownValue),
8231 }
8232
8233 #[doc(hidden)]
8234 pub mod api_method {
8235 #[allow(unused_imports)]
8236 use super::*;
8237 #[derive(Clone, Debug, PartialEq)]
8238 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8239 }
8240
8241 impl APIMethod {
8242 /// Gets the enum value.
8243 ///
8244 /// Returns `None` if the enum contains an unknown value deserialized from
8245 /// the string representation of enums.
8246 pub fn value(&self) -> std::option::Option<i32> {
8247 match self {
8248 Self::Unspecified => std::option::Option::Some(0),
8249 Self::Create => std::option::Option::Some(1),
8250 Self::Update => std::option::Option::Some(2),
8251 Self::Delete => std::option::Option::Some(3),
8252 Self::UnknownValue(u) => u.0.value(),
8253 }
8254 }
8255
8256 /// Gets the enum value as a string.
8257 ///
8258 /// Returns `None` if the enum contains an unknown value deserialized from
8259 /// the integer representation of enums.
8260 pub fn name(&self) -> std::option::Option<&str> {
8261 match self {
8262 Self::Unspecified => std::option::Option::Some("API_METHOD_UNSPECIFIED"),
8263 Self::Create => std::option::Option::Some("CREATE"),
8264 Self::Update => std::option::Option::Some("UPDATE"),
8265 Self::Delete => std::option::Option::Some("DELETE"),
8266 Self::UnknownValue(u) => u.0.name(),
8267 }
8268 }
8269 }
8270
8271 impl std::default::Default for APIMethod {
8272 fn default() -> Self {
8273 use std::convert::From;
8274 Self::from(0)
8275 }
8276 }
8277
8278 impl std::fmt::Display for APIMethod {
8279 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8280 wkt::internal::display_enum(f, self.name(), self.value())
8281 }
8282 }
8283
8284 impl std::convert::From<i32> for APIMethod {
8285 fn from(value: i32) -> Self {
8286 match value {
8287 0 => Self::Unspecified,
8288 1 => Self::Create,
8289 2 => Self::Update,
8290 3 => Self::Delete,
8291 _ => Self::UnknownValue(api_method::UnknownValue(
8292 wkt::internal::UnknownEnumValue::Integer(value),
8293 )),
8294 }
8295 }
8296 }
8297
8298 impl std::convert::From<&str> for APIMethod {
8299 fn from(value: &str) -> Self {
8300 use std::string::ToString;
8301 match value {
8302 "API_METHOD_UNSPECIFIED" => Self::Unspecified,
8303 "CREATE" => Self::Create,
8304 "UPDATE" => Self::Update,
8305 "DELETE" => Self::Delete,
8306 _ => Self::UnknownValue(api_method::UnknownValue(
8307 wkt::internal::UnknownEnumValue::String(value.to_string()),
8308 )),
8309 }
8310 }
8311 }
8312
8313 impl serde::ser::Serialize for APIMethod {
8314 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8315 where
8316 S: serde::Serializer,
8317 {
8318 match self {
8319 Self::Unspecified => serializer.serialize_i32(0),
8320 Self::Create => serializer.serialize_i32(1),
8321 Self::Update => serializer.serialize_i32(2),
8322 Self::Delete => serializer.serialize_i32(3),
8323 Self::UnknownValue(u) => u.0.serialize(serializer),
8324 }
8325 }
8326 }
8327
8328 impl<'de> serde::de::Deserialize<'de> for APIMethod {
8329 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8330 where
8331 D: serde::Deserializer<'de>,
8332 {
8333 deserializer.deserialize_any(wkt::internal::EnumVisitor::<APIMethod>::new(
8334 ".google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata.APIMethod",
8335 ))
8336 }
8337 }
8338
8339 /// State of the rollout
8340 ///
8341 /// # Working with unknown values
8342 ///
8343 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8344 /// additional enum variants at any time. Adding new variants is not considered
8345 /// a breaking change. Applications should write their code in anticipation of:
8346 ///
8347 /// - New values appearing in future releases of the client library, **and**
8348 /// - New values received dynamically, without application changes.
8349 ///
8350 /// Please consult the [Working with enums] section in the user guide for some
8351 /// guidelines.
8352 ///
8353 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8354 #[derive(Clone, Debug, PartialEq)]
8355 #[non_exhaustive]
8356 pub enum RolloutState {
8357 /// Invalid value
8358 Unspecified,
8359 /// The rollout is in progress.
8360 InProgress,
8361 /// The rollout is being cancelled.
8362 Cancelling,
8363 /// The rollout is cancelled.
8364 Cancelled,
8365 /// The rollout has completed successfully.
8366 Succeeded,
8367 /// If set, the enum was initialized with an unknown value.
8368 ///
8369 /// Applications can examine the value using [RolloutState::value] or
8370 /// [RolloutState::name].
8371 UnknownValue(rollout_state::UnknownValue),
8372 }
8373
8374 #[doc(hidden)]
8375 pub mod rollout_state {
8376 #[allow(unused_imports)]
8377 use super::*;
8378 #[derive(Clone, Debug, PartialEq)]
8379 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8380 }
8381
8382 impl RolloutState {
8383 /// Gets the enum value.
8384 ///
8385 /// Returns `None` if the enum contains an unknown value deserialized from
8386 /// the string representation of enums.
8387 pub fn value(&self) -> std::option::Option<i32> {
8388 match self {
8389 Self::Unspecified => std::option::Option::Some(0),
8390 Self::InProgress => std::option::Option::Some(1),
8391 Self::Cancelling => std::option::Option::Some(2),
8392 Self::Cancelled => std::option::Option::Some(3),
8393 Self::Succeeded => std::option::Option::Some(4),
8394 Self::UnknownValue(u) => u.0.value(),
8395 }
8396 }
8397
8398 /// Gets the enum value as a string.
8399 ///
8400 /// Returns `None` if the enum contains an unknown value deserialized from
8401 /// the integer representation of enums.
8402 pub fn name(&self) -> std::option::Option<&str> {
8403 match self {
8404 Self::Unspecified => std::option::Option::Some("ROLLOUT_STATE_UNSPECIFIED"),
8405 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
8406 Self::Cancelling => std::option::Option::Some("CANCELLING"),
8407 Self::Cancelled => std::option::Option::Some("CANCELLED"),
8408 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
8409 Self::UnknownValue(u) => u.0.name(),
8410 }
8411 }
8412 }
8413
8414 impl std::default::Default for RolloutState {
8415 fn default() -> Self {
8416 use std::convert::From;
8417 Self::from(0)
8418 }
8419 }
8420
8421 impl std::fmt::Display for RolloutState {
8422 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8423 wkt::internal::display_enum(f, self.name(), self.value())
8424 }
8425 }
8426
8427 impl std::convert::From<i32> for RolloutState {
8428 fn from(value: i32) -> Self {
8429 match value {
8430 0 => Self::Unspecified,
8431 1 => Self::InProgress,
8432 2 => Self::Cancelling,
8433 3 => Self::Cancelled,
8434 4 => Self::Succeeded,
8435 _ => Self::UnknownValue(rollout_state::UnknownValue(
8436 wkt::internal::UnknownEnumValue::Integer(value),
8437 )),
8438 }
8439 }
8440 }
8441
8442 impl std::convert::From<&str> for RolloutState {
8443 fn from(value: &str) -> Self {
8444 use std::string::ToString;
8445 match value {
8446 "ROLLOUT_STATE_UNSPECIFIED" => Self::Unspecified,
8447 "IN_PROGRESS" => Self::InProgress,
8448 "CANCELLING" => Self::Cancelling,
8449 "CANCELLED" => Self::Cancelled,
8450 "SUCCEEDED" => Self::Succeeded,
8451 _ => Self::UnknownValue(rollout_state::UnknownValue(
8452 wkt::internal::UnknownEnumValue::String(value.to_string()),
8453 )),
8454 }
8455 }
8456 }
8457
8458 impl serde::ser::Serialize for RolloutState {
8459 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8460 where
8461 S: serde::Serializer,
8462 {
8463 match self {
8464 Self::Unspecified => serializer.serialize_i32(0),
8465 Self::InProgress => serializer.serialize_i32(1),
8466 Self::Cancelling => serializer.serialize_i32(2),
8467 Self::Cancelled => serializer.serialize_i32(3),
8468 Self::Succeeded => serializer.serialize_i32(4),
8469 Self::UnknownValue(u) => u.0.serialize(serializer),
8470 }
8471 }
8472 }
8473
8474 impl<'de> serde::de::Deserialize<'de> for RolloutState {
8475 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8476 where
8477 D: serde::Deserializer<'de>,
8478 {
8479 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RolloutState>::new(
8480 ".google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata.RolloutState",
8481 ))
8482 }
8483 }
8484}
8485
8486/// A request message to create an OS policy assignment
8487#[derive(Clone, Default, PartialEq)]
8488#[non_exhaustive]
8489pub struct CreateOSPolicyAssignmentRequest {
8490 /// Required. The parent resource name in the form:
8491 /// projects/{project}/locations/{location}
8492 pub parent: std::string::String,
8493
8494 /// Required. The OS policy assignment to be created.
8495 pub os_policy_assignment: std::option::Option<crate::model::OSPolicyAssignment>,
8496
8497 /// Required. The logical name of the OS policy assignment in the project
8498 /// with the following restrictions:
8499 ///
8500 /// * Must contain only lowercase letters, numbers, and hyphens.
8501 /// * Must start with a letter.
8502 /// * Must be between 1-63 characters.
8503 /// * Must end with a number or a letter.
8504 /// * Must be unique within the project.
8505 pub os_policy_assignment_id: std::string::String,
8506
8507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8508}
8509
8510impl CreateOSPolicyAssignmentRequest {
8511 /// Creates a new default instance.
8512 pub fn new() -> Self {
8513 std::default::Default::default()
8514 }
8515
8516 /// Sets the value of [parent][crate::model::CreateOSPolicyAssignmentRequest::parent].
8517 ///
8518 /// # Example
8519 /// ```ignore,no_run
8520 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8521 /// let x = CreateOSPolicyAssignmentRequest::new().set_parent("example");
8522 /// ```
8523 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8524 self.parent = v.into();
8525 self
8526 }
8527
8528 /// Sets the value of [os_policy_assignment][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment].
8529 ///
8530 /// # Example
8531 /// ```ignore,no_run
8532 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8533 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8534 /// let x = CreateOSPolicyAssignmentRequest::new().set_os_policy_assignment(OSPolicyAssignment::default()/* use setters */);
8535 /// ```
8536 pub fn set_os_policy_assignment<T>(mut self, v: T) -> Self
8537 where
8538 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8539 {
8540 self.os_policy_assignment = std::option::Option::Some(v.into());
8541 self
8542 }
8543
8544 /// Sets or clears the value of [os_policy_assignment][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment].
8545 ///
8546 /// # Example
8547 /// ```ignore,no_run
8548 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8549 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8550 /// let x = CreateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(Some(OSPolicyAssignment::default()/* use setters */));
8551 /// let x = CreateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(None::<OSPolicyAssignment>);
8552 /// ```
8553 pub fn set_or_clear_os_policy_assignment<T>(mut self, v: std::option::Option<T>) -> Self
8554 where
8555 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8556 {
8557 self.os_policy_assignment = v.map(|x| x.into());
8558 self
8559 }
8560
8561 /// Sets the value of [os_policy_assignment_id][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment_id].
8562 ///
8563 /// # Example
8564 /// ```ignore,no_run
8565 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8566 /// let x = CreateOSPolicyAssignmentRequest::new().set_os_policy_assignment_id("example");
8567 /// ```
8568 pub fn set_os_policy_assignment_id<T: std::convert::Into<std::string::String>>(
8569 mut self,
8570 v: T,
8571 ) -> Self {
8572 self.os_policy_assignment_id = v.into();
8573 self
8574 }
8575}
8576
8577impl wkt::message::Message for CreateOSPolicyAssignmentRequest {
8578 fn typename() -> &'static str {
8579 "type.googleapis.com/google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest"
8580 }
8581}
8582
8583/// A request message to update an OS policy assignment
8584#[derive(Clone, Default, PartialEq)]
8585#[non_exhaustive]
8586pub struct UpdateOSPolicyAssignmentRequest {
8587 /// Required. The updated OS policy assignment.
8588 pub os_policy_assignment: std::option::Option<crate::model::OSPolicyAssignment>,
8589
8590 /// Optional. Field mask that controls which fields of the assignment should be
8591 /// updated.
8592 pub update_mask: std::option::Option<wkt::FieldMask>,
8593
8594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8595}
8596
8597impl UpdateOSPolicyAssignmentRequest {
8598 /// Creates a new default instance.
8599 pub fn new() -> Self {
8600 std::default::Default::default()
8601 }
8602
8603 /// Sets the value of [os_policy_assignment][crate::model::UpdateOSPolicyAssignmentRequest::os_policy_assignment].
8604 ///
8605 /// # Example
8606 /// ```ignore,no_run
8607 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8608 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8609 /// let x = UpdateOSPolicyAssignmentRequest::new().set_os_policy_assignment(OSPolicyAssignment::default()/* use setters */);
8610 /// ```
8611 pub fn set_os_policy_assignment<T>(mut self, v: T) -> Self
8612 where
8613 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8614 {
8615 self.os_policy_assignment = std::option::Option::Some(v.into());
8616 self
8617 }
8618
8619 /// Sets or clears the value of [os_policy_assignment][crate::model::UpdateOSPolicyAssignmentRequest::os_policy_assignment].
8620 ///
8621 /// # Example
8622 /// ```ignore,no_run
8623 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8624 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8625 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(Some(OSPolicyAssignment::default()/* use setters */));
8626 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(None::<OSPolicyAssignment>);
8627 /// ```
8628 pub fn set_or_clear_os_policy_assignment<T>(mut self, v: std::option::Option<T>) -> Self
8629 where
8630 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8631 {
8632 self.os_policy_assignment = v.map(|x| x.into());
8633 self
8634 }
8635
8636 /// Sets the value of [update_mask][crate::model::UpdateOSPolicyAssignmentRequest::update_mask].
8637 ///
8638 /// # Example
8639 /// ```ignore,no_run
8640 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8641 /// use wkt::FieldMask;
8642 /// let x = UpdateOSPolicyAssignmentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8643 /// ```
8644 pub fn set_update_mask<T>(mut self, v: T) -> Self
8645 where
8646 T: std::convert::Into<wkt::FieldMask>,
8647 {
8648 self.update_mask = std::option::Option::Some(v.into());
8649 self
8650 }
8651
8652 /// Sets or clears the value of [update_mask][crate::model::UpdateOSPolicyAssignmentRequest::update_mask].
8653 ///
8654 /// # Example
8655 /// ```ignore,no_run
8656 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8657 /// use wkt::FieldMask;
8658 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8659 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8660 /// ```
8661 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8662 where
8663 T: std::convert::Into<wkt::FieldMask>,
8664 {
8665 self.update_mask = v.map(|x| x.into());
8666 self
8667 }
8668}
8669
8670impl wkt::message::Message for UpdateOSPolicyAssignmentRequest {
8671 fn typename() -> &'static str {
8672 "type.googleapis.com/google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest"
8673 }
8674}
8675
8676/// A request message to get an OS policy assignment
8677#[derive(Clone, Default, PartialEq)]
8678#[non_exhaustive]
8679pub struct GetOSPolicyAssignmentRequest {
8680 /// Required. The resource name of OS policy assignment.
8681 ///
8682 /// Format:
8683 /// `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}`
8684 pub name: std::string::String,
8685
8686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8687}
8688
8689impl GetOSPolicyAssignmentRequest {
8690 /// Creates a new default instance.
8691 pub fn new() -> Self {
8692 std::default::Default::default()
8693 }
8694
8695 /// Sets the value of [name][crate::model::GetOSPolicyAssignmentRequest::name].
8696 ///
8697 /// # Example
8698 /// ```ignore,no_run
8699 /// # use google_cloud_osconfig_v1::model::GetOSPolicyAssignmentRequest;
8700 /// let x = GetOSPolicyAssignmentRequest::new().set_name("example");
8701 /// ```
8702 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8703 self.name = v.into();
8704 self
8705 }
8706}
8707
8708impl wkt::message::Message for GetOSPolicyAssignmentRequest {
8709 fn typename() -> &'static str {
8710 "type.googleapis.com/google.cloud.osconfig.v1.GetOSPolicyAssignmentRequest"
8711 }
8712}
8713
8714/// A request message to list OS policy assignments for a parent resource
8715#[derive(Clone, Default, PartialEq)]
8716#[non_exhaustive]
8717pub struct ListOSPolicyAssignmentsRequest {
8718 /// Required. The parent resource name.
8719 pub parent: std::string::String,
8720
8721 /// The maximum number of assignments to return.
8722 pub page_size: i32,
8723
8724 /// A pagination token returned from a previous call to
8725 /// `ListOSPolicyAssignments` that indicates where this listing should continue
8726 /// from.
8727 pub page_token: std::string::String,
8728
8729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8730}
8731
8732impl ListOSPolicyAssignmentsRequest {
8733 /// Creates a new default instance.
8734 pub fn new() -> Self {
8735 std::default::Default::default()
8736 }
8737
8738 /// Sets the value of [parent][crate::model::ListOSPolicyAssignmentsRequest::parent].
8739 ///
8740 /// # Example
8741 /// ```ignore,no_run
8742 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsRequest;
8743 /// let x = ListOSPolicyAssignmentsRequest::new().set_parent("example");
8744 /// ```
8745 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8746 self.parent = v.into();
8747 self
8748 }
8749
8750 /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentsRequest::page_size].
8751 ///
8752 /// # Example
8753 /// ```ignore,no_run
8754 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsRequest;
8755 /// let x = ListOSPolicyAssignmentsRequest::new().set_page_size(42);
8756 /// ```
8757 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8758 self.page_size = v.into();
8759 self
8760 }
8761
8762 /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentsRequest::page_token].
8763 ///
8764 /// # Example
8765 /// ```ignore,no_run
8766 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsRequest;
8767 /// let x = ListOSPolicyAssignmentsRequest::new().set_page_token("example");
8768 /// ```
8769 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8770 self.page_token = v.into();
8771 self
8772 }
8773}
8774
8775impl wkt::message::Message for ListOSPolicyAssignmentsRequest {
8776 fn typename() -> &'static str {
8777 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest"
8778 }
8779}
8780
8781/// A response message for listing all assignments under given parent.
8782#[derive(Clone, Default, PartialEq)]
8783#[non_exhaustive]
8784pub struct ListOSPolicyAssignmentsResponse {
8785 /// The list of assignments
8786 pub os_policy_assignments: std::vec::Vec<crate::model::OSPolicyAssignment>,
8787
8788 /// The pagination token to retrieve the next page of OS policy assignments.
8789 pub next_page_token: std::string::String,
8790
8791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8792}
8793
8794impl ListOSPolicyAssignmentsResponse {
8795 /// Creates a new default instance.
8796 pub fn new() -> Self {
8797 std::default::Default::default()
8798 }
8799
8800 /// Sets the value of [os_policy_assignments][crate::model::ListOSPolicyAssignmentsResponse::os_policy_assignments].
8801 ///
8802 /// # Example
8803 /// ```ignore,no_run
8804 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsResponse;
8805 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8806 /// let x = ListOSPolicyAssignmentsResponse::new()
8807 /// .set_os_policy_assignments([
8808 /// OSPolicyAssignment::default()/* use setters */,
8809 /// OSPolicyAssignment::default()/* use (different) setters */,
8810 /// ]);
8811 /// ```
8812 pub fn set_os_policy_assignments<T, V>(mut self, v: T) -> Self
8813 where
8814 T: std::iter::IntoIterator<Item = V>,
8815 V: std::convert::Into<crate::model::OSPolicyAssignment>,
8816 {
8817 use std::iter::Iterator;
8818 self.os_policy_assignments = v.into_iter().map(|i| i.into()).collect();
8819 self
8820 }
8821
8822 /// Sets the value of [next_page_token][crate::model::ListOSPolicyAssignmentsResponse::next_page_token].
8823 ///
8824 /// # Example
8825 /// ```ignore,no_run
8826 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsResponse;
8827 /// let x = ListOSPolicyAssignmentsResponse::new().set_next_page_token("example");
8828 /// ```
8829 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8830 self.next_page_token = v.into();
8831 self
8832 }
8833}
8834
8835impl wkt::message::Message for ListOSPolicyAssignmentsResponse {
8836 fn typename() -> &'static str {
8837 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentsResponse"
8838 }
8839}
8840
8841#[doc(hidden)]
8842impl google_cloud_gax::paginator::internal::PageableResponse for ListOSPolicyAssignmentsResponse {
8843 type PageItem = crate::model::OSPolicyAssignment;
8844
8845 fn items(self) -> std::vec::Vec<Self::PageItem> {
8846 self.os_policy_assignments
8847 }
8848
8849 fn next_page_token(&self) -> std::string::String {
8850 use std::clone::Clone;
8851 self.next_page_token.clone()
8852 }
8853}
8854
8855/// A request message to list revisions for a OS policy assignment
8856#[derive(Clone, Default, PartialEq)]
8857#[non_exhaustive]
8858pub struct ListOSPolicyAssignmentRevisionsRequest {
8859 /// Required. The name of the OS policy assignment to list revisions for.
8860 pub name: std::string::String,
8861
8862 /// The maximum number of revisions to return.
8863 pub page_size: i32,
8864
8865 /// A pagination token returned from a previous call to
8866 /// `ListOSPolicyAssignmentRevisions` that indicates where this listing should
8867 /// continue from.
8868 pub page_token: std::string::String,
8869
8870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8871}
8872
8873impl ListOSPolicyAssignmentRevisionsRequest {
8874 /// Creates a new default instance.
8875 pub fn new() -> Self {
8876 std::default::Default::default()
8877 }
8878
8879 /// Sets the value of [name][crate::model::ListOSPolicyAssignmentRevisionsRequest::name].
8880 ///
8881 /// # Example
8882 /// ```ignore,no_run
8883 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsRequest;
8884 /// let x = ListOSPolicyAssignmentRevisionsRequest::new().set_name("example");
8885 /// ```
8886 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8887 self.name = v.into();
8888 self
8889 }
8890
8891 /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentRevisionsRequest::page_size].
8892 ///
8893 /// # Example
8894 /// ```ignore,no_run
8895 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsRequest;
8896 /// let x = ListOSPolicyAssignmentRevisionsRequest::new().set_page_size(42);
8897 /// ```
8898 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8899 self.page_size = v.into();
8900 self
8901 }
8902
8903 /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentRevisionsRequest::page_token].
8904 ///
8905 /// # Example
8906 /// ```ignore,no_run
8907 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsRequest;
8908 /// let x = ListOSPolicyAssignmentRevisionsRequest::new().set_page_token("example");
8909 /// ```
8910 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8911 self.page_token = v.into();
8912 self
8913 }
8914}
8915
8916impl wkt::message::Message for ListOSPolicyAssignmentRevisionsRequest {
8917 fn typename() -> &'static str {
8918 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest"
8919 }
8920}
8921
8922/// A response message for listing all revisions for a OS policy assignment.
8923#[derive(Clone, Default, PartialEq)]
8924#[non_exhaustive]
8925pub struct ListOSPolicyAssignmentRevisionsResponse {
8926 /// The OS policy assignment revisions
8927 pub os_policy_assignments: std::vec::Vec<crate::model::OSPolicyAssignment>,
8928
8929 /// The pagination token to retrieve the next page of OS policy assignment
8930 /// revisions.
8931 pub next_page_token: std::string::String,
8932
8933 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8934}
8935
8936impl ListOSPolicyAssignmentRevisionsResponse {
8937 /// Creates a new default instance.
8938 pub fn new() -> Self {
8939 std::default::Default::default()
8940 }
8941
8942 /// Sets the value of [os_policy_assignments][crate::model::ListOSPolicyAssignmentRevisionsResponse::os_policy_assignments].
8943 ///
8944 /// # Example
8945 /// ```ignore,no_run
8946 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsResponse;
8947 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8948 /// let x = ListOSPolicyAssignmentRevisionsResponse::new()
8949 /// .set_os_policy_assignments([
8950 /// OSPolicyAssignment::default()/* use setters */,
8951 /// OSPolicyAssignment::default()/* use (different) setters */,
8952 /// ]);
8953 /// ```
8954 pub fn set_os_policy_assignments<T, V>(mut self, v: T) -> Self
8955 where
8956 T: std::iter::IntoIterator<Item = V>,
8957 V: std::convert::Into<crate::model::OSPolicyAssignment>,
8958 {
8959 use std::iter::Iterator;
8960 self.os_policy_assignments = v.into_iter().map(|i| i.into()).collect();
8961 self
8962 }
8963
8964 /// Sets the value of [next_page_token][crate::model::ListOSPolicyAssignmentRevisionsResponse::next_page_token].
8965 ///
8966 /// # Example
8967 /// ```ignore,no_run
8968 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsResponse;
8969 /// let x = ListOSPolicyAssignmentRevisionsResponse::new().set_next_page_token("example");
8970 /// ```
8971 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8972 self.next_page_token = v.into();
8973 self
8974 }
8975}
8976
8977impl wkt::message::Message for ListOSPolicyAssignmentRevisionsResponse {
8978 fn typename() -> &'static str {
8979 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsResponse"
8980 }
8981}
8982
8983#[doc(hidden)]
8984impl google_cloud_gax::paginator::internal::PageableResponse
8985 for ListOSPolicyAssignmentRevisionsResponse
8986{
8987 type PageItem = crate::model::OSPolicyAssignment;
8988
8989 fn items(self) -> std::vec::Vec<Self::PageItem> {
8990 self.os_policy_assignments
8991 }
8992
8993 fn next_page_token(&self) -> std::string::String {
8994 use std::clone::Clone;
8995 self.next_page_token.clone()
8996 }
8997}
8998
8999/// A request message for deleting a OS policy assignment.
9000#[derive(Clone, Default, PartialEq)]
9001#[non_exhaustive]
9002pub struct DeleteOSPolicyAssignmentRequest {
9003 /// Required. The name of the OS policy assignment to be deleted
9004 pub name: std::string::String,
9005
9006 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9007}
9008
9009impl DeleteOSPolicyAssignmentRequest {
9010 /// Creates a new default instance.
9011 pub fn new() -> Self {
9012 std::default::Default::default()
9013 }
9014
9015 /// Sets the value of [name][crate::model::DeleteOSPolicyAssignmentRequest::name].
9016 ///
9017 /// # Example
9018 /// ```ignore,no_run
9019 /// # use google_cloud_osconfig_v1::model::DeleteOSPolicyAssignmentRequest;
9020 /// let x = DeleteOSPolicyAssignmentRequest::new().set_name("example");
9021 /// ```
9022 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9023 self.name = v.into();
9024 self
9025 }
9026}
9027
9028impl wkt::message::Message for DeleteOSPolicyAssignmentRequest {
9029 fn typename() -> &'static str {
9030 "type.googleapis.com/google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest"
9031 }
9032}
9033
9034/// Message encapsulating a value that can be either absolute ("fixed") or
9035/// relative ("percent") to a value.
9036#[derive(Clone, Default, PartialEq)]
9037#[non_exhaustive]
9038pub struct FixedOrPercent {
9039 /// Type of the value.
9040 pub mode: std::option::Option<crate::model::fixed_or_percent::Mode>,
9041
9042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9043}
9044
9045impl FixedOrPercent {
9046 /// Creates a new default instance.
9047 pub fn new() -> Self {
9048 std::default::Default::default()
9049 }
9050
9051 /// Sets the value of [mode][crate::model::FixedOrPercent::mode].
9052 ///
9053 /// Note that all the setters affecting `mode` are mutually
9054 /// exclusive.
9055 ///
9056 /// # Example
9057 /// ```ignore,no_run
9058 /// # use google_cloud_osconfig_v1::model::FixedOrPercent;
9059 /// use google_cloud_osconfig_v1::model::fixed_or_percent::Mode;
9060 /// let x = FixedOrPercent::new().set_mode(Some(Mode::Fixed(42)));
9061 /// ```
9062 pub fn set_mode<
9063 T: std::convert::Into<std::option::Option<crate::model::fixed_or_percent::Mode>>,
9064 >(
9065 mut self,
9066 v: T,
9067 ) -> Self {
9068 self.mode = v.into();
9069 self
9070 }
9071
9072 /// The value of [mode][crate::model::FixedOrPercent::mode]
9073 /// if it holds a `Fixed`, `None` if the field is not set or
9074 /// holds a different branch.
9075 pub fn fixed(&self) -> std::option::Option<&i32> {
9076 #[allow(unreachable_patterns)]
9077 self.mode.as_ref().and_then(|v| match v {
9078 crate::model::fixed_or_percent::Mode::Fixed(v) => std::option::Option::Some(v),
9079 _ => std::option::Option::None,
9080 })
9081 }
9082
9083 /// Sets the value of [mode][crate::model::FixedOrPercent::mode]
9084 /// to hold a `Fixed`.
9085 ///
9086 /// Note that all the setters affecting `mode` are
9087 /// mutually exclusive.
9088 ///
9089 /// # Example
9090 /// ```ignore,no_run
9091 /// # use google_cloud_osconfig_v1::model::FixedOrPercent;
9092 /// let x = FixedOrPercent::new().set_fixed(42);
9093 /// assert!(x.fixed().is_some());
9094 /// assert!(x.percent().is_none());
9095 /// ```
9096 pub fn set_fixed<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9097 self.mode =
9098 std::option::Option::Some(crate::model::fixed_or_percent::Mode::Fixed(v.into()));
9099 self
9100 }
9101
9102 /// The value of [mode][crate::model::FixedOrPercent::mode]
9103 /// if it holds a `Percent`, `None` if the field is not set or
9104 /// holds a different branch.
9105 pub fn percent(&self) -> std::option::Option<&i32> {
9106 #[allow(unreachable_patterns)]
9107 self.mode.as_ref().and_then(|v| match v {
9108 crate::model::fixed_or_percent::Mode::Percent(v) => std::option::Option::Some(v),
9109 _ => std::option::Option::None,
9110 })
9111 }
9112
9113 /// Sets the value of [mode][crate::model::FixedOrPercent::mode]
9114 /// to hold a `Percent`.
9115 ///
9116 /// Note that all the setters affecting `mode` are
9117 /// mutually exclusive.
9118 ///
9119 /// # Example
9120 /// ```ignore,no_run
9121 /// # use google_cloud_osconfig_v1::model::FixedOrPercent;
9122 /// let x = FixedOrPercent::new().set_percent(42);
9123 /// assert!(x.percent().is_some());
9124 /// assert!(x.fixed().is_none());
9125 /// ```
9126 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9127 self.mode =
9128 std::option::Option::Some(crate::model::fixed_or_percent::Mode::Percent(v.into()));
9129 self
9130 }
9131}
9132
9133impl wkt::message::Message for FixedOrPercent {
9134 fn typename() -> &'static str {
9135 "type.googleapis.com/google.cloud.osconfig.v1.FixedOrPercent"
9136 }
9137}
9138
9139/// Defines additional types related to [FixedOrPercent].
9140pub mod fixed_or_percent {
9141 #[allow(unused_imports)]
9142 use super::*;
9143
9144 /// Type of the value.
9145 #[derive(Clone, Debug, PartialEq)]
9146 #[non_exhaustive]
9147 pub enum Mode {
9148 /// Specifies a fixed value.
9149 Fixed(i32),
9150 /// Specifies the relative value defined as a percentage, which will be
9151 /// multiplied by a reference value.
9152 Percent(i32),
9153 }
9154}
9155
9156/// Patch deployments are configurations that individual patch jobs use to
9157/// complete a patch. These configurations include instance filter, package
9158/// repository settings, and a schedule. For more information about creating and
9159/// managing patch deployments, see [Scheduling patch
9160/// jobs](https://cloud.google.com/compute/docs/os-patch-management/schedule-patch-jobs).
9161#[derive(Clone, Default, PartialEq)]
9162#[non_exhaustive]
9163pub struct PatchDeployment {
9164 /// Unique name for the patch deployment resource in a project. The patch
9165 /// deployment name is in the form:
9166 /// `projects/{project_id}/patchDeployments/{patch_deployment_id}`.
9167 /// This field is ignored when you create a new patch deployment.
9168 pub name: std::string::String,
9169
9170 /// Optional. Description of the patch deployment. Length of the description is
9171 /// limited to 1024 characters.
9172 pub description: std::string::String,
9173
9174 /// Required. VM instances to patch.
9175 pub instance_filter: std::option::Option<crate::model::PatchInstanceFilter>,
9176
9177 /// Optional. Patch configuration that is applied.
9178 pub patch_config: std::option::Option<crate::model::PatchConfig>,
9179
9180 /// Optional. Duration of the patch. After the duration ends, the patch times
9181 /// out.
9182 pub duration: std::option::Option<wkt::Duration>,
9183
9184 /// Output only. Time the patch deployment was created. Timestamp is in
9185 /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
9186 pub create_time: std::option::Option<wkt::Timestamp>,
9187
9188 /// Output only. Time the patch deployment was last updated. Timestamp is in
9189 /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
9190 pub update_time: std::option::Option<wkt::Timestamp>,
9191
9192 /// Output only. The last time a patch job was started by this deployment.
9193 /// Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text
9194 /// format.
9195 pub last_execute_time: std::option::Option<wkt::Timestamp>,
9196
9197 /// Optional. Rollout strategy of the patch job.
9198 pub rollout: std::option::Option<crate::model::PatchRollout>,
9199
9200 /// Output only. Current state of the patch deployment.
9201 pub state: crate::model::patch_deployment::State,
9202
9203 /// Schedule for the patch.
9204 pub schedule: std::option::Option<crate::model::patch_deployment::Schedule>,
9205
9206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9207}
9208
9209impl PatchDeployment {
9210 /// Creates a new default instance.
9211 pub fn new() -> Self {
9212 std::default::Default::default()
9213 }
9214
9215 /// Sets the value of [name][crate::model::PatchDeployment::name].
9216 ///
9217 /// # Example
9218 /// ```ignore,no_run
9219 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9220 /// let x = PatchDeployment::new().set_name("example");
9221 /// ```
9222 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9223 self.name = v.into();
9224 self
9225 }
9226
9227 /// Sets the value of [description][crate::model::PatchDeployment::description].
9228 ///
9229 /// # Example
9230 /// ```ignore,no_run
9231 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9232 /// let x = PatchDeployment::new().set_description("example");
9233 /// ```
9234 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9235 self.description = v.into();
9236 self
9237 }
9238
9239 /// Sets the value of [instance_filter][crate::model::PatchDeployment::instance_filter].
9240 ///
9241 /// # Example
9242 /// ```ignore,no_run
9243 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9244 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
9245 /// let x = PatchDeployment::new().set_instance_filter(PatchInstanceFilter::default()/* use setters */);
9246 /// ```
9247 pub fn set_instance_filter<T>(mut self, v: T) -> Self
9248 where
9249 T: std::convert::Into<crate::model::PatchInstanceFilter>,
9250 {
9251 self.instance_filter = std::option::Option::Some(v.into());
9252 self
9253 }
9254
9255 /// Sets or clears the value of [instance_filter][crate::model::PatchDeployment::instance_filter].
9256 ///
9257 /// # Example
9258 /// ```ignore,no_run
9259 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9260 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
9261 /// let x = PatchDeployment::new().set_or_clear_instance_filter(Some(PatchInstanceFilter::default()/* use setters */));
9262 /// let x = PatchDeployment::new().set_or_clear_instance_filter(None::<PatchInstanceFilter>);
9263 /// ```
9264 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
9265 where
9266 T: std::convert::Into<crate::model::PatchInstanceFilter>,
9267 {
9268 self.instance_filter = v.map(|x| x.into());
9269 self
9270 }
9271
9272 /// Sets the value of [patch_config][crate::model::PatchDeployment::patch_config].
9273 ///
9274 /// # Example
9275 /// ```ignore,no_run
9276 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9277 /// use google_cloud_osconfig_v1::model::PatchConfig;
9278 /// let x = PatchDeployment::new().set_patch_config(PatchConfig::default()/* use setters */);
9279 /// ```
9280 pub fn set_patch_config<T>(mut self, v: T) -> Self
9281 where
9282 T: std::convert::Into<crate::model::PatchConfig>,
9283 {
9284 self.patch_config = std::option::Option::Some(v.into());
9285 self
9286 }
9287
9288 /// Sets or clears the value of [patch_config][crate::model::PatchDeployment::patch_config].
9289 ///
9290 /// # Example
9291 /// ```ignore,no_run
9292 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9293 /// use google_cloud_osconfig_v1::model::PatchConfig;
9294 /// let x = PatchDeployment::new().set_or_clear_patch_config(Some(PatchConfig::default()/* use setters */));
9295 /// let x = PatchDeployment::new().set_or_clear_patch_config(None::<PatchConfig>);
9296 /// ```
9297 pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
9298 where
9299 T: std::convert::Into<crate::model::PatchConfig>,
9300 {
9301 self.patch_config = v.map(|x| x.into());
9302 self
9303 }
9304
9305 /// Sets the value of [duration][crate::model::PatchDeployment::duration].
9306 ///
9307 /// # Example
9308 /// ```ignore,no_run
9309 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9310 /// use wkt::Duration;
9311 /// let x = PatchDeployment::new().set_duration(Duration::default()/* use setters */);
9312 /// ```
9313 pub fn set_duration<T>(mut self, v: T) -> Self
9314 where
9315 T: std::convert::Into<wkt::Duration>,
9316 {
9317 self.duration = std::option::Option::Some(v.into());
9318 self
9319 }
9320
9321 /// Sets or clears the value of [duration][crate::model::PatchDeployment::duration].
9322 ///
9323 /// # Example
9324 /// ```ignore,no_run
9325 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9326 /// use wkt::Duration;
9327 /// let x = PatchDeployment::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
9328 /// let x = PatchDeployment::new().set_or_clear_duration(None::<Duration>);
9329 /// ```
9330 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
9331 where
9332 T: std::convert::Into<wkt::Duration>,
9333 {
9334 self.duration = v.map(|x| x.into());
9335 self
9336 }
9337
9338 /// Sets the value of [create_time][crate::model::PatchDeployment::create_time].
9339 ///
9340 /// # Example
9341 /// ```ignore,no_run
9342 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9343 /// use wkt::Timestamp;
9344 /// let x = PatchDeployment::new().set_create_time(Timestamp::default()/* use setters */);
9345 /// ```
9346 pub fn set_create_time<T>(mut self, v: T) -> Self
9347 where
9348 T: std::convert::Into<wkt::Timestamp>,
9349 {
9350 self.create_time = std::option::Option::Some(v.into());
9351 self
9352 }
9353
9354 /// Sets or clears the value of [create_time][crate::model::PatchDeployment::create_time].
9355 ///
9356 /// # Example
9357 /// ```ignore,no_run
9358 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9359 /// use wkt::Timestamp;
9360 /// let x = PatchDeployment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9361 /// let x = PatchDeployment::new().set_or_clear_create_time(None::<Timestamp>);
9362 /// ```
9363 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9364 where
9365 T: std::convert::Into<wkt::Timestamp>,
9366 {
9367 self.create_time = v.map(|x| x.into());
9368 self
9369 }
9370
9371 /// Sets the value of [update_time][crate::model::PatchDeployment::update_time].
9372 ///
9373 /// # Example
9374 /// ```ignore,no_run
9375 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9376 /// use wkt::Timestamp;
9377 /// let x = PatchDeployment::new().set_update_time(Timestamp::default()/* use setters */);
9378 /// ```
9379 pub fn set_update_time<T>(mut self, v: T) -> Self
9380 where
9381 T: std::convert::Into<wkt::Timestamp>,
9382 {
9383 self.update_time = std::option::Option::Some(v.into());
9384 self
9385 }
9386
9387 /// Sets or clears the value of [update_time][crate::model::PatchDeployment::update_time].
9388 ///
9389 /// # Example
9390 /// ```ignore,no_run
9391 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9392 /// use wkt::Timestamp;
9393 /// let x = PatchDeployment::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9394 /// let x = PatchDeployment::new().set_or_clear_update_time(None::<Timestamp>);
9395 /// ```
9396 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9397 where
9398 T: std::convert::Into<wkt::Timestamp>,
9399 {
9400 self.update_time = v.map(|x| x.into());
9401 self
9402 }
9403
9404 /// Sets the value of [last_execute_time][crate::model::PatchDeployment::last_execute_time].
9405 ///
9406 /// # Example
9407 /// ```ignore,no_run
9408 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9409 /// use wkt::Timestamp;
9410 /// let x = PatchDeployment::new().set_last_execute_time(Timestamp::default()/* use setters */);
9411 /// ```
9412 pub fn set_last_execute_time<T>(mut self, v: T) -> Self
9413 where
9414 T: std::convert::Into<wkt::Timestamp>,
9415 {
9416 self.last_execute_time = std::option::Option::Some(v.into());
9417 self
9418 }
9419
9420 /// Sets or clears the value of [last_execute_time][crate::model::PatchDeployment::last_execute_time].
9421 ///
9422 /// # Example
9423 /// ```ignore,no_run
9424 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9425 /// use wkt::Timestamp;
9426 /// let x = PatchDeployment::new().set_or_clear_last_execute_time(Some(Timestamp::default()/* use setters */));
9427 /// let x = PatchDeployment::new().set_or_clear_last_execute_time(None::<Timestamp>);
9428 /// ```
9429 pub fn set_or_clear_last_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
9430 where
9431 T: std::convert::Into<wkt::Timestamp>,
9432 {
9433 self.last_execute_time = v.map(|x| x.into());
9434 self
9435 }
9436
9437 /// Sets the value of [rollout][crate::model::PatchDeployment::rollout].
9438 ///
9439 /// # Example
9440 /// ```ignore,no_run
9441 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9442 /// use google_cloud_osconfig_v1::model::PatchRollout;
9443 /// let x = PatchDeployment::new().set_rollout(PatchRollout::default()/* use setters */);
9444 /// ```
9445 pub fn set_rollout<T>(mut self, v: T) -> Self
9446 where
9447 T: std::convert::Into<crate::model::PatchRollout>,
9448 {
9449 self.rollout = std::option::Option::Some(v.into());
9450 self
9451 }
9452
9453 /// Sets or clears the value of [rollout][crate::model::PatchDeployment::rollout].
9454 ///
9455 /// # Example
9456 /// ```ignore,no_run
9457 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9458 /// use google_cloud_osconfig_v1::model::PatchRollout;
9459 /// let x = PatchDeployment::new().set_or_clear_rollout(Some(PatchRollout::default()/* use setters */));
9460 /// let x = PatchDeployment::new().set_or_clear_rollout(None::<PatchRollout>);
9461 /// ```
9462 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
9463 where
9464 T: std::convert::Into<crate::model::PatchRollout>,
9465 {
9466 self.rollout = v.map(|x| x.into());
9467 self
9468 }
9469
9470 /// Sets the value of [state][crate::model::PatchDeployment::state].
9471 ///
9472 /// # Example
9473 /// ```ignore,no_run
9474 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9475 /// use google_cloud_osconfig_v1::model::patch_deployment::State;
9476 /// let x0 = PatchDeployment::new().set_state(State::Active);
9477 /// let x1 = PatchDeployment::new().set_state(State::Paused);
9478 /// ```
9479 pub fn set_state<T: std::convert::Into<crate::model::patch_deployment::State>>(
9480 mut self,
9481 v: T,
9482 ) -> Self {
9483 self.state = v.into();
9484 self
9485 }
9486
9487 /// Sets the value of [schedule][crate::model::PatchDeployment::schedule].
9488 ///
9489 /// Note that all the setters affecting `schedule` are mutually
9490 /// exclusive.
9491 ///
9492 /// # Example
9493 /// ```ignore,no_run
9494 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9495 /// use google_cloud_osconfig_v1::model::OneTimeSchedule;
9496 /// let x = PatchDeployment::new().set_schedule(Some(
9497 /// google_cloud_osconfig_v1::model::patch_deployment::Schedule::OneTimeSchedule(OneTimeSchedule::default().into())));
9498 /// ```
9499 pub fn set_schedule<
9500 T: std::convert::Into<std::option::Option<crate::model::patch_deployment::Schedule>>,
9501 >(
9502 mut self,
9503 v: T,
9504 ) -> Self {
9505 self.schedule = v.into();
9506 self
9507 }
9508
9509 /// The value of [schedule][crate::model::PatchDeployment::schedule]
9510 /// if it holds a `OneTimeSchedule`, `None` if the field is not set or
9511 /// holds a different branch.
9512 pub fn one_time_schedule(
9513 &self,
9514 ) -> std::option::Option<&std::boxed::Box<crate::model::OneTimeSchedule>> {
9515 #[allow(unreachable_patterns)]
9516 self.schedule.as_ref().and_then(|v| match v {
9517 crate::model::patch_deployment::Schedule::OneTimeSchedule(v) => {
9518 std::option::Option::Some(v)
9519 }
9520 _ => std::option::Option::None,
9521 })
9522 }
9523
9524 /// Sets the value of [schedule][crate::model::PatchDeployment::schedule]
9525 /// to hold a `OneTimeSchedule`.
9526 ///
9527 /// Note that all the setters affecting `schedule` are
9528 /// mutually exclusive.
9529 ///
9530 /// # Example
9531 /// ```ignore,no_run
9532 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9533 /// use google_cloud_osconfig_v1::model::OneTimeSchedule;
9534 /// let x = PatchDeployment::new().set_one_time_schedule(OneTimeSchedule::default()/* use setters */);
9535 /// assert!(x.one_time_schedule().is_some());
9536 /// assert!(x.recurring_schedule().is_none());
9537 /// ```
9538 pub fn set_one_time_schedule<
9539 T: std::convert::Into<std::boxed::Box<crate::model::OneTimeSchedule>>,
9540 >(
9541 mut self,
9542 v: T,
9543 ) -> Self {
9544 self.schedule = std::option::Option::Some(
9545 crate::model::patch_deployment::Schedule::OneTimeSchedule(v.into()),
9546 );
9547 self
9548 }
9549
9550 /// The value of [schedule][crate::model::PatchDeployment::schedule]
9551 /// if it holds a `RecurringSchedule`, `None` if the field is not set or
9552 /// holds a different branch.
9553 pub fn recurring_schedule(
9554 &self,
9555 ) -> std::option::Option<&std::boxed::Box<crate::model::RecurringSchedule>> {
9556 #[allow(unreachable_patterns)]
9557 self.schedule.as_ref().and_then(|v| match v {
9558 crate::model::patch_deployment::Schedule::RecurringSchedule(v) => {
9559 std::option::Option::Some(v)
9560 }
9561 _ => std::option::Option::None,
9562 })
9563 }
9564
9565 /// Sets the value of [schedule][crate::model::PatchDeployment::schedule]
9566 /// to hold a `RecurringSchedule`.
9567 ///
9568 /// Note that all the setters affecting `schedule` are
9569 /// mutually exclusive.
9570 ///
9571 /// # Example
9572 /// ```ignore,no_run
9573 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9574 /// use google_cloud_osconfig_v1::model::RecurringSchedule;
9575 /// let x = PatchDeployment::new().set_recurring_schedule(RecurringSchedule::default()/* use setters */);
9576 /// assert!(x.recurring_schedule().is_some());
9577 /// assert!(x.one_time_schedule().is_none());
9578 /// ```
9579 pub fn set_recurring_schedule<
9580 T: std::convert::Into<std::boxed::Box<crate::model::RecurringSchedule>>,
9581 >(
9582 mut self,
9583 v: T,
9584 ) -> Self {
9585 self.schedule = std::option::Option::Some(
9586 crate::model::patch_deployment::Schedule::RecurringSchedule(v.into()),
9587 );
9588 self
9589 }
9590}
9591
9592impl wkt::message::Message for PatchDeployment {
9593 fn typename() -> &'static str {
9594 "type.googleapis.com/google.cloud.osconfig.v1.PatchDeployment"
9595 }
9596}
9597
9598/// Defines additional types related to [PatchDeployment].
9599pub mod patch_deployment {
9600 #[allow(unused_imports)]
9601 use super::*;
9602
9603 /// Represents state of patch peployment.
9604 ///
9605 /// # Working with unknown values
9606 ///
9607 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9608 /// additional enum variants at any time. Adding new variants is not considered
9609 /// a breaking change. Applications should write their code in anticipation of:
9610 ///
9611 /// - New values appearing in future releases of the client library, **and**
9612 /// - New values received dynamically, without application changes.
9613 ///
9614 /// Please consult the [Working with enums] section in the user guide for some
9615 /// guidelines.
9616 ///
9617 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9618 #[derive(Clone, Debug, PartialEq)]
9619 #[non_exhaustive]
9620 pub enum State {
9621 /// The default value. This value is used if the state is omitted.
9622 Unspecified,
9623 /// Active value means that patch deployment generates Patch Jobs.
9624 Active,
9625 /// Paused value means that patch deployment does not generate
9626 /// Patch jobs. Requires user action to move in and out from this state.
9627 Paused,
9628 /// If set, the enum was initialized with an unknown value.
9629 ///
9630 /// Applications can examine the value using [State::value] or
9631 /// [State::name].
9632 UnknownValue(state::UnknownValue),
9633 }
9634
9635 #[doc(hidden)]
9636 pub mod state {
9637 #[allow(unused_imports)]
9638 use super::*;
9639 #[derive(Clone, Debug, PartialEq)]
9640 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9641 }
9642
9643 impl State {
9644 /// Gets the enum value.
9645 ///
9646 /// Returns `None` if the enum contains an unknown value deserialized from
9647 /// the string representation of enums.
9648 pub fn value(&self) -> std::option::Option<i32> {
9649 match self {
9650 Self::Unspecified => std::option::Option::Some(0),
9651 Self::Active => std::option::Option::Some(1),
9652 Self::Paused => std::option::Option::Some(2),
9653 Self::UnknownValue(u) => u.0.value(),
9654 }
9655 }
9656
9657 /// Gets the enum value as a string.
9658 ///
9659 /// Returns `None` if the enum contains an unknown value deserialized from
9660 /// the integer representation of enums.
9661 pub fn name(&self) -> std::option::Option<&str> {
9662 match self {
9663 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9664 Self::Active => std::option::Option::Some("ACTIVE"),
9665 Self::Paused => std::option::Option::Some("PAUSED"),
9666 Self::UnknownValue(u) => u.0.name(),
9667 }
9668 }
9669 }
9670
9671 impl std::default::Default for State {
9672 fn default() -> Self {
9673 use std::convert::From;
9674 Self::from(0)
9675 }
9676 }
9677
9678 impl std::fmt::Display for State {
9679 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9680 wkt::internal::display_enum(f, self.name(), self.value())
9681 }
9682 }
9683
9684 impl std::convert::From<i32> for State {
9685 fn from(value: i32) -> Self {
9686 match value {
9687 0 => Self::Unspecified,
9688 1 => Self::Active,
9689 2 => Self::Paused,
9690 _ => Self::UnknownValue(state::UnknownValue(
9691 wkt::internal::UnknownEnumValue::Integer(value),
9692 )),
9693 }
9694 }
9695 }
9696
9697 impl std::convert::From<&str> for State {
9698 fn from(value: &str) -> Self {
9699 use std::string::ToString;
9700 match value {
9701 "STATE_UNSPECIFIED" => Self::Unspecified,
9702 "ACTIVE" => Self::Active,
9703 "PAUSED" => Self::Paused,
9704 _ => Self::UnknownValue(state::UnknownValue(
9705 wkt::internal::UnknownEnumValue::String(value.to_string()),
9706 )),
9707 }
9708 }
9709 }
9710
9711 impl serde::ser::Serialize for State {
9712 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9713 where
9714 S: serde::Serializer,
9715 {
9716 match self {
9717 Self::Unspecified => serializer.serialize_i32(0),
9718 Self::Active => serializer.serialize_i32(1),
9719 Self::Paused => serializer.serialize_i32(2),
9720 Self::UnknownValue(u) => u.0.serialize(serializer),
9721 }
9722 }
9723 }
9724
9725 impl<'de> serde::de::Deserialize<'de> for State {
9726 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9727 where
9728 D: serde::Deserializer<'de>,
9729 {
9730 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9731 ".google.cloud.osconfig.v1.PatchDeployment.State",
9732 ))
9733 }
9734 }
9735
9736 /// Schedule for the patch.
9737 #[derive(Clone, Debug, PartialEq)]
9738 #[non_exhaustive]
9739 pub enum Schedule {
9740 /// Required. Schedule a one-time execution.
9741 OneTimeSchedule(std::boxed::Box<crate::model::OneTimeSchedule>),
9742 /// Required. Schedule recurring executions.
9743 RecurringSchedule(std::boxed::Box<crate::model::RecurringSchedule>),
9744 }
9745}
9746
9747/// Sets the time for a one time patch deployment. Timestamp is in
9748/// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
9749#[derive(Clone, Default, PartialEq)]
9750#[non_exhaustive]
9751pub struct OneTimeSchedule {
9752 /// Required. The desired patch job execution time.
9753 pub execute_time: std::option::Option<wkt::Timestamp>,
9754
9755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9756}
9757
9758impl OneTimeSchedule {
9759 /// Creates a new default instance.
9760 pub fn new() -> Self {
9761 std::default::Default::default()
9762 }
9763
9764 /// Sets the value of [execute_time][crate::model::OneTimeSchedule::execute_time].
9765 ///
9766 /// # Example
9767 /// ```ignore,no_run
9768 /// # use google_cloud_osconfig_v1::model::OneTimeSchedule;
9769 /// use wkt::Timestamp;
9770 /// let x = OneTimeSchedule::new().set_execute_time(Timestamp::default()/* use setters */);
9771 /// ```
9772 pub fn set_execute_time<T>(mut self, v: T) -> Self
9773 where
9774 T: std::convert::Into<wkt::Timestamp>,
9775 {
9776 self.execute_time = std::option::Option::Some(v.into());
9777 self
9778 }
9779
9780 /// Sets or clears the value of [execute_time][crate::model::OneTimeSchedule::execute_time].
9781 ///
9782 /// # Example
9783 /// ```ignore,no_run
9784 /// # use google_cloud_osconfig_v1::model::OneTimeSchedule;
9785 /// use wkt::Timestamp;
9786 /// let x = OneTimeSchedule::new().set_or_clear_execute_time(Some(Timestamp::default()/* use setters */));
9787 /// let x = OneTimeSchedule::new().set_or_clear_execute_time(None::<Timestamp>);
9788 /// ```
9789 pub fn set_or_clear_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
9790 where
9791 T: std::convert::Into<wkt::Timestamp>,
9792 {
9793 self.execute_time = v.map(|x| x.into());
9794 self
9795 }
9796}
9797
9798impl wkt::message::Message for OneTimeSchedule {
9799 fn typename() -> &'static str {
9800 "type.googleapis.com/google.cloud.osconfig.v1.OneTimeSchedule"
9801 }
9802}
9803
9804/// Sets the time for recurring patch deployments.
9805#[derive(Clone, Default, PartialEq)]
9806#[non_exhaustive]
9807pub struct RecurringSchedule {
9808 /// Required. Defines the time zone that `time_of_day` is relative to.
9809 /// The rules for daylight saving time are determined by the chosen time zone.
9810 pub time_zone: std::option::Option<google_cloud_type::model::TimeZone>,
9811
9812 /// Optional. The time that the recurring schedule becomes effective.
9813 /// Defaults to `create_time` of the patch deployment.
9814 pub start_time: std::option::Option<wkt::Timestamp>,
9815
9816 /// Optional. The end time at which a recurring patch deployment schedule is no
9817 /// longer active.
9818 pub end_time: std::option::Option<wkt::Timestamp>,
9819
9820 /// Required. Time of the day to run a recurring deployment.
9821 pub time_of_day: std::option::Option<google_cloud_type::model::TimeOfDay>,
9822
9823 /// Required. The frequency unit of this recurring schedule.
9824 pub frequency: crate::model::recurring_schedule::Frequency,
9825
9826 /// Output only. The time the last patch job ran successfully.
9827 pub last_execute_time: std::option::Option<wkt::Timestamp>,
9828
9829 /// Output only. The time the next patch job is scheduled to run.
9830 pub next_execute_time: std::option::Option<wkt::Timestamp>,
9831
9832 /// Configurations for this recurring schedule.
9833 /// Configurations must match frequency.
9834 pub schedule_config: std::option::Option<crate::model::recurring_schedule::ScheduleConfig>,
9835
9836 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9837}
9838
9839impl RecurringSchedule {
9840 /// Creates a new default instance.
9841 pub fn new() -> Self {
9842 std::default::Default::default()
9843 }
9844
9845 /// Sets the value of [time_zone][crate::model::RecurringSchedule::time_zone].
9846 ///
9847 /// # Example
9848 /// ```ignore,no_run
9849 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9850 /// use google_cloud_type::model::TimeZone;
9851 /// let x = RecurringSchedule::new().set_time_zone(TimeZone::default()/* use setters */);
9852 /// ```
9853 pub fn set_time_zone<T>(mut self, v: T) -> Self
9854 where
9855 T: std::convert::Into<google_cloud_type::model::TimeZone>,
9856 {
9857 self.time_zone = std::option::Option::Some(v.into());
9858 self
9859 }
9860
9861 /// Sets or clears the value of [time_zone][crate::model::RecurringSchedule::time_zone].
9862 ///
9863 /// # Example
9864 /// ```ignore,no_run
9865 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9866 /// use google_cloud_type::model::TimeZone;
9867 /// let x = RecurringSchedule::new().set_or_clear_time_zone(Some(TimeZone::default()/* use setters */));
9868 /// let x = RecurringSchedule::new().set_or_clear_time_zone(None::<TimeZone>);
9869 /// ```
9870 pub fn set_or_clear_time_zone<T>(mut self, v: std::option::Option<T>) -> Self
9871 where
9872 T: std::convert::Into<google_cloud_type::model::TimeZone>,
9873 {
9874 self.time_zone = v.map(|x| x.into());
9875 self
9876 }
9877
9878 /// Sets the value of [start_time][crate::model::RecurringSchedule::start_time].
9879 ///
9880 /// # Example
9881 /// ```ignore,no_run
9882 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9883 /// use wkt::Timestamp;
9884 /// let x = RecurringSchedule::new().set_start_time(Timestamp::default()/* use setters */);
9885 /// ```
9886 pub fn set_start_time<T>(mut self, v: T) -> Self
9887 where
9888 T: std::convert::Into<wkt::Timestamp>,
9889 {
9890 self.start_time = std::option::Option::Some(v.into());
9891 self
9892 }
9893
9894 /// Sets or clears the value of [start_time][crate::model::RecurringSchedule::start_time].
9895 ///
9896 /// # Example
9897 /// ```ignore,no_run
9898 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9899 /// use wkt::Timestamp;
9900 /// let x = RecurringSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
9901 /// let x = RecurringSchedule::new().set_or_clear_start_time(None::<Timestamp>);
9902 /// ```
9903 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9904 where
9905 T: std::convert::Into<wkt::Timestamp>,
9906 {
9907 self.start_time = v.map(|x| x.into());
9908 self
9909 }
9910
9911 /// Sets the value of [end_time][crate::model::RecurringSchedule::end_time].
9912 ///
9913 /// # Example
9914 /// ```ignore,no_run
9915 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9916 /// use wkt::Timestamp;
9917 /// let x = RecurringSchedule::new().set_end_time(Timestamp::default()/* use setters */);
9918 /// ```
9919 pub fn set_end_time<T>(mut self, v: T) -> Self
9920 where
9921 T: std::convert::Into<wkt::Timestamp>,
9922 {
9923 self.end_time = std::option::Option::Some(v.into());
9924 self
9925 }
9926
9927 /// Sets or clears the value of [end_time][crate::model::RecurringSchedule::end_time].
9928 ///
9929 /// # Example
9930 /// ```ignore,no_run
9931 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9932 /// use wkt::Timestamp;
9933 /// let x = RecurringSchedule::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
9934 /// let x = RecurringSchedule::new().set_or_clear_end_time(None::<Timestamp>);
9935 /// ```
9936 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
9937 where
9938 T: std::convert::Into<wkt::Timestamp>,
9939 {
9940 self.end_time = v.map(|x| x.into());
9941 self
9942 }
9943
9944 /// Sets the value of [time_of_day][crate::model::RecurringSchedule::time_of_day].
9945 ///
9946 /// # Example
9947 /// ```ignore,no_run
9948 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9949 /// use google_cloud_type::model::TimeOfDay;
9950 /// let x = RecurringSchedule::new().set_time_of_day(TimeOfDay::default()/* use setters */);
9951 /// ```
9952 pub fn set_time_of_day<T>(mut self, v: T) -> Self
9953 where
9954 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
9955 {
9956 self.time_of_day = std::option::Option::Some(v.into());
9957 self
9958 }
9959
9960 /// Sets or clears the value of [time_of_day][crate::model::RecurringSchedule::time_of_day].
9961 ///
9962 /// # Example
9963 /// ```ignore,no_run
9964 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9965 /// use google_cloud_type::model::TimeOfDay;
9966 /// let x = RecurringSchedule::new().set_or_clear_time_of_day(Some(TimeOfDay::default()/* use setters */));
9967 /// let x = RecurringSchedule::new().set_or_clear_time_of_day(None::<TimeOfDay>);
9968 /// ```
9969 pub fn set_or_clear_time_of_day<T>(mut self, v: std::option::Option<T>) -> Self
9970 where
9971 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
9972 {
9973 self.time_of_day = v.map(|x| x.into());
9974 self
9975 }
9976
9977 /// Sets the value of [frequency][crate::model::RecurringSchedule::frequency].
9978 ///
9979 /// # Example
9980 /// ```ignore,no_run
9981 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9982 /// use google_cloud_osconfig_v1::model::recurring_schedule::Frequency;
9983 /// let x0 = RecurringSchedule::new().set_frequency(Frequency::Weekly);
9984 /// let x1 = RecurringSchedule::new().set_frequency(Frequency::Monthly);
9985 /// let x2 = RecurringSchedule::new().set_frequency(Frequency::Daily);
9986 /// ```
9987 pub fn set_frequency<T: std::convert::Into<crate::model::recurring_schedule::Frequency>>(
9988 mut self,
9989 v: T,
9990 ) -> Self {
9991 self.frequency = v.into();
9992 self
9993 }
9994
9995 /// Sets the value of [last_execute_time][crate::model::RecurringSchedule::last_execute_time].
9996 ///
9997 /// # Example
9998 /// ```ignore,no_run
9999 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10000 /// use wkt::Timestamp;
10001 /// let x = RecurringSchedule::new().set_last_execute_time(Timestamp::default()/* use setters */);
10002 /// ```
10003 pub fn set_last_execute_time<T>(mut self, v: T) -> Self
10004 where
10005 T: std::convert::Into<wkt::Timestamp>,
10006 {
10007 self.last_execute_time = std::option::Option::Some(v.into());
10008 self
10009 }
10010
10011 /// Sets or clears the value of [last_execute_time][crate::model::RecurringSchedule::last_execute_time].
10012 ///
10013 /// # Example
10014 /// ```ignore,no_run
10015 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10016 /// use wkt::Timestamp;
10017 /// let x = RecurringSchedule::new().set_or_clear_last_execute_time(Some(Timestamp::default()/* use setters */));
10018 /// let x = RecurringSchedule::new().set_or_clear_last_execute_time(None::<Timestamp>);
10019 /// ```
10020 pub fn set_or_clear_last_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
10021 where
10022 T: std::convert::Into<wkt::Timestamp>,
10023 {
10024 self.last_execute_time = v.map(|x| x.into());
10025 self
10026 }
10027
10028 /// Sets the value of [next_execute_time][crate::model::RecurringSchedule::next_execute_time].
10029 ///
10030 /// # Example
10031 /// ```ignore,no_run
10032 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10033 /// use wkt::Timestamp;
10034 /// let x = RecurringSchedule::new().set_next_execute_time(Timestamp::default()/* use setters */);
10035 /// ```
10036 pub fn set_next_execute_time<T>(mut self, v: T) -> Self
10037 where
10038 T: std::convert::Into<wkt::Timestamp>,
10039 {
10040 self.next_execute_time = std::option::Option::Some(v.into());
10041 self
10042 }
10043
10044 /// Sets or clears the value of [next_execute_time][crate::model::RecurringSchedule::next_execute_time].
10045 ///
10046 /// # Example
10047 /// ```ignore,no_run
10048 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10049 /// use wkt::Timestamp;
10050 /// let x = RecurringSchedule::new().set_or_clear_next_execute_time(Some(Timestamp::default()/* use setters */));
10051 /// let x = RecurringSchedule::new().set_or_clear_next_execute_time(None::<Timestamp>);
10052 /// ```
10053 pub fn set_or_clear_next_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
10054 where
10055 T: std::convert::Into<wkt::Timestamp>,
10056 {
10057 self.next_execute_time = v.map(|x| x.into());
10058 self
10059 }
10060
10061 /// Sets the value of [schedule_config][crate::model::RecurringSchedule::schedule_config].
10062 ///
10063 /// Note that all the setters affecting `schedule_config` are mutually
10064 /// exclusive.
10065 ///
10066 /// # Example
10067 /// ```ignore,no_run
10068 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10069 /// use google_cloud_osconfig_v1::model::WeeklySchedule;
10070 /// let x = RecurringSchedule::new().set_schedule_config(Some(
10071 /// google_cloud_osconfig_v1::model::recurring_schedule::ScheduleConfig::Weekly(WeeklySchedule::default().into())));
10072 /// ```
10073 pub fn set_schedule_config<
10074 T: std::convert::Into<std::option::Option<crate::model::recurring_schedule::ScheduleConfig>>,
10075 >(
10076 mut self,
10077 v: T,
10078 ) -> Self {
10079 self.schedule_config = v.into();
10080 self
10081 }
10082
10083 /// The value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10084 /// if it holds a `Weekly`, `None` if the field is not set or
10085 /// holds a different branch.
10086 pub fn weekly(&self) -> std::option::Option<&std::boxed::Box<crate::model::WeeklySchedule>> {
10087 #[allow(unreachable_patterns)]
10088 self.schedule_config.as_ref().and_then(|v| match v {
10089 crate::model::recurring_schedule::ScheduleConfig::Weekly(v) => {
10090 std::option::Option::Some(v)
10091 }
10092 _ => std::option::Option::None,
10093 })
10094 }
10095
10096 /// Sets the value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10097 /// to hold a `Weekly`.
10098 ///
10099 /// Note that all the setters affecting `schedule_config` are
10100 /// mutually exclusive.
10101 ///
10102 /// # Example
10103 /// ```ignore,no_run
10104 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10105 /// use google_cloud_osconfig_v1::model::WeeklySchedule;
10106 /// let x = RecurringSchedule::new().set_weekly(WeeklySchedule::default()/* use setters */);
10107 /// assert!(x.weekly().is_some());
10108 /// assert!(x.monthly().is_none());
10109 /// ```
10110 pub fn set_weekly<T: std::convert::Into<std::boxed::Box<crate::model::WeeklySchedule>>>(
10111 mut self,
10112 v: T,
10113 ) -> Self {
10114 self.schedule_config = std::option::Option::Some(
10115 crate::model::recurring_schedule::ScheduleConfig::Weekly(v.into()),
10116 );
10117 self
10118 }
10119
10120 /// The value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10121 /// if it holds a `Monthly`, `None` if the field is not set or
10122 /// holds a different branch.
10123 pub fn monthly(&self) -> std::option::Option<&std::boxed::Box<crate::model::MonthlySchedule>> {
10124 #[allow(unreachable_patterns)]
10125 self.schedule_config.as_ref().and_then(|v| match v {
10126 crate::model::recurring_schedule::ScheduleConfig::Monthly(v) => {
10127 std::option::Option::Some(v)
10128 }
10129 _ => std::option::Option::None,
10130 })
10131 }
10132
10133 /// Sets the value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10134 /// to hold a `Monthly`.
10135 ///
10136 /// Note that all the setters affecting `schedule_config` are
10137 /// mutually exclusive.
10138 ///
10139 /// # Example
10140 /// ```ignore,no_run
10141 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10142 /// use google_cloud_osconfig_v1::model::MonthlySchedule;
10143 /// let x = RecurringSchedule::new().set_monthly(MonthlySchedule::default()/* use setters */);
10144 /// assert!(x.monthly().is_some());
10145 /// assert!(x.weekly().is_none());
10146 /// ```
10147 pub fn set_monthly<T: std::convert::Into<std::boxed::Box<crate::model::MonthlySchedule>>>(
10148 mut self,
10149 v: T,
10150 ) -> Self {
10151 self.schedule_config = std::option::Option::Some(
10152 crate::model::recurring_schedule::ScheduleConfig::Monthly(v.into()),
10153 );
10154 self
10155 }
10156}
10157
10158impl wkt::message::Message for RecurringSchedule {
10159 fn typename() -> &'static str {
10160 "type.googleapis.com/google.cloud.osconfig.v1.RecurringSchedule"
10161 }
10162}
10163
10164/// Defines additional types related to [RecurringSchedule].
10165pub mod recurring_schedule {
10166 #[allow(unused_imports)]
10167 use super::*;
10168
10169 /// Specifies the frequency of the recurring patch deployments.
10170 ///
10171 /// # Working with unknown values
10172 ///
10173 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10174 /// additional enum variants at any time. Adding new variants is not considered
10175 /// a breaking change. Applications should write their code in anticipation of:
10176 ///
10177 /// - New values appearing in future releases of the client library, **and**
10178 /// - New values received dynamically, without application changes.
10179 ///
10180 /// Please consult the [Working with enums] section in the user guide for some
10181 /// guidelines.
10182 ///
10183 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10184 #[derive(Clone, Debug, PartialEq)]
10185 #[non_exhaustive]
10186 pub enum Frequency {
10187 /// Invalid. A frequency must be specified.
10188 Unspecified,
10189 /// Indicates that the frequency of recurrence should be expressed in terms
10190 /// of weeks.
10191 Weekly,
10192 /// Indicates that the frequency of recurrence should be expressed in terms
10193 /// of months.
10194 Monthly,
10195 /// Indicates that the frequency of recurrence should be expressed in terms
10196 /// of days.
10197 Daily,
10198 /// If set, the enum was initialized with an unknown value.
10199 ///
10200 /// Applications can examine the value using [Frequency::value] or
10201 /// [Frequency::name].
10202 UnknownValue(frequency::UnknownValue),
10203 }
10204
10205 #[doc(hidden)]
10206 pub mod frequency {
10207 #[allow(unused_imports)]
10208 use super::*;
10209 #[derive(Clone, Debug, PartialEq)]
10210 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10211 }
10212
10213 impl Frequency {
10214 /// Gets the enum value.
10215 ///
10216 /// Returns `None` if the enum contains an unknown value deserialized from
10217 /// the string representation of enums.
10218 pub fn value(&self) -> std::option::Option<i32> {
10219 match self {
10220 Self::Unspecified => std::option::Option::Some(0),
10221 Self::Weekly => std::option::Option::Some(1),
10222 Self::Monthly => std::option::Option::Some(2),
10223 Self::Daily => std::option::Option::Some(3),
10224 Self::UnknownValue(u) => u.0.value(),
10225 }
10226 }
10227
10228 /// Gets the enum value as a string.
10229 ///
10230 /// Returns `None` if the enum contains an unknown value deserialized from
10231 /// the integer representation of enums.
10232 pub fn name(&self) -> std::option::Option<&str> {
10233 match self {
10234 Self::Unspecified => std::option::Option::Some("FREQUENCY_UNSPECIFIED"),
10235 Self::Weekly => std::option::Option::Some("WEEKLY"),
10236 Self::Monthly => std::option::Option::Some("MONTHLY"),
10237 Self::Daily => std::option::Option::Some("DAILY"),
10238 Self::UnknownValue(u) => u.0.name(),
10239 }
10240 }
10241 }
10242
10243 impl std::default::Default for Frequency {
10244 fn default() -> Self {
10245 use std::convert::From;
10246 Self::from(0)
10247 }
10248 }
10249
10250 impl std::fmt::Display for Frequency {
10251 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10252 wkt::internal::display_enum(f, self.name(), self.value())
10253 }
10254 }
10255
10256 impl std::convert::From<i32> for Frequency {
10257 fn from(value: i32) -> Self {
10258 match value {
10259 0 => Self::Unspecified,
10260 1 => Self::Weekly,
10261 2 => Self::Monthly,
10262 3 => Self::Daily,
10263 _ => Self::UnknownValue(frequency::UnknownValue(
10264 wkt::internal::UnknownEnumValue::Integer(value),
10265 )),
10266 }
10267 }
10268 }
10269
10270 impl std::convert::From<&str> for Frequency {
10271 fn from(value: &str) -> Self {
10272 use std::string::ToString;
10273 match value {
10274 "FREQUENCY_UNSPECIFIED" => Self::Unspecified,
10275 "WEEKLY" => Self::Weekly,
10276 "MONTHLY" => Self::Monthly,
10277 "DAILY" => Self::Daily,
10278 _ => Self::UnknownValue(frequency::UnknownValue(
10279 wkt::internal::UnknownEnumValue::String(value.to_string()),
10280 )),
10281 }
10282 }
10283 }
10284
10285 impl serde::ser::Serialize for Frequency {
10286 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10287 where
10288 S: serde::Serializer,
10289 {
10290 match self {
10291 Self::Unspecified => serializer.serialize_i32(0),
10292 Self::Weekly => serializer.serialize_i32(1),
10293 Self::Monthly => serializer.serialize_i32(2),
10294 Self::Daily => serializer.serialize_i32(3),
10295 Self::UnknownValue(u) => u.0.serialize(serializer),
10296 }
10297 }
10298 }
10299
10300 impl<'de> serde::de::Deserialize<'de> for Frequency {
10301 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10302 where
10303 D: serde::Deserializer<'de>,
10304 {
10305 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Frequency>::new(
10306 ".google.cloud.osconfig.v1.RecurringSchedule.Frequency",
10307 ))
10308 }
10309 }
10310
10311 /// Configurations for this recurring schedule.
10312 /// Configurations must match frequency.
10313 #[derive(Clone, Debug, PartialEq)]
10314 #[non_exhaustive]
10315 pub enum ScheduleConfig {
10316 /// Required. Schedule with weekly executions.
10317 Weekly(std::boxed::Box<crate::model::WeeklySchedule>),
10318 /// Required. Schedule with monthly executions.
10319 Monthly(std::boxed::Box<crate::model::MonthlySchedule>),
10320 }
10321}
10322
10323/// Represents a weekly schedule.
10324#[derive(Clone, Default, PartialEq)]
10325#[non_exhaustive]
10326pub struct WeeklySchedule {
10327 /// Required. Day of the week.
10328 pub day_of_week: google_cloud_type::model::DayOfWeek,
10329
10330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10331}
10332
10333impl WeeklySchedule {
10334 /// Creates a new default instance.
10335 pub fn new() -> Self {
10336 std::default::Default::default()
10337 }
10338
10339 /// Sets the value of [day_of_week][crate::model::WeeklySchedule::day_of_week].
10340 ///
10341 /// # Example
10342 /// ```ignore,no_run
10343 /// # use google_cloud_osconfig_v1::model::WeeklySchedule;
10344 /// use google_cloud_type::model::DayOfWeek;
10345 /// let x0 = WeeklySchedule::new().set_day_of_week(DayOfWeek::Monday);
10346 /// let x1 = WeeklySchedule::new().set_day_of_week(DayOfWeek::Tuesday);
10347 /// let x2 = WeeklySchedule::new().set_day_of_week(DayOfWeek::Wednesday);
10348 /// ```
10349 pub fn set_day_of_week<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
10350 mut self,
10351 v: T,
10352 ) -> Self {
10353 self.day_of_week = v.into();
10354 self
10355 }
10356}
10357
10358impl wkt::message::Message for WeeklySchedule {
10359 fn typename() -> &'static str {
10360 "type.googleapis.com/google.cloud.osconfig.v1.WeeklySchedule"
10361 }
10362}
10363
10364/// Represents a monthly schedule. An example of a valid monthly schedule is
10365/// "on the third Tuesday of the month" or "on the 15th of the month".
10366#[derive(Clone, Default, PartialEq)]
10367#[non_exhaustive]
10368pub struct MonthlySchedule {
10369 /// One day in a month.
10370 pub day_of_month: std::option::Option<crate::model::monthly_schedule::DayOfMonth>,
10371
10372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10373}
10374
10375impl MonthlySchedule {
10376 /// Creates a new default instance.
10377 pub fn new() -> Self {
10378 std::default::Default::default()
10379 }
10380
10381 /// Sets the value of [day_of_month][crate::model::MonthlySchedule::day_of_month].
10382 ///
10383 /// Note that all the setters affecting `day_of_month` are mutually
10384 /// exclusive.
10385 ///
10386 /// # Example
10387 /// ```ignore,no_run
10388 /// # use google_cloud_osconfig_v1::model::MonthlySchedule;
10389 /// use google_cloud_osconfig_v1::model::monthly_schedule::DayOfMonth;
10390 /// let x = MonthlySchedule::new().set_day_of_month(Some(DayOfMonth::MonthDay(42)));
10391 /// ```
10392 pub fn set_day_of_month<
10393 T: std::convert::Into<std::option::Option<crate::model::monthly_schedule::DayOfMonth>>,
10394 >(
10395 mut self,
10396 v: T,
10397 ) -> Self {
10398 self.day_of_month = v.into();
10399 self
10400 }
10401
10402 /// The value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10403 /// if it holds a `WeekDayOfMonth`, `None` if the field is not set or
10404 /// holds a different branch.
10405 pub fn week_day_of_month(
10406 &self,
10407 ) -> std::option::Option<&std::boxed::Box<crate::model::WeekDayOfMonth>> {
10408 #[allow(unreachable_patterns)]
10409 self.day_of_month.as_ref().and_then(|v| match v {
10410 crate::model::monthly_schedule::DayOfMonth::WeekDayOfMonth(v) => {
10411 std::option::Option::Some(v)
10412 }
10413 _ => std::option::Option::None,
10414 })
10415 }
10416
10417 /// Sets the value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10418 /// to hold a `WeekDayOfMonth`.
10419 ///
10420 /// Note that all the setters affecting `day_of_month` are
10421 /// mutually exclusive.
10422 ///
10423 /// # Example
10424 /// ```ignore,no_run
10425 /// # use google_cloud_osconfig_v1::model::MonthlySchedule;
10426 /// use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10427 /// let x = MonthlySchedule::new().set_week_day_of_month(WeekDayOfMonth::default()/* use setters */);
10428 /// assert!(x.week_day_of_month().is_some());
10429 /// assert!(x.month_day().is_none());
10430 /// ```
10431 pub fn set_week_day_of_month<
10432 T: std::convert::Into<std::boxed::Box<crate::model::WeekDayOfMonth>>,
10433 >(
10434 mut self,
10435 v: T,
10436 ) -> Self {
10437 self.day_of_month = std::option::Option::Some(
10438 crate::model::monthly_schedule::DayOfMonth::WeekDayOfMonth(v.into()),
10439 );
10440 self
10441 }
10442
10443 /// The value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10444 /// if it holds a `MonthDay`, `None` if the field is not set or
10445 /// holds a different branch.
10446 pub fn month_day(&self) -> std::option::Option<&i32> {
10447 #[allow(unreachable_patterns)]
10448 self.day_of_month.as_ref().and_then(|v| match v {
10449 crate::model::monthly_schedule::DayOfMonth::MonthDay(v) => std::option::Option::Some(v),
10450 _ => std::option::Option::None,
10451 })
10452 }
10453
10454 /// Sets the value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10455 /// to hold a `MonthDay`.
10456 ///
10457 /// Note that all the setters affecting `day_of_month` are
10458 /// mutually exclusive.
10459 ///
10460 /// # Example
10461 /// ```ignore,no_run
10462 /// # use google_cloud_osconfig_v1::model::MonthlySchedule;
10463 /// let x = MonthlySchedule::new().set_month_day(42);
10464 /// assert!(x.month_day().is_some());
10465 /// assert!(x.week_day_of_month().is_none());
10466 /// ```
10467 pub fn set_month_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10468 self.day_of_month = std::option::Option::Some(
10469 crate::model::monthly_schedule::DayOfMonth::MonthDay(v.into()),
10470 );
10471 self
10472 }
10473}
10474
10475impl wkt::message::Message for MonthlySchedule {
10476 fn typename() -> &'static str {
10477 "type.googleapis.com/google.cloud.osconfig.v1.MonthlySchedule"
10478 }
10479}
10480
10481/// Defines additional types related to [MonthlySchedule].
10482pub mod monthly_schedule {
10483 #[allow(unused_imports)]
10484 use super::*;
10485
10486 /// One day in a month.
10487 #[derive(Clone, Debug, PartialEq)]
10488 #[non_exhaustive]
10489 pub enum DayOfMonth {
10490 /// Required. Week day in a month.
10491 WeekDayOfMonth(std::boxed::Box<crate::model::WeekDayOfMonth>),
10492 /// Required. One day of the month. 1-31 indicates the 1st to the 31st day.
10493 /// -1 indicates the last day of the month. Months without the target day
10494 /// will be skipped. For example, a schedule to run "every month on the 31st"
10495 /// will not run in February, April, June, etc.
10496 MonthDay(i32),
10497 }
10498}
10499
10500/// Represents one week day in a month. An example is "the 4th Sunday".
10501#[derive(Clone, Default, PartialEq)]
10502#[non_exhaustive]
10503pub struct WeekDayOfMonth {
10504 /// Required. Week number in a month. 1-4 indicates the 1st to 4th week of the
10505 /// month. -1 indicates the last week of the month.
10506 pub week_ordinal: i32,
10507
10508 /// Required. A day of the week.
10509 pub day_of_week: google_cloud_type::model::DayOfWeek,
10510
10511 /// Optional. Represents the number of days before or after the given week day
10512 /// of month that the patch deployment is scheduled for. For example if
10513 /// `week_ordinal` and `day_of_week` values point to the second day of the
10514 /// month and this `day_offset` value is set to `3`, the patch deployment takes
10515 /// place three days after the second Tuesday of the month. If this value is
10516 /// negative, for example -5, the patches are deployed five days before before
10517 /// the second Tuesday of the month. Allowed values are in range [-30, 30].
10518 pub day_offset: i32,
10519
10520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10521}
10522
10523impl WeekDayOfMonth {
10524 /// Creates a new default instance.
10525 pub fn new() -> Self {
10526 std::default::Default::default()
10527 }
10528
10529 /// Sets the value of [week_ordinal][crate::model::WeekDayOfMonth::week_ordinal].
10530 ///
10531 /// # Example
10532 /// ```ignore,no_run
10533 /// # use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10534 /// let x = WeekDayOfMonth::new().set_week_ordinal(42);
10535 /// ```
10536 pub fn set_week_ordinal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10537 self.week_ordinal = v.into();
10538 self
10539 }
10540
10541 /// Sets the value of [day_of_week][crate::model::WeekDayOfMonth::day_of_week].
10542 ///
10543 /// # Example
10544 /// ```ignore,no_run
10545 /// # use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10546 /// use google_cloud_type::model::DayOfWeek;
10547 /// let x0 = WeekDayOfMonth::new().set_day_of_week(DayOfWeek::Monday);
10548 /// let x1 = WeekDayOfMonth::new().set_day_of_week(DayOfWeek::Tuesday);
10549 /// let x2 = WeekDayOfMonth::new().set_day_of_week(DayOfWeek::Wednesday);
10550 /// ```
10551 pub fn set_day_of_week<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
10552 mut self,
10553 v: T,
10554 ) -> Self {
10555 self.day_of_week = v.into();
10556 self
10557 }
10558
10559 /// Sets the value of [day_offset][crate::model::WeekDayOfMonth::day_offset].
10560 ///
10561 /// # Example
10562 /// ```ignore,no_run
10563 /// # use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10564 /// let x = WeekDayOfMonth::new().set_day_offset(42);
10565 /// ```
10566 pub fn set_day_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10567 self.day_offset = v.into();
10568 self
10569 }
10570}
10571
10572impl wkt::message::Message for WeekDayOfMonth {
10573 fn typename() -> &'static str {
10574 "type.googleapis.com/google.cloud.osconfig.v1.WeekDayOfMonth"
10575 }
10576}
10577
10578/// A request message for creating a patch deployment.
10579#[derive(Clone, Default, PartialEq)]
10580#[non_exhaustive]
10581pub struct CreatePatchDeploymentRequest {
10582 /// Required. The project to apply this patch deployment to in the form
10583 /// `projects/*`.
10584 pub parent: std::string::String,
10585
10586 /// Required. A name for the patch deployment in the project. When creating a
10587 /// name the following rules apply:
10588 ///
10589 /// * Must contain only lowercase letters, numbers, and hyphens.
10590 /// * Must start with a letter.
10591 /// * Must be between 1-63 characters.
10592 /// * Must end with a number or a letter.
10593 /// * Must be unique within the project.
10594 pub patch_deployment_id: std::string::String,
10595
10596 /// Required. The patch deployment to create.
10597 pub patch_deployment: std::option::Option<crate::model::PatchDeployment>,
10598
10599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10600}
10601
10602impl CreatePatchDeploymentRequest {
10603 /// Creates a new default instance.
10604 pub fn new() -> Self {
10605 std::default::Default::default()
10606 }
10607
10608 /// Sets the value of [parent][crate::model::CreatePatchDeploymentRequest::parent].
10609 ///
10610 /// # Example
10611 /// ```ignore,no_run
10612 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10613 /// let x = CreatePatchDeploymentRequest::new().set_parent("example");
10614 /// ```
10615 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10616 self.parent = v.into();
10617 self
10618 }
10619
10620 /// Sets the value of [patch_deployment_id][crate::model::CreatePatchDeploymentRequest::patch_deployment_id].
10621 ///
10622 /// # Example
10623 /// ```ignore,no_run
10624 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10625 /// let x = CreatePatchDeploymentRequest::new().set_patch_deployment_id("example");
10626 /// ```
10627 pub fn set_patch_deployment_id<T: std::convert::Into<std::string::String>>(
10628 mut self,
10629 v: T,
10630 ) -> Self {
10631 self.patch_deployment_id = v.into();
10632 self
10633 }
10634
10635 /// Sets the value of [patch_deployment][crate::model::CreatePatchDeploymentRequest::patch_deployment].
10636 ///
10637 /// # Example
10638 /// ```ignore,no_run
10639 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10640 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10641 /// let x = CreatePatchDeploymentRequest::new().set_patch_deployment(PatchDeployment::default()/* use setters */);
10642 /// ```
10643 pub fn set_patch_deployment<T>(mut self, v: T) -> Self
10644 where
10645 T: std::convert::Into<crate::model::PatchDeployment>,
10646 {
10647 self.patch_deployment = std::option::Option::Some(v.into());
10648 self
10649 }
10650
10651 /// Sets or clears the value of [patch_deployment][crate::model::CreatePatchDeploymentRequest::patch_deployment].
10652 ///
10653 /// # Example
10654 /// ```ignore,no_run
10655 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10656 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10657 /// let x = CreatePatchDeploymentRequest::new().set_or_clear_patch_deployment(Some(PatchDeployment::default()/* use setters */));
10658 /// let x = CreatePatchDeploymentRequest::new().set_or_clear_patch_deployment(None::<PatchDeployment>);
10659 /// ```
10660 pub fn set_or_clear_patch_deployment<T>(mut self, v: std::option::Option<T>) -> Self
10661 where
10662 T: std::convert::Into<crate::model::PatchDeployment>,
10663 {
10664 self.patch_deployment = v.map(|x| x.into());
10665 self
10666 }
10667}
10668
10669impl wkt::message::Message for CreatePatchDeploymentRequest {
10670 fn typename() -> &'static str {
10671 "type.googleapis.com/google.cloud.osconfig.v1.CreatePatchDeploymentRequest"
10672 }
10673}
10674
10675/// A request message for retrieving a patch deployment.
10676#[derive(Clone, Default, PartialEq)]
10677#[non_exhaustive]
10678pub struct GetPatchDeploymentRequest {
10679 /// Required. The resource name of the patch deployment in the form
10680 /// `projects/*/patchDeployments/*`.
10681 pub name: std::string::String,
10682
10683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10684}
10685
10686impl GetPatchDeploymentRequest {
10687 /// Creates a new default instance.
10688 pub fn new() -> Self {
10689 std::default::Default::default()
10690 }
10691
10692 /// Sets the value of [name][crate::model::GetPatchDeploymentRequest::name].
10693 ///
10694 /// # Example
10695 /// ```ignore,no_run
10696 /// # use google_cloud_osconfig_v1::model::GetPatchDeploymentRequest;
10697 /// let x = GetPatchDeploymentRequest::new().set_name("example");
10698 /// ```
10699 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10700 self.name = v.into();
10701 self
10702 }
10703}
10704
10705impl wkt::message::Message for GetPatchDeploymentRequest {
10706 fn typename() -> &'static str {
10707 "type.googleapis.com/google.cloud.osconfig.v1.GetPatchDeploymentRequest"
10708 }
10709}
10710
10711/// A request message for listing patch deployments.
10712#[derive(Clone, Default, PartialEq)]
10713#[non_exhaustive]
10714pub struct ListPatchDeploymentsRequest {
10715 /// Required. The resource name of the parent in the form `projects/*`.
10716 pub parent: std::string::String,
10717
10718 /// Optional. The maximum number of patch deployments to return. Default is
10719 /// 100.
10720 pub page_size: i32,
10721
10722 /// Optional. A pagination token returned from a previous call to
10723 /// ListPatchDeployments that indicates where this listing should continue
10724 /// from.
10725 pub page_token: std::string::String,
10726
10727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10728}
10729
10730impl ListPatchDeploymentsRequest {
10731 /// Creates a new default instance.
10732 pub fn new() -> Self {
10733 std::default::Default::default()
10734 }
10735
10736 /// Sets the value of [parent][crate::model::ListPatchDeploymentsRequest::parent].
10737 ///
10738 /// # Example
10739 /// ```ignore,no_run
10740 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsRequest;
10741 /// let x = ListPatchDeploymentsRequest::new().set_parent("example");
10742 /// ```
10743 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10744 self.parent = v.into();
10745 self
10746 }
10747
10748 /// Sets the value of [page_size][crate::model::ListPatchDeploymentsRequest::page_size].
10749 ///
10750 /// # Example
10751 /// ```ignore,no_run
10752 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsRequest;
10753 /// let x = ListPatchDeploymentsRequest::new().set_page_size(42);
10754 /// ```
10755 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10756 self.page_size = v.into();
10757 self
10758 }
10759
10760 /// Sets the value of [page_token][crate::model::ListPatchDeploymentsRequest::page_token].
10761 ///
10762 /// # Example
10763 /// ```ignore,no_run
10764 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsRequest;
10765 /// let x = ListPatchDeploymentsRequest::new().set_page_token("example");
10766 /// ```
10767 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10768 self.page_token = v.into();
10769 self
10770 }
10771}
10772
10773impl wkt::message::Message for ListPatchDeploymentsRequest {
10774 fn typename() -> &'static str {
10775 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchDeploymentsRequest"
10776 }
10777}
10778
10779/// A response message for listing patch deployments.
10780#[derive(Clone, Default, PartialEq)]
10781#[non_exhaustive]
10782pub struct ListPatchDeploymentsResponse {
10783 /// The list of patch deployments.
10784 pub patch_deployments: std::vec::Vec<crate::model::PatchDeployment>,
10785
10786 /// A pagination token that can be used to get the next page of patch
10787 /// deployments.
10788 pub next_page_token: std::string::String,
10789
10790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10791}
10792
10793impl ListPatchDeploymentsResponse {
10794 /// Creates a new default instance.
10795 pub fn new() -> Self {
10796 std::default::Default::default()
10797 }
10798
10799 /// Sets the value of [patch_deployments][crate::model::ListPatchDeploymentsResponse::patch_deployments].
10800 ///
10801 /// # Example
10802 /// ```ignore,no_run
10803 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsResponse;
10804 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10805 /// let x = ListPatchDeploymentsResponse::new()
10806 /// .set_patch_deployments([
10807 /// PatchDeployment::default()/* use setters */,
10808 /// PatchDeployment::default()/* use (different) setters */,
10809 /// ]);
10810 /// ```
10811 pub fn set_patch_deployments<T, V>(mut self, v: T) -> Self
10812 where
10813 T: std::iter::IntoIterator<Item = V>,
10814 V: std::convert::Into<crate::model::PatchDeployment>,
10815 {
10816 use std::iter::Iterator;
10817 self.patch_deployments = v.into_iter().map(|i| i.into()).collect();
10818 self
10819 }
10820
10821 /// Sets the value of [next_page_token][crate::model::ListPatchDeploymentsResponse::next_page_token].
10822 ///
10823 /// # Example
10824 /// ```ignore,no_run
10825 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsResponse;
10826 /// let x = ListPatchDeploymentsResponse::new().set_next_page_token("example");
10827 /// ```
10828 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10829 self.next_page_token = v.into();
10830 self
10831 }
10832}
10833
10834impl wkt::message::Message for ListPatchDeploymentsResponse {
10835 fn typename() -> &'static str {
10836 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchDeploymentsResponse"
10837 }
10838}
10839
10840#[doc(hidden)]
10841impl google_cloud_gax::paginator::internal::PageableResponse for ListPatchDeploymentsResponse {
10842 type PageItem = crate::model::PatchDeployment;
10843
10844 fn items(self) -> std::vec::Vec<Self::PageItem> {
10845 self.patch_deployments
10846 }
10847
10848 fn next_page_token(&self) -> std::string::String {
10849 use std::clone::Clone;
10850 self.next_page_token.clone()
10851 }
10852}
10853
10854/// A request message for deleting a patch deployment.
10855#[derive(Clone, Default, PartialEq)]
10856#[non_exhaustive]
10857pub struct DeletePatchDeploymentRequest {
10858 /// Required. The resource name of the patch deployment in the form
10859 /// `projects/*/patchDeployments/*`.
10860 pub name: std::string::String,
10861
10862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10863}
10864
10865impl DeletePatchDeploymentRequest {
10866 /// Creates a new default instance.
10867 pub fn new() -> Self {
10868 std::default::Default::default()
10869 }
10870
10871 /// Sets the value of [name][crate::model::DeletePatchDeploymentRequest::name].
10872 ///
10873 /// # Example
10874 /// ```ignore,no_run
10875 /// # use google_cloud_osconfig_v1::model::DeletePatchDeploymentRequest;
10876 /// let x = DeletePatchDeploymentRequest::new().set_name("example");
10877 /// ```
10878 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10879 self.name = v.into();
10880 self
10881 }
10882}
10883
10884impl wkt::message::Message for DeletePatchDeploymentRequest {
10885 fn typename() -> &'static str {
10886 "type.googleapis.com/google.cloud.osconfig.v1.DeletePatchDeploymentRequest"
10887 }
10888}
10889
10890/// A request message for updating a patch deployment.
10891#[derive(Clone, Default, PartialEq)]
10892#[non_exhaustive]
10893pub struct UpdatePatchDeploymentRequest {
10894 /// Required. The patch deployment to Update.
10895 pub patch_deployment: std::option::Option<crate::model::PatchDeployment>,
10896
10897 /// Optional. Field mask that controls which fields of the patch deployment
10898 /// should be updated.
10899 pub update_mask: std::option::Option<wkt::FieldMask>,
10900
10901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10902}
10903
10904impl UpdatePatchDeploymentRequest {
10905 /// Creates a new default instance.
10906 pub fn new() -> Self {
10907 std::default::Default::default()
10908 }
10909
10910 /// Sets the value of [patch_deployment][crate::model::UpdatePatchDeploymentRequest::patch_deployment].
10911 ///
10912 /// # Example
10913 /// ```ignore,no_run
10914 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10915 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10916 /// let x = UpdatePatchDeploymentRequest::new().set_patch_deployment(PatchDeployment::default()/* use setters */);
10917 /// ```
10918 pub fn set_patch_deployment<T>(mut self, v: T) -> Self
10919 where
10920 T: std::convert::Into<crate::model::PatchDeployment>,
10921 {
10922 self.patch_deployment = std::option::Option::Some(v.into());
10923 self
10924 }
10925
10926 /// Sets or clears the value of [patch_deployment][crate::model::UpdatePatchDeploymentRequest::patch_deployment].
10927 ///
10928 /// # Example
10929 /// ```ignore,no_run
10930 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10931 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10932 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_patch_deployment(Some(PatchDeployment::default()/* use setters */));
10933 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_patch_deployment(None::<PatchDeployment>);
10934 /// ```
10935 pub fn set_or_clear_patch_deployment<T>(mut self, v: std::option::Option<T>) -> Self
10936 where
10937 T: std::convert::Into<crate::model::PatchDeployment>,
10938 {
10939 self.patch_deployment = v.map(|x| x.into());
10940 self
10941 }
10942
10943 /// Sets the value of [update_mask][crate::model::UpdatePatchDeploymentRequest::update_mask].
10944 ///
10945 /// # Example
10946 /// ```ignore,no_run
10947 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10948 /// use wkt::FieldMask;
10949 /// let x = UpdatePatchDeploymentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10950 /// ```
10951 pub fn set_update_mask<T>(mut self, v: T) -> Self
10952 where
10953 T: std::convert::Into<wkt::FieldMask>,
10954 {
10955 self.update_mask = std::option::Option::Some(v.into());
10956 self
10957 }
10958
10959 /// Sets or clears the value of [update_mask][crate::model::UpdatePatchDeploymentRequest::update_mask].
10960 ///
10961 /// # Example
10962 /// ```ignore,no_run
10963 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10964 /// use wkt::FieldMask;
10965 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10966 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10967 /// ```
10968 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10969 where
10970 T: std::convert::Into<wkt::FieldMask>,
10971 {
10972 self.update_mask = v.map(|x| x.into());
10973 self
10974 }
10975}
10976
10977impl wkt::message::Message for UpdatePatchDeploymentRequest {
10978 fn typename() -> &'static str {
10979 "type.googleapis.com/google.cloud.osconfig.v1.UpdatePatchDeploymentRequest"
10980 }
10981}
10982
10983/// A request message for pausing a patch deployment.
10984#[derive(Clone, Default, PartialEq)]
10985#[non_exhaustive]
10986pub struct PausePatchDeploymentRequest {
10987 /// Required. The resource name of the patch deployment in the form
10988 /// `projects/*/patchDeployments/*`.
10989 pub name: std::string::String,
10990
10991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10992}
10993
10994impl PausePatchDeploymentRequest {
10995 /// Creates a new default instance.
10996 pub fn new() -> Self {
10997 std::default::Default::default()
10998 }
10999
11000 /// Sets the value of [name][crate::model::PausePatchDeploymentRequest::name].
11001 ///
11002 /// # Example
11003 /// ```ignore,no_run
11004 /// # use google_cloud_osconfig_v1::model::PausePatchDeploymentRequest;
11005 /// let x = PausePatchDeploymentRequest::new().set_name("example");
11006 /// ```
11007 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11008 self.name = v.into();
11009 self
11010 }
11011}
11012
11013impl wkt::message::Message for PausePatchDeploymentRequest {
11014 fn typename() -> &'static str {
11015 "type.googleapis.com/google.cloud.osconfig.v1.PausePatchDeploymentRequest"
11016 }
11017}
11018
11019/// A request message for resuming a patch deployment.
11020#[derive(Clone, Default, PartialEq)]
11021#[non_exhaustive]
11022pub struct ResumePatchDeploymentRequest {
11023 /// Required. The resource name of the patch deployment in the form
11024 /// `projects/*/patchDeployments/*`.
11025 pub name: std::string::String,
11026
11027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11028}
11029
11030impl ResumePatchDeploymentRequest {
11031 /// Creates a new default instance.
11032 pub fn new() -> Self {
11033 std::default::Default::default()
11034 }
11035
11036 /// Sets the value of [name][crate::model::ResumePatchDeploymentRequest::name].
11037 ///
11038 /// # Example
11039 /// ```ignore,no_run
11040 /// # use google_cloud_osconfig_v1::model::ResumePatchDeploymentRequest;
11041 /// let x = ResumePatchDeploymentRequest::new().set_name("example");
11042 /// ```
11043 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11044 self.name = v.into();
11045 self
11046 }
11047}
11048
11049impl wkt::message::Message for ResumePatchDeploymentRequest {
11050 fn typename() -> &'static str {
11051 "type.googleapis.com/google.cloud.osconfig.v1.ResumePatchDeploymentRequest"
11052 }
11053}
11054
11055/// A request message to initiate patching across Compute Engine
11056/// instances.
11057#[derive(Clone, Default, PartialEq)]
11058#[non_exhaustive]
11059pub struct ExecutePatchJobRequest {
11060 /// Required. The project in which to run this patch in the form `projects/*`
11061 pub parent: std::string::String,
11062
11063 /// Description of the patch job. Length of the description is limited
11064 /// to 1024 characters.
11065 pub description: std::string::String,
11066
11067 /// Required. Instances to patch, either explicitly or filtered by some
11068 /// criteria such as zone or labels.
11069 pub instance_filter: std::option::Option<crate::model::PatchInstanceFilter>,
11070
11071 /// Patch configuration being applied. If omitted, instances are
11072 /// patched using the default configurations.
11073 pub patch_config: std::option::Option<crate::model::PatchConfig>,
11074
11075 /// Duration of the patch job. After the duration ends, the patch job
11076 /// times out.
11077 pub duration: std::option::Option<wkt::Duration>,
11078
11079 /// If this patch is a dry-run only, instances are contacted but
11080 /// will do nothing.
11081 pub dry_run: bool,
11082
11083 /// Display name for this patch job. This does not have to be unique.
11084 pub display_name: std::string::String,
11085
11086 /// Rollout strategy of the patch job.
11087 pub rollout: std::option::Option<crate::model::PatchRollout>,
11088
11089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11090}
11091
11092impl ExecutePatchJobRequest {
11093 /// Creates a new default instance.
11094 pub fn new() -> Self {
11095 std::default::Default::default()
11096 }
11097
11098 /// Sets the value of [parent][crate::model::ExecutePatchJobRequest::parent].
11099 ///
11100 /// # Example
11101 /// ```ignore,no_run
11102 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11103 /// let x = ExecutePatchJobRequest::new().set_parent("example");
11104 /// ```
11105 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11106 self.parent = v.into();
11107 self
11108 }
11109
11110 /// Sets the value of [description][crate::model::ExecutePatchJobRequest::description].
11111 ///
11112 /// # Example
11113 /// ```ignore,no_run
11114 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11115 /// let x = ExecutePatchJobRequest::new().set_description("example");
11116 /// ```
11117 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11118 self.description = v.into();
11119 self
11120 }
11121
11122 /// Sets the value of [instance_filter][crate::model::ExecutePatchJobRequest::instance_filter].
11123 ///
11124 /// # Example
11125 /// ```ignore,no_run
11126 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11127 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11128 /// let x = ExecutePatchJobRequest::new().set_instance_filter(PatchInstanceFilter::default()/* use setters */);
11129 /// ```
11130 pub fn set_instance_filter<T>(mut self, v: T) -> Self
11131 where
11132 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11133 {
11134 self.instance_filter = std::option::Option::Some(v.into());
11135 self
11136 }
11137
11138 /// Sets or clears the value of [instance_filter][crate::model::ExecutePatchJobRequest::instance_filter].
11139 ///
11140 /// # Example
11141 /// ```ignore,no_run
11142 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11143 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11144 /// let x = ExecutePatchJobRequest::new().set_or_clear_instance_filter(Some(PatchInstanceFilter::default()/* use setters */));
11145 /// let x = ExecutePatchJobRequest::new().set_or_clear_instance_filter(None::<PatchInstanceFilter>);
11146 /// ```
11147 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
11148 where
11149 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11150 {
11151 self.instance_filter = v.map(|x| x.into());
11152 self
11153 }
11154
11155 /// Sets the value of [patch_config][crate::model::ExecutePatchJobRequest::patch_config].
11156 ///
11157 /// # Example
11158 /// ```ignore,no_run
11159 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11160 /// use google_cloud_osconfig_v1::model::PatchConfig;
11161 /// let x = ExecutePatchJobRequest::new().set_patch_config(PatchConfig::default()/* use setters */);
11162 /// ```
11163 pub fn set_patch_config<T>(mut self, v: T) -> Self
11164 where
11165 T: std::convert::Into<crate::model::PatchConfig>,
11166 {
11167 self.patch_config = std::option::Option::Some(v.into());
11168 self
11169 }
11170
11171 /// Sets or clears the value of [patch_config][crate::model::ExecutePatchJobRequest::patch_config].
11172 ///
11173 /// # Example
11174 /// ```ignore,no_run
11175 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11176 /// use google_cloud_osconfig_v1::model::PatchConfig;
11177 /// let x = ExecutePatchJobRequest::new().set_or_clear_patch_config(Some(PatchConfig::default()/* use setters */));
11178 /// let x = ExecutePatchJobRequest::new().set_or_clear_patch_config(None::<PatchConfig>);
11179 /// ```
11180 pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
11181 where
11182 T: std::convert::Into<crate::model::PatchConfig>,
11183 {
11184 self.patch_config = v.map(|x| x.into());
11185 self
11186 }
11187
11188 /// Sets the value of [duration][crate::model::ExecutePatchJobRequest::duration].
11189 ///
11190 /// # Example
11191 /// ```ignore,no_run
11192 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11193 /// use wkt::Duration;
11194 /// let x = ExecutePatchJobRequest::new().set_duration(Duration::default()/* use setters */);
11195 /// ```
11196 pub fn set_duration<T>(mut self, v: T) -> Self
11197 where
11198 T: std::convert::Into<wkt::Duration>,
11199 {
11200 self.duration = std::option::Option::Some(v.into());
11201 self
11202 }
11203
11204 /// Sets or clears the value of [duration][crate::model::ExecutePatchJobRequest::duration].
11205 ///
11206 /// # Example
11207 /// ```ignore,no_run
11208 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11209 /// use wkt::Duration;
11210 /// let x = ExecutePatchJobRequest::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
11211 /// let x = ExecutePatchJobRequest::new().set_or_clear_duration(None::<Duration>);
11212 /// ```
11213 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
11214 where
11215 T: std::convert::Into<wkt::Duration>,
11216 {
11217 self.duration = v.map(|x| x.into());
11218 self
11219 }
11220
11221 /// Sets the value of [dry_run][crate::model::ExecutePatchJobRequest::dry_run].
11222 ///
11223 /// # Example
11224 /// ```ignore,no_run
11225 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11226 /// let x = ExecutePatchJobRequest::new().set_dry_run(true);
11227 /// ```
11228 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11229 self.dry_run = v.into();
11230 self
11231 }
11232
11233 /// Sets the value of [display_name][crate::model::ExecutePatchJobRequest::display_name].
11234 ///
11235 /// # Example
11236 /// ```ignore,no_run
11237 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11238 /// let x = ExecutePatchJobRequest::new().set_display_name("example");
11239 /// ```
11240 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11241 self.display_name = v.into();
11242 self
11243 }
11244
11245 /// Sets the value of [rollout][crate::model::ExecutePatchJobRequest::rollout].
11246 ///
11247 /// # Example
11248 /// ```ignore,no_run
11249 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11250 /// use google_cloud_osconfig_v1::model::PatchRollout;
11251 /// let x = ExecutePatchJobRequest::new().set_rollout(PatchRollout::default()/* use setters */);
11252 /// ```
11253 pub fn set_rollout<T>(mut self, v: T) -> Self
11254 where
11255 T: std::convert::Into<crate::model::PatchRollout>,
11256 {
11257 self.rollout = std::option::Option::Some(v.into());
11258 self
11259 }
11260
11261 /// Sets or clears the value of [rollout][crate::model::ExecutePatchJobRequest::rollout].
11262 ///
11263 /// # Example
11264 /// ```ignore,no_run
11265 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11266 /// use google_cloud_osconfig_v1::model::PatchRollout;
11267 /// let x = ExecutePatchJobRequest::new().set_or_clear_rollout(Some(PatchRollout::default()/* use setters */));
11268 /// let x = ExecutePatchJobRequest::new().set_or_clear_rollout(None::<PatchRollout>);
11269 /// ```
11270 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
11271 where
11272 T: std::convert::Into<crate::model::PatchRollout>,
11273 {
11274 self.rollout = v.map(|x| x.into());
11275 self
11276 }
11277}
11278
11279impl wkt::message::Message for ExecutePatchJobRequest {
11280 fn typename() -> &'static str {
11281 "type.googleapis.com/google.cloud.osconfig.v1.ExecutePatchJobRequest"
11282 }
11283}
11284
11285/// Request to get an active or completed patch job.
11286#[derive(Clone, Default, PartialEq)]
11287#[non_exhaustive]
11288pub struct GetPatchJobRequest {
11289 /// Required. Name of the patch in the form `projects/*/patchJobs/*`
11290 pub name: std::string::String,
11291
11292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11293}
11294
11295impl GetPatchJobRequest {
11296 /// Creates a new default instance.
11297 pub fn new() -> Self {
11298 std::default::Default::default()
11299 }
11300
11301 /// Sets the value of [name][crate::model::GetPatchJobRequest::name].
11302 ///
11303 /// # Example
11304 /// ```ignore,no_run
11305 /// # use google_cloud_osconfig_v1::model::GetPatchJobRequest;
11306 /// let x = GetPatchJobRequest::new().set_name("example");
11307 /// ```
11308 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11309 self.name = v.into();
11310 self
11311 }
11312}
11313
11314impl wkt::message::Message for GetPatchJobRequest {
11315 fn typename() -> &'static str {
11316 "type.googleapis.com/google.cloud.osconfig.v1.GetPatchJobRequest"
11317 }
11318}
11319
11320/// Request to list details for all instances that are part of a patch job.
11321#[derive(Clone, Default, PartialEq)]
11322#[non_exhaustive]
11323pub struct ListPatchJobInstanceDetailsRequest {
11324 /// Required. The parent for the instances are in the form of
11325 /// `projects/*/patchJobs/*`.
11326 pub parent: std::string::String,
11327
11328 /// The maximum number of instance details records to return. Default is 100.
11329 pub page_size: i32,
11330
11331 /// A pagination token returned from a previous call
11332 /// that indicates where this listing should continue from.
11333 pub page_token: std::string::String,
11334
11335 /// A filter expression that filters results listed in the response. This
11336 /// field supports filtering results by instance zone, name, state, or
11337 /// `failure_reason`.
11338 pub filter: std::string::String,
11339
11340 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11341}
11342
11343impl ListPatchJobInstanceDetailsRequest {
11344 /// Creates a new default instance.
11345 pub fn new() -> Self {
11346 std::default::Default::default()
11347 }
11348
11349 /// Sets the value of [parent][crate::model::ListPatchJobInstanceDetailsRequest::parent].
11350 ///
11351 /// # Example
11352 /// ```ignore,no_run
11353 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11354 /// let x = ListPatchJobInstanceDetailsRequest::new().set_parent("example");
11355 /// ```
11356 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11357 self.parent = v.into();
11358 self
11359 }
11360
11361 /// Sets the value of [page_size][crate::model::ListPatchJobInstanceDetailsRequest::page_size].
11362 ///
11363 /// # Example
11364 /// ```ignore,no_run
11365 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11366 /// let x = ListPatchJobInstanceDetailsRequest::new().set_page_size(42);
11367 /// ```
11368 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11369 self.page_size = v.into();
11370 self
11371 }
11372
11373 /// Sets the value of [page_token][crate::model::ListPatchJobInstanceDetailsRequest::page_token].
11374 ///
11375 /// # Example
11376 /// ```ignore,no_run
11377 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11378 /// let x = ListPatchJobInstanceDetailsRequest::new().set_page_token("example");
11379 /// ```
11380 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11381 self.page_token = v.into();
11382 self
11383 }
11384
11385 /// Sets the value of [filter][crate::model::ListPatchJobInstanceDetailsRequest::filter].
11386 ///
11387 /// # Example
11388 /// ```ignore,no_run
11389 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11390 /// let x = ListPatchJobInstanceDetailsRequest::new().set_filter("example");
11391 /// ```
11392 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11393 self.filter = v.into();
11394 self
11395 }
11396}
11397
11398impl wkt::message::Message for ListPatchJobInstanceDetailsRequest {
11399 fn typename() -> &'static str {
11400 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobInstanceDetailsRequest"
11401 }
11402}
11403
11404/// A response message for listing the instances details for a patch job.
11405#[derive(Clone, Default, PartialEq)]
11406#[non_exhaustive]
11407pub struct ListPatchJobInstanceDetailsResponse {
11408 /// A list of instance status.
11409 pub patch_job_instance_details: std::vec::Vec<crate::model::PatchJobInstanceDetails>,
11410
11411 /// A pagination token that can be used to get the next page of results.
11412 pub next_page_token: std::string::String,
11413
11414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11415}
11416
11417impl ListPatchJobInstanceDetailsResponse {
11418 /// Creates a new default instance.
11419 pub fn new() -> Self {
11420 std::default::Default::default()
11421 }
11422
11423 /// Sets the value of [patch_job_instance_details][crate::model::ListPatchJobInstanceDetailsResponse::patch_job_instance_details].
11424 ///
11425 /// # Example
11426 /// ```ignore,no_run
11427 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsResponse;
11428 /// use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11429 /// let x = ListPatchJobInstanceDetailsResponse::new()
11430 /// .set_patch_job_instance_details([
11431 /// PatchJobInstanceDetails::default()/* use setters */,
11432 /// PatchJobInstanceDetails::default()/* use (different) setters */,
11433 /// ]);
11434 /// ```
11435 pub fn set_patch_job_instance_details<T, V>(mut self, v: T) -> Self
11436 where
11437 T: std::iter::IntoIterator<Item = V>,
11438 V: std::convert::Into<crate::model::PatchJobInstanceDetails>,
11439 {
11440 use std::iter::Iterator;
11441 self.patch_job_instance_details = v.into_iter().map(|i| i.into()).collect();
11442 self
11443 }
11444
11445 /// Sets the value of [next_page_token][crate::model::ListPatchJobInstanceDetailsResponse::next_page_token].
11446 ///
11447 /// # Example
11448 /// ```ignore,no_run
11449 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsResponse;
11450 /// let x = ListPatchJobInstanceDetailsResponse::new().set_next_page_token("example");
11451 /// ```
11452 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11453 self.next_page_token = v.into();
11454 self
11455 }
11456}
11457
11458impl wkt::message::Message for ListPatchJobInstanceDetailsResponse {
11459 fn typename() -> &'static str {
11460 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobInstanceDetailsResponse"
11461 }
11462}
11463
11464#[doc(hidden)]
11465impl google_cloud_gax::paginator::internal::PageableResponse
11466 for ListPatchJobInstanceDetailsResponse
11467{
11468 type PageItem = crate::model::PatchJobInstanceDetails;
11469
11470 fn items(self) -> std::vec::Vec<Self::PageItem> {
11471 self.patch_job_instance_details
11472 }
11473
11474 fn next_page_token(&self) -> std::string::String {
11475 use std::clone::Clone;
11476 self.next_page_token.clone()
11477 }
11478}
11479
11480/// Patch details for a VM instance. For more information about reviewing VM
11481/// instance details, see
11482/// [Listing all VM instance details for a specific patch
11483/// job](https://cloud.google.com/compute/docs/os-patch-management/manage-patch-jobs#list-instance-details).
11484#[derive(Clone, Default, PartialEq)]
11485#[non_exhaustive]
11486pub struct PatchJobInstanceDetails {
11487 /// The instance name in the form `projects/*/zones/*/instances/*`
11488 pub name: std::string::String,
11489
11490 /// The unique identifier for the instance. This identifier is
11491 /// defined by the server.
11492 pub instance_system_id: std::string::String,
11493
11494 /// Current state of instance patch.
11495 pub state: crate::model::instance::PatchState,
11496
11497 /// If the patch fails, this field provides the reason.
11498 pub failure_reason: std::string::String,
11499
11500 /// The number of times the agent that the agent attempts to apply the patch.
11501 pub attempt_count: i64,
11502
11503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11504}
11505
11506impl PatchJobInstanceDetails {
11507 /// Creates a new default instance.
11508 pub fn new() -> Self {
11509 std::default::Default::default()
11510 }
11511
11512 /// Sets the value of [name][crate::model::PatchJobInstanceDetails::name].
11513 ///
11514 /// # Example
11515 /// ```ignore,no_run
11516 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11517 /// let x = PatchJobInstanceDetails::new().set_name("example");
11518 /// ```
11519 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11520 self.name = v.into();
11521 self
11522 }
11523
11524 /// Sets the value of [instance_system_id][crate::model::PatchJobInstanceDetails::instance_system_id].
11525 ///
11526 /// # Example
11527 /// ```ignore,no_run
11528 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11529 /// let x = PatchJobInstanceDetails::new().set_instance_system_id("example");
11530 /// ```
11531 pub fn set_instance_system_id<T: std::convert::Into<std::string::String>>(
11532 mut self,
11533 v: T,
11534 ) -> Self {
11535 self.instance_system_id = v.into();
11536 self
11537 }
11538
11539 /// Sets the value of [state][crate::model::PatchJobInstanceDetails::state].
11540 ///
11541 /// # Example
11542 /// ```ignore,no_run
11543 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11544 /// use google_cloud_osconfig_v1::model::instance::PatchState;
11545 /// let x0 = PatchJobInstanceDetails::new().set_state(PatchState::Pending);
11546 /// let x1 = PatchJobInstanceDetails::new().set_state(PatchState::Inactive);
11547 /// let x2 = PatchJobInstanceDetails::new().set_state(PatchState::Notified);
11548 /// ```
11549 pub fn set_state<T: std::convert::Into<crate::model::instance::PatchState>>(
11550 mut self,
11551 v: T,
11552 ) -> Self {
11553 self.state = v.into();
11554 self
11555 }
11556
11557 /// Sets the value of [failure_reason][crate::model::PatchJobInstanceDetails::failure_reason].
11558 ///
11559 /// # Example
11560 /// ```ignore,no_run
11561 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11562 /// let x = PatchJobInstanceDetails::new().set_failure_reason("example");
11563 /// ```
11564 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11565 self.failure_reason = v.into();
11566 self
11567 }
11568
11569 /// Sets the value of [attempt_count][crate::model::PatchJobInstanceDetails::attempt_count].
11570 ///
11571 /// # Example
11572 /// ```ignore,no_run
11573 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11574 /// let x = PatchJobInstanceDetails::new().set_attempt_count(42);
11575 /// ```
11576 pub fn set_attempt_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11577 self.attempt_count = v.into();
11578 self
11579 }
11580}
11581
11582impl wkt::message::Message for PatchJobInstanceDetails {
11583 fn typename() -> &'static str {
11584 "type.googleapis.com/google.cloud.osconfig.v1.PatchJobInstanceDetails"
11585 }
11586}
11587
11588/// A request message for listing patch jobs.
11589#[derive(Clone, Default, PartialEq)]
11590#[non_exhaustive]
11591pub struct ListPatchJobsRequest {
11592 /// Required. In the form of `projects/*`
11593 pub parent: std::string::String,
11594
11595 /// The maximum number of instance status to return.
11596 pub page_size: i32,
11597
11598 /// A pagination token returned from a previous call
11599 /// that indicates where this listing should continue from.
11600 pub page_token: std::string::String,
11601
11602 /// If provided, this field specifies the criteria that must be met by patch
11603 /// jobs to be included in the response.
11604 /// Currently, filtering is only available on the patch_deployment field.
11605 pub filter: std::string::String,
11606
11607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11608}
11609
11610impl ListPatchJobsRequest {
11611 /// Creates a new default instance.
11612 pub fn new() -> Self {
11613 std::default::Default::default()
11614 }
11615
11616 /// Sets the value of [parent][crate::model::ListPatchJobsRequest::parent].
11617 ///
11618 /// # Example
11619 /// ```ignore,no_run
11620 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11621 /// let x = ListPatchJobsRequest::new().set_parent("example");
11622 /// ```
11623 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11624 self.parent = v.into();
11625 self
11626 }
11627
11628 /// Sets the value of [page_size][crate::model::ListPatchJobsRequest::page_size].
11629 ///
11630 /// # Example
11631 /// ```ignore,no_run
11632 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11633 /// let x = ListPatchJobsRequest::new().set_page_size(42);
11634 /// ```
11635 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11636 self.page_size = v.into();
11637 self
11638 }
11639
11640 /// Sets the value of [page_token][crate::model::ListPatchJobsRequest::page_token].
11641 ///
11642 /// # Example
11643 /// ```ignore,no_run
11644 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11645 /// let x = ListPatchJobsRequest::new().set_page_token("example");
11646 /// ```
11647 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11648 self.page_token = v.into();
11649 self
11650 }
11651
11652 /// Sets the value of [filter][crate::model::ListPatchJobsRequest::filter].
11653 ///
11654 /// # Example
11655 /// ```ignore,no_run
11656 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11657 /// let x = ListPatchJobsRequest::new().set_filter("example");
11658 /// ```
11659 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11660 self.filter = v.into();
11661 self
11662 }
11663}
11664
11665impl wkt::message::Message for ListPatchJobsRequest {
11666 fn typename() -> &'static str {
11667 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobsRequest"
11668 }
11669}
11670
11671/// A response message for listing patch jobs.
11672#[derive(Clone, Default, PartialEq)]
11673#[non_exhaustive]
11674pub struct ListPatchJobsResponse {
11675 /// The list of patch jobs.
11676 pub patch_jobs: std::vec::Vec<crate::model::PatchJob>,
11677
11678 /// A pagination token that can be used to get the next page of results.
11679 pub next_page_token: std::string::String,
11680
11681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11682}
11683
11684impl ListPatchJobsResponse {
11685 /// Creates a new default instance.
11686 pub fn new() -> Self {
11687 std::default::Default::default()
11688 }
11689
11690 /// Sets the value of [patch_jobs][crate::model::ListPatchJobsResponse::patch_jobs].
11691 ///
11692 /// # Example
11693 /// ```ignore,no_run
11694 /// # use google_cloud_osconfig_v1::model::ListPatchJobsResponse;
11695 /// use google_cloud_osconfig_v1::model::PatchJob;
11696 /// let x = ListPatchJobsResponse::new()
11697 /// .set_patch_jobs([
11698 /// PatchJob::default()/* use setters */,
11699 /// PatchJob::default()/* use (different) setters */,
11700 /// ]);
11701 /// ```
11702 pub fn set_patch_jobs<T, V>(mut self, v: T) -> Self
11703 where
11704 T: std::iter::IntoIterator<Item = V>,
11705 V: std::convert::Into<crate::model::PatchJob>,
11706 {
11707 use std::iter::Iterator;
11708 self.patch_jobs = v.into_iter().map(|i| i.into()).collect();
11709 self
11710 }
11711
11712 /// Sets the value of [next_page_token][crate::model::ListPatchJobsResponse::next_page_token].
11713 ///
11714 /// # Example
11715 /// ```ignore,no_run
11716 /// # use google_cloud_osconfig_v1::model::ListPatchJobsResponse;
11717 /// let x = ListPatchJobsResponse::new().set_next_page_token("example");
11718 /// ```
11719 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11720 self.next_page_token = v.into();
11721 self
11722 }
11723}
11724
11725impl wkt::message::Message for ListPatchJobsResponse {
11726 fn typename() -> &'static str {
11727 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobsResponse"
11728 }
11729}
11730
11731#[doc(hidden)]
11732impl google_cloud_gax::paginator::internal::PageableResponse for ListPatchJobsResponse {
11733 type PageItem = crate::model::PatchJob;
11734
11735 fn items(self) -> std::vec::Vec<Self::PageItem> {
11736 self.patch_jobs
11737 }
11738
11739 fn next_page_token(&self) -> std::string::String {
11740 use std::clone::Clone;
11741 self.next_page_token.clone()
11742 }
11743}
11744
11745/// A high level representation of a patch job that is either in progress
11746/// or has completed.
11747///
11748/// Instance details are not included in the job. To paginate through instance
11749/// details, use ListPatchJobInstanceDetails.
11750///
11751/// For more information about patch jobs, see
11752/// [Creating patch
11753/// jobs](https://cloud.google.com/compute/docs/os-patch-management/create-patch-job).
11754#[derive(Clone, Default, PartialEq)]
11755#[non_exhaustive]
11756pub struct PatchJob {
11757 /// Unique identifier for this patch job in the form
11758 /// `projects/*/patchJobs/*`
11759 pub name: std::string::String,
11760
11761 /// Display name for this patch job. This is not a unique identifier.
11762 pub display_name: std::string::String,
11763
11764 /// Description of the patch job. Length of the description is limited
11765 /// to 1024 characters.
11766 pub description: std::string::String,
11767
11768 /// Time this patch job was created.
11769 pub create_time: std::option::Option<wkt::Timestamp>,
11770
11771 /// Last time this patch job was updated.
11772 pub update_time: std::option::Option<wkt::Timestamp>,
11773
11774 /// The current state of the PatchJob.
11775 pub state: crate::model::patch_job::State,
11776
11777 /// Instances to patch.
11778 pub instance_filter: std::option::Option<crate::model::PatchInstanceFilter>,
11779
11780 /// Patch configuration being applied.
11781 pub patch_config: std::option::Option<crate::model::PatchConfig>,
11782
11783 /// Duration of the patch job. After the duration ends, the
11784 /// patch job times out.
11785 pub duration: std::option::Option<wkt::Duration>,
11786
11787 /// Summary of instance details.
11788 pub instance_details_summary:
11789 std::option::Option<crate::model::patch_job::InstanceDetailsSummary>,
11790
11791 /// If this patch job is a dry run, the agent reports that it has
11792 /// finished without running any updates on the VM instance.
11793 pub dry_run: bool,
11794
11795 /// If this patch job failed, this message provides information about the
11796 /// failure.
11797 pub error_message: std::string::String,
11798
11799 /// Reflects the overall progress of the patch job in the range of
11800 /// 0.0 being no progress to 100.0 being complete.
11801 pub percent_complete: f64,
11802
11803 /// Output only. Name of the patch deployment that created this patch job.
11804 pub patch_deployment: std::string::String,
11805
11806 /// Rollout strategy being applied.
11807 pub rollout: std::option::Option<crate::model::PatchRollout>,
11808
11809 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11810}
11811
11812impl PatchJob {
11813 /// Creates a new default instance.
11814 pub fn new() -> Self {
11815 std::default::Default::default()
11816 }
11817
11818 /// Sets the value of [name][crate::model::PatchJob::name].
11819 ///
11820 /// # Example
11821 /// ```ignore,no_run
11822 /// # use google_cloud_osconfig_v1::model::PatchJob;
11823 /// let x = PatchJob::new().set_name("example");
11824 /// ```
11825 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11826 self.name = v.into();
11827 self
11828 }
11829
11830 /// Sets the value of [display_name][crate::model::PatchJob::display_name].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_osconfig_v1::model::PatchJob;
11835 /// let x = PatchJob::new().set_display_name("example");
11836 /// ```
11837 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11838 self.display_name = v.into();
11839 self
11840 }
11841
11842 /// Sets the value of [description][crate::model::PatchJob::description].
11843 ///
11844 /// # Example
11845 /// ```ignore,no_run
11846 /// # use google_cloud_osconfig_v1::model::PatchJob;
11847 /// let x = PatchJob::new().set_description("example");
11848 /// ```
11849 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11850 self.description = v.into();
11851 self
11852 }
11853
11854 /// Sets the value of [create_time][crate::model::PatchJob::create_time].
11855 ///
11856 /// # Example
11857 /// ```ignore,no_run
11858 /// # use google_cloud_osconfig_v1::model::PatchJob;
11859 /// use wkt::Timestamp;
11860 /// let x = PatchJob::new().set_create_time(Timestamp::default()/* use setters */);
11861 /// ```
11862 pub fn set_create_time<T>(mut self, v: T) -> Self
11863 where
11864 T: std::convert::Into<wkt::Timestamp>,
11865 {
11866 self.create_time = std::option::Option::Some(v.into());
11867 self
11868 }
11869
11870 /// Sets or clears the value of [create_time][crate::model::PatchJob::create_time].
11871 ///
11872 /// # Example
11873 /// ```ignore,no_run
11874 /// # use google_cloud_osconfig_v1::model::PatchJob;
11875 /// use wkt::Timestamp;
11876 /// let x = PatchJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11877 /// let x = PatchJob::new().set_or_clear_create_time(None::<Timestamp>);
11878 /// ```
11879 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11880 where
11881 T: std::convert::Into<wkt::Timestamp>,
11882 {
11883 self.create_time = v.map(|x| x.into());
11884 self
11885 }
11886
11887 /// Sets the value of [update_time][crate::model::PatchJob::update_time].
11888 ///
11889 /// # Example
11890 /// ```ignore,no_run
11891 /// # use google_cloud_osconfig_v1::model::PatchJob;
11892 /// use wkt::Timestamp;
11893 /// let x = PatchJob::new().set_update_time(Timestamp::default()/* use setters */);
11894 /// ```
11895 pub fn set_update_time<T>(mut self, v: T) -> Self
11896 where
11897 T: std::convert::Into<wkt::Timestamp>,
11898 {
11899 self.update_time = std::option::Option::Some(v.into());
11900 self
11901 }
11902
11903 /// Sets or clears the value of [update_time][crate::model::PatchJob::update_time].
11904 ///
11905 /// # Example
11906 /// ```ignore,no_run
11907 /// # use google_cloud_osconfig_v1::model::PatchJob;
11908 /// use wkt::Timestamp;
11909 /// let x = PatchJob::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11910 /// let x = PatchJob::new().set_or_clear_update_time(None::<Timestamp>);
11911 /// ```
11912 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11913 where
11914 T: std::convert::Into<wkt::Timestamp>,
11915 {
11916 self.update_time = v.map(|x| x.into());
11917 self
11918 }
11919
11920 /// Sets the value of [state][crate::model::PatchJob::state].
11921 ///
11922 /// # Example
11923 /// ```ignore,no_run
11924 /// # use google_cloud_osconfig_v1::model::PatchJob;
11925 /// use google_cloud_osconfig_v1::model::patch_job::State;
11926 /// let x0 = PatchJob::new().set_state(State::Started);
11927 /// let x1 = PatchJob::new().set_state(State::InstanceLookup);
11928 /// let x2 = PatchJob::new().set_state(State::Patching);
11929 /// ```
11930 pub fn set_state<T: std::convert::Into<crate::model::patch_job::State>>(
11931 mut self,
11932 v: T,
11933 ) -> Self {
11934 self.state = v.into();
11935 self
11936 }
11937
11938 /// Sets the value of [instance_filter][crate::model::PatchJob::instance_filter].
11939 ///
11940 /// # Example
11941 /// ```ignore,no_run
11942 /// # use google_cloud_osconfig_v1::model::PatchJob;
11943 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11944 /// let x = PatchJob::new().set_instance_filter(PatchInstanceFilter::default()/* use setters */);
11945 /// ```
11946 pub fn set_instance_filter<T>(mut self, v: T) -> Self
11947 where
11948 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11949 {
11950 self.instance_filter = std::option::Option::Some(v.into());
11951 self
11952 }
11953
11954 /// Sets or clears the value of [instance_filter][crate::model::PatchJob::instance_filter].
11955 ///
11956 /// # Example
11957 /// ```ignore,no_run
11958 /// # use google_cloud_osconfig_v1::model::PatchJob;
11959 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11960 /// let x = PatchJob::new().set_or_clear_instance_filter(Some(PatchInstanceFilter::default()/* use setters */));
11961 /// let x = PatchJob::new().set_or_clear_instance_filter(None::<PatchInstanceFilter>);
11962 /// ```
11963 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
11964 where
11965 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11966 {
11967 self.instance_filter = v.map(|x| x.into());
11968 self
11969 }
11970
11971 /// Sets the value of [patch_config][crate::model::PatchJob::patch_config].
11972 ///
11973 /// # Example
11974 /// ```ignore,no_run
11975 /// # use google_cloud_osconfig_v1::model::PatchJob;
11976 /// use google_cloud_osconfig_v1::model::PatchConfig;
11977 /// let x = PatchJob::new().set_patch_config(PatchConfig::default()/* use setters */);
11978 /// ```
11979 pub fn set_patch_config<T>(mut self, v: T) -> Self
11980 where
11981 T: std::convert::Into<crate::model::PatchConfig>,
11982 {
11983 self.patch_config = std::option::Option::Some(v.into());
11984 self
11985 }
11986
11987 /// Sets or clears the value of [patch_config][crate::model::PatchJob::patch_config].
11988 ///
11989 /// # Example
11990 /// ```ignore,no_run
11991 /// # use google_cloud_osconfig_v1::model::PatchJob;
11992 /// use google_cloud_osconfig_v1::model::PatchConfig;
11993 /// let x = PatchJob::new().set_or_clear_patch_config(Some(PatchConfig::default()/* use setters */));
11994 /// let x = PatchJob::new().set_or_clear_patch_config(None::<PatchConfig>);
11995 /// ```
11996 pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
11997 where
11998 T: std::convert::Into<crate::model::PatchConfig>,
11999 {
12000 self.patch_config = v.map(|x| x.into());
12001 self
12002 }
12003
12004 /// Sets the value of [duration][crate::model::PatchJob::duration].
12005 ///
12006 /// # Example
12007 /// ```ignore,no_run
12008 /// # use google_cloud_osconfig_v1::model::PatchJob;
12009 /// use wkt::Duration;
12010 /// let x = PatchJob::new().set_duration(Duration::default()/* use setters */);
12011 /// ```
12012 pub fn set_duration<T>(mut self, v: T) -> Self
12013 where
12014 T: std::convert::Into<wkt::Duration>,
12015 {
12016 self.duration = std::option::Option::Some(v.into());
12017 self
12018 }
12019
12020 /// Sets or clears the value of [duration][crate::model::PatchJob::duration].
12021 ///
12022 /// # Example
12023 /// ```ignore,no_run
12024 /// # use google_cloud_osconfig_v1::model::PatchJob;
12025 /// use wkt::Duration;
12026 /// let x = PatchJob::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
12027 /// let x = PatchJob::new().set_or_clear_duration(None::<Duration>);
12028 /// ```
12029 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
12030 where
12031 T: std::convert::Into<wkt::Duration>,
12032 {
12033 self.duration = v.map(|x| x.into());
12034 self
12035 }
12036
12037 /// Sets the value of [instance_details_summary][crate::model::PatchJob::instance_details_summary].
12038 ///
12039 /// # Example
12040 /// ```ignore,no_run
12041 /// # use google_cloud_osconfig_v1::model::PatchJob;
12042 /// use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12043 /// let x = PatchJob::new().set_instance_details_summary(InstanceDetailsSummary::default()/* use setters */);
12044 /// ```
12045 pub fn set_instance_details_summary<T>(mut self, v: T) -> Self
12046 where
12047 T: std::convert::Into<crate::model::patch_job::InstanceDetailsSummary>,
12048 {
12049 self.instance_details_summary = std::option::Option::Some(v.into());
12050 self
12051 }
12052
12053 /// Sets or clears the value of [instance_details_summary][crate::model::PatchJob::instance_details_summary].
12054 ///
12055 /// # Example
12056 /// ```ignore,no_run
12057 /// # use google_cloud_osconfig_v1::model::PatchJob;
12058 /// use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12059 /// let x = PatchJob::new().set_or_clear_instance_details_summary(Some(InstanceDetailsSummary::default()/* use setters */));
12060 /// let x = PatchJob::new().set_or_clear_instance_details_summary(None::<InstanceDetailsSummary>);
12061 /// ```
12062 pub fn set_or_clear_instance_details_summary<T>(mut self, v: std::option::Option<T>) -> Self
12063 where
12064 T: std::convert::Into<crate::model::patch_job::InstanceDetailsSummary>,
12065 {
12066 self.instance_details_summary = v.map(|x| x.into());
12067 self
12068 }
12069
12070 /// Sets the value of [dry_run][crate::model::PatchJob::dry_run].
12071 ///
12072 /// # Example
12073 /// ```ignore,no_run
12074 /// # use google_cloud_osconfig_v1::model::PatchJob;
12075 /// let x = PatchJob::new().set_dry_run(true);
12076 /// ```
12077 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12078 self.dry_run = v.into();
12079 self
12080 }
12081
12082 /// Sets the value of [error_message][crate::model::PatchJob::error_message].
12083 ///
12084 /// # Example
12085 /// ```ignore,no_run
12086 /// # use google_cloud_osconfig_v1::model::PatchJob;
12087 /// let x = PatchJob::new().set_error_message("example");
12088 /// ```
12089 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12090 self.error_message = v.into();
12091 self
12092 }
12093
12094 /// Sets the value of [percent_complete][crate::model::PatchJob::percent_complete].
12095 ///
12096 /// # Example
12097 /// ```ignore,no_run
12098 /// # use google_cloud_osconfig_v1::model::PatchJob;
12099 /// let x = PatchJob::new().set_percent_complete(42.0);
12100 /// ```
12101 pub fn set_percent_complete<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
12102 self.percent_complete = v.into();
12103 self
12104 }
12105
12106 /// Sets the value of [patch_deployment][crate::model::PatchJob::patch_deployment].
12107 ///
12108 /// # Example
12109 /// ```ignore,no_run
12110 /// # use google_cloud_osconfig_v1::model::PatchJob;
12111 /// let x = PatchJob::new().set_patch_deployment("example");
12112 /// ```
12113 pub fn set_patch_deployment<T: std::convert::Into<std::string::String>>(
12114 mut self,
12115 v: T,
12116 ) -> Self {
12117 self.patch_deployment = v.into();
12118 self
12119 }
12120
12121 /// Sets the value of [rollout][crate::model::PatchJob::rollout].
12122 ///
12123 /// # Example
12124 /// ```ignore,no_run
12125 /// # use google_cloud_osconfig_v1::model::PatchJob;
12126 /// use google_cloud_osconfig_v1::model::PatchRollout;
12127 /// let x = PatchJob::new().set_rollout(PatchRollout::default()/* use setters */);
12128 /// ```
12129 pub fn set_rollout<T>(mut self, v: T) -> Self
12130 where
12131 T: std::convert::Into<crate::model::PatchRollout>,
12132 {
12133 self.rollout = std::option::Option::Some(v.into());
12134 self
12135 }
12136
12137 /// Sets or clears the value of [rollout][crate::model::PatchJob::rollout].
12138 ///
12139 /// # Example
12140 /// ```ignore,no_run
12141 /// # use google_cloud_osconfig_v1::model::PatchJob;
12142 /// use google_cloud_osconfig_v1::model::PatchRollout;
12143 /// let x = PatchJob::new().set_or_clear_rollout(Some(PatchRollout::default()/* use setters */));
12144 /// let x = PatchJob::new().set_or_clear_rollout(None::<PatchRollout>);
12145 /// ```
12146 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
12147 where
12148 T: std::convert::Into<crate::model::PatchRollout>,
12149 {
12150 self.rollout = v.map(|x| x.into());
12151 self
12152 }
12153}
12154
12155impl wkt::message::Message for PatchJob {
12156 fn typename() -> &'static str {
12157 "type.googleapis.com/google.cloud.osconfig.v1.PatchJob"
12158 }
12159}
12160
12161/// Defines additional types related to [PatchJob].
12162pub mod patch_job {
12163 #[allow(unused_imports)]
12164 use super::*;
12165
12166 /// A summary of the current patch state across all instances that this patch
12167 /// job affects. Contains counts of instances in different states. These states
12168 /// map to `InstancePatchState`. List patch job instance details to see the
12169 /// specific states of each instance.
12170 #[derive(Clone, Default, PartialEq)]
12171 #[non_exhaustive]
12172 pub struct InstanceDetailsSummary {
12173 /// Number of instances pending patch job.
12174 pub pending_instance_count: i64,
12175
12176 /// Number of instances that are inactive.
12177 pub inactive_instance_count: i64,
12178
12179 /// Number of instances notified about patch job.
12180 pub notified_instance_count: i64,
12181
12182 /// Number of instances that have started.
12183 pub started_instance_count: i64,
12184
12185 /// Number of instances that are downloading patches.
12186 pub downloading_patches_instance_count: i64,
12187
12188 /// Number of instances that are applying patches.
12189 pub applying_patches_instance_count: i64,
12190
12191 /// Number of instances rebooting.
12192 pub rebooting_instance_count: i64,
12193
12194 /// Number of instances that have completed successfully.
12195 pub succeeded_instance_count: i64,
12196
12197 /// Number of instances that require reboot.
12198 pub succeeded_reboot_required_instance_count: i64,
12199
12200 /// Number of instances that failed.
12201 pub failed_instance_count: i64,
12202
12203 /// Number of instances that have acked and will start shortly.
12204 pub acked_instance_count: i64,
12205
12206 /// Number of instances that exceeded the time out while applying the patch.
12207 pub timed_out_instance_count: i64,
12208
12209 /// Number of instances that are running the pre-patch step.
12210 pub pre_patch_step_instance_count: i64,
12211
12212 /// Number of instances that are running the post-patch step.
12213 pub post_patch_step_instance_count: i64,
12214
12215 /// Number of instances that do not appear to be running the agent. Check to
12216 /// ensure that the agent is installed, running, and able to communicate with
12217 /// the service.
12218 pub no_agent_detected_instance_count: i64,
12219
12220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12221 }
12222
12223 impl InstanceDetailsSummary {
12224 /// Creates a new default instance.
12225 pub fn new() -> Self {
12226 std::default::Default::default()
12227 }
12228
12229 /// Sets the value of [pending_instance_count][crate::model::patch_job::InstanceDetailsSummary::pending_instance_count].
12230 ///
12231 /// # Example
12232 /// ```ignore,no_run
12233 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12234 /// let x = InstanceDetailsSummary::new().set_pending_instance_count(42);
12235 /// ```
12236 pub fn set_pending_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12237 self.pending_instance_count = v.into();
12238 self
12239 }
12240
12241 /// Sets the value of [inactive_instance_count][crate::model::patch_job::InstanceDetailsSummary::inactive_instance_count].
12242 ///
12243 /// # Example
12244 /// ```ignore,no_run
12245 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12246 /// let x = InstanceDetailsSummary::new().set_inactive_instance_count(42);
12247 /// ```
12248 pub fn set_inactive_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12249 self.inactive_instance_count = v.into();
12250 self
12251 }
12252
12253 /// Sets the value of [notified_instance_count][crate::model::patch_job::InstanceDetailsSummary::notified_instance_count].
12254 ///
12255 /// # Example
12256 /// ```ignore,no_run
12257 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12258 /// let x = InstanceDetailsSummary::new().set_notified_instance_count(42);
12259 /// ```
12260 pub fn set_notified_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12261 self.notified_instance_count = v.into();
12262 self
12263 }
12264
12265 /// Sets the value of [started_instance_count][crate::model::patch_job::InstanceDetailsSummary::started_instance_count].
12266 ///
12267 /// # Example
12268 /// ```ignore,no_run
12269 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12270 /// let x = InstanceDetailsSummary::new().set_started_instance_count(42);
12271 /// ```
12272 pub fn set_started_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12273 self.started_instance_count = v.into();
12274 self
12275 }
12276
12277 /// Sets the value of [downloading_patches_instance_count][crate::model::patch_job::InstanceDetailsSummary::downloading_patches_instance_count].
12278 ///
12279 /// # Example
12280 /// ```ignore,no_run
12281 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12282 /// let x = InstanceDetailsSummary::new().set_downloading_patches_instance_count(42);
12283 /// ```
12284 pub fn set_downloading_patches_instance_count<T: std::convert::Into<i64>>(
12285 mut self,
12286 v: T,
12287 ) -> Self {
12288 self.downloading_patches_instance_count = v.into();
12289 self
12290 }
12291
12292 /// Sets the value of [applying_patches_instance_count][crate::model::patch_job::InstanceDetailsSummary::applying_patches_instance_count].
12293 ///
12294 /// # Example
12295 /// ```ignore,no_run
12296 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12297 /// let x = InstanceDetailsSummary::new().set_applying_patches_instance_count(42);
12298 /// ```
12299 pub fn set_applying_patches_instance_count<T: std::convert::Into<i64>>(
12300 mut self,
12301 v: T,
12302 ) -> Self {
12303 self.applying_patches_instance_count = v.into();
12304 self
12305 }
12306
12307 /// Sets the value of [rebooting_instance_count][crate::model::patch_job::InstanceDetailsSummary::rebooting_instance_count].
12308 ///
12309 /// # Example
12310 /// ```ignore,no_run
12311 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12312 /// let x = InstanceDetailsSummary::new().set_rebooting_instance_count(42);
12313 /// ```
12314 pub fn set_rebooting_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12315 self.rebooting_instance_count = v.into();
12316 self
12317 }
12318
12319 /// Sets the value of [succeeded_instance_count][crate::model::patch_job::InstanceDetailsSummary::succeeded_instance_count].
12320 ///
12321 /// # Example
12322 /// ```ignore,no_run
12323 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12324 /// let x = InstanceDetailsSummary::new().set_succeeded_instance_count(42);
12325 /// ```
12326 pub fn set_succeeded_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12327 self.succeeded_instance_count = v.into();
12328 self
12329 }
12330
12331 /// Sets the value of [succeeded_reboot_required_instance_count][crate::model::patch_job::InstanceDetailsSummary::succeeded_reboot_required_instance_count].
12332 ///
12333 /// # Example
12334 /// ```ignore,no_run
12335 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12336 /// let x = InstanceDetailsSummary::new().set_succeeded_reboot_required_instance_count(42);
12337 /// ```
12338 pub fn set_succeeded_reboot_required_instance_count<T: std::convert::Into<i64>>(
12339 mut self,
12340 v: T,
12341 ) -> Self {
12342 self.succeeded_reboot_required_instance_count = v.into();
12343 self
12344 }
12345
12346 /// Sets the value of [failed_instance_count][crate::model::patch_job::InstanceDetailsSummary::failed_instance_count].
12347 ///
12348 /// # Example
12349 /// ```ignore,no_run
12350 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12351 /// let x = InstanceDetailsSummary::new().set_failed_instance_count(42);
12352 /// ```
12353 pub fn set_failed_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12354 self.failed_instance_count = v.into();
12355 self
12356 }
12357
12358 /// Sets the value of [acked_instance_count][crate::model::patch_job::InstanceDetailsSummary::acked_instance_count].
12359 ///
12360 /// # Example
12361 /// ```ignore,no_run
12362 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12363 /// let x = InstanceDetailsSummary::new().set_acked_instance_count(42);
12364 /// ```
12365 pub fn set_acked_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12366 self.acked_instance_count = v.into();
12367 self
12368 }
12369
12370 /// Sets the value of [timed_out_instance_count][crate::model::patch_job::InstanceDetailsSummary::timed_out_instance_count].
12371 ///
12372 /// # Example
12373 /// ```ignore,no_run
12374 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12375 /// let x = InstanceDetailsSummary::new().set_timed_out_instance_count(42);
12376 /// ```
12377 pub fn set_timed_out_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12378 self.timed_out_instance_count = v.into();
12379 self
12380 }
12381
12382 /// Sets the value of [pre_patch_step_instance_count][crate::model::patch_job::InstanceDetailsSummary::pre_patch_step_instance_count].
12383 ///
12384 /// # Example
12385 /// ```ignore,no_run
12386 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12387 /// let x = InstanceDetailsSummary::new().set_pre_patch_step_instance_count(42);
12388 /// ```
12389 pub fn set_pre_patch_step_instance_count<T: std::convert::Into<i64>>(
12390 mut self,
12391 v: T,
12392 ) -> Self {
12393 self.pre_patch_step_instance_count = v.into();
12394 self
12395 }
12396
12397 /// Sets the value of [post_patch_step_instance_count][crate::model::patch_job::InstanceDetailsSummary::post_patch_step_instance_count].
12398 ///
12399 /// # Example
12400 /// ```ignore,no_run
12401 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12402 /// let x = InstanceDetailsSummary::new().set_post_patch_step_instance_count(42);
12403 /// ```
12404 pub fn set_post_patch_step_instance_count<T: std::convert::Into<i64>>(
12405 mut self,
12406 v: T,
12407 ) -> Self {
12408 self.post_patch_step_instance_count = v.into();
12409 self
12410 }
12411
12412 /// Sets the value of [no_agent_detected_instance_count][crate::model::patch_job::InstanceDetailsSummary::no_agent_detected_instance_count].
12413 ///
12414 /// # Example
12415 /// ```ignore,no_run
12416 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12417 /// let x = InstanceDetailsSummary::new().set_no_agent_detected_instance_count(42);
12418 /// ```
12419 pub fn set_no_agent_detected_instance_count<T: std::convert::Into<i64>>(
12420 mut self,
12421 v: T,
12422 ) -> Self {
12423 self.no_agent_detected_instance_count = v.into();
12424 self
12425 }
12426 }
12427
12428 impl wkt::message::Message for InstanceDetailsSummary {
12429 fn typename() -> &'static str {
12430 "type.googleapis.com/google.cloud.osconfig.v1.PatchJob.InstanceDetailsSummary"
12431 }
12432 }
12433
12434 /// Enumeration of the various states a patch job passes through as it
12435 /// executes.
12436 ///
12437 /// # Working with unknown values
12438 ///
12439 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12440 /// additional enum variants at any time. Adding new variants is not considered
12441 /// a breaking change. Applications should write their code in anticipation of:
12442 ///
12443 /// - New values appearing in future releases of the client library, **and**
12444 /// - New values received dynamically, without application changes.
12445 ///
12446 /// Please consult the [Working with enums] section in the user guide for some
12447 /// guidelines.
12448 ///
12449 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12450 #[derive(Clone, Debug, PartialEq)]
12451 #[non_exhaustive]
12452 pub enum State {
12453 /// State must be specified.
12454 Unspecified,
12455 /// The patch job was successfully initiated.
12456 Started,
12457 /// The patch job is looking up instances to run the patch on.
12458 InstanceLookup,
12459 /// Instances are being patched.
12460 Patching,
12461 /// Patch job completed successfully.
12462 Succeeded,
12463 /// Patch job completed but there were errors.
12464 CompletedWithErrors,
12465 /// The patch job was canceled.
12466 Canceled,
12467 /// The patch job timed out.
12468 TimedOut,
12469 /// If set, the enum was initialized with an unknown value.
12470 ///
12471 /// Applications can examine the value using [State::value] or
12472 /// [State::name].
12473 UnknownValue(state::UnknownValue),
12474 }
12475
12476 #[doc(hidden)]
12477 pub mod state {
12478 #[allow(unused_imports)]
12479 use super::*;
12480 #[derive(Clone, Debug, PartialEq)]
12481 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12482 }
12483
12484 impl State {
12485 /// Gets the enum value.
12486 ///
12487 /// Returns `None` if the enum contains an unknown value deserialized from
12488 /// the string representation of enums.
12489 pub fn value(&self) -> std::option::Option<i32> {
12490 match self {
12491 Self::Unspecified => std::option::Option::Some(0),
12492 Self::Started => std::option::Option::Some(1),
12493 Self::InstanceLookup => std::option::Option::Some(2),
12494 Self::Patching => std::option::Option::Some(3),
12495 Self::Succeeded => std::option::Option::Some(4),
12496 Self::CompletedWithErrors => std::option::Option::Some(5),
12497 Self::Canceled => std::option::Option::Some(6),
12498 Self::TimedOut => std::option::Option::Some(7),
12499 Self::UnknownValue(u) => u.0.value(),
12500 }
12501 }
12502
12503 /// Gets the enum value as a string.
12504 ///
12505 /// Returns `None` if the enum contains an unknown value deserialized from
12506 /// the integer representation of enums.
12507 pub fn name(&self) -> std::option::Option<&str> {
12508 match self {
12509 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12510 Self::Started => std::option::Option::Some("STARTED"),
12511 Self::InstanceLookup => std::option::Option::Some("INSTANCE_LOOKUP"),
12512 Self::Patching => std::option::Option::Some("PATCHING"),
12513 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
12514 Self::CompletedWithErrors => std::option::Option::Some("COMPLETED_WITH_ERRORS"),
12515 Self::Canceled => std::option::Option::Some("CANCELED"),
12516 Self::TimedOut => std::option::Option::Some("TIMED_OUT"),
12517 Self::UnknownValue(u) => u.0.name(),
12518 }
12519 }
12520 }
12521
12522 impl std::default::Default for State {
12523 fn default() -> Self {
12524 use std::convert::From;
12525 Self::from(0)
12526 }
12527 }
12528
12529 impl std::fmt::Display for State {
12530 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12531 wkt::internal::display_enum(f, self.name(), self.value())
12532 }
12533 }
12534
12535 impl std::convert::From<i32> for State {
12536 fn from(value: i32) -> Self {
12537 match value {
12538 0 => Self::Unspecified,
12539 1 => Self::Started,
12540 2 => Self::InstanceLookup,
12541 3 => Self::Patching,
12542 4 => Self::Succeeded,
12543 5 => Self::CompletedWithErrors,
12544 6 => Self::Canceled,
12545 7 => Self::TimedOut,
12546 _ => Self::UnknownValue(state::UnknownValue(
12547 wkt::internal::UnknownEnumValue::Integer(value),
12548 )),
12549 }
12550 }
12551 }
12552
12553 impl std::convert::From<&str> for State {
12554 fn from(value: &str) -> Self {
12555 use std::string::ToString;
12556 match value {
12557 "STATE_UNSPECIFIED" => Self::Unspecified,
12558 "STARTED" => Self::Started,
12559 "INSTANCE_LOOKUP" => Self::InstanceLookup,
12560 "PATCHING" => Self::Patching,
12561 "SUCCEEDED" => Self::Succeeded,
12562 "COMPLETED_WITH_ERRORS" => Self::CompletedWithErrors,
12563 "CANCELED" => Self::Canceled,
12564 "TIMED_OUT" => Self::TimedOut,
12565 _ => Self::UnknownValue(state::UnknownValue(
12566 wkt::internal::UnknownEnumValue::String(value.to_string()),
12567 )),
12568 }
12569 }
12570 }
12571
12572 impl serde::ser::Serialize for State {
12573 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12574 where
12575 S: serde::Serializer,
12576 {
12577 match self {
12578 Self::Unspecified => serializer.serialize_i32(0),
12579 Self::Started => serializer.serialize_i32(1),
12580 Self::InstanceLookup => serializer.serialize_i32(2),
12581 Self::Patching => serializer.serialize_i32(3),
12582 Self::Succeeded => serializer.serialize_i32(4),
12583 Self::CompletedWithErrors => serializer.serialize_i32(5),
12584 Self::Canceled => serializer.serialize_i32(6),
12585 Self::TimedOut => serializer.serialize_i32(7),
12586 Self::UnknownValue(u) => u.0.serialize(serializer),
12587 }
12588 }
12589 }
12590
12591 impl<'de> serde::de::Deserialize<'de> for State {
12592 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12593 where
12594 D: serde::Deserializer<'de>,
12595 {
12596 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12597 ".google.cloud.osconfig.v1.PatchJob.State",
12598 ))
12599 }
12600 }
12601}
12602
12603/// Patch configuration specifications. Contains details on how to apply the
12604/// patch(es) to a VM instance.
12605#[derive(Clone, Default, PartialEq)]
12606#[non_exhaustive]
12607pub struct PatchConfig {
12608 /// Post-patch reboot settings.
12609 pub reboot_config: crate::model::patch_config::RebootConfig,
12610
12611 /// Apt update settings. Use this setting to override the default `apt` patch
12612 /// rules.
12613 pub apt: std::option::Option<crate::model::AptSettings>,
12614
12615 /// Yum update settings. Use this setting to override the default `yum` patch
12616 /// rules.
12617 pub yum: std::option::Option<crate::model::YumSettings>,
12618
12619 /// Goo update settings. Use this setting to override the default `goo` patch
12620 /// rules.
12621 pub goo: std::option::Option<crate::model::GooSettings>,
12622
12623 /// Zypper update settings. Use this setting to override the default `zypper`
12624 /// patch rules.
12625 pub zypper: std::option::Option<crate::model::ZypperSettings>,
12626
12627 /// Windows update settings. Use this override the default windows patch rules.
12628 pub windows_update: std::option::Option<crate::model::WindowsUpdateSettings>,
12629
12630 /// The `ExecStep` to run before the patch update.
12631 pub pre_step: std::option::Option<crate::model::ExecStep>,
12632
12633 /// The `ExecStep` to run after the patch update.
12634 pub post_step: std::option::Option<crate::model::ExecStep>,
12635
12636 /// Allows the patch job to run on Managed instance groups (MIGs).
12637 pub mig_instances_allowed: bool,
12638
12639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12640}
12641
12642impl PatchConfig {
12643 /// Creates a new default instance.
12644 pub fn new() -> Self {
12645 std::default::Default::default()
12646 }
12647
12648 /// Sets the value of [reboot_config][crate::model::PatchConfig::reboot_config].
12649 ///
12650 /// # Example
12651 /// ```ignore,no_run
12652 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12653 /// use google_cloud_osconfig_v1::model::patch_config::RebootConfig;
12654 /// let x0 = PatchConfig::new().set_reboot_config(RebootConfig::Default);
12655 /// let x1 = PatchConfig::new().set_reboot_config(RebootConfig::Always);
12656 /// let x2 = PatchConfig::new().set_reboot_config(RebootConfig::Never);
12657 /// ```
12658 pub fn set_reboot_config<T: std::convert::Into<crate::model::patch_config::RebootConfig>>(
12659 mut self,
12660 v: T,
12661 ) -> Self {
12662 self.reboot_config = v.into();
12663 self
12664 }
12665
12666 /// Sets the value of [apt][crate::model::PatchConfig::apt].
12667 ///
12668 /// # Example
12669 /// ```ignore,no_run
12670 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12671 /// use google_cloud_osconfig_v1::model::AptSettings;
12672 /// let x = PatchConfig::new().set_apt(AptSettings::default()/* use setters */);
12673 /// ```
12674 pub fn set_apt<T>(mut self, v: T) -> Self
12675 where
12676 T: std::convert::Into<crate::model::AptSettings>,
12677 {
12678 self.apt = std::option::Option::Some(v.into());
12679 self
12680 }
12681
12682 /// Sets or clears the value of [apt][crate::model::PatchConfig::apt].
12683 ///
12684 /// # Example
12685 /// ```ignore,no_run
12686 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12687 /// use google_cloud_osconfig_v1::model::AptSettings;
12688 /// let x = PatchConfig::new().set_or_clear_apt(Some(AptSettings::default()/* use setters */));
12689 /// let x = PatchConfig::new().set_or_clear_apt(None::<AptSettings>);
12690 /// ```
12691 pub fn set_or_clear_apt<T>(mut self, v: std::option::Option<T>) -> Self
12692 where
12693 T: std::convert::Into<crate::model::AptSettings>,
12694 {
12695 self.apt = v.map(|x| x.into());
12696 self
12697 }
12698
12699 /// Sets the value of [yum][crate::model::PatchConfig::yum].
12700 ///
12701 /// # Example
12702 /// ```ignore,no_run
12703 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12704 /// use google_cloud_osconfig_v1::model::YumSettings;
12705 /// let x = PatchConfig::new().set_yum(YumSettings::default()/* use setters */);
12706 /// ```
12707 pub fn set_yum<T>(mut self, v: T) -> Self
12708 where
12709 T: std::convert::Into<crate::model::YumSettings>,
12710 {
12711 self.yum = std::option::Option::Some(v.into());
12712 self
12713 }
12714
12715 /// Sets or clears the value of [yum][crate::model::PatchConfig::yum].
12716 ///
12717 /// # Example
12718 /// ```ignore,no_run
12719 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12720 /// use google_cloud_osconfig_v1::model::YumSettings;
12721 /// let x = PatchConfig::new().set_or_clear_yum(Some(YumSettings::default()/* use setters */));
12722 /// let x = PatchConfig::new().set_or_clear_yum(None::<YumSettings>);
12723 /// ```
12724 pub fn set_or_clear_yum<T>(mut self, v: std::option::Option<T>) -> Self
12725 where
12726 T: std::convert::Into<crate::model::YumSettings>,
12727 {
12728 self.yum = v.map(|x| x.into());
12729 self
12730 }
12731
12732 /// Sets the value of [goo][crate::model::PatchConfig::goo].
12733 ///
12734 /// # Example
12735 /// ```ignore,no_run
12736 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12737 /// use google_cloud_osconfig_v1::model::GooSettings;
12738 /// let x = PatchConfig::new().set_goo(GooSettings::default()/* use setters */);
12739 /// ```
12740 pub fn set_goo<T>(mut self, v: T) -> Self
12741 where
12742 T: std::convert::Into<crate::model::GooSettings>,
12743 {
12744 self.goo = std::option::Option::Some(v.into());
12745 self
12746 }
12747
12748 /// Sets or clears the value of [goo][crate::model::PatchConfig::goo].
12749 ///
12750 /// # Example
12751 /// ```ignore,no_run
12752 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12753 /// use google_cloud_osconfig_v1::model::GooSettings;
12754 /// let x = PatchConfig::new().set_or_clear_goo(Some(GooSettings::default()/* use setters */));
12755 /// let x = PatchConfig::new().set_or_clear_goo(None::<GooSettings>);
12756 /// ```
12757 pub fn set_or_clear_goo<T>(mut self, v: std::option::Option<T>) -> Self
12758 where
12759 T: std::convert::Into<crate::model::GooSettings>,
12760 {
12761 self.goo = v.map(|x| x.into());
12762 self
12763 }
12764
12765 /// Sets the value of [zypper][crate::model::PatchConfig::zypper].
12766 ///
12767 /// # Example
12768 /// ```ignore,no_run
12769 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12770 /// use google_cloud_osconfig_v1::model::ZypperSettings;
12771 /// let x = PatchConfig::new().set_zypper(ZypperSettings::default()/* use setters */);
12772 /// ```
12773 pub fn set_zypper<T>(mut self, v: T) -> Self
12774 where
12775 T: std::convert::Into<crate::model::ZypperSettings>,
12776 {
12777 self.zypper = std::option::Option::Some(v.into());
12778 self
12779 }
12780
12781 /// Sets or clears the value of [zypper][crate::model::PatchConfig::zypper].
12782 ///
12783 /// # Example
12784 /// ```ignore,no_run
12785 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12786 /// use google_cloud_osconfig_v1::model::ZypperSettings;
12787 /// let x = PatchConfig::new().set_or_clear_zypper(Some(ZypperSettings::default()/* use setters */));
12788 /// let x = PatchConfig::new().set_or_clear_zypper(None::<ZypperSettings>);
12789 /// ```
12790 pub fn set_or_clear_zypper<T>(mut self, v: std::option::Option<T>) -> Self
12791 where
12792 T: std::convert::Into<crate::model::ZypperSettings>,
12793 {
12794 self.zypper = v.map(|x| x.into());
12795 self
12796 }
12797
12798 /// Sets the value of [windows_update][crate::model::PatchConfig::windows_update].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12803 /// use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
12804 /// let x = PatchConfig::new().set_windows_update(WindowsUpdateSettings::default()/* use setters */);
12805 /// ```
12806 pub fn set_windows_update<T>(mut self, v: T) -> Self
12807 where
12808 T: std::convert::Into<crate::model::WindowsUpdateSettings>,
12809 {
12810 self.windows_update = std::option::Option::Some(v.into());
12811 self
12812 }
12813
12814 /// Sets or clears the value of [windows_update][crate::model::PatchConfig::windows_update].
12815 ///
12816 /// # Example
12817 /// ```ignore,no_run
12818 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12819 /// use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
12820 /// let x = PatchConfig::new().set_or_clear_windows_update(Some(WindowsUpdateSettings::default()/* use setters */));
12821 /// let x = PatchConfig::new().set_or_clear_windows_update(None::<WindowsUpdateSettings>);
12822 /// ```
12823 pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
12824 where
12825 T: std::convert::Into<crate::model::WindowsUpdateSettings>,
12826 {
12827 self.windows_update = v.map(|x| x.into());
12828 self
12829 }
12830
12831 /// Sets the value of [pre_step][crate::model::PatchConfig::pre_step].
12832 ///
12833 /// # Example
12834 /// ```ignore,no_run
12835 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12836 /// use google_cloud_osconfig_v1::model::ExecStep;
12837 /// let x = PatchConfig::new().set_pre_step(ExecStep::default()/* use setters */);
12838 /// ```
12839 pub fn set_pre_step<T>(mut self, v: T) -> Self
12840 where
12841 T: std::convert::Into<crate::model::ExecStep>,
12842 {
12843 self.pre_step = std::option::Option::Some(v.into());
12844 self
12845 }
12846
12847 /// Sets or clears the value of [pre_step][crate::model::PatchConfig::pre_step].
12848 ///
12849 /// # Example
12850 /// ```ignore,no_run
12851 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12852 /// use google_cloud_osconfig_v1::model::ExecStep;
12853 /// let x = PatchConfig::new().set_or_clear_pre_step(Some(ExecStep::default()/* use setters */));
12854 /// let x = PatchConfig::new().set_or_clear_pre_step(None::<ExecStep>);
12855 /// ```
12856 pub fn set_or_clear_pre_step<T>(mut self, v: std::option::Option<T>) -> Self
12857 where
12858 T: std::convert::Into<crate::model::ExecStep>,
12859 {
12860 self.pre_step = v.map(|x| x.into());
12861 self
12862 }
12863
12864 /// Sets the value of [post_step][crate::model::PatchConfig::post_step].
12865 ///
12866 /// # Example
12867 /// ```ignore,no_run
12868 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12869 /// use google_cloud_osconfig_v1::model::ExecStep;
12870 /// let x = PatchConfig::new().set_post_step(ExecStep::default()/* use setters */);
12871 /// ```
12872 pub fn set_post_step<T>(mut self, v: T) -> Self
12873 where
12874 T: std::convert::Into<crate::model::ExecStep>,
12875 {
12876 self.post_step = std::option::Option::Some(v.into());
12877 self
12878 }
12879
12880 /// Sets or clears the value of [post_step][crate::model::PatchConfig::post_step].
12881 ///
12882 /// # Example
12883 /// ```ignore,no_run
12884 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12885 /// use google_cloud_osconfig_v1::model::ExecStep;
12886 /// let x = PatchConfig::new().set_or_clear_post_step(Some(ExecStep::default()/* use setters */));
12887 /// let x = PatchConfig::new().set_or_clear_post_step(None::<ExecStep>);
12888 /// ```
12889 pub fn set_or_clear_post_step<T>(mut self, v: std::option::Option<T>) -> Self
12890 where
12891 T: std::convert::Into<crate::model::ExecStep>,
12892 {
12893 self.post_step = v.map(|x| x.into());
12894 self
12895 }
12896
12897 /// Sets the value of [mig_instances_allowed][crate::model::PatchConfig::mig_instances_allowed].
12898 ///
12899 /// # Example
12900 /// ```ignore,no_run
12901 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12902 /// let x = PatchConfig::new().set_mig_instances_allowed(true);
12903 /// ```
12904 pub fn set_mig_instances_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12905 self.mig_instances_allowed = v.into();
12906 self
12907 }
12908}
12909
12910impl wkt::message::Message for PatchConfig {
12911 fn typename() -> &'static str {
12912 "type.googleapis.com/google.cloud.osconfig.v1.PatchConfig"
12913 }
12914}
12915
12916/// Defines additional types related to [PatchConfig].
12917pub mod patch_config {
12918 #[allow(unused_imports)]
12919 use super::*;
12920
12921 /// Post-patch reboot settings.
12922 ///
12923 /// # Working with unknown values
12924 ///
12925 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12926 /// additional enum variants at any time. Adding new variants is not considered
12927 /// a breaking change. Applications should write their code in anticipation of:
12928 ///
12929 /// - New values appearing in future releases of the client library, **and**
12930 /// - New values received dynamically, without application changes.
12931 ///
12932 /// Please consult the [Working with enums] section in the user guide for some
12933 /// guidelines.
12934 ///
12935 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12936 #[derive(Clone, Debug, PartialEq)]
12937 #[non_exhaustive]
12938 pub enum RebootConfig {
12939 /// The default behavior is DEFAULT.
12940 Unspecified,
12941 /// The agent decides if a reboot is necessary by checking signals such as
12942 /// registry keys on Windows or `/var/run/reboot-required` on APT based
12943 /// systems. On RPM based systems, a set of core system package install times
12944 /// are compared with system boot time.
12945 Default,
12946 /// Always reboot the machine after the update completes.
12947 Always,
12948 /// Never reboot the machine after the update completes.
12949 Never,
12950 /// If set, the enum was initialized with an unknown value.
12951 ///
12952 /// Applications can examine the value using [RebootConfig::value] or
12953 /// [RebootConfig::name].
12954 UnknownValue(reboot_config::UnknownValue),
12955 }
12956
12957 #[doc(hidden)]
12958 pub mod reboot_config {
12959 #[allow(unused_imports)]
12960 use super::*;
12961 #[derive(Clone, Debug, PartialEq)]
12962 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12963 }
12964
12965 impl RebootConfig {
12966 /// Gets the enum value.
12967 ///
12968 /// Returns `None` if the enum contains an unknown value deserialized from
12969 /// the string representation of enums.
12970 pub fn value(&self) -> std::option::Option<i32> {
12971 match self {
12972 Self::Unspecified => std::option::Option::Some(0),
12973 Self::Default => std::option::Option::Some(1),
12974 Self::Always => std::option::Option::Some(2),
12975 Self::Never => std::option::Option::Some(3),
12976 Self::UnknownValue(u) => u.0.value(),
12977 }
12978 }
12979
12980 /// Gets the enum value as a string.
12981 ///
12982 /// Returns `None` if the enum contains an unknown value deserialized from
12983 /// the integer representation of enums.
12984 pub fn name(&self) -> std::option::Option<&str> {
12985 match self {
12986 Self::Unspecified => std::option::Option::Some("REBOOT_CONFIG_UNSPECIFIED"),
12987 Self::Default => std::option::Option::Some("DEFAULT"),
12988 Self::Always => std::option::Option::Some("ALWAYS"),
12989 Self::Never => std::option::Option::Some("NEVER"),
12990 Self::UnknownValue(u) => u.0.name(),
12991 }
12992 }
12993 }
12994
12995 impl std::default::Default for RebootConfig {
12996 fn default() -> Self {
12997 use std::convert::From;
12998 Self::from(0)
12999 }
13000 }
13001
13002 impl std::fmt::Display for RebootConfig {
13003 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13004 wkt::internal::display_enum(f, self.name(), self.value())
13005 }
13006 }
13007
13008 impl std::convert::From<i32> for RebootConfig {
13009 fn from(value: i32) -> Self {
13010 match value {
13011 0 => Self::Unspecified,
13012 1 => Self::Default,
13013 2 => Self::Always,
13014 3 => Self::Never,
13015 _ => Self::UnknownValue(reboot_config::UnknownValue(
13016 wkt::internal::UnknownEnumValue::Integer(value),
13017 )),
13018 }
13019 }
13020 }
13021
13022 impl std::convert::From<&str> for RebootConfig {
13023 fn from(value: &str) -> Self {
13024 use std::string::ToString;
13025 match value {
13026 "REBOOT_CONFIG_UNSPECIFIED" => Self::Unspecified,
13027 "DEFAULT" => Self::Default,
13028 "ALWAYS" => Self::Always,
13029 "NEVER" => Self::Never,
13030 _ => Self::UnknownValue(reboot_config::UnknownValue(
13031 wkt::internal::UnknownEnumValue::String(value.to_string()),
13032 )),
13033 }
13034 }
13035 }
13036
13037 impl serde::ser::Serialize for RebootConfig {
13038 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13039 where
13040 S: serde::Serializer,
13041 {
13042 match self {
13043 Self::Unspecified => serializer.serialize_i32(0),
13044 Self::Default => serializer.serialize_i32(1),
13045 Self::Always => serializer.serialize_i32(2),
13046 Self::Never => serializer.serialize_i32(3),
13047 Self::UnknownValue(u) => u.0.serialize(serializer),
13048 }
13049 }
13050 }
13051
13052 impl<'de> serde::de::Deserialize<'de> for RebootConfig {
13053 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13054 where
13055 D: serde::Deserializer<'de>,
13056 {
13057 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RebootConfig>::new(
13058 ".google.cloud.osconfig.v1.PatchConfig.RebootConfig",
13059 ))
13060 }
13061 }
13062}
13063
13064/// Namespace for instance state enums.
13065#[derive(Clone, Default, PartialEq)]
13066#[non_exhaustive]
13067pub struct Instance {
13068 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13069}
13070
13071impl Instance {
13072 /// Creates a new default instance.
13073 pub fn new() -> Self {
13074 std::default::Default::default()
13075 }
13076}
13077
13078impl wkt::message::Message for Instance {
13079 fn typename() -> &'static str {
13080 "type.googleapis.com/google.cloud.osconfig.v1.Instance"
13081 }
13082}
13083
13084/// Defines additional types related to [Instance].
13085pub mod instance {
13086 #[allow(unused_imports)]
13087 use super::*;
13088
13089 /// Patch state of an instance.
13090 ///
13091 /// # Working with unknown values
13092 ///
13093 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13094 /// additional enum variants at any time. Adding new variants is not considered
13095 /// a breaking change. Applications should write their code in anticipation of:
13096 ///
13097 /// - New values appearing in future releases of the client library, **and**
13098 /// - New values received dynamically, without application changes.
13099 ///
13100 /// Please consult the [Working with enums] section in the user guide for some
13101 /// guidelines.
13102 ///
13103 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13104 #[derive(Clone, Debug, PartialEq)]
13105 #[non_exhaustive]
13106 pub enum PatchState {
13107 /// Unspecified.
13108 Unspecified,
13109 /// The instance is not yet notified.
13110 Pending,
13111 /// Instance is inactive and cannot be patched.
13112 Inactive,
13113 /// The instance is notified that it should be patched.
13114 Notified,
13115 /// The instance has started the patching process.
13116 Started,
13117 /// The instance is downloading patches.
13118 DownloadingPatches,
13119 /// The instance is applying patches.
13120 ApplyingPatches,
13121 /// The instance is rebooting.
13122 Rebooting,
13123 /// The instance has completed applying patches.
13124 Succeeded,
13125 /// The instance has completed applying patches but a reboot is required.
13126 SucceededRebootRequired,
13127 /// The instance has failed to apply the patch.
13128 Failed,
13129 /// The instance acked the notification and will start shortly.
13130 Acked,
13131 /// The instance exceeded the time out while applying the patch.
13132 TimedOut,
13133 /// The instance is running the pre-patch step.
13134 RunningPrePatchStep,
13135 /// The instance is running the post-patch step.
13136 RunningPostPatchStep,
13137 /// The service could not detect the presence of the agent. Check to ensure
13138 /// that the agent is installed, running, and able to communicate with the
13139 /// service.
13140 NoAgentDetected,
13141 /// If set, the enum was initialized with an unknown value.
13142 ///
13143 /// Applications can examine the value using [PatchState::value] or
13144 /// [PatchState::name].
13145 UnknownValue(patch_state::UnknownValue),
13146 }
13147
13148 #[doc(hidden)]
13149 pub mod patch_state {
13150 #[allow(unused_imports)]
13151 use super::*;
13152 #[derive(Clone, Debug, PartialEq)]
13153 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13154 }
13155
13156 impl PatchState {
13157 /// Gets the enum value.
13158 ///
13159 /// Returns `None` if the enum contains an unknown value deserialized from
13160 /// the string representation of enums.
13161 pub fn value(&self) -> std::option::Option<i32> {
13162 match self {
13163 Self::Unspecified => std::option::Option::Some(0),
13164 Self::Pending => std::option::Option::Some(1),
13165 Self::Inactive => std::option::Option::Some(2),
13166 Self::Notified => std::option::Option::Some(3),
13167 Self::Started => std::option::Option::Some(4),
13168 Self::DownloadingPatches => std::option::Option::Some(5),
13169 Self::ApplyingPatches => std::option::Option::Some(6),
13170 Self::Rebooting => std::option::Option::Some(7),
13171 Self::Succeeded => std::option::Option::Some(8),
13172 Self::SucceededRebootRequired => std::option::Option::Some(9),
13173 Self::Failed => std::option::Option::Some(10),
13174 Self::Acked => std::option::Option::Some(11),
13175 Self::TimedOut => std::option::Option::Some(12),
13176 Self::RunningPrePatchStep => std::option::Option::Some(13),
13177 Self::RunningPostPatchStep => std::option::Option::Some(14),
13178 Self::NoAgentDetected => std::option::Option::Some(15),
13179 Self::UnknownValue(u) => u.0.value(),
13180 }
13181 }
13182
13183 /// Gets the enum value as a string.
13184 ///
13185 /// Returns `None` if the enum contains an unknown value deserialized from
13186 /// the integer representation of enums.
13187 pub fn name(&self) -> std::option::Option<&str> {
13188 match self {
13189 Self::Unspecified => std::option::Option::Some("PATCH_STATE_UNSPECIFIED"),
13190 Self::Pending => std::option::Option::Some("PENDING"),
13191 Self::Inactive => std::option::Option::Some("INACTIVE"),
13192 Self::Notified => std::option::Option::Some("NOTIFIED"),
13193 Self::Started => std::option::Option::Some("STARTED"),
13194 Self::DownloadingPatches => std::option::Option::Some("DOWNLOADING_PATCHES"),
13195 Self::ApplyingPatches => std::option::Option::Some("APPLYING_PATCHES"),
13196 Self::Rebooting => std::option::Option::Some("REBOOTING"),
13197 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
13198 Self::SucceededRebootRequired => {
13199 std::option::Option::Some("SUCCEEDED_REBOOT_REQUIRED")
13200 }
13201 Self::Failed => std::option::Option::Some("FAILED"),
13202 Self::Acked => std::option::Option::Some("ACKED"),
13203 Self::TimedOut => std::option::Option::Some("TIMED_OUT"),
13204 Self::RunningPrePatchStep => std::option::Option::Some("RUNNING_PRE_PATCH_STEP"),
13205 Self::RunningPostPatchStep => std::option::Option::Some("RUNNING_POST_PATCH_STEP"),
13206 Self::NoAgentDetected => std::option::Option::Some("NO_AGENT_DETECTED"),
13207 Self::UnknownValue(u) => u.0.name(),
13208 }
13209 }
13210 }
13211
13212 impl std::default::Default for PatchState {
13213 fn default() -> Self {
13214 use std::convert::From;
13215 Self::from(0)
13216 }
13217 }
13218
13219 impl std::fmt::Display for PatchState {
13220 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13221 wkt::internal::display_enum(f, self.name(), self.value())
13222 }
13223 }
13224
13225 impl std::convert::From<i32> for PatchState {
13226 fn from(value: i32) -> Self {
13227 match value {
13228 0 => Self::Unspecified,
13229 1 => Self::Pending,
13230 2 => Self::Inactive,
13231 3 => Self::Notified,
13232 4 => Self::Started,
13233 5 => Self::DownloadingPatches,
13234 6 => Self::ApplyingPatches,
13235 7 => Self::Rebooting,
13236 8 => Self::Succeeded,
13237 9 => Self::SucceededRebootRequired,
13238 10 => Self::Failed,
13239 11 => Self::Acked,
13240 12 => Self::TimedOut,
13241 13 => Self::RunningPrePatchStep,
13242 14 => Self::RunningPostPatchStep,
13243 15 => Self::NoAgentDetected,
13244 _ => Self::UnknownValue(patch_state::UnknownValue(
13245 wkt::internal::UnknownEnumValue::Integer(value),
13246 )),
13247 }
13248 }
13249 }
13250
13251 impl std::convert::From<&str> for PatchState {
13252 fn from(value: &str) -> Self {
13253 use std::string::ToString;
13254 match value {
13255 "PATCH_STATE_UNSPECIFIED" => Self::Unspecified,
13256 "PENDING" => Self::Pending,
13257 "INACTIVE" => Self::Inactive,
13258 "NOTIFIED" => Self::Notified,
13259 "STARTED" => Self::Started,
13260 "DOWNLOADING_PATCHES" => Self::DownloadingPatches,
13261 "APPLYING_PATCHES" => Self::ApplyingPatches,
13262 "REBOOTING" => Self::Rebooting,
13263 "SUCCEEDED" => Self::Succeeded,
13264 "SUCCEEDED_REBOOT_REQUIRED" => Self::SucceededRebootRequired,
13265 "FAILED" => Self::Failed,
13266 "ACKED" => Self::Acked,
13267 "TIMED_OUT" => Self::TimedOut,
13268 "RUNNING_PRE_PATCH_STEP" => Self::RunningPrePatchStep,
13269 "RUNNING_POST_PATCH_STEP" => Self::RunningPostPatchStep,
13270 "NO_AGENT_DETECTED" => Self::NoAgentDetected,
13271 _ => Self::UnknownValue(patch_state::UnknownValue(
13272 wkt::internal::UnknownEnumValue::String(value.to_string()),
13273 )),
13274 }
13275 }
13276 }
13277
13278 impl serde::ser::Serialize for PatchState {
13279 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13280 where
13281 S: serde::Serializer,
13282 {
13283 match self {
13284 Self::Unspecified => serializer.serialize_i32(0),
13285 Self::Pending => serializer.serialize_i32(1),
13286 Self::Inactive => serializer.serialize_i32(2),
13287 Self::Notified => serializer.serialize_i32(3),
13288 Self::Started => serializer.serialize_i32(4),
13289 Self::DownloadingPatches => serializer.serialize_i32(5),
13290 Self::ApplyingPatches => serializer.serialize_i32(6),
13291 Self::Rebooting => serializer.serialize_i32(7),
13292 Self::Succeeded => serializer.serialize_i32(8),
13293 Self::SucceededRebootRequired => serializer.serialize_i32(9),
13294 Self::Failed => serializer.serialize_i32(10),
13295 Self::Acked => serializer.serialize_i32(11),
13296 Self::TimedOut => serializer.serialize_i32(12),
13297 Self::RunningPrePatchStep => serializer.serialize_i32(13),
13298 Self::RunningPostPatchStep => serializer.serialize_i32(14),
13299 Self::NoAgentDetected => serializer.serialize_i32(15),
13300 Self::UnknownValue(u) => u.0.serialize(serializer),
13301 }
13302 }
13303 }
13304
13305 impl<'de> serde::de::Deserialize<'de> for PatchState {
13306 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13307 where
13308 D: serde::Deserializer<'de>,
13309 {
13310 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PatchState>::new(
13311 ".google.cloud.osconfig.v1.Instance.PatchState",
13312 ))
13313 }
13314 }
13315}
13316
13317/// Message for canceling a patch job.
13318#[derive(Clone, Default, PartialEq)]
13319#[non_exhaustive]
13320pub struct CancelPatchJobRequest {
13321 /// Required. Name of the patch in the form `projects/*/patchJobs/*`
13322 pub name: std::string::String,
13323
13324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13325}
13326
13327impl CancelPatchJobRequest {
13328 /// Creates a new default instance.
13329 pub fn new() -> Self {
13330 std::default::Default::default()
13331 }
13332
13333 /// Sets the value of [name][crate::model::CancelPatchJobRequest::name].
13334 ///
13335 /// # Example
13336 /// ```ignore,no_run
13337 /// # use google_cloud_osconfig_v1::model::CancelPatchJobRequest;
13338 /// let x = CancelPatchJobRequest::new().set_name("example");
13339 /// ```
13340 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13341 self.name = v.into();
13342 self
13343 }
13344}
13345
13346impl wkt::message::Message for CancelPatchJobRequest {
13347 fn typename() -> &'static str {
13348 "type.googleapis.com/google.cloud.osconfig.v1.CancelPatchJobRequest"
13349 }
13350}
13351
13352/// Apt patching is completed by executing `apt-get update && apt-get
13353/// upgrade`. Additional options can be set to control how this is executed.
13354#[derive(Clone, Default, PartialEq)]
13355#[non_exhaustive]
13356pub struct AptSettings {
13357 /// By changing the type to DIST, the patching is performed
13358 /// using `apt-get dist-upgrade` instead.
13359 pub r#type: crate::model::apt_settings::Type,
13360
13361 /// List of packages to exclude from update. These packages will be excluded
13362 pub excludes: std::vec::Vec<std::string::String>,
13363
13364 /// An exclusive list of packages to be updated. These are the only packages
13365 /// that will be updated. If these packages are not installed, they will be
13366 /// ignored. This field cannot be specified with any other patch configuration
13367 /// fields.
13368 pub exclusive_packages: std::vec::Vec<std::string::String>,
13369
13370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13371}
13372
13373impl AptSettings {
13374 /// Creates a new default instance.
13375 pub fn new() -> Self {
13376 std::default::Default::default()
13377 }
13378
13379 /// Sets the value of [r#type][crate::model::AptSettings::type].
13380 ///
13381 /// # Example
13382 /// ```ignore,no_run
13383 /// # use google_cloud_osconfig_v1::model::AptSettings;
13384 /// use google_cloud_osconfig_v1::model::apt_settings::Type;
13385 /// let x0 = AptSettings::new().set_type(Type::Dist);
13386 /// let x1 = AptSettings::new().set_type(Type::Upgrade);
13387 /// ```
13388 pub fn set_type<T: std::convert::Into<crate::model::apt_settings::Type>>(
13389 mut self,
13390 v: T,
13391 ) -> Self {
13392 self.r#type = v.into();
13393 self
13394 }
13395
13396 /// Sets the value of [excludes][crate::model::AptSettings::excludes].
13397 ///
13398 /// # Example
13399 /// ```ignore,no_run
13400 /// # use google_cloud_osconfig_v1::model::AptSettings;
13401 /// let x = AptSettings::new().set_excludes(["a", "b", "c"]);
13402 /// ```
13403 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13404 where
13405 T: std::iter::IntoIterator<Item = V>,
13406 V: std::convert::Into<std::string::String>,
13407 {
13408 use std::iter::Iterator;
13409 self.excludes = v.into_iter().map(|i| i.into()).collect();
13410 self
13411 }
13412
13413 /// Sets the value of [exclusive_packages][crate::model::AptSettings::exclusive_packages].
13414 ///
13415 /// # Example
13416 /// ```ignore,no_run
13417 /// # use google_cloud_osconfig_v1::model::AptSettings;
13418 /// let x = AptSettings::new().set_exclusive_packages(["a", "b", "c"]);
13419 /// ```
13420 pub fn set_exclusive_packages<T, V>(mut self, v: T) -> Self
13421 where
13422 T: std::iter::IntoIterator<Item = V>,
13423 V: std::convert::Into<std::string::String>,
13424 {
13425 use std::iter::Iterator;
13426 self.exclusive_packages = v.into_iter().map(|i| i.into()).collect();
13427 self
13428 }
13429}
13430
13431impl wkt::message::Message for AptSettings {
13432 fn typename() -> &'static str {
13433 "type.googleapis.com/google.cloud.osconfig.v1.AptSettings"
13434 }
13435}
13436
13437/// Defines additional types related to [AptSettings].
13438pub mod apt_settings {
13439 #[allow(unused_imports)]
13440 use super::*;
13441
13442 /// Apt patch type.
13443 ///
13444 /// # Working with unknown values
13445 ///
13446 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13447 /// additional enum variants at any time. Adding new variants is not considered
13448 /// a breaking change. Applications should write their code in anticipation of:
13449 ///
13450 /// - New values appearing in future releases of the client library, **and**
13451 /// - New values received dynamically, without application changes.
13452 ///
13453 /// Please consult the [Working with enums] section in the user guide for some
13454 /// guidelines.
13455 ///
13456 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13457 #[derive(Clone, Debug, PartialEq)]
13458 #[non_exhaustive]
13459 pub enum Type {
13460 /// By default, upgrade will be performed.
13461 Unspecified,
13462 /// Runs `apt-get dist-upgrade`.
13463 Dist,
13464 /// Runs `apt-get upgrade`.
13465 Upgrade,
13466 /// If set, the enum was initialized with an unknown value.
13467 ///
13468 /// Applications can examine the value using [Type::value] or
13469 /// [Type::name].
13470 UnknownValue(r#type::UnknownValue),
13471 }
13472
13473 #[doc(hidden)]
13474 pub mod r#type {
13475 #[allow(unused_imports)]
13476 use super::*;
13477 #[derive(Clone, Debug, PartialEq)]
13478 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13479 }
13480
13481 impl Type {
13482 /// Gets the enum value.
13483 ///
13484 /// Returns `None` if the enum contains an unknown value deserialized from
13485 /// the string representation of enums.
13486 pub fn value(&self) -> std::option::Option<i32> {
13487 match self {
13488 Self::Unspecified => std::option::Option::Some(0),
13489 Self::Dist => std::option::Option::Some(1),
13490 Self::Upgrade => std::option::Option::Some(2),
13491 Self::UnknownValue(u) => u.0.value(),
13492 }
13493 }
13494
13495 /// Gets the enum value as a string.
13496 ///
13497 /// Returns `None` if the enum contains an unknown value deserialized from
13498 /// the integer representation of enums.
13499 pub fn name(&self) -> std::option::Option<&str> {
13500 match self {
13501 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
13502 Self::Dist => std::option::Option::Some("DIST"),
13503 Self::Upgrade => std::option::Option::Some("UPGRADE"),
13504 Self::UnknownValue(u) => u.0.name(),
13505 }
13506 }
13507 }
13508
13509 impl std::default::Default for Type {
13510 fn default() -> Self {
13511 use std::convert::From;
13512 Self::from(0)
13513 }
13514 }
13515
13516 impl std::fmt::Display for Type {
13517 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13518 wkt::internal::display_enum(f, self.name(), self.value())
13519 }
13520 }
13521
13522 impl std::convert::From<i32> for Type {
13523 fn from(value: i32) -> Self {
13524 match value {
13525 0 => Self::Unspecified,
13526 1 => Self::Dist,
13527 2 => Self::Upgrade,
13528 _ => Self::UnknownValue(r#type::UnknownValue(
13529 wkt::internal::UnknownEnumValue::Integer(value),
13530 )),
13531 }
13532 }
13533 }
13534
13535 impl std::convert::From<&str> for Type {
13536 fn from(value: &str) -> Self {
13537 use std::string::ToString;
13538 match value {
13539 "TYPE_UNSPECIFIED" => Self::Unspecified,
13540 "DIST" => Self::Dist,
13541 "UPGRADE" => Self::Upgrade,
13542 _ => Self::UnknownValue(r#type::UnknownValue(
13543 wkt::internal::UnknownEnumValue::String(value.to_string()),
13544 )),
13545 }
13546 }
13547 }
13548
13549 impl serde::ser::Serialize for Type {
13550 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13551 where
13552 S: serde::Serializer,
13553 {
13554 match self {
13555 Self::Unspecified => serializer.serialize_i32(0),
13556 Self::Dist => serializer.serialize_i32(1),
13557 Self::Upgrade => serializer.serialize_i32(2),
13558 Self::UnknownValue(u) => u.0.serialize(serializer),
13559 }
13560 }
13561 }
13562
13563 impl<'de> serde::de::Deserialize<'de> for Type {
13564 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13565 where
13566 D: serde::Deserializer<'de>,
13567 {
13568 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
13569 ".google.cloud.osconfig.v1.AptSettings.Type",
13570 ))
13571 }
13572 }
13573}
13574
13575/// Yum patching is performed by executing `yum update`. Additional options
13576/// can be set to control how this is executed.
13577///
13578/// Note that not all settings are supported on all platforms.
13579#[derive(Clone, Default, PartialEq)]
13580#[non_exhaustive]
13581pub struct YumSettings {
13582 /// Adds the `--security` flag to `yum update`. Not supported on
13583 /// all platforms.
13584 pub security: bool,
13585
13586 /// Will cause patch to run `yum update-minimal` instead.
13587 pub minimal: bool,
13588
13589 /// List of packages to exclude from update. These packages are excluded by
13590 /// using the yum `--exclude` flag.
13591 pub excludes: std::vec::Vec<std::string::String>,
13592
13593 /// An exclusive list of packages to be updated. These are the only packages
13594 /// that will be updated. If these packages are not installed, they will be
13595 /// ignored. This field must not be specified with any other patch
13596 /// configuration fields.
13597 pub exclusive_packages: std::vec::Vec<std::string::String>,
13598
13599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13600}
13601
13602impl YumSettings {
13603 /// Creates a new default instance.
13604 pub fn new() -> Self {
13605 std::default::Default::default()
13606 }
13607
13608 /// Sets the value of [security][crate::model::YumSettings::security].
13609 ///
13610 /// # Example
13611 /// ```ignore,no_run
13612 /// # use google_cloud_osconfig_v1::model::YumSettings;
13613 /// let x = YumSettings::new().set_security(true);
13614 /// ```
13615 pub fn set_security<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13616 self.security = v.into();
13617 self
13618 }
13619
13620 /// Sets the value of [minimal][crate::model::YumSettings::minimal].
13621 ///
13622 /// # Example
13623 /// ```ignore,no_run
13624 /// # use google_cloud_osconfig_v1::model::YumSettings;
13625 /// let x = YumSettings::new().set_minimal(true);
13626 /// ```
13627 pub fn set_minimal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13628 self.minimal = v.into();
13629 self
13630 }
13631
13632 /// Sets the value of [excludes][crate::model::YumSettings::excludes].
13633 ///
13634 /// # Example
13635 /// ```ignore,no_run
13636 /// # use google_cloud_osconfig_v1::model::YumSettings;
13637 /// let x = YumSettings::new().set_excludes(["a", "b", "c"]);
13638 /// ```
13639 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13640 where
13641 T: std::iter::IntoIterator<Item = V>,
13642 V: std::convert::Into<std::string::String>,
13643 {
13644 use std::iter::Iterator;
13645 self.excludes = v.into_iter().map(|i| i.into()).collect();
13646 self
13647 }
13648
13649 /// Sets the value of [exclusive_packages][crate::model::YumSettings::exclusive_packages].
13650 ///
13651 /// # Example
13652 /// ```ignore,no_run
13653 /// # use google_cloud_osconfig_v1::model::YumSettings;
13654 /// let x = YumSettings::new().set_exclusive_packages(["a", "b", "c"]);
13655 /// ```
13656 pub fn set_exclusive_packages<T, V>(mut self, v: T) -> Self
13657 where
13658 T: std::iter::IntoIterator<Item = V>,
13659 V: std::convert::Into<std::string::String>,
13660 {
13661 use std::iter::Iterator;
13662 self.exclusive_packages = v.into_iter().map(|i| i.into()).collect();
13663 self
13664 }
13665}
13666
13667impl wkt::message::Message for YumSettings {
13668 fn typename() -> &'static str {
13669 "type.googleapis.com/google.cloud.osconfig.v1.YumSettings"
13670 }
13671}
13672
13673/// Googet patching is performed by running `googet update`.
13674#[derive(Clone, Default, PartialEq)]
13675#[non_exhaustive]
13676pub struct GooSettings {
13677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13678}
13679
13680impl GooSettings {
13681 /// Creates a new default instance.
13682 pub fn new() -> Self {
13683 std::default::Default::default()
13684 }
13685}
13686
13687impl wkt::message::Message for GooSettings {
13688 fn typename() -> &'static str {
13689 "type.googleapis.com/google.cloud.osconfig.v1.GooSettings"
13690 }
13691}
13692
13693/// Zypper patching is performed by running `zypper patch`.
13694/// See also <https://en.opensuse.org/SDB:Zypper_manual>.
13695#[derive(Clone, Default, PartialEq)]
13696#[non_exhaustive]
13697pub struct ZypperSettings {
13698 /// Adds the `--with-optional` flag to `zypper patch`.
13699 pub with_optional: bool,
13700
13701 /// Adds the `--with-update` flag, to `zypper patch`.
13702 pub with_update: bool,
13703
13704 /// Install only patches with these categories.
13705 /// Common categories include security, recommended, and feature.
13706 pub categories: std::vec::Vec<std::string::String>,
13707
13708 /// Install only patches with these severities.
13709 /// Common severities include critical, important, moderate, and low.
13710 pub severities: std::vec::Vec<std::string::String>,
13711
13712 /// List of patches to exclude from update.
13713 pub excludes: std::vec::Vec<std::string::String>,
13714
13715 /// An exclusive list of patches to be updated. These are the only patches
13716 /// that will be installed using 'zypper patch patch:<patch_name>' command.
13717 /// This field must not be used with any other patch configuration fields.
13718 pub exclusive_patches: std::vec::Vec<std::string::String>,
13719
13720 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13721}
13722
13723impl ZypperSettings {
13724 /// Creates a new default instance.
13725 pub fn new() -> Self {
13726 std::default::Default::default()
13727 }
13728
13729 /// Sets the value of [with_optional][crate::model::ZypperSettings::with_optional].
13730 ///
13731 /// # Example
13732 /// ```ignore,no_run
13733 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13734 /// let x = ZypperSettings::new().set_with_optional(true);
13735 /// ```
13736 pub fn set_with_optional<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13737 self.with_optional = v.into();
13738 self
13739 }
13740
13741 /// Sets the value of [with_update][crate::model::ZypperSettings::with_update].
13742 ///
13743 /// # Example
13744 /// ```ignore,no_run
13745 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13746 /// let x = ZypperSettings::new().set_with_update(true);
13747 /// ```
13748 pub fn set_with_update<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13749 self.with_update = v.into();
13750 self
13751 }
13752
13753 /// Sets the value of [categories][crate::model::ZypperSettings::categories].
13754 ///
13755 /// # Example
13756 /// ```ignore,no_run
13757 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13758 /// let x = ZypperSettings::new().set_categories(["a", "b", "c"]);
13759 /// ```
13760 pub fn set_categories<T, V>(mut self, v: T) -> Self
13761 where
13762 T: std::iter::IntoIterator<Item = V>,
13763 V: std::convert::Into<std::string::String>,
13764 {
13765 use std::iter::Iterator;
13766 self.categories = v.into_iter().map(|i| i.into()).collect();
13767 self
13768 }
13769
13770 /// Sets the value of [severities][crate::model::ZypperSettings::severities].
13771 ///
13772 /// # Example
13773 /// ```ignore,no_run
13774 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13775 /// let x = ZypperSettings::new().set_severities(["a", "b", "c"]);
13776 /// ```
13777 pub fn set_severities<T, V>(mut self, v: T) -> Self
13778 where
13779 T: std::iter::IntoIterator<Item = V>,
13780 V: std::convert::Into<std::string::String>,
13781 {
13782 use std::iter::Iterator;
13783 self.severities = v.into_iter().map(|i| i.into()).collect();
13784 self
13785 }
13786
13787 /// Sets the value of [excludes][crate::model::ZypperSettings::excludes].
13788 ///
13789 /// # Example
13790 /// ```ignore,no_run
13791 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13792 /// let x = ZypperSettings::new().set_excludes(["a", "b", "c"]);
13793 /// ```
13794 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13795 where
13796 T: std::iter::IntoIterator<Item = V>,
13797 V: std::convert::Into<std::string::String>,
13798 {
13799 use std::iter::Iterator;
13800 self.excludes = v.into_iter().map(|i| i.into()).collect();
13801 self
13802 }
13803
13804 /// Sets the value of [exclusive_patches][crate::model::ZypperSettings::exclusive_patches].
13805 ///
13806 /// # Example
13807 /// ```ignore,no_run
13808 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13809 /// let x = ZypperSettings::new().set_exclusive_patches(["a", "b", "c"]);
13810 /// ```
13811 pub fn set_exclusive_patches<T, V>(mut self, v: T) -> Self
13812 where
13813 T: std::iter::IntoIterator<Item = V>,
13814 V: std::convert::Into<std::string::String>,
13815 {
13816 use std::iter::Iterator;
13817 self.exclusive_patches = v.into_iter().map(|i| i.into()).collect();
13818 self
13819 }
13820}
13821
13822impl wkt::message::Message for ZypperSettings {
13823 fn typename() -> &'static str {
13824 "type.googleapis.com/google.cloud.osconfig.v1.ZypperSettings"
13825 }
13826}
13827
13828/// Windows patching is performed using the Windows Update Agent.
13829#[derive(Clone, Default, PartialEq)]
13830#[non_exhaustive]
13831pub struct WindowsUpdateSettings {
13832 /// Only apply updates of these windows update classifications. If empty, all
13833 /// updates are applied.
13834 pub classifications: std::vec::Vec<crate::model::windows_update_settings::Classification>,
13835
13836 /// List of KBs to exclude from update.
13837 pub excludes: std::vec::Vec<std::string::String>,
13838
13839 /// An exclusive list of kbs to be updated. These are the only patches
13840 /// that will be updated. This field must not be used with other
13841 /// patch configurations.
13842 pub exclusive_patches: std::vec::Vec<std::string::String>,
13843
13844 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13845}
13846
13847impl WindowsUpdateSettings {
13848 /// Creates a new default instance.
13849 pub fn new() -> Self {
13850 std::default::Default::default()
13851 }
13852
13853 /// Sets the value of [classifications][crate::model::WindowsUpdateSettings::classifications].
13854 ///
13855 /// # Example
13856 /// ```ignore,no_run
13857 /// # use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
13858 /// use google_cloud_osconfig_v1::model::windows_update_settings::Classification;
13859 /// let x = WindowsUpdateSettings::new().set_classifications([
13860 /// Classification::Critical,
13861 /// Classification::Security,
13862 /// Classification::Definition,
13863 /// ]);
13864 /// ```
13865 pub fn set_classifications<T, V>(mut self, v: T) -> Self
13866 where
13867 T: std::iter::IntoIterator<Item = V>,
13868 V: std::convert::Into<crate::model::windows_update_settings::Classification>,
13869 {
13870 use std::iter::Iterator;
13871 self.classifications = v.into_iter().map(|i| i.into()).collect();
13872 self
13873 }
13874
13875 /// Sets the value of [excludes][crate::model::WindowsUpdateSettings::excludes].
13876 ///
13877 /// # Example
13878 /// ```ignore,no_run
13879 /// # use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
13880 /// let x = WindowsUpdateSettings::new().set_excludes(["a", "b", "c"]);
13881 /// ```
13882 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13883 where
13884 T: std::iter::IntoIterator<Item = V>,
13885 V: std::convert::Into<std::string::String>,
13886 {
13887 use std::iter::Iterator;
13888 self.excludes = v.into_iter().map(|i| i.into()).collect();
13889 self
13890 }
13891
13892 /// Sets the value of [exclusive_patches][crate::model::WindowsUpdateSettings::exclusive_patches].
13893 ///
13894 /// # Example
13895 /// ```ignore,no_run
13896 /// # use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
13897 /// let x = WindowsUpdateSettings::new().set_exclusive_patches(["a", "b", "c"]);
13898 /// ```
13899 pub fn set_exclusive_patches<T, V>(mut self, v: T) -> Self
13900 where
13901 T: std::iter::IntoIterator<Item = V>,
13902 V: std::convert::Into<std::string::String>,
13903 {
13904 use std::iter::Iterator;
13905 self.exclusive_patches = v.into_iter().map(|i| i.into()).collect();
13906 self
13907 }
13908}
13909
13910impl wkt::message::Message for WindowsUpdateSettings {
13911 fn typename() -> &'static str {
13912 "type.googleapis.com/google.cloud.osconfig.v1.WindowsUpdateSettings"
13913 }
13914}
13915
13916/// Defines additional types related to [WindowsUpdateSettings].
13917pub mod windows_update_settings {
13918 #[allow(unused_imports)]
13919 use super::*;
13920
13921 /// Microsoft Windows update classifications as defined in
13922 /// [1]
13923 /// <https://support.microsoft.com/en-us/help/824684/description-of-the-standard-terminology-that-is-used-to-describe-micro>
13924 ///
13925 /// # Working with unknown values
13926 ///
13927 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13928 /// additional enum variants at any time. Adding new variants is not considered
13929 /// a breaking change. Applications should write their code in anticipation of:
13930 ///
13931 /// - New values appearing in future releases of the client library, **and**
13932 /// - New values received dynamically, without application changes.
13933 ///
13934 /// Please consult the [Working with enums] section in the user guide for some
13935 /// guidelines.
13936 ///
13937 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13938 #[derive(Clone, Debug, PartialEq)]
13939 #[non_exhaustive]
13940 pub enum Classification {
13941 /// Invalid. If classifications are included, they must be specified.
13942 Unspecified,
13943 /// "A widely released fix for a specific problem that addresses a critical,
13944 /// non-security-related bug." [1]
13945 Critical,
13946 /// "A widely released fix for a product-specific, security-related
13947 /// vulnerability. Security vulnerabilities are rated by their severity. The
13948 /// severity rating is indicated in the Microsoft security bulletin as
13949 /// critical, important, moderate, or low." [1]
13950 Security,
13951 /// "A widely released and frequent software update that contains additions
13952 /// to a product's definition database. Definition databases are often used
13953 /// to detect objects that have specific attributes, such as malicious code,
13954 /// phishing websites, or junk mail." [1]
13955 Definition,
13956 /// "Software that controls the input and output of a device." [1]
13957 Driver,
13958 /// "New product functionality that is first distributed outside the context
13959 /// of a product release and that is typically included in the next full
13960 /// product release." [1]
13961 FeaturePack,
13962 /// "A tested, cumulative set of all hotfixes, security updates, critical
13963 /// updates, and updates. Additionally, service packs may contain additional
13964 /// fixes for problems that are found internally since the release of the
13965 /// product. Service packs my also contain a limited number of
13966 /// customer-requested design changes or features." [1]
13967 ServicePack,
13968 /// "A utility or feature that helps complete a task or set of tasks." [1]
13969 Tool,
13970 /// "A tested, cumulative set of hotfixes, security updates, critical
13971 /// updates, and updates that are packaged together for easy deployment. A
13972 /// rollup generally targets a specific area, such as security, or a
13973 /// component of a product, such as Internet Information Services (IIS)." [1]
13974 UpdateRollup,
13975 /// "A widely released fix for a specific problem. An update addresses a
13976 /// noncritical, non-security-related bug." [1]
13977 Update,
13978 /// If set, the enum was initialized with an unknown value.
13979 ///
13980 /// Applications can examine the value using [Classification::value] or
13981 /// [Classification::name].
13982 UnknownValue(classification::UnknownValue),
13983 }
13984
13985 #[doc(hidden)]
13986 pub mod classification {
13987 #[allow(unused_imports)]
13988 use super::*;
13989 #[derive(Clone, Debug, PartialEq)]
13990 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13991 }
13992
13993 impl Classification {
13994 /// Gets the enum value.
13995 ///
13996 /// Returns `None` if the enum contains an unknown value deserialized from
13997 /// the string representation of enums.
13998 pub fn value(&self) -> std::option::Option<i32> {
13999 match self {
14000 Self::Unspecified => std::option::Option::Some(0),
14001 Self::Critical => std::option::Option::Some(1),
14002 Self::Security => std::option::Option::Some(2),
14003 Self::Definition => std::option::Option::Some(3),
14004 Self::Driver => std::option::Option::Some(4),
14005 Self::FeaturePack => std::option::Option::Some(5),
14006 Self::ServicePack => std::option::Option::Some(6),
14007 Self::Tool => std::option::Option::Some(7),
14008 Self::UpdateRollup => std::option::Option::Some(8),
14009 Self::Update => std::option::Option::Some(9),
14010 Self::UnknownValue(u) => u.0.value(),
14011 }
14012 }
14013
14014 /// Gets the enum value as a string.
14015 ///
14016 /// Returns `None` if the enum contains an unknown value deserialized from
14017 /// the integer representation of enums.
14018 pub fn name(&self) -> std::option::Option<&str> {
14019 match self {
14020 Self::Unspecified => std::option::Option::Some("CLASSIFICATION_UNSPECIFIED"),
14021 Self::Critical => std::option::Option::Some("CRITICAL"),
14022 Self::Security => std::option::Option::Some("SECURITY"),
14023 Self::Definition => std::option::Option::Some("DEFINITION"),
14024 Self::Driver => std::option::Option::Some("DRIVER"),
14025 Self::FeaturePack => std::option::Option::Some("FEATURE_PACK"),
14026 Self::ServicePack => std::option::Option::Some("SERVICE_PACK"),
14027 Self::Tool => std::option::Option::Some("TOOL"),
14028 Self::UpdateRollup => std::option::Option::Some("UPDATE_ROLLUP"),
14029 Self::Update => std::option::Option::Some("UPDATE"),
14030 Self::UnknownValue(u) => u.0.name(),
14031 }
14032 }
14033 }
14034
14035 impl std::default::Default for Classification {
14036 fn default() -> Self {
14037 use std::convert::From;
14038 Self::from(0)
14039 }
14040 }
14041
14042 impl std::fmt::Display for Classification {
14043 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14044 wkt::internal::display_enum(f, self.name(), self.value())
14045 }
14046 }
14047
14048 impl std::convert::From<i32> for Classification {
14049 fn from(value: i32) -> Self {
14050 match value {
14051 0 => Self::Unspecified,
14052 1 => Self::Critical,
14053 2 => Self::Security,
14054 3 => Self::Definition,
14055 4 => Self::Driver,
14056 5 => Self::FeaturePack,
14057 6 => Self::ServicePack,
14058 7 => Self::Tool,
14059 8 => Self::UpdateRollup,
14060 9 => Self::Update,
14061 _ => Self::UnknownValue(classification::UnknownValue(
14062 wkt::internal::UnknownEnumValue::Integer(value),
14063 )),
14064 }
14065 }
14066 }
14067
14068 impl std::convert::From<&str> for Classification {
14069 fn from(value: &str) -> Self {
14070 use std::string::ToString;
14071 match value {
14072 "CLASSIFICATION_UNSPECIFIED" => Self::Unspecified,
14073 "CRITICAL" => Self::Critical,
14074 "SECURITY" => Self::Security,
14075 "DEFINITION" => Self::Definition,
14076 "DRIVER" => Self::Driver,
14077 "FEATURE_PACK" => Self::FeaturePack,
14078 "SERVICE_PACK" => Self::ServicePack,
14079 "TOOL" => Self::Tool,
14080 "UPDATE_ROLLUP" => Self::UpdateRollup,
14081 "UPDATE" => Self::Update,
14082 _ => Self::UnknownValue(classification::UnknownValue(
14083 wkt::internal::UnknownEnumValue::String(value.to_string()),
14084 )),
14085 }
14086 }
14087 }
14088
14089 impl serde::ser::Serialize for Classification {
14090 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14091 where
14092 S: serde::Serializer,
14093 {
14094 match self {
14095 Self::Unspecified => serializer.serialize_i32(0),
14096 Self::Critical => serializer.serialize_i32(1),
14097 Self::Security => serializer.serialize_i32(2),
14098 Self::Definition => serializer.serialize_i32(3),
14099 Self::Driver => serializer.serialize_i32(4),
14100 Self::FeaturePack => serializer.serialize_i32(5),
14101 Self::ServicePack => serializer.serialize_i32(6),
14102 Self::Tool => serializer.serialize_i32(7),
14103 Self::UpdateRollup => serializer.serialize_i32(8),
14104 Self::Update => serializer.serialize_i32(9),
14105 Self::UnknownValue(u) => u.0.serialize(serializer),
14106 }
14107 }
14108 }
14109
14110 impl<'de> serde::de::Deserialize<'de> for Classification {
14111 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14112 where
14113 D: serde::Deserializer<'de>,
14114 {
14115 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Classification>::new(
14116 ".google.cloud.osconfig.v1.WindowsUpdateSettings.Classification",
14117 ))
14118 }
14119 }
14120}
14121
14122/// A step that runs an executable for a PatchJob.
14123#[derive(Clone, Default, PartialEq)]
14124#[non_exhaustive]
14125pub struct ExecStep {
14126 /// The ExecStepConfig for all Linux VMs targeted by the PatchJob.
14127 pub linux_exec_step_config: std::option::Option<crate::model::ExecStepConfig>,
14128
14129 /// The ExecStepConfig for all Windows VMs targeted by the PatchJob.
14130 pub windows_exec_step_config: std::option::Option<crate::model::ExecStepConfig>,
14131
14132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14133}
14134
14135impl ExecStep {
14136 /// Creates a new default instance.
14137 pub fn new() -> Self {
14138 std::default::Default::default()
14139 }
14140
14141 /// Sets the value of [linux_exec_step_config][crate::model::ExecStep::linux_exec_step_config].
14142 ///
14143 /// # Example
14144 /// ```ignore,no_run
14145 /// # use google_cloud_osconfig_v1::model::ExecStep;
14146 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14147 /// let x = ExecStep::new().set_linux_exec_step_config(ExecStepConfig::default()/* use setters */);
14148 /// ```
14149 pub fn set_linux_exec_step_config<T>(mut self, v: T) -> Self
14150 where
14151 T: std::convert::Into<crate::model::ExecStepConfig>,
14152 {
14153 self.linux_exec_step_config = std::option::Option::Some(v.into());
14154 self
14155 }
14156
14157 /// Sets or clears the value of [linux_exec_step_config][crate::model::ExecStep::linux_exec_step_config].
14158 ///
14159 /// # Example
14160 /// ```ignore,no_run
14161 /// # use google_cloud_osconfig_v1::model::ExecStep;
14162 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14163 /// let x = ExecStep::new().set_or_clear_linux_exec_step_config(Some(ExecStepConfig::default()/* use setters */));
14164 /// let x = ExecStep::new().set_or_clear_linux_exec_step_config(None::<ExecStepConfig>);
14165 /// ```
14166 pub fn set_or_clear_linux_exec_step_config<T>(mut self, v: std::option::Option<T>) -> Self
14167 where
14168 T: std::convert::Into<crate::model::ExecStepConfig>,
14169 {
14170 self.linux_exec_step_config = v.map(|x| x.into());
14171 self
14172 }
14173
14174 /// Sets the value of [windows_exec_step_config][crate::model::ExecStep::windows_exec_step_config].
14175 ///
14176 /// # Example
14177 /// ```ignore,no_run
14178 /// # use google_cloud_osconfig_v1::model::ExecStep;
14179 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14180 /// let x = ExecStep::new().set_windows_exec_step_config(ExecStepConfig::default()/* use setters */);
14181 /// ```
14182 pub fn set_windows_exec_step_config<T>(mut self, v: T) -> Self
14183 where
14184 T: std::convert::Into<crate::model::ExecStepConfig>,
14185 {
14186 self.windows_exec_step_config = std::option::Option::Some(v.into());
14187 self
14188 }
14189
14190 /// Sets or clears the value of [windows_exec_step_config][crate::model::ExecStep::windows_exec_step_config].
14191 ///
14192 /// # Example
14193 /// ```ignore,no_run
14194 /// # use google_cloud_osconfig_v1::model::ExecStep;
14195 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14196 /// let x = ExecStep::new().set_or_clear_windows_exec_step_config(Some(ExecStepConfig::default()/* use setters */));
14197 /// let x = ExecStep::new().set_or_clear_windows_exec_step_config(None::<ExecStepConfig>);
14198 /// ```
14199 pub fn set_or_clear_windows_exec_step_config<T>(mut self, v: std::option::Option<T>) -> Self
14200 where
14201 T: std::convert::Into<crate::model::ExecStepConfig>,
14202 {
14203 self.windows_exec_step_config = v.map(|x| x.into());
14204 self
14205 }
14206}
14207
14208impl wkt::message::Message for ExecStep {
14209 fn typename() -> &'static str {
14210 "type.googleapis.com/google.cloud.osconfig.v1.ExecStep"
14211 }
14212}
14213
14214/// Common configurations for an ExecStep.
14215#[derive(Clone, Default, PartialEq)]
14216#[non_exhaustive]
14217pub struct ExecStepConfig {
14218 /// Defaults to [0]. A list of possible return values that the
14219 /// execution can return to indicate a success.
14220 pub allowed_success_codes: std::vec::Vec<i32>,
14221
14222 /// The script interpreter to use to run the script. If no interpreter is
14223 /// specified the script will be executed directly, which will likely
14224 /// only succeed for scripts with [shebang lines]
14225 /// (<https://en.wikipedia.org/wiki/Shebang_>\(Unix\)).
14226 pub interpreter: crate::model::exec_step_config::Interpreter,
14227
14228 /// Location of the executable.
14229 pub executable: std::option::Option<crate::model::exec_step_config::Executable>,
14230
14231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14232}
14233
14234impl ExecStepConfig {
14235 /// Creates a new default instance.
14236 pub fn new() -> Self {
14237 std::default::Default::default()
14238 }
14239
14240 /// Sets the value of [allowed_success_codes][crate::model::ExecStepConfig::allowed_success_codes].
14241 ///
14242 /// # Example
14243 /// ```ignore,no_run
14244 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14245 /// let x = ExecStepConfig::new().set_allowed_success_codes([1, 2, 3]);
14246 /// ```
14247 pub fn set_allowed_success_codes<T, V>(mut self, v: T) -> Self
14248 where
14249 T: std::iter::IntoIterator<Item = V>,
14250 V: std::convert::Into<i32>,
14251 {
14252 use std::iter::Iterator;
14253 self.allowed_success_codes = v.into_iter().map(|i| i.into()).collect();
14254 self
14255 }
14256
14257 /// Sets the value of [interpreter][crate::model::ExecStepConfig::interpreter].
14258 ///
14259 /// # Example
14260 /// ```ignore,no_run
14261 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14262 /// use google_cloud_osconfig_v1::model::exec_step_config::Interpreter;
14263 /// let x0 = ExecStepConfig::new().set_interpreter(Interpreter::Shell);
14264 /// let x1 = ExecStepConfig::new().set_interpreter(Interpreter::Powershell);
14265 /// ```
14266 pub fn set_interpreter<T: std::convert::Into<crate::model::exec_step_config::Interpreter>>(
14267 mut self,
14268 v: T,
14269 ) -> Self {
14270 self.interpreter = v.into();
14271 self
14272 }
14273
14274 /// Sets the value of [executable][crate::model::ExecStepConfig::executable].
14275 ///
14276 /// Note that all the setters affecting `executable` are mutually
14277 /// exclusive.
14278 ///
14279 /// # Example
14280 /// ```ignore,no_run
14281 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14282 /// use google_cloud_osconfig_v1::model::exec_step_config::Executable;
14283 /// let x = ExecStepConfig::new().set_executable(Some(Executable::LocalPath("example".to_string())));
14284 /// ```
14285 pub fn set_executable<
14286 T: std::convert::Into<std::option::Option<crate::model::exec_step_config::Executable>>,
14287 >(
14288 mut self,
14289 v: T,
14290 ) -> Self {
14291 self.executable = v.into();
14292 self
14293 }
14294
14295 /// The value of [executable][crate::model::ExecStepConfig::executable]
14296 /// if it holds a `LocalPath`, `None` if the field is not set or
14297 /// holds a different branch.
14298 pub fn local_path(&self) -> std::option::Option<&std::string::String> {
14299 #[allow(unreachable_patterns)]
14300 self.executable.as_ref().and_then(|v| match v {
14301 crate::model::exec_step_config::Executable::LocalPath(v) => {
14302 std::option::Option::Some(v)
14303 }
14304 _ => std::option::Option::None,
14305 })
14306 }
14307
14308 /// Sets the value of [executable][crate::model::ExecStepConfig::executable]
14309 /// to hold a `LocalPath`.
14310 ///
14311 /// Note that all the setters affecting `executable` are
14312 /// mutually exclusive.
14313 ///
14314 /// # Example
14315 /// ```ignore,no_run
14316 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14317 /// let x = ExecStepConfig::new().set_local_path("example");
14318 /// assert!(x.local_path().is_some());
14319 /// assert!(x.gcs_object().is_none());
14320 /// ```
14321 pub fn set_local_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14322 self.executable = std::option::Option::Some(
14323 crate::model::exec_step_config::Executable::LocalPath(v.into()),
14324 );
14325 self
14326 }
14327
14328 /// The value of [executable][crate::model::ExecStepConfig::executable]
14329 /// if it holds a `GcsObject`, `None` if the field is not set or
14330 /// holds a different branch.
14331 pub fn gcs_object(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsObject>> {
14332 #[allow(unreachable_patterns)]
14333 self.executable.as_ref().and_then(|v| match v {
14334 crate::model::exec_step_config::Executable::GcsObject(v) => {
14335 std::option::Option::Some(v)
14336 }
14337 _ => std::option::Option::None,
14338 })
14339 }
14340
14341 /// Sets the value of [executable][crate::model::ExecStepConfig::executable]
14342 /// to hold a `GcsObject`.
14343 ///
14344 /// Note that all the setters affecting `executable` are
14345 /// mutually exclusive.
14346 ///
14347 /// # Example
14348 /// ```ignore,no_run
14349 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14350 /// use google_cloud_osconfig_v1::model::GcsObject;
14351 /// let x = ExecStepConfig::new().set_gcs_object(GcsObject::default()/* use setters */);
14352 /// assert!(x.gcs_object().is_some());
14353 /// assert!(x.local_path().is_none());
14354 /// ```
14355 pub fn set_gcs_object<T: std::convert::Into<std::boxed::Box<crate::model::GcsObject>>>(
14356 mut self,
14357 v: T,
14358 ) -> Self {
14359 self.executable = std::option::Option::Some(
14360 crate::model::exec_step_config::Executable::GcsObject(v.into()),
14361 );
14362 self
14363 }
14364}
14365
14366impl wkt::message::Message for ExecStepConfig {
14367 fn typename() -> &'static str {
14368 "type.googleapis.com/google.cloud.osconfig.v1.ExecStepConfig"
14369 }
14370}
14371
14372/// Defines additional types related to [ExecStepConfig].
14373pub mod exec_step_config {
14374 #[allow(unused_imports)]
14375 use super::*;
14376
14377 /// The interpreter used to execute the a file.
14378 ///
14379 /// # Working with unknown values
14380 ///
14381 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14382 /// additional enum variants at any time. Adding new variants is not considered
14383 /// a breaking change. Applications should write their code in anticipation of:
14384 ///
14385 /// - New values appearing in future releases of the client library, **and**
14386 /// - New values received dynamically, without application changes.
14387 ///
14388 /// Please consult the [Working with enums] section in the user guide for some
14389 /// guidelines.
14390 ///
14391 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14392 #[derive(Clone, Debug, PartialEq)]
14393 #[non_exhaustive]
14394 pub enum Interpreter {
14395 /// Invalid for a Windows ExecStepConfig. For a Linux ExecStepConfig, the
14396 /// interpreter will be parsed from the shebang line of the script if
14397 /// unspecified.
14398 Unspecified,
14399 /// Indicates that the script is run with `/bin/sh` on Linux and `cmd`
14400 /// on Windows.
14401 Shell,
14402 /// Indicates that the file is run with PowerShell flags
14403 /// `-NonInteractive`, `-NoProfile`, and `-ExecutionPolicy Bypass`.
14404 Powershell,
14405 /// If set, the enum was initialized with an unknown value.
14406 ///
14407 /// Applications can examine the value using [Interpreter::value] or
14408 /// [Interpreter::name].
14409 UnknownValue(interpreter::UnknownValue),
14410 }
14411
14412 #[doc(hidden)]
14413 pub mod interpreter {
14414 #[allow(unused_imports)]
14415 use super::*;
14416 #[derive(Clone, Debug, PartialEq)]
14417 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14418 }
14419
14420 impl Interpreter {
14421 /// Gets the enum value.
14422 ///
14423 /// Returns `None` if the enum contains an unknown value deserialized from
14424 /// the string representation of enums.
14425 pub fn value(&self) -> std::option::Option<i32> {
14426 match self {
14427 Self::Unspecified => std::option::Option::Some(0),
14428 Self::Shell => std::option::Option::Some(1),
14429 Self::Powershell => std::option::Option::Some(2),
14430 Self::UnknownValue(u) => u.0.value(),
14431 }
14432 }
14433
14434 /// Gets the enum value as a string.
14435 ///
14436 /// Returns `None` if the enum contains an unknown value deserialized from
14437 /// the integer representation of enums.
14438 pub fn name(&self) -> std::option::Option<&str> {
14439 match self {
14440 Self::Unspecified => std::option::Option::Some("INTERPRETER_UNSPECIFIED"),
14441 Self::Shell => std::option::Option::Some("SHELL"),
14442 Self::Powershell => std::option::Option::Some("POWERSHELL"),
14443 Self::UnknownValue(u) => u.0.name(),
14444 }
14445 }
14446 }
14447
14448 impl std::default::Default for Interpreter {
14449 fn default() -> Self {
14450 use std::convert::From;
14451 Self::from(0)
14452 }
14453 }
14454
14455 impl std::fmt::Display for Interpreter {
14456 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14457 wkt::internal::display_enum(f, self.name(), self.value())
14458 }
14459 }
14460
14461 impl std::convert::From<i32> for Interpreter {
14462 fn from(value: i32) -> Self {
14463 match value {
14464 0 => Self::Unspecified,
14465 1 => Self::Shell,
14466 2 => Self::Powershell,
14467 _ => Self::UnknownValue(interpreter::UnknownValue(
14468 wkt::internal::UnknownEnumValue::Integer(value),
14469 )),
14470 }
14471 }
14472 }
14473
14474 impl std::convert::From<&str> for Interpreter {
14475 fn from(value: &str) -> Self {
14476 use std::string::ToString;
14477 match value {
14478 "INTERPRETER_UNSPECIFIED" => Self::Unspecified,
14479 "SHELL" => Self::Shell,
14480 "POWERSHELL" => Self::Powershell,
14481 _ => Self::UnknownValue(interpreter::UnknownValue(
14482 wkt::internal::UnknownEnumValue::String(value.to_string()),
14483 )),
14484 }
14485 }
14486 }
14487
14488 impl serde::ser::Serialize for Interpreter {
14489 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14490 where
14491 S: serde::Serializer,
14492 {
14493 match self {
14494 Self::Unspecified => serializer.serialize_i32(0),
14495 Self::Shell => serializer.serialize_i32(1),
14496 Self::Powershell => serializer.serialize_i32(2),
14497 Self::UnknownValue(u) => u.0.serialize(serializer),
14498 }
14499 }
14500 }
14501
14502 impl<'de> serde::de::Deserialize<'de> for Interpreter {
14503 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14504 where
14505 D: serde::Deserializer<'de>,
14506 {
14507 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Interpreter>::new(
14508 ".google.cloud.osconfig.v1.ExecStepConfig.Interpreter",
14509 ))
14510 }
14511 }
14512
14513 /// Location of the executable.
14514 #[derive(Clone, Debug, PartialEq)]
14515 #[non_exhaustive]
14516 pub enum Executable {
14517 /// An absolute path to the executable on the VM.
14518 LocalPath(std::string::String),
14519 /// A Cloud Storage object containing the executable.
14520 GcsObject(std::boxed::Box<crate::model::GcsObject>),
14521 }
14522}
14523
14524/// Cloud Storage object representation.
14525#[derive(Clone, Default, PartialEq)]
14526#[non_exhaustive]
14527pub struct GcsObject {
14528 /// Required. Bucket of the Cloud Storage object.
14529 pub bucket: std::string::String,
14530
14531 /// Required. Name of the Cloud Storage object.
14532 pub object: std::string::String,
14533
14534 /// Required. Generation number of the Cloud Storage object. This is used to
14535 /// ensure that the ExecStep specified by this PatchJob does not change.
14536 pub generation_number: i64,
14537
14538 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14539}
14540
14541impl GcsObject {
14542 /// Creates a new default instance.
14543 pub fn new() -> Self {
14544 std::default::Default::default()
14545 }
14546
14547 /// Sets the value of [bucket][crate::model::GcsObject::bucket].
14548 ///
14549 /// # Example
14550 /// ```ignore,no_run
14551 /// # use google_cloud_osconfig_v1::model::GcsObject;
14552 /// let x = GcsObject::new().set_bucket("example");
14553 /// ```
14554 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14555 self.bucket = v.into();
14556 self
14557 }
14558
14559 /// Sets the value of [object][crate::model::GcsObject::object].
14560 ///
14561 /// # Example
14562 /// ```ignore,no_run
14563 /// # use google_cloud_osconfig_v1::model::GcsObject;
14564 /// let x = GcsObject::new().set_object("example");
14565 /// ```
14566 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14567 self.object = v.into();
14568 self
14569 }
14570
14571 /// Sets the value of [generation_number][crate::model::GcsObject::generation_number].
14572 ///
14573 /// # Example
14574 /// ```ignore,no_run
14575 /// # use google_cloud_osconfig_v1::model::GcsObject;
14576 /// let x = GcsObject::new().set_generation_number(42);
14577 /// ```
14578 pub fn set_generation_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14579 self.generation_number = v.into();
14580 self
14581 }
14582}
14583
14584impl wkt::message::Message for GcsObject {
14585 fn typename() -> &'static str {
14586 "type.googleapis.com/google.cloud.osconfig.v1.GcsObject"
14587 }
14588}
14589
14590/// A filter to target VM instances for patching. The targeted
14591/// VMs must meet all criteria specified. So if both labels and zones are
14592/// specified, the patch job targets only VMs with those labels and in those
14593/// zones.
14594#[derive(Clone, Default, PartialEq)]
14595#[non_exhaustive]
14596pub struct PatchInstanceFilter {
14597 /// Target all VM instances in the project. If true, no other criteria is
14598 /// permitted.
14599 pub all: bool,
14600
14601 /// Targets VM instances matching ANY of these GroupLabels. This allows
14602 /// targeting of disparate groups of VM instances.
14603 pub group_labels: std::vec::Vec<crate::model::patch_instance_filter::GroupLabel>,
14604
14605 /// Targets VM instances in ANY of these zones. Leave empty to target VM
14606 /// instances in any zone.
14607 pub zones: std::vec::Vec<std::string::String>,
14608
14609 /// Targets any of the VM instances specified. Instances are specified by their
14610 /// URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`,
14611 /// `projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or
14612 /// `<https://www.googleapis.com/compute/v1/projects/>[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`
14613 pub instances: std::vec::Vec<std::string::String>,
14614
14615 /// Targets VMs whose name starts with one of these prefixes. Similar to
14616 /// labels, this is another way to group VMs when targeting configs, for
14617 /// example prefix="prod-".
14618 pub instance_name_prefixes: std::vec::Vec<std::string::String>,
14619
14620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14621}
14622
14623impl PatchInstanceFilter {
14624 /// Creates a new default instance.
14625 pub fn new() -> Self {
14626 std::default::Default::default()
14627 }
14628
14629 /// Sets the value of [all][crate::model::PatchInstanceFilter::all].
14630 ///
14631 /// # Example
14632 /// ```ignore,no_run
14633 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14634 /// let x = PatchInstanceFilter::new().set_all(true);
14635 /// ```
14636 pub fn set_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14637 self.all = v.into();
14638 self
14639 }
14640
14641 /// Sets the value of [group_labels][crate::model::PatchInstanceFilter::group_labels].
14642 ///
14643 /// # Example
14644 /// ```ignore,no_run
14645 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14646 /// use google_cloud_osconfig_v1::model::patch_instance_filter::GroupLabel;
14647 /// let x = PatchInstanceFilter::new()
14648 /// .set_group_labels([
14649 /// GroupLabel::default()/* use setters */,
14650 /// GroupLabel::default()/* use (different) setters */,
14651 /// ]);
14652 /// ```
14653 pub fn set_group_labels<T, V>(mut self, v: T) -> Self
14654 where
14655 T: std::iter::IntoIterator<Item = V>,
14656 V: std::convert::Into<crate::model::patch_instance_filter::GroupLabel>,
14657 {
14658 use std::iter::Iterator;
14659 self.group_labels = v.into_iter().map(|i| i.into()).collect();
14660 self
14661 }
14662
14663 /// Sets the value of [zones][crate::model::PatchInstanceFilter::zones].
14664 ///
14665 /// # Example
14666 /// ```ignore,no_run
14667 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14668 /// let x = PatchInstanceFilter::new().set_zones(["a", "b", "c"]);
14669 /// ```
14670 pub fn set_zones<T, V>(mut self, v: T) -> Self
14671 where
14672 T: std::iter::IntoIterator<Item = V>,
14673 V: std::convert::Into<std::string::String>,
14674 {
14675 use std::iter::Iterator;
14676 self.zones = v.into_iter().map(|i| i.into()).collect();
14677 self
14678 }
14679
14680 /// Sets the value of [instances][crate::model::PatchInstanceFilter::instances].
14681 ///
14682 /// # Example
14683 /// ```ignore,no_run
14684 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14685 /// let x = PatchInstanceFilter::new().set_instances(["a", "b", "c"]);
14686 /// ```
14687 pub fn set_instances<T, V>(mut self, v: T) -> Self
14688 where
14689 T: std::iter::IntoIterator<Item = V>,
14690 V: std::convert::Into<std::string::String>,
14691 {
14692 use std::iter::Iterator;
14693 self.instances = v.into_iter().map(|i| i.into()).collect();
14694 self
14695 }
14696
14697 /// Sets the value of [instance_name_prefixes][crate::model::PatchInstanceFilter::instance_name_prefixes].
14698 ///
14699 /// # Example
14700 /// ```ignore,no_run
14701 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14702 /// let x = PatchInstanceFilter::new().set_instance_name_prefixes(["a", "b", "c"]);
14703 /// ```
14704 pub fn set_instance_name_prefixes<T, V>(mut self, v: T) -> Self
14705 where
14706 T: std::iter::IntoIterator<Item = V>,
14707 V: std::convert::Into<std::string::String>,
14708 {
14709 use std::iter::Iterator;
14710 self.instance_name_prefixes = v.into_iter().map(|i| i.into()).collect();
14711 self
14712 }
14713}
14714
14715impl wkt::message::Message for PatchInstanceFilter {
14716 fn typename() -> &'static str {
14717 "type.googleapis.com/google.cloud.osconfig.v1.PatchInstanceFilter"
14718 }
14719}
14720
14721/// Defines additional types related to [PatchInstanceFilter].
14722pub mod patch_instance_filter {
14723 #[allow(unused_imports)]
14724 use super::*;
14725
14726 /// Targets a group of VM instances by using their [assigned
14727 /// labels](https://cloud.google.com/compute/docs/labeling-resources). Labels
14728 /// are key-value pairs. A `GroupLabel` is a combination of labels
14729 /// that is used to target VMs for a patch job.
14730 ///
14731 /// For example, a patch job can target VMs that have the following
14732 /// `GroupLabel`: `{"env":"test", "app":"web"}`. This means that the patch job
14733 /// is applied to VMs that have both the labels `env=test` and `app=web`.
14734 #[derive(Clone, Default, PartialEq)]
14735 #[non_exhaustive]
14736 pub struct GroupLabel {
14737 /// Compute Engine instance labels that must be present for a VM
14738 /// instance to be targeted by this filter.
14739 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14740
14741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14742 }
14743
14744 impl GroupLabel {
14745 /// Creates a new default instance.
14746 pub fn new() -> Self {
14747 std::default::Default::default()
14748 }
14749
14750 /// Sets the value of [labels][crate::model::patch_instance_filter::GroupLabel::labels].
14751 ///
14752 /// # Example
14753 /// ```ignore,no_run
14754 /// # use google_cloud_osconfig_v1::model::patch_instance_filter::GroupLabel;
14755 /// let x = GroupLabel::new().set_labels([
14756 /// ("key0", "abc"),
14757 /// ("key1", "xyz"),
14758 /// ]);
14759 /// ```
14760 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14761 where
14762 T: std::iter::IntoIterator<Item = (K, V)>,
14763 K: std::convert::Into<std::string::String>,
14764 V: std::convert::Into<std::string::String>,
14765 {
14766 use std::iter::Iterator;
14767 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14768 self
14769 }
14770 }
14771
14772 impl wkt::message::Message for GroupLabel {
14773 fn typename() -> &'static str {
14774 "type.googleapis.com/google.cloud.osconfig.v1.PatchInstanceFilter.GroupLabel"
14775 }
14776 }
14777}
14778
14779/// Patch rollout configuration specifications. Contains details on the
14780/// concurrency control when applying patch(es) to all targeted VMs.
14781#[derive(Clone, Default, PartialEq)]
14782#[non_exhaustive]
14783pub struct PatchRollout {
14784 /// Mode of the patch rollout.
14785 pub mode: crate::model::patch_rollout::Mode,
14786
14787 /// The maximum number (or percentage) of VMs per zone to disrupt at any given
14788 /// moment. The number of VMs calculated from multiplying the percentage by the
14789 /// total number of VMs in a zone is rounded up.
14790 ///
14791 /// During patching, a VM is considered disrupted from the time the agent is
14792 /// notified to begin until patching has completed. This disruption time
14793 /// includes the time to complete reboot and any post-patch steps.
14794 ///
14795 /// A VM contributes to the disruption budget if its patching operation fails
14796 /// either when applying the patches, running pre or post patch steps, or if it
14797 /// fails to respond with a success notification before timing out. VMs that
14798 /// are not running or do not have an active agent do not count toward this
14799 /// disruption budget.
14800 ///
14801 /// For zone-by-zone rollouts, if the disruption budget in a zone is exceeded,
14802 /// the patch job stops, because continuing to the next zone requires
14803 /// completion of the patch process in the previous zone.
14804 ///
14805 /// For example, if the disruption budget has a fixed value of `10`, and 8 VMs
14806 /// fail to patch in the current zone, the patch job continues to patch 2 VMs
14807 /// at a time until the zone is completed. When that zone is completed
14808 /// successfully, patching begins with 10 VMs at a time in the next zone. If 10
14809 /// VMs in the next zone fail to patch, the patch job stops.
14810 pub disruption_budget: std::option::Option<crate::model::FixedOrPercent>,
14811
14812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14813}
14814
14815impl PatchRollout {
14816 /// Creates a new default instance.
14817 pub fn new() -> Self {
14818 std::default::Default::default()
14819 }
14820
14821 /// Sets the value of [mode][crate::model::PatchRollout::mode].
14822 ///
14823 /// # Example
14824 /// ```ignore,no_run
14825 /// # use google_cloud_osconfig_v1::model::PatchRollout;
14826 /// use google_cloud_osconfig_v1::model::patch_rollout::Mode;
14827 /// let x0 = PatchRollout::new().set_mode(Mode::ZoneByZone);
14828 /// let x1 = PatchRollout::new().set_mode(Mode::ConcurrentZones);
14829 /// ```
14830 pub fn set_mode<T: std::convert::Into<crate::model::patch_rollout::Mode>>(
14831 mut self,
14832 v: T,
14833 ) -> Self {
14834 self.mode = v.into();
14835 self
14836 }
14837
14838 /// Sets the value of [disruption_budget][crate::model::PatchRollout::disruption_budget].
14839 ///
14840 /// # Example
14841 /// ```ignore,no_run
14842 /// # use google_cloud_osconfig_v1::model::PatchRollout;
14843 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
14844 /// let x = PatchRollout::new().set_disruption_budget(FixedOrPercent::default()/* use setters */);
14845 /// ```
14846 pub fn set_disruption_budget<T>(mut self, v: T) -> Self
14847 where
14848 T: std::convert::Into<crate::model::FixedOrPercent>,
14849 {
14850 self.disruption_budget = std::option::Option::Some(v.into());
14851 self
14852 }
14853
14854 /// Sets or clears the value of [disruption_budget][crate::model::PatchRollout::disruption_budget].
14855 ///
14856 /// # Example
14857 /// ```ignore,no_run
14858 /// # use google_cloud_osconfig_v1::model::PatchRollout;
14859 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
14860 /// let x = PatchRollout::new().set_or_clear_disruption_budget(Some(FixedOrPercent::default()/* use setters */));
14861 /// let x = PatchRollout::new().set_or_clear_disruption_budget(None::<FixedOrPercent>);
14862 /// ```
14863 pub fn set_or_clear_disruption_budget<T>(mut self, v: std::option::Option<T>) -> Self
14864 where
14865 T: std::convert::Into<crate::model::FixedOrPercent>,
14866 {
14867 self.disruption_budget = v.map(|x| x.into());
14868 self
14869 }
14870}
14871
14872impl wkt::message::Message for PatchRollout {
14873 fn typename() -> &'static str {
14874 "type.googleapis.com/google.cloud.osconfig.v1.PatchRollout"
14875 }
14876}
14877
14878/// Defines additional types related to [PatchRollout].
14879pub mod patch_rollout {
14880 #[allow(unused_imports)]
14881 use super::*;
14882
14883 /// Type of the rollout.
14884 ///
14885 /// # Working with unknown values
14886 ///
14887 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14888 /// additional enum variants at any time. Adding new variants is not considered
14889 /// a breaking change. Applications should write their code in anticipation of:
14890 ///
14891 /// - New values appearing in future releases of the client library, **and**
14892 /// - New values received dynamically, without application changes.
14893 ///
14894 /// Please consult the [Working with enums] section in the user guide for some
14895 /// guidelines.
14896 ///
14897 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14898 #[derive(Clone, Debug, PartialEq)]
14899 #[non_exhaustive]
14900 pub enum Mode {
14901 /// Mode must be specified.
14902 Unspecified,
14903 /// Patches are applied one zone at a time. The patch job begins in the
14904 /// region with the lowest number of targeted VMs. Within the region,
14905 /// patching begins in the zone with the lowest number of targeted VMs. If
14906 /// multiple regions (or zones within a region) have the same number of
14907 /// targeted VMs, a tie-breaker is achieved by sorting the regions or zones
14908 /// in alphabetical order.
14909 ZoneByZone,
14910 /// Patches are applied to VMs in all zones at the same time.
14911 ConcurrentZones,
14912 /// If set, the enum was initialized with an unknown value.
14913 ///
14914 /// Applications can examine the value using [Mode::value] or
14915 /// [Mode::name].
14916 UnknownValue(mode::UnknownValue),
14917 }
14918
14919 #[doc(hidden)]
14920 pub mod mode {
14921 #[allow(unused_imports)]
14922 use super::*;
14923 #[derive(Clone, Debug, PartialEq)]
14924 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14925 }
14926
14927 impl Mode {
14928 /// Gets the enum value.
14929 ///
14930 /// Returns `None` if the enum contains an unknown value deserialized from
14931 /// the string representation of enums.
14932 pub fn value(&self) -> std::option::Option<i32> {
14933 match self {
14934 Self::Unspecified => std::option::Option::Some(0),
14935 Self::ZoneByZone => std::option::Option::Some(1),
14936 Self::ConcurrentZones => std::option::Option::Some(2),
14937 Self::UnknownValue(u) => u.0.value(),
14938 }
14939 }
14940
14941 /// Gets the enum value as a string.
14942 ///
14943 /// Returns `None` if the enum contains an unknown value deserialized from
14944 /// the integer representation of enums.
14945 pub fn name(&self) -> std::option::Option<&str> {
14946 match self {
14947 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
14948 Self::ZoneByZone => std::option::Option::Some("ZONE_BY_ZONE"),
14949 Self::ConcurrentZones => std::option::Option::Some("CONCURRENT_ZONES"),
14950 Self::UnknownValue(u) => u.0.name(),
14951 }
14952 }
14953 }
14954
14955 impl std::default::Default for Mode {
14956 fn default() -> Self {
14957 use std::convert::From;
14958 Self::from(0)
14959 }
14960 }
14961
14962 impl std::fmt::Display for Mode {
14963 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14964 wkt::internal::display_enum(f, self.name(), self.value())
14965 }
14966 }
14967
14968 impl std::convert::From<i32> for Mode {
14969 fn from(value: i32) -> Self {
14970 match value {
14971 0 => Self::Unspecified,
14972 1 => Self::ZoneByZone,
14973 2 => Self::ConcurrentZones,
14974 _ => Self::UnknownValue(mode::UnknownValue(
14975 wkt::internal::UnknownEnumValue::Integer(value),
14976 )),
14977 }
14978 }
14979 }
14980
14981 impl std::convert::From<&str> for Mode {
14982 fn from(value: &str) -> Self {
14983 use std::string::ToString;
14984 match value {
14985 "MODE_UNSPECIFIED" => Self::Unspecified,
14986 "ZONE_BY_ZONE" => Self::ZoneByZone,
14987 "CONCURRENT_ZONES" => Self::ConcurrentZones,
14988 _ => Self::UnknownValue(mode::UnknownValue(
14989 wkt::internal::UnknownEnumValue::String(value.to_string()),
14990 )),
14991 }
14992 }
14993 }
14994
14995 impl serde::ser::Serialize for Mode {
14996 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14997 where
14998 S: serde::Serializer,
14999 {
15000 match self {
15001 Self::Unspecified => serializer.serialize_i32(0),
15002 Self::ZoneByZone => serializer.serialize_i32(1),
15003 Self::ConcurrentZones => serializer.serialize_i32(2),
15004 Self::UnknownValue(u) => u.0.serialize(serializer),
15005 }
15006 }
15007 }
15008
15009 impl<'de> serde::de::Deserialize<'de> for Mode {
15010 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15011 where
15012 D: serde::Deserializer<'de>,
15013 {
15014 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
15015 ".google.cloud.osconfig.v1.PatchRollout.Mode",
15016 ))
15017 }
15018 }
15019}
15020
15021/// This API resource represents the vulnerability report for a specified
15022/// Compute Engine virtual machine (VM) instance at a given point in time.
15023///
15024/// For more information, see [Vulnerability
15025/// reports](https://cloud.google.com/compute/docs/instances/os-inventory-management#vulnerability-reports).
15026#[derive(Clone, Default, PartialEq)]
15027#[non_exhaustive]
15028pub struct VulnerabilityReport {
15029 /// Output only. The `vulnerabilityReport` API resource name.
15030 ///
15031 /// Format:
15032 /// `projects/{project_number}/locations/{location}/instances/{instance_id}/vulnerabilityReport`
15033 pub name: std::string::String,
15034
15035 /// Output only. List of vulnerabilities affecting the VM.
15036 pub vulnerabilities: std::vec::Vec<crate::model::vulnerability_report::Vulnerability>,
15037
15038 /// Output only. The timestamp for when the last vulnerability report was
15039 /// generated for the VM.
15040 pub update_time: std::option::Option<wkt::Timestamp>,
15041
15042 /// Output only. Highest level of severity among all the upgradable
15043 /// vulnerabilities with CVEs attached.
15044 pub highest_upgradable_cve_severity:
15045 crate::model::vulnerability_report::VulnerabilitySeverityLevel,
15046
15047 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15048}
15049
15050impl VulnerabilityReport {
15051 /// Creates a new default instance.
15052 pub fn new() -> Self {
15053 std::default::Default::default()
15054 }
15055
15056 /// Sets the value of [name][crate::model::VulnerabilityReport::name].
15057 ///
15058 /// # Example
15059 /// ```ignore,no_run
15060 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15061 /// let x = VulnerabilityReport::new().set_name("example");
15062 /// ```
15063 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15064 self.name = v.into();
15065 self
15066 }
15067
15068 /// Sets the value of [vulnerabilities][crate::model::VulnerabilityReport::vulnerabilities].
15069 ///
15070 /// # Example
15071 /// ```ignore,no_run
15072 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15073 /// use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15074 /// let x = VulnerabilityReport::new()
15075 /// .set_vulnerabilities([
15076 /// Vulnerability::default()/* use setters */,
15077 /// Vulnerability::default()/* use (different) setters */,
15078 /// ]);
15079 /// ```
15080 pub fn set_vulnerabilities<T, V>(mut self, v: T) -> Self
15081 where
15082 T: std::iter::IntoIterator<Item = V>,
15083 V: std::convert::Into<crate::model::vulnerability_report::Vulnerability>,
15084 {
15085 use std::iter::Iterator;
15086 self.vulnerabilities = v.into_iter().map(|i| i.into()).collect();
15087 self
15088 }
15089
15090 /// Sets the value of [update_time][crate::model::VulnerabilityReport::update_time].
15091 ///
15092 /// # Example
15093 /// ```ignore,no_run
15094 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15095 /// use wkt::Timestamp;
15096 /// let x = VulnerabilityReport::new().set_update_time(Timestamp::default()/* use setters */);
15097 /// ```
15098 pub fn set_update_time<T>(mut self, v: T) -> Self
15099 where
15100 T: std::convert::Into<wkt::Timestamp>,
15101 {
15102 self.update_time = std::option::Option::Some(v.into());
15103 self
15104 }
15105
15106 /// Sets or clears the value of [update_time][crate::model::VulnerabilityReport::update_time].
15107 ///
15108 /// # Example
15109 /// ```ignore,no_run
15110 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15111 /// use wkt::Timestamp;
15112 /// let x = VulnerabilityReport::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15113 /// let x = VulnerabilityReport::new().set_or_clear_update_time(None::<Timestamp>);
15114 /// ```
15115 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15116 where
15117 T: std::convert::Into<wkt::Timestamp>,
15118 {
15119 self.update_time = v.map(|x| x.into());
15120 self
15121 }
15122
15123 /// Sets the value of [highest_upgradable_cve_severity][crate::model::VulnerabilityReport::highest_upgradable_cve_severity].
15124 ///
15125 /// # Example
15126 /// ```ignore,no_run
15127 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15128 /// use google_cloud_osconfig_v1::model::vulnerability_report::VulnerabilitySeverityLevel;
15129 /// let x0 = VulnerabilityReport::new().set_highest_upgradable_cve_severity(VulnerabilitySeverityLevel::None);
15130 /// let x1 = VulnerabilityReport::new().set_highest_upgradable_cve_severity(VulnerabilitySeverityLevel::Minimal);
15131 /// let x2 = VulnerabilityReport::new().set_highest_upgradable_cve_severity(VulnerabilitySeverityLevel::Low);
15132 /// ```
15133 pub fn set_highest_upgradable_cve_severity<
15134 T: std::convert::Into<crate::model::vulnerability_report::VulnerabilitySeverityLevel>,
15135 >(
15136 mut self,
15137 v: T,
15138 ) -> Self {
15139 self.highest_upgradable_cve_severity = v.into();
15140 self
15141 }
15142}
15143
15144impl wkt::message::Message for VulnerabilityReport {
15145 fn typename() -> &'static str {
15146 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport"
15147 }
15148}
15149
15150/// Defines additional types related to [VulnerabilityReport].
15151pub mod vulnerability_report {
15152 #[allow(unused_imports)]
15153 use super::*;
15154
15155 /// A vulnerability affecting the VM instance.
15156 #[derive(Clone, Default, PartialEq)]
15157 #[non_exhaustive]
15158 pub struct Vulnerability {
15159 /// Contains metadata as per the upstream feed of the operating system and
15160 /// NVD.
15161 pub details:
15162 std::option::Option<crate::model::vulnerability_report::vulnerability::Details>,
15163
15164 /// Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM.
15165 /// This field displays the inventory items affected by this vulnerability.
15166 /// If the vulnerability report was not updated after the VM inventory
15167 /// update, these values might not display in VM inventory. For some distros,
15168 /// this field may be empty.
15169 #[deprecated]
15170 pub installed_inventory_item_ids: std::vec::Vec<std::string::String>,
15171
15172 /// Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM.
15173 /// If the vulnerability report was not updated after the VM inventory
15174 /// update, these values might not display in VM inventory. If there is no
15175 /// available fix, the field is empty. The `inventory_item` value specifies
15176 /// the latest `SoftwarePackage` available to the VM that fixes the
15177 /// vulnerability.
15178 #[deprecated]
15179 pub available_inventory_item_ids: std::vec::Vec<std::string::String>,
15180
15181 /// The timestamp for when the vulnerability was first detected.
15182 pub create_time: std::option::Option<wkt::Timestamp>,
15183
15184 /// The timestamp for when the vulnerability was last modified.
15185 pub update_time: std::option::Option<wkt::Timestamp>,
15186
15187 /// List of items affected by the vulnerability.
15188 pub items: std::vec::Vec<crate::model::vulnerability_report::vulnerability::Item>,
15189
15190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15191 }
15192
15193 impl Vulnerability {
15194 /// Creates a new default instance.
15195 pub fn new() -> Self {
15196 std::default::Default::default()
15197 }
15198
15199 /// Sets the value of [details][crate::model::vulnerability_report::Vulnerability::details].
15200 ///
15201 /// # Example
15202 /// ```ignore,no_run
15203 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15204 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15205 /// let x = Vulnerability::new().set_details(Details::default()/* use setters */);
15206 /// ```
15207 pub fn set_details<T>(mut self, v: T) -> Self
15208 where
15209 T: std::convert::Into<crate::model::vulnerability_report::vulnerability::Details>,
15210 {
15211 self.details = std::option::Option::Some(v.into());
15212 self
15213 }
15214
15215 /// Sets or clears the value of [details][crate::model::vulnerability_report::Vulnerability::details].
15216 ///
15217 /// # Example
15218 /// ```ignore,no_run
15219 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15220 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15221 /// let x = Vulnerability::new().set_or_clear_details(Some(Details::default()/* use setters */));
15222 /// let x = Vulnerability::new().set_or_clear_details(None::<Details>);
15223 /// ```
15224 pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
15225 where
15226 T: std::convert::Into<crate::model::vulnerability_report::vulnerability::Details>,
15227 {
15228 self.details = v.map(|x| x.into());
15229 self
15230 }
15231
15232 /// Sets the value of [installed_inventory_item_ids][crate::model::vulnerability_report::Vulnerability::installed_inventory_item_ids].
15233 ///
15234 /// # Example
15235 /// ```ignore,no_run
15236 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15237 /// let x = Vulnerability::new().set_installed_inventory_item_ids(["a", "b", "c"]);
15238 /// ```
15239 #[deprecated]
15240 pub fn set_installed_inventory_item_ids<T, V>(mut self, v: T) -> Self
15241 where
15242 T: std::iter::IntoIterator<Item = V>,
15243 V: std::convert::Into<std::string::String>,
15244 {
15245 use std::iter::Iterator;
15246 self.installed_inventory_item_ids = v.into_iter().map(|i| i.into()).collect();
15247 self
15248 }
15249
15250 /// Sets the value of [available_inventory_item_ids][crate::model::vulnerability_report::Vulnerability::available_inventory_item_ids].
15251 ///
15252 /// # Example
15253 /// ```ignore,no_run
15254 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15255 /// let x = Vulnerability::new().set_available_inventory_item_ids(["a", "b", "c"]);
15256 /// ```
15257 #[deprecated]
15258 pub fn set_available_inventory_item_ids<T, V>(mut self, v: T) -> Self
15259 where
15260 T: std::iter::IntoIterator<Item = V>,
15261 V: std::convert::Into<std::string::String>,
15262 {
15263 use std::iter::Iterator;
15264 self.available_inventory_item_ids = v.into_iter().map(|i| i.into()).collect();
15265 self
15266 }
15267
15268 /// Sets the value of [create_time][crate::model::vulnerability_report::Vulnerability::create_time].
15269 ///
15270 /// # Example
15271 /// ```ignore,no_run
15272 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15273 /// use wkt::Timestamp;
15274 /// let x = Vulnerability::new().set_create_time(Timestamp::default()/* use setters */);
15275 /// ```
15276 pub fn set_create_time<T>(mut self, v: T) -> Self
15277 where
15278 T: std::convert::Into<wkt::Timestamp>,
15279 {
15280 self.create_time = std::option::Option::Some(v.into());
15281 self
15282 }
15283
15284 /// Sets or clears the value of [create_time][crate::model::vulnerability_report::Vulnerability::create_time].
15285 ///
15286 /// # Example
15287 /// ```ignore,no_run
15288 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15289 /// use wkt::Timestamp;
15290 /// let x = Vulnerability::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15291 /// let x = Vulnerability::new().set_or_clear_create_time(None::<Timestamp>);
15292 /// ```
15293 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15294 where
15295 T: std::convert::Into<wkt::Timestamp>,
15296 {
15297 self.create_time = v.map(|x| x.into());
15298 self
15299 }
15300
15301 /// Sets the value of [update_time][crate::model::vulnerability_report::Vulnerability::update_time].
15302 ///
15303 /// # Example
15304 /// ```ignore,no_run
15305 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15306 /// use wkt::Timestamp;
15307 /// let x = Vulnerability::new().set_update_time(Timestamp::default()/* use setters */);
15308 /// ```
15309 pub fn set_update_time<T>(mut self, v: T) -> Self
15310 where
15311 T: std::convert::Into<wkt::Timestamp>,
15312 {
15313 self.update_time = std::option::Option::Some(v.into());
15314 self
15315 }
15316
15317 /// Sets or clears the value of [update_time][crate::model::vulnerability_report::Vulnerability::update_time].
15318 ///
15319 /// # Example
15320 /// ```ignore,no_run
15321 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15322 /// use wkt::Timestamp;
15323 /// let x = Vulnerability::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15324 /// let x = Vulnerability::new().set_or_clear_update_time(None::<Timestamp>);
15325 /// ```
15326 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15327 where
15328 T: std::convert::Into<wkt::Timestamp>,
15329 {
15330 self.update_time = v.map(|x| x.into());
15331 self
15332 }
15333
15334 /// Sets the value of [items][crate::model::vulnerability_report::Vulnerability::items].
15335 ///
15336 /// # Example
15337 /// ```ignore,no_run
15338 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15339 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15340 /// let x = Vulnerability::new()
15341 /// .set_items([
15342 /// Item::default()/* use setters */,
15343 /// Item::default()/* use (different) setters */,
15344 /// ]);
15345 /// ```
15346 pub fn set_items<T, V>(mut self, v: T) -> Self
15347 where
15348 T: std::iter::IntoIterator<Item = V>,
15349 V: std::convert::Into<crate::model::vulnerability_report::vulnerability::Item>,
15350 {
15351 use std::iter::Iterator;
15352 self.items = v.into_iter().map(|i| i.into()).collect();
15353 self
15354 }
15355 }
15356
15357 impl wkt::message::Message for Vulnerability {
15358 fn typename() -> &'static str {
15359 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability"
15360 }
15361 }
15362
15363 /// Defines additional types related to [Vulnerability].
15364 pub mod vulnerability {
15365 #[allow(unused_imports)]
15366 use super::*;
15367
15368 /// Contains metadata information for the vulnerability. This information is
15369 /// collected from the upstream feed of the operating system.
15370 #[derive(Clone, Default, PartialEq)]
15371 #[non_exhaustive]
15372 pub struct Details {
15373 /// The CVE of the vulnerability. CVE cannot be
15374 /// empty and the combination of <cve, classification> should be unique
15375 /// across vulnerabilities for a VM.
15376 pub cve: std::string::String,
15377
15378 /// The CVSS V2 score of this vulnerability. CVSS V2 score is on a scale of
15379 /// 0 - 10 where 0 indicates low severity and 10 indicates high severity.
15380 pub cvss_v2_score: f32,
15381
15382 /// The full description of the CVSSv3 for this vulnerability from NVD.
15383 pub cvss_v3: std::option::Option<crate::model::CVSSv3>,
15384
15385 /// Assigned severity/impact ranking from the distro.
15386 pub severity: std::string::String,
15387
15388 /// The note or description describing the vulnerability from the distro.
15389 pub description: std::string::String,
15390
15391 /// Corresponds to the references attached to the `VulnerabilityDetails`.
15392 pub references: std::vec::Vec<
15393 crate::model::vulnerability_report::vulnerability::details::Reference,
15394 >,
15395
15396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15397 }
15398
15399 impl Details {
15400 /// Creates a new default instance.
15401 pub fn new() -> Self {
15402 std::default::Default::default()
15403 }
15404
15405 /// Sets the value of [cve][crate::model::vulnerability_report::vulnerability::Details::cve].
15406 ///
15407 /// # Example
15408 /// ```ignore,no_run
15409 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15410 /// let x = Details::new().set_cve("example");
15411 /// ```
15412 pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15413 self.cve = v.into();
15414 self
15415 }
15416
15417 /// Sets the value of [cvss_v2_score][crate::model::vulnerability_report::vulnerability::Details::cvss_v2_score].
15418 ///
15419 /// # Example
15420 /// ```ignore,no_run
15421 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15422 /// let x = Details::new().set_cvss_v2_score(42.0);
15423 /// ```
15424 pub fn set_cvss_v2_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15425 self.cvss_v2_score = v.into();
15426 self
15427 }
15428
15429 /// Sets the value of [cvss_v3][crate::model::vulnerability_report::vulnerability::Details::cvss_v3].
15430 ///
15431 /// # Example
15432 /// ```ignore,no_run
15433 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15434 /// use google_cloud_osconfig_v1::model::CVSSv3;
15435 /// let x = Details::new().set_cvss_v3(CVSSv3::default()/* use setters */);
15436 /// ```
15437 pub fn set_cvss_v3<T>(mut self, v: T) -> Self
15438 where
15439 T: std::convert::Into<crate::model::CVSSv3>,
15440 {
15441 self.cvss_v3 = std::option::Option::Some(v.into());
15442 self
15443 }
15444
15445 /// Sets or clears the value of [cvss_v3][crate::model::vulnerability_report::vulnerability::Details::cvss_v3].
15446 ///
15447 /// # Example
15448 /// ```ignore,no_run
15449 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15450 /// use google_cloud_osconfig_v1::model::CVSSv3;
15451 /// let x = Details::new().set_or_clear_cvss_v3(Some(CVSSv3::default()/* use setters */));
15452 /// let x = Details::new().set_or_clear_cvss_v3(None::<CVSSv3>);
15453 /// ```
15454 pub fn set_or_clear_cvss_v3<T>(mut self, v: std::option::Option<T>) -> Self
15455 where
15456 T: std::convert::Into<crate::model::CVSSv3>,
15457 {
15458 self.cvss_v3 = v.map(|x| x.into());
15459 self
15460 }
15461
15462 /// Sets the value of [severity][crate::model::vulnerability_report::vulnerability::Details::severity].
15463 ///
15464 /// # Example
15465 /// ```ignore,no_run
15466 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15467 /// let x = Details::new().set_severity("example");
15468 /// ```
15469 pub fn set_severity<T: std::convert::Into<std::string::String>>(
15470 mut self,
15471 v: T,
15472 ) -> Self {
15473 self.severity = v.into();
15474 self
15475 }
15476
15477 /// Sets the value of [description][crate::model::vulnerability_report::vulnerability::Details::description].
15478 ///
15479 /// # Example
15480 /// ```ignore,no_run
15481 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15482 /// let x = Details::new().set_description("example");
15483 /// ```
15484 pub fn set_description<T: std::convert::Into<std::string::String>>(
15485 mut self,
15486 v: T,
15487 ) -> Self {
15488 self.description = v.into();
15489 self
15490 }
15491
15492 /// Sets the value of [references][crate::model::vulnerability_report::vulnerability::Details::references].
15493 ///
15494 /// # Example
15495 /// ```ignore,no_run
15496 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15497 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::details::Reference;
15498 /// let x = Details::new()
15499 /// .set_references([
15500 /// Reference::default()/* use setters */,
15501 /// Reference::default()/* use (different) setters */,
15502 /// ]);
15503 /// ```
15504 pub fn set_references<T, V>(mut self, v: T) -> Self
15505 where
15506 T: std::iter::IntoIterator<Item = V>,
15507 V: std::convert::Into<
15508 crate::model::vulnerability_report::vulnerability::details::Reference,
15509 >,
15510 {
15511 use std::iter::Iterator;
15512 self.references = v.into_iter().map(|i| i.into()).collect();
15513 self
15514 }
15515 }
15516
15517 impl wkt::message::Message for Details {
15518 fn typename() -> &'static str {
15519 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability.Details"
15520 }
15521 }
15522
15523 /// Defines additional types related to [Details].
15524 pub mod details {
15525 #[allow(unused_imports)]
15526 use super::*;
15527
15528 /// A reference for this vulnerability.
15529 #[derive(Clone, Default, PartialEq)]
15530 #[non_exhaustive]
15531 pub struct Reference {
15532 /// The url of the reference.
15533 pub url: std::string::String,
15534
15535 /// The source of the reference e.g. NVD.
15536 pub source: std::string::String,
15537
15538 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15539 }
15540
15541 impl Reference {
15542 /// Creates a new default instance.
15543 pub fn new() -> Self {
15544 std::default::Default::default()
15545 }
15546
15547 /// Sets the value of [url][crate::model::vulnerability_report::vulnerability::details::Reference::url].
15548 ///
15549 /// # Example
15550 /// ```ignore,no_run
15551 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::details::Reference;
15552 /// let x = Reference::new().set_url("example");
15553 /// ```
15554 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15555 self.url = v.into();
15556 self
15557 }
15558
15559 /// Sets the value of [source][crate::model::vulnerability_report::vulnerability::details::Reference::source].
15560 ///
15561 /// # Example
15562 /// ```ignore,no_run
15563 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::details::Reference;
15564 /// let x = Reference::new().set_source("example");
15565 /// ```
15566 pub fn set_source<T: std::convert::Into<std::string::String>>(
15567 mut self,
15568 v: T,
15569 ) -> Self {
15570 self.source = v.into();
15571 self
15572 }
15573 }
15574
15575 impl wkt::message::Message for Reference {
15576 fn typename() -> &'static str {
15577 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability.Details.Reference"
15578 }
15579 }
15580 }
15581
15582 /// OS inventory item that is affected by a vulnerability or fixed as a
15583 /// result of a vulnerability.
15584 #[derive(Clone, Default, PartialEq)]
15585 #[non_exhaustive]
15586 pub struct Item {
15587 /// Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM.
15588 /// This field displays the inventory items affected by this vulnerability.
15589 /// If the vulnerability report was not updated after the VM inventory
15590 /// update, these values might not display in VM inventory. For some
15591 /// operating systems, this field might be empty.
15592 pub installed_inventory_item_id: std::string::String,
15593
15594 /// Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM.
15595 /// If the vulnerability report was not updated after the VM inventory
15596 /// update, these values might not display in VM inventory. If there is no
15597 /// available fix, the field is empty. The `inventory_item` value specifies
15598 /// the latest `SoftwarePackage` available to the VM that fixes the
15599 /// vulnerability.
15600 pub available_inventory_item_id: std::string::String,
15601
15602 /// The recommended [CPE URI](https://cpe.mitre.org/specification/) update
15603 /// that contains a fix for this vulnerability.
15604 pub fixed_cpe_uri: std::string::String,
15605
15606 /// The upstream OS patch, packages or KB that fixes the vulnerability.
15607 pub upstream_fix: std::string::String,
15608
15609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15610 }
15611
15612 impl Item {
15613 /// Creates a new default instance.
15614 pub fn new() -> Self {
15615 std::default::Default::default()
15616 }
15617
15618 /// Sets the value of [installed_inventory_item_id][crate::model::vulnerability_report::vulnerability::Item::installed_inventory_item_id].
15619 ///
15620 /// # Example
15621 /// ```ignore,no_run
15622 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15623 /// let x = Item::new().set_installed_inventory_item_id("example");
15624 /// ```
15625 pub fn set_installed_inventory_item_id<T: std::convert::Into<std::string::String>>(
15626 mut self,
15627 v: T,
15628 ) -> Self {
15629 self.installed_inventory_item_id = v.into();
15630 self
15631 }
15632
15633 /// Sets the value of [available_inventory_item_id][crate::model::vulnerability_report::vulnerability::Item::available_inventory_item_id].
15634 ///
15635 /// # Example
15636 /// ```ignore,no_run
15637 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15638 /// let x = Item::new().set_available_inventory_item_id("example");
15639 /// ```
15640 pub fn set_available_inventory_item_id<T: std::convert::Into<std::string::String>>(
15641 mut self,
15642 v: T,
15643 ) -> Self {
15644 self.available_inventory_item_id = v.into();
15645 self
15646 }
15647
15648 /// Sets the value of [fixed_cpe_uri][crate::model::vulnerability_report::vulnerability::Item::fixed_cpe_uri].
15649 ///
15650 /// # Example
15651 /// ```ignore,no_run
15652 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15653 /// let x = Item::new().set_fixed_cpe_uri("example");
15654 /// ```
15655 pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
15656 mut self,
15657 v: T,
15658 ) -> Self {
15659 self.fixed_cpe_uri = v.into();
15660 self
15661 }
15662
15663 /// Sets the value of [upstream_fix][crate::model::vulnerability_report::vulnerability::Item::upstream_fix].
15664 ///
15665 /// # Example
15666 /// ```ignore,no_run
15667 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15668 /// let x = Item::new().set_upstream_fix("example");
15669 /// ```
15670 pub fn set_upstream_fix<T: std::convert::Into<std::string::String>>(
15671 mut self,
15672 v: T,
15673 ) -> Self {
15674 self.upstream_fix = v.into();
15675 self
15676 }
15677 }
15678
15679 impl wkt::message::Message for Item {
15680 fn typename() -> &'static str {
15681 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability.Item"
15682 }
15683 }
15684 }
15685
15686 /// Severity levels for vulnerabilities.
15687 ///
15688 /// # Working with unknown values
15689 ///
15690 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15691 /// additional enum variants at any time. Adding new variants is not considered
15692 /// a breaking change. Applications should write their code in anticipation of:
15693 ///
15694 /// - New values appearing in future releases of the client library, **and**
15695 /// - New values received dynamically, without application changes.
15696 ///
15697 /// Please consult the [Working with enums] section in the user guide for some
15698 /// guidelines.
15699 ///
15700 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15701 #[derive(Clone, Debug, PartialEq)]
15702 #[non_exhaustive]
15703 pub enum VulnerabilitySeverityLevel {
15704 /// Default SeverityLevel. This value is unused.
15705 Unspecified,
15706 /// Vulnerability has no severity level.
15707 None,
15708 /// Vulnerability severity level is minimal. This is level below the low
15709 /// severity level.
15710 Minimal,
15711 /// Vulnerability severity level is low. This is level below the medium
15712 /// severity level.
15713 Low,
15714 /// Vulnerability severity level is medium. This is level below the high
15715 /// severity level.
15716 Medium,
15717 /// Vulnerability severity level is high. This is level below the critical
15718 /// severity level.
15719 High,
15720 /// Vulnerability severity level is critical. This is the highest severity
15721 /// level.
15722 Critical,
15723 /// If set, the enum was initialized with an unknown value.
15724 ///
15725 /// Applications can examine the value using [VulnerabilitySeverityLevel::value] or
15726 /// [VulnerabilitySeverityLevel::name].
15727 UnknownValue(vulnerability_severity_level::UnknownValue),
15728 }
15729
15730 #[doc(hidden)]
15731 pub mod vulnerability_severity_level {
15732 #[allow(unused_imports)]
15733 use super::*;
15734 #[derive(Clone, Debug, PartialEq)]
15735 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15736 }
15737
15738 impl VulnerabilitySeverityLevel {
15739 /// Gets the enum value.
15740 ///
15741 /// Returns `None` if the enum contains an unknown value deserialized from
15742 /// the string representation of enums.
15743 pub fn value(&self) -> std::option::Option<i32> {
15744 match self {
15745 Self::Unspecified => std::option::Option::Some(0),
15746 Self::None => std::option::Option::Some(1),
15747 Self::Minimal => std::option::Option::Some(2),
15748 Self::Low => std::option::Option::Some(3),
15749 Self::Medium => std::option::Option::Some(4),
15750 Self::High => std::option::Option::Some(5),
15751 Self::Critical => std::option::Option::Some(6),
15752 Self::UnknownValue(u) => u.0.value(),
15753 }
15754 }
15755
15756 /// Gets the enum value as a string.
15757 ///
15758 /// Returns `None` if the enum contains an unknown value deserialized from
15759 /// the integer representation of enums.
15760 pub fn name(&self) -> std::option::Option<&str> {
15761 match self {
15762 Self::Unspecified => {
15763 std::option::Option::Some("VULNERABILITY_SEVERITY_LEVEL_UNSPECIFIED")
15764 }
15765 Self::None => std::option::Option::Some("NONE"),
15766 Self::Minimal => std::option::Option::Some("MINIMAL"),
15767 Self::Low => std::option::Option::Some("LOW"),
15768 Self::Medium => std::option::Option::Some("MEDIUM"),
15769 Self::High => std::option::Option::Some("HIGH"),
15770 Self::Critical => std::option::Option::Some("CRITICAL"),
15771 Self::UnknownValue(u) => u.0.name(),
15772 }
15773 }
15774 }
15775
15776 impl std::default::Default for VulnerabilitySeverityLevel {
15777 fn default() -> Self {
15778 use std::convert::From;
15779 Self::from(0)
15780 }
15781 }
15782
15783 impl std::fmt::Display for VulnerabilitySeverityLevel {
15784 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15785 wkt::internal::display_enum(f, self.name(), self.value())
15786 }
15787 }
15788
15789 impl std::convert::From<i32> for VulnerabilitySeverityLevel {
15790 fn from(value: i32) -> Self {
15791 match value {
15792 0 => Self::Unspecified,
15793 1 => Self::None,
15794 2 => Self::Minimal,
15795 3 => Self::Low,
15796 4 => Self::Medium,
15797 5 => Self::High,
15798 6 => Self::Critical,
15799 _ => Self::UnknownValue(vulnerability_severity_level::UnknownValue(
15800 wkt::internal::UnknownEnumValue::Integer(value),
15801 )),
15802 }
15803 }
15804 }
15805
15806 impl std::convert::From<&str> for VulnerabilitySeverityLevel {
15807 fn from(value: &str) -> Self {
15808 use std::string::ToString;
15809 match value {
15810 "VULNERABILITY_SEVERITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
15811 "NONE" => Self::None,
15812 "MINIMAL" => Self::Minimal,
15813 "LOW" => Self::Low,
15814 "MEDIUM" => Self::Medium,
15815 "HIGH" => Self::High,
15816 "CRITICAL" => Self::Critical,
15817 _ => Self::UnknownValue(vulnerability_severity_level::UnknownValue(
15818 wkt::internal::UnknownEnumValue::String(value.to_string()),
15819 )),
15820 }
15821 }
15822 }
15823
15824 impl serde::ser::Serialize for VulnerabilitySeverityLevel {
15825 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15826 where
15827 S: serde::Serializer,
15828 {
15829 match self {
15830 Self::Unspecified => serializer.serialize_i32(0),
15831 Self::None => serializer.serialize_i32(1),
15832 Self::Minimal => serializer.serialize_i32(2),
15833 Self::Low => serializer.serialize_i32(3),
15834 Self::Medium => serializer.serialize_i32(4),
15835 Self::High => serializer.serialize_i32(5),
15836 Self::Critical => serializer.serialize_i32(6),
15837 Self::UnknownValue(u) => u.0.serialize(serializer),
15838 }
15839 }
15840 }
15841
15842 impl<'de> serde::de::Deserialize<'de> for VulnerabilitySeverityLevel {
15843 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15844 where
15845 D: serde::Deserializer<'de>,
15846 {
15847 deserializer.deserialize_any(
15848 wkt::internal::EnumVisitor::<VulnerabilitySeverityLevel>::new(
15849 ".google.cloud.osconfig.v1.VulnerabilityReport.VulnerabilitySeverityLevel",
15850 ),
15851 )
15852 }
15853 }
15854}
15855
15856/// A request message for getting the vulnerability report for the specified VM.
15857#[derive(Clone, Default, PartialEq)]
15858#[non_exhaustive]
15859pub struct GetVulnerabilityReportRequest {
15860 /// Required. API resource name for vulnerability resource.
15861 ///
15862 /// Format:
15863 /// `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport`
15864 ///
15865 /// For `{project}`, either `project-number` or `project-id` can be provided.
15866 /// For `{instance}`, either Compute Engine `instance-id` or `instance-name`
15867 /// can be provided.
15868 pub name: std::string::String,
15869
15870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15871}
15872
15873impl GetVulnerabilityReportRequest {
15874 /// Creates a new default instance.
15875 pub fn new() -> Self {
15876 std::default::Default::default()
15877 }
15878
15879 /// Sets the value of [name][crate::model::GetVulnerabilityReportRequest::name].
15880 ///
15881 /// # Example
15882 /// ```ignore,no_run
15883 /// # use google_cloud_osconfig_v1::model::GetVulnerabilityReportRequest;
15884 /// let x = GetVulnerabilityReportRequest::new().set_name("example");
15885 /// ```
15886 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15887 self.name = v.into();
15888 self
15889 }
15890}
15891
15892impl wkt::message::Message for GetVulnerabilityReportRequest {
15893 fn typename() -> &'static str {
15894 "type.googleapis.com/google.cloud.osconfig.v1.GetVulnerabilityReportRequest"
15895 }
15896}
15897
15898/// A request message for listing vulnerability reports for all VM instances in
15899/// the specified location.
15900#[derive(Clone, Default, PartialEq)]
15901#[non_exhaustive]
15902pub struct ListVulnerabilityReportsRequest {
15903 /// Required. The parent resource name.
15904 ///
15905 /// Format: `projects/{project}/locations/{location}/instances/-`
15906 ///
15907 /// For `{project}`, either `project-number` or `project-id` can be provided.
15908 pub parent: std::string::String,
15909
15910 /// The maximum number of results to return.
15911 pub page_size: i32,
15912
15913 /// A pagination token returned from a previous call to
15914 /// `ListVulnerabilityReports` that indicates where this listing
15915 /// should continue from.
15916 pub page_token: std::string::String,
15917
15918 /// This field supports filtering by the severity level for the vulnerability.
15919 /// For a list of severity levels, see [Severity levels for
15920 /// vulnerabilities](https://cloud.google.com/container-analysis/docs/container-scanning-overview#severity_levels_for_vulnerabilities).
15921 ///
15922 /// The filter field follows the rules described in the
15923 /// [AIP-160](https://google.aip.dev/160) guidelines as follows:
15924 ///
15925 /// + **Filter for a specific severity type**: you can list reports that
15926 /// contain
15927 /// vulnerabilities that are classified as medium by specifying
15928 /// `vulnerabilities.details.severity:MEDIUM`.
15929 ///
15930 /// + **Filter for a range of severities** : you can list reports that have
15931 /// vulnerabilities that are classified as critical or high by specifying
15932 /// `vulnerabilities.details.severity:HIGH OR
15933 /// vulnerabilities.details.severity:CRITICAL`
15934 ///
15935 pub filter: std::string::String,
15936
15937 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15938}
15939
15940impl ListVulnerabilityReportsRequest {
15941 /// Creates a new default instance.
15942 pub fn new() -> Self {
15943 std::default::Default::default()
15944 }
15945
15946 /// Sets the value of [parent][crate::model::ListVulnerabilityReportsRequest::parent].
15947 ///
15948 /// # Example
15949 /// ```ignore,no_run
15950 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
15951 /// let x = ListVulnerabilityReportsRequest::new().set_parent("example");
15952 /// ```
15953 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15954 self.parent = v.into();
15955 self
15956 }
15957
15958 /// Sets the value of [page_size][crate::model::ListVulnerabilityReportsRequest::page_size].
15959 ///
15960 /// # Example
15961 /// ```ignore,no_run
15962 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
15963 /// let x = ListVulnerabilityReportsRequest::new().set_page_size(42);
15964 /// ```
15965 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15966 self.page_size = v.into();
15967 self
15968 }
15969
15970 /// Sets the value of [page_token][crate::model::ListVulnerabilityReportsRequest::page_token].
15971 ///
15972 /// # Example
15973 /// ```ignore,no_run
15974 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
15975 /// let x = ListVulnerabilityReportsRequest::new().set_page_token("example");
15976 /// ```
15977 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15978 self.page_token = v.into();
15979 self
15980 }
15981
15982 /// Sets the value of [filter][crate::model::ListVulnerabilityReportsRequest::filter].
15983 ///
15984 /// # Example
15985 /// ```ignore,no_run
15986 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
15987 /// let x = ListVulnerabilityReportsRequest::new().set_filter("example");
15988 /// ```
15989 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15990 self.filter = v.into();
15991 self
15992 }
15993}
15994
15995impl wkt::message::Message for ListVulnerabilityReportsRequest {
15996 fn typename() -> &'static str {
15997 "type.googleapis.com/google.cloud.osconfig.v1.ListVulnerabilityReportsRequest"
15998 }
15999}
16000
16001/// A response message for listing vulnerability reports for all VM instances in
16002/// the specified location.
16003#[derive(Clone, Default, PartialEq)]
16004#[non_exhaustive]
16005pub struct ListVulnerabilityReportsResponse {
16006 /// List of vulnerabilityReport objects.
16007 pub vulnerability_reports: std::vec::Vec<crate::model::VulnerabilityReport>,
16008
16009 /// The pagination token to retrieve the next page of vulnerabilityReports
16010 /// object.
16011 pub next_page_token: std::string::String,
16012
16013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16014}
16015
16016impl ListVulnerabilityReportsResponse {
16017 /// Creates a new default instance.
16018 pub fn new() -> Self {
16019 std::default::Default::default()
16020 }
16021
16022 /// Sets the value of [vulnerability_reports][crate::model::ListVulnerabilityReportsResponse::vulnerability_reports].
16023 ///
16024 /// # Example
16025 /// ```ignore,no_run
16026 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsResponse;
16027 /// use google_cloud_osconfig_v1::model::VulnerabilityReport;
16028 /// let x = ListVulnerabilityReportsResponse::new()
16029 /// .set_vulnerability_reports([
16030 /// VulnerabilityReport::default()/* use setters */,
16031 /// VulnerabilityReport::default()/* use (different) setters */,
16032 /// ]);
16033 /// ```
16034 pub fn set_vulnerability_reports<T, V>(mut self, v: T) -> Self
16035 where
16036 T: std::iter::IntoIterator<Item = V>,
16037 V: std::convert::Into<crate::model::VulnerabilityReport>,
16038 {
16039 use std::iter::Iterator;
16040 self.vulnerability_reports = v.into_iter().map(|i| i.into()).collect();
16041 self
16042 }
16043
16044 /// Sets the value of [next_page_token][crate::model::ListVulnerabilityReportsResponse::next_page_token].
16045 ///
16046 /// # Example
16047 /// ```ignore,no_run
16048 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsResponse;
16049 /// let x = ListVulnerabilityReportsResponse::new().set_next_page_token("example");
16050 /// ```
16051 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16052 self.next_page_token = v.into();
16053 self
16054 }
16055}
16056
16057impl wkt::message::Message for ListVulnerabilityReportsResponse {
16058 fn typename() -> &'static str {
16059 "type.googleapis.com/google.cloud.osconfig.v1.ListVulnerabilityReportsResponse"
16060 }
16061}
16062
16063#[doc(hidden)]
16064impl google_cloud_gax::paginator::internal::PageableResponse for ListVulnerabilityReportsResponse {
16065 type PageItem = crate::model::VulnerabilityReport;
16066
16067 fn items(self) -> std::vec::Vec<Self::PageItem> {
16068 self.vulnerability_reports
16069 }
16070
16071 fn next_page_token(&self) -> std::string::String {
16072 use std::clone::Clone;
16073 self.next_page_token.clone()
16074 }
16075}
16076
16077/// Common Vulnerability Scoring System version 3.
16078/// For details, see <https://www.first.org/cvss/specification-document>
16079#[derive(Clone, Default, PartialEq)]
16080#[non_exhaustive]
16081pub struct CVSSv3 {
16082 /// The base score is a function of the base metric scores.
16083 /// <https://www.first.org/cvss/specification-document#Base-Metrics>
16084 pub base_score: f32,
16085
16086 /// The Exploitability sub-score equation is derived from the Base
16087 /// Exploitability metrics.
16088 /// <https://www.first.org/cvss/specification-document#2-1-Exploitability-Metrics>
16089 pub exploitability_score: f32,
16090
16091 /// The Impact sub-score equation is derived from the Base Impact metrics.
16092 pub impact_score: f32,
16093
16094 /// This metric reflects the context by which vulnerability exploitation is
16095 /// possible.
16096 pub attack_vector: crate::model::cvs_sv_3::AttackVector,
16097
16098 /// This metric describes the conditions beyond the attacker's control that
16099 /// must exist in order to exploit the vulnerability.
16100 pub attack_complexity: crate::model::cvs_sv_3::AttackComplexity,
16101
16102 /// This metric describes the level of privileges an attacker must possess
16103 /// before successfully exploiting the vulnerability.
16104 pub privileges_required: crate::model::cvs_sv_3::PrivilegesRequired,
16105
16106 /// This metric captures the requirement for a human user, other than the
16107 /// attacker, to participate in the successful compromise of the vulnerable
16108 /// component.
16109 pub user_interaction: crate::model::cvs_sv_3::UserInteraction,
16110
16111 /// The Scope metric captures whether a vulnerability in one vulnerable
16112 /// component impacts resources in components beyond its security scope.
16113 pub scope: crate::model::cvs_sv_3::Scope,
16114
16115 /// This metric measures the impact to the confidentiality of the information
16116 /// resources managed by a software component due to a successfully exploited
16117 /// vulnerability.
16118 pub confidentiality_impact: crate::model::cvs_sv_3::Impact,
16119
16120 /// This metric measures the impact to integrity of a successfully exploited
16121 /// vulnerability.
16122 pub integrity_impact: crate::model::cvs_sv_3::Impact,
16123
16124 /// This metric measures the impact to the availability of the impacted
16125 /// component resulting from a successfully exploited vulnerability.
16126 pub availability_impact: crate::model::cvs_sv_3::Impact,
16127
16128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16129}
16130
16131impl CVSSv3 {
16132 /// Creates a new default instance.
16133 pub fn new() -> Self {
16134 std::default::Default::default()
16135 }
16136
16137 /// Sets the value of [base_score][crate::model::CVSSv3::base_score].
16138 ///
16139 /// # Example
16140 /// ```ignore,no_run
16141 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16142 /// let x = CVSSv3::new().set_base_score(42.0);
16143 /// ```
16144 pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16145 self.base_score = v.into();
16146 self
16147 }
16148
16149 /// Sets the value of [exploitability_score][crate::model::CVSSv3::exploitability_score].
16150 ///
16151 /// # Example
16152 /// ```ignore,no_run
16153 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16154 /// let x = CVSSv3::new().set_exploitability_score(42.0);
16155 /// ```
16156 pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16157 self.exploitability_score = v.into();
16158 self
16159 }
16160
16161 /// Sets the value of [impact_score][crate::model::CVSSv3::impact_score].
16162 ///
16163 /// # Example
16164 /// ```ignore,no_run
16165 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16166 /// let x = CVSSv3::new().set_impact_score(42.0);
16167 /// ```
16168 pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16169 self.impact_score = v.into();
16170 self
16171 }
16172
16173 /// Sets the value of [attack_vector][crate::model::CVSSv3::attack_vector].
16174 ///
16175 /// # Example
16176 /// ```ignore,no_run
16177 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16178 /// use google_cloud_osconfig_v1::model::cvs_sv_3::AttackVector;
16179 /// let x0 = CVSSv3::new().set_attack_vector(AttackVector::Network);
16180 /// let x1 = CVSSv3::new().set_attack_vector(AttackVector::Adjacent);
16181 /// let x2 = CVSSv3::new().set_attack_vector(AttackVector::Local);
16182 /// ```
16183 pub fn set_attack_vector<T: std::convert::Into<crate::model::cvs_sv_3::AttackVector>>(
16184 mut self,
16185 v: T,
16186 ) -> Self {
16187 self.attack_vector = v.into();
16188 self
16189 }
16190
16191 /// Sets the value of [attack_complexity][crate::model::CVSSv3::attack_complexity].
16192 ///
16193 /// # Example
16194 /// ```ignore,no_run
16195 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16196 /// use google_cloud_osconfig_v1::model::cvs_sv_3::AttackComplexity;
16197 /// let x0 = CVSSv3::new().set_attack_complexity(AttackComplexity::Low);
16198 /// let x1 = CVSSv3::new().set_attack_complexity(AttackComplexity::High);
16199 /// ```
16200 pub fn set_attack_complexity<
16201 T: std::convert::Into<crate::model::cvs_sv_3::AttackComplexity>,
16202 >(
16203 mut self,
16204 v: T,
16205 ) -> Self {
16206 self.attack_complexity = v.into();
16207 self
16208 }
16209
16210 /// Sets the value of [privileges_required][crate::model::CVSSv3::privileges_required].
16211 ///
16212 /// # Example
16213 /// ```ignore,no_run
16214 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16215 /// use google_cloud_osconfig_v1::model::cvs_sv_3::PrivilegesRequired;
16216 /// let x0 = CVSSv3::new().set_privileges_required(PrivilegesRequired::None);
16217 /// let x1 = CVSSv3::new().set_privileges_required(PrivilegesRequired::Low);
16218 /// let x2 = CVSSv3::new().set_privileges_required(PrivilegesRequired::High);
16219 /// ```
16220 pub fn set_privileges_required<
16221 T: std::convert::Into<crate::model::cvs_sv_3::PrivilegesRequired>,
16222 >(
16223 mut self,
16224 v: T,
16225 ) -> Self {
16226 self.privileges_required = v.into();
16227 self
16228 }
16229
16230 /// Sets the value of [user_interaction][crate::model::CVSSv3::user_interaction].
16231 ///
16232 /// # Example
16233 /// ```ignore,no_run
16234 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16235 /// use google_cloud_osconfig_v1::model::cvs_sv_3::UserInteraction;
16236 /// let x0 = CVSSv3::new().set_user_interaction(UserInteraction::None);
16237 /// let x1 = CVSSv3::new().set_user_interaction(UserInteraction::Required);
16238 /// ```
16239 pub fn set_user_interaction<T: std::convert::Into<crate::model::cvs_sv_3::UserInteraction>>(
16240 mut self,
16241 v: T,
16242 ) -> Self {
16243 self.user_interaction = v.into();
16244 self
16245 }
16246
16247 /// Sets the value of [scope][crate::model::CVSSv3::scope].
16248 ///
16249 /// # Example
16250 /// ```ignore,no_run
16251 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16252 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Scope;
16253 /// let x0 = CVSSv3::new().set_scope(Scope::Unchanged);
16254 /// let x1 = CVSSv3::new().set_scope(Scope::Changed);
16255 /// ```
16256 pub fn set_scope<T: std::convert::Into<crate::model::cvs_sv_3::Scope>>(mut self, v: T) -> Self {
16257 self.scope = v.into();
16258 self
16259 }
16260
16261 /// Sets the value of [confidentiality_impact][crate::model::CVSSv3::confidentiality_impact].
16262 ///
16263 /// # Example
16264 /// ```ignore,no_run
16265 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16266 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Impact;
16267 /// let x0 = CVSSv3::new().set_confidentiality_impact(Impact::High);
16268 /// let x1 = CVSSv3::new().set_confidentiality_impact(Impact::Low);
16269 /// let x2 = CVSSv3::new().set_confidentiality_impact(Impact::None);
16270 /// ```
16271 pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
16272 mut self,
16273 v: T,
16274 ) -> Self {
16275 self.confidentiality_impact = v.into();
16276 self
16277 }
16278
16279 /// Sets the value of [integrity_impact][crate::model::CVSSv3::integrity_impact].
16280 ///
16281 /// # Example
16282 /// ```ignore,no_run
16283 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16284 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Impact;
16285 /// let x0 = CVSSv3::new().set_integrity_impact(Impact::High);
16286 /// let x1 = CVSSv3::new().set_integrity_impact(Impact::Low);
16287 /// let x2 = CVSSv3::new().set_integrity_impact(Impact::None);
16288 /// ```
16289 pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
16290 mut self,
16291 v: T,
16292 ) -> Self {
16293 self.integrity_impact = v.into();
16294 self
16295 }
16296
16297 /// Sets the value of [availability_impact][crate::model::CVSSv3::availability_impact].
16298 ///
16299 /// # Example
16300 /// ```ignore,no_run
16301 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16302 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Impact;
16303 /// let x0 = CVSSv3::new().set_availability_impact(Impact::High);
16304 /// let x1 = CVSSv3::new().set_availability_impact(Impact::Low);
16305 /// let x2 = CVSSv3::new().set_availability_impact(Impact::None);
16306 /// ```
16307 pub fn set_availability_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
16308 mut self,
16309 v: T,
16310 ) -> Self {
16311 self.availability_impact = v.into();
16312 self
16313 }
16314}
16315
16316impl wkt::message::Message for CVSSv3 {
16317 fn typename() -> &'static str {
16318 "type.googleapis.com/google.cloud.osconfig.v1.CVSSv3"
16319 }
16320}
16321
16322/// Defines additional types related to [CVSSv3].
16323pub mod cvs_sv_3 {
16324 #[allow(unused_imports)]
16325 use super::*;
16326
16327 /// This metric reflects the context by which vulnerability exploitation is
16328 /// possible.
16329 ///
16330 /// # Working with unknown values
16331 ///
16332 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16333 /// additional enum variants at any time. Adding new variants is not considered
16334 /// a breaking change. Applications should write their code in anticipation of:
16335 ///
16336 /// - New values appearing in future releases of the client library, **and**
16337 /// - New values received dynamically, without application changes.
16338 ///
16339 /// Please consult the [Working with enums] section in the user guide for some
16340 /// guidelines.
16341 ///
16342 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16343 #[derive(Clone, Debug, PartialEq)]
16344 #[non_exhaustive]
16345 pub enum AttackVector {
16346 /// Invalid value.
16347 Unspecified,
16348 /// The vulnerable component is bound to the network stack and the set of
16349 /// possible attackers extends beyond the other options listed below, up to
16350 /// and including the entire Internet.
16351 Network,
16352 /// The vulnerable component is bound to the network stack, but the attack is
16353 /// limited at the protocol level to a logically adjacent topology.
16354 Adjacent,
16355 /// The vulnerable component is not bound to the network stack and the
16356 /// attacker's path is via read/write/execute capabilities.
16357 Local,
16358 /// The attack requires the attacker to physically touch or manipulate the
16359 /// vulnerable component.
16360 Physical,
16361 /// If set, the enum was initialized with an unknown value.
16362 ///
16363 /// Applications can examine the value using [AttackVector::value] or
16364 /// [AttackVector::name].
16365 UnknownValue(attack_vector::UnknownValue),
16366 }
16367
16368 #[doc(hidden)]
16369 pub mod attack_vector {
16370 #[allow(unused_imports)]
16371 use super::*;
16372 #[derive(Clone, Debug, PartialEq)]
16373 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16374 }
16375
16376 impl AttackVector {
16377 /// Gets the enum value.
16378 ///
16379 /// Returns `None` if the enum contains an unknown value deserialized from
16380 /// the string representation of enums.
16381 pub fn value(&self) -> std::option::Option<i32> {
16382 match self {
16383 Self::Unspecified => std::option::Option::Some(0),
16384 Self::Network => std::option::Option::Some(1),
16385 Self::Adjacent => std::option::Option::Some(2),
16386 Self::Local => std::option::Option::Some(3),
16387 Self::Physical => std::option::Option::Some(4),
16388 Self::UnknownValue(u) => u.0.value(),
16389 }
16390 }
16391
16392 /// Gets the enum value as a string.
16393 ///
16394 /// Returns `None` if the enum contains an unknown value deserialized from
16395 /// the integer representation of enums.
16396 pub fn name(&self) -> std::option::Option<&str> {
16397 match self {
16398 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
16399 Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
16400 Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
16401 Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
16402 Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
16403 Self::UnknownValue(u) => u.0.name(),
16404 }
16405 }
16406 }
16407
16408 impl std::default::Default for AttackVector {
16409 fn default() -> Self {
16410 use std::convert::From;
16411 Self::from(0)
16412 }
16413 }
16414
16415 impl std::fmt::Display for AttackVector {
16416 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16417 wkt::internal::display_enum(f, self.name(), self.value())
16418 }
16419 }
16420
16421 impl std::convert::From<i32> for AttackVector {
16422 fn from(value: i32) -> Self {
16423 match value {
16424 0 => Self::Unspecified,
16425 1 => Self::Network,
16426 2 => Self::Adjacent,
16427 3 => Self::Local,
16428 4 => Self::Physical,
16429 _ => Self::UnknownValue(attack_vector::UnknownValue(
16430 wkt::internal::UnknownEnumValue::Integer(value),
16431 )),
16432 }
16433 }
16434 }
16435
16436 impl std::convert::From<&str> for AttackVector {
16437 fn from(value: &str) -> Self {
16438 use std::string::ToString;
16439 match value {
16440 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
16441 "ATTACK_VECTOR_NETWORK" => Self::Network,
16442 "ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
16443 "ATTACK_VECTOR_LOCAL" => Self::Local,
16444 "ATTACK_VECTOR_PHYSICAL" => Self::Physical,
16445 _ => Self::UnknownValue(attack_vector::UnknownValue(
16446 wkt::internal::UnknownEnumValue::String(value.to_string()),
16447 )),
16448 }
16449 }
16450 }
16451
16452 impl serde::ser::Serialize for AttackVector {
16453 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16454 where
16455 S: serde::Serializer,
16456 {
16457 match self {
16458 Self::Unspecified => serializer.serialize_i32(0),
16459 Self::Network => serializer.serialize_i32(1),
16460 Self::Adjacent => serializer.serialize_i32(2),
16461 Self::Local => serializer.serialize_i32(3),
16462 Self::Physical => serializer.serialize_i32(4),
16463 Self::UnknownValue(u) => u.0.serialize(serializer),
16464 }
16465 }
16466 }
16467
16468 impl<'de> serde::de::Deserialize<'de> for AttackVector {
16469 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16470 where
16471 D: serde::Deserializer<'de>,
16472 {
16473 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
16474 ".google.cloud.osconfig.v1.CVSSv3.AttackVector",
16475 ))
16476 }
16477 }
16478
16479 /// This metric describes the conditions beyond the attacker's control that
16480 /// must exist in order to exploit the vulnerability.
16481 ///
16482 /// # Working with unknown values
16483 ///
16484 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16485 /// additional enum variants at any time. Adding new variants is not considered
16486 /// a breaking change. Applications should write their code in anticipation of:
16487 ///
16488 /// - New values appearing in future releases of the client library, **and**
16489 /// - New values received dynamically, without application changes.
16490 ///
16491 /// Please consult the [Working with enums] section in the user guide for some
16492 /// guidelines.
16493 ///
16494 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16495 #[derive(Clone, Debug, PartialEq)]
16496 #[non_exhaustive]
16497 pub enum AttackComplexity {
16498 /// Invalid value.
16499 Unspecified,
16500 /// Specialized access conditions or extenuating circumstances do not exist.
16501 /// An attacker can expect repeatable success when attacking the vulnerable
16502 /// component.
16503 Low,
16504 /// A successful attack depends on conditions beyond the attacker's control.
16505 /// That is, a successful attack cannot be accomplished at will, but requires
16506 /// the attacker to invest in some measurable amount of effort in preparation
16507 /// or execution against the vulnerable component before a successful attack
16508 /// can be expected.
16509 High,
16510 /// If set, the enum was initialized with an unknown value.
16511 ///
16512 /// Applications can examine the value using [AttackComplexity::value] or
16513 /// [AttackComplexity::name].
16514 UnknownValue(attack_complexity::UnknownValue),
16515 }
16516
16517 #[doc(hidden)]
16518 pub mod attack_complexity {
16519 #[allow(unused_imports)]
16520 use super::*;
16521 #[derive(Clone, Debug, PartialEq)]
16522 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16523 }
16524
16525 impl AttackComplexity {
16526 /// Gets the enum value.
16527 ///
16528 /// Returns `None` if the enum contains an unknown value deserialized from
16529 /// the string representation of enums.
16530 pub fn value(&self) -> std::option::Option<i32> {
16531 match self {
16532 Self::Unspecified => std::option::Option::Some(0),
16533 Self::Low => std::option::Option::Some(1),
16534 Self::High => std::option::Option::Some(2),
16535 Self::UnknownValue(u) => u.0.value(),
16536 }
16537 }
16538
16539 /// Gets the enum value as a string.
16540 ///
16541 /// Returns `None` if the enum contains an unknown value deserialized from
16542 /// the integer representation of enums.
16543 pub fn name(&self) -> std::option::Option<&str> {
16544 match self {
16545 Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
16546 Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
16547 Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
16548 Self::UnknownValue(u) => u.0.name(),
16549 }
16550 }
16551 }
16552
16553 impl std::default::Default for AttackComplexity {
16554 fn default() -> Self {
16555 use std::convert::From;
16556 Self::from(0)
16557 }
16558 }
16559
16560 impl std::fmt::Display for AttackComplexity {
16561 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16562 wkt::internal::display_enum(f, self.name(), self.value())
16563 }
16564 }
16565
16566 impl std::convert::From<i32> for AttackComplexity {
16567 fn from(value: i32) -> Self {
16568 match value {
16569 0 => Self::Unspecified,
16570 1 => Self::Low,
16571 2 => Self::High,
16572 _ => Self::UnknownValue(attack_complexity::UnknownValue(
16573 wkt::internal::UnknownEnumValue::Integer(value),
16574 )),
16575 }
16576 }
16577 }
16578
16579 impl std::convert::From<&str> for AttackComplexity {
16580 fn from(value: &str) -> Self {
16581 use std::string::ToString;
16582 match value {
16583 "ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
16584 "ATTACK_COMPLEXITY_LOW" => Self::Low,
16585 "ATTACK_COMPLEXITY_HIGH" => Self::High,
16586 _ => Self::UnknownValue(attack_complexity::UnknownValue(
16587 wkt::internal::UnknownEnumValue::String(value.to_string()),
16588 )),
16589 }
16590 }
16591 }
16592
16593 impl serde::ser::Serialize for AttackComplexity {
16594 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16595 where
16596 S: serde::Serializer,
16597 {
16598 match self {
16599 Self::Unspecified => serializer.serialize_i32(0),
16600 Self::Low => serializer.serialize_i32(1),
16601 Self::High => serializer.serialize_i32(2),
16602 Self::UnknownValue(u) => u.0.serialize(serializer),
16603 }
16604 }
16605 }
16606
16607 impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
16608 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16609 where
16610 D: serde::Deserializer<'de>,
16611 {
16612 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
16613 ".google.cloud.osconfig.v1.CVSSv3.AttackComplexity",
16614 ))
16615 }
16616 }
16617
16618 /// This metric describes the level of privileges an attacker must possess
16619 /// before successfully exploiting the vulnerability.
16620 ///
16621 /// # Working with unknown values
16622 ///
16623 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16624 /// additional enum variants at any time. Adding new variants is not considered
16625 /// a breaking change. Applications should write their code in anticipation of:
16626 ///
16627 /// - New values appearing in future releases of the client library, **and**
16628 /// - New values received dynamically, without application changes.
16629 ///
16630 /// Please consult the [Working with enums] section in the user guide for some
16631 /// guidelines.
16632 ///
16633 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16634 #[derive(Clone, Debug, PartialEq)]
16635 #[non_exhaustive]
16636 pub enum PrivilegesRequired {
16637 /// Invalid value.
16638 Unspecified,
16639 /// The attacker is unauthorized prior to attack, and therefore does not
16640 /// require any access to settings or files of the vulnerable system to
16641 /// carry out an attack.
16642 None,
16643 /// The attacker requires privileges that provide basic user capabilities
16644 /// that could normally affect only settings and files owned by a user.
16645 /// Alternatively, an attacker with Low privileges has the ability to access
16646 /// only non-sensitive resources.
16647 Low,
16648 /// The attacker requires privileges that provide significant (e.g.,
16649 /// administrative) control over the vulnerable component allowing access to
16650 /// component-wide settings and files.
16651 High,
16652 /// If set, the enum was initialized with an unknown value.
16653 ///
16654 /// Applications can examine the value using [PrivilegesRequired::value] or
16655 /// [PrivilegesRequired::name].
16656 UnknownValue(privileges_required::UnknownValue),
16657 }
16658
16659 #[doc(hidden)]
16660 pub mod privileges_required {
16661 #[allow(unused_imports)]
16662 use super::*;
16663 #[derive(Clone, Debug, PartialEq)]
16664 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16665 }
16666
16667 impl PrivilegesRequired {
16668 /// Gets the enum value.
16669 ///
16670 /// Returns `None` if the enum contains an unknown value deserialized from
16671 /// the string representation of enums.
16672 pub fn value(&self) -> std::option::Option<i32> {
16673 match self {
16674 Self::Unspecified => std::option::Option::Some(0),
16675 Self::None => std::option::Option::Some(1),
16676 Self::Low => std::option::Option::Some(2),
16677 Self::High => std::option::Option::Some(3),
16678 Self::UnknownValue(u) => u.0.value(),
16679 }
16680 }
16681
16682 /// Gets the enum value as a string.
16683 ///
16684 /// Returns `None` if the enum contains an unknown value deserialized from
16685 /// the integer representation of enums.
16686 pub fn name(&self) -> std::option::Option<&str> {
16687 match self {
16688 Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
16689 Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
16690 Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
16691 Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
16692 Self::UnknownValue(u) => u.0.name(),
16693 }
16694 }
16695 }
16696
16697 impl std::default::Default for PrivilegesRequired {
16698 fn default() -> Self {
16699 use std::convert::From;
16700 Self::from(0)
16701 }
16702 }
16703
16704 impl std::fmt::Display for PrivilegesRequired {
16705 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16706 wkt::internal::display_enum(f, self.name(), self.value())
16707 }
16708 }
16709
16710 impl std::convert::From<i32> for PrivilegesRequired {
16711 fn from(value: i32) -> Self {
16712 match value {
16713 0 => Self::Unspecified,
16714 1 => Self::None,
16715 2 => Self::Low,
16716 3 => Self::High,
16717 _ => Self::UnknownValue(privileges_required::UnknownValue(
16718 wkt::internal::UnknownEnumValue::Integer(value),
16719 )),
16720 }
16721 }
16722 }
16723
16724 impl std::convert::From<&str> for PrivilegesRequired {
16725 fn from(value: &str) -> Self {
16726 use std::string::ToString;
16727 match value {
16728 "PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
16729 "PRIVILEGES_REQUIRED_NONE" => Self::None,
16730 "PRIVILEGES_REQUIRED_LOW" => Self::Low,
16731 "PRIVILEGES_REQUIRED_HIGH" => Self::High,
16732 _ => Self::UnknownValue(privileges_required::UnknownValue(
16733 wkt::internal::UnknownEnumValue::String(value.to_string()),
16734 )),
16735 }
16736 }
16737 }
16738
16739 impl serde::ser::Serialize for PrivilegesRequired {
16740 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16741 where
16742 S: serde::Serializer,
16743 {
16744 match self {
16745 Self::Unspecified => serializer.serialize_i32(0),
16746 Self::None => serializer.serialize_i32(1),
16747 Self::Low => serializer.serialize_i32(2),
16748 Self::High => serializer.serialize_i32(3),
16749 Self::UnknownValue(u) => u.0.serialize(serializer),
16750 }
16751 }
16752 }
16753
16754 impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
16755 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16756 where
16757 D: serde::Deserializer<'de>,
16758 {
16759 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
16760 ".google.cloud.osconfig.v1.CVSSv3.PrivilegesRequired",
16761 ))
16762 }
16763 }
16764
16765 /// This metric captures the requirement for a human user, other than the
16766 /// attacker, to participate in the successful compromise of the vulnerable
16767 /// component.
16768 ///
16769 /// # Working with unknown values
16770 ///
16771 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16772 /// additional enum variants at any time. Adding new variants is not considered
16773 /// a breaking change. Applications should write their code in anticipation of:
16774 ///
16775 /// - New values appearing in future releases of the client library, **and**
16776 /// - New values received dynamically, without application changes.
16777 ///
16778 /// Please consult the [Working with enums] section in the user guide for some
16779 /// guidelines.
16780 ///
16781 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16782 #[derive(Clone, Debug, PartialEq)]
16783 #[non_exhaustive]
16784 pub enum UserInteraction {
16785 /// Invalid value.
16786 Unspecified,
16787 /// The vulnerable system can be exploited without interaction from any user.
16788 None,
16789 /// Successful exploitation of this vulnerability requires a user to take
16790 /// some action before the vulnerability can be exploited.
16791 Required,
16792 /// If set, the enum was initialized with an unknown value.
16793 ///
16794 /// Applications can examine the value using [UserInteraction::value] or
16795 /// [UserInteraction::name].
16796 UnknownValue(user_interaction::UnknownValue),
16797 }
16798
16799 #[doc(hidden)]
16800 pub mod user_interaction {
16801 #[allow(unused_imports)]
16802 use super::*;
16803 #[derive(Clone, Debug, PartialEq)]
16804 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16805 }
16806
16807 impl UserInteraction {
16808 /// Gets the enum value.
16809 ///
16810 /// Returns `None` if the enum contains an unknown value deserialized from
16811 /// the string representation of enums.
16812 pub fn value(&self) -> std::option::Option<i32> {
16813 match self {
16814 Self::Unspecified => std::option::Option::Some(0),
16815 Self::None => std::option::Option::Some(1),
16816 Self::Required => std::option::Option::Some(2),
16817 Self::UnknownValue(u) => u.0.value(),
16818 }
16819 }
16820
16821 /// Gets the enum value as a string.
16822 ///
16823 /// Returns `None` if the enum contains an unknown value deserialized from
16824 /// the integer representation of enums.
16825 pub fn name(&self) -> std::option::Option<&str> {
16826 match self {
16827 Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
16828 Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
16829 Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
16830 Self::UnknownValue(u) => u.0.name(),
16831 }
16832 }
16833 }
16834
16835 impl std::default::Default for UserInteraction {
16836 fn default() -> Self {
16837 use std::convert::From;
16838 Self::from(0)
16839 }
16840 }
16841
16842 impl std::fmt::Display for UserInteraction {
16843 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16844 wkt::internal::display_enum(f, self.name(), self.value())
16845 }
16846 }
16847
16848 impl std::convert::From<i32> for UserInteraction {
16849 fn from(value: i32) -> Self {
16850 match value {
16851 0 => Self::Unspecified,
16852 1 => Self::None,
16853 2 => Self::Required,
16854 _ => Self::UnknownValue(user_interaction::UnknownValue(
16855 wkt::internal::UnknownEnumValue::Integer(value),
16856 )),
16857 }
16858 }
16859 }
16860
16861 impl std::convert::From<&str> for UserInteraction {
16862 fn from(value: &str) -> Self {
16863 use std::string::ToString;
16864 match value {
16865 "USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
16866 "USER_INTERACTION_NONE" => Self::None,
16867 "USER_INTERACTION_REQUIRED" => Self::Required,
16868 _ => Self::UnknownValue(user_interaction::UnknownValue(
16869 wkt::internal::UnknownEnumValue::String(value.to_string()),
16870 )),
16871 }
16872 }
16873 }
16874
16875 impl serde::ser::Serialize for UserInteraction {
16876 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16877 where
16878 S: serde::Serializer,
16879 {
16880 match self {
16881 Self::Unspecified => serializer.serialize_i32(0),
16882 Self::None => serializer.serialize_i32(1),
16883 Self::Required => serializer.serialize_i32(2),
16884 Self::UnknownValue(u) => u.0.serialize(serializer),
16885 }
16886 }
16887 }
16888
16889 impl<'de> serde::de::Deserialize<'de> for UserInteraction {
16890 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16891 where
16892 D: serde::Deserializer<'de>,
16893 {
16894 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
16895 ".google.cloud.osconfig.v1.CVSSv3.UserInteraction",
16896 ))
16897 }
16898 }
16899
16900 /// The Scope metric captures whether a vulnerability in one vulnerable
16901 /// component impacts resources in components beyond its security scope.
16902 ///
16903 /// # Working with unknown values
16904 ///
16905 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16906 /// additional enum variants at any time. Adding new variants is not considered
16907 /// a breaking change. Applications should write their code in anticipation of:
16908 ///
16909 /// - New values appearing in future releases of the client library, **and**
16910 /// - New values received dynamically, without application changes.
16911 ///
16912 /// Please consult the [Working with enums] section in the user guide for some
16913 /// guidelines.
16914 ///
16915 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16916 #[derive(Clone, Debug, PartialEq)]
16917 #[non_exhaustive]
16918 pub enum Scope {
16919 /// Invalid value.
16920 Unspecified,
16921 /// An exploited vulnerability can only affect resources managed by the same
16922 /// security authority.
16923 Unchanged,
16924 /// An exploited vulnerability can affect resources beyond the security scope
16925 /// managed by the security authority of the vulnerable component.
16926 Changed,
16927 /// If set, the enum was initialized with an unknown value.
16928 ///
16929 /// Applications can examine the value using [Scope::value] or
16930 /// [Scope::name].
16931 UnknownValue(scope::UnknownValue),
16932 }
16933
16934 #[doc(hidden)]
16935 pub mod scope {
16936 #[allow(unused_imports)]
16937 use super::*;
16938 #[derive(Clone, Debug, PartialEq)]
16939 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16940 }
16941
16942 impl Scope {
16943 /// Gets the enum value.
16944 ///
16945 /// Returns `None` if the enum contains an unknown value deserialized from
16946 /// the string representation of enums.
16947 pub fn value(&self) -> std::option::Option<i32> {
16948 match self {
16949 Self::Unspecified => std::option::Option::Some(0),
16950 Self::Unchanged => std::option::Option::Some(1),
16951 Self::Changed => std::option::Option::Some(2),
16952 Self::UnknownValue(u) => u.0.value(),
16953 }
16954 }
16955
16956 /// Gets the enum value as a string.
16957 ///
16958 /// Returns `None` if the enum contains an unknown value deserialized from
16959 /// the integer representation of enums.
16960 pub fn name(&self) -> std::option::Option<&str> {
16961 match self {
16962 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
16963 Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
16964 Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
16965 Self::UnknownValue(u) => u.0.name(),
16966 }
16967 }
16968 }
16969
16970 impl std::default::Default for Scope {
16971 fn default() -> Self {
16972 use std::convert::From;
16973 Self::from(0)
16974 }
16975 }
16976
16977 impl std::fmt::Display for Scope {
16978 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16979 wkt::internal::display_enum(f, self.name(), self.value())
16980 }
16981 }
16982
16983 impl std::convert::From<i32> for Scope {
16984 fn from(value: i32) -> Self {
16985 match value {
16986 0 => Self::Unspecified,
16987 1 => Self::Unchanged,
16988 2 => Self::Changed,
16989 _ => Self::UnknownValue(scope::UnknownValue(
16990 wkt::internal::UnknownEnumValue::Integer(value),
16991 )),
16992 }
16993 }
16994 }
16995
16996 impl std::convert::From<&str> for Scope {
16997 fn from(value: &str) -> Self {
16998 use std::string::ToString;
16999 match value {
17000 "SCOPE_UNSPECIFIED" => Self::Unspecified,
17001 "SCOPE_UNCHANGED" => Self::Unchanged,
17002 "SCOPE_CHANGED" => Self::Changed,
17003 _ => Self::UnknownValue(scope::UnknownValue(
17004 wkt::internal::UnknownEnumValue::String(value.to_string()),
17005 )),
17006 }
17007 }
17008 }
17009
17010 impl serde::ser::Serialize for Scope {
17011 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17012 where
17013 S: serde::Serializer,
17014 {
17015 match self {
17016 Self::Unspecified => serializer.serialize_i32(0),
17017 Self::Unchanged => serializer.serialize_i32(1),
17018 Self::Changed => serializer.serialize_i32(2),
17019 Self::UnknownValue(u) => u.0.serialize(serializer),
17020 }
17021 }
17022 }
17023
17024 impl<'de> serde::de::Deserialize<'de> for Scope {
17025 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17026 where
17027 D: serde::Deserializer<'de>,
17028 {
17029 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
17030 ".google.cloud.osconfig.v1.CVSSv3.Scope",
17031 ))
17032 }
17033 }
17034
17035 /// The Impact metrics capture the effects of a successfully exploited
17036 /// vulnerability on the component that suffers the worst outcome that is most
17037 /// directly and predictably associated with the attack.
17038 ///
17039 /// # Working with unknown values
17040 ///
17041 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17042 /// additional enum variants at any time. Adding new variants is not considered
17043 /// a breaking change. Applications should write their code in anticipation of:
17044 ///
17045 /// - New values appearing in future releases of the client library, **and**
17046 /// - New values received dynamically, without application changes.
17047 ///
17048 /// Please consult the [Working with enums] section in the user guide for some
17049 /// guidelines.
17050 ///
17051 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17052 #[derive(Clone, Debug, PartialEq)]
17053 #[non_exhaustive]
17054 pub enum Impact {
17055 /// Invalid value.
17056 Unspecified,
17057 /// High impact.
17058 High,
17059 /// Low impact.
17060 Low,
17061 /// No impact.
17062 None,
17063 /// If set, the enum was initialized with an unknown value.
17064 ///
17065 /// Applications can examine the value using [Impact::value] or
17066 /// [Impact::name].
17067 UnknownValue(impact::UnknownValue),
17068 }
17069
17070 #[doc(hidden)]
17071 pub mod impact {
17072 #[allow(unused_imports)]
17073 use super::*;
17074 #[derive(Clone, Debug, PartialEq)]
17075 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17076 }
17077
17078 impl Impact {
17079 /// Gets the enum value.
17080 ///
17081 /// Returns `None` if the enum contains an unknown value deserialized from
17082 /// the string representation of enums.
17083 pub fn value(&self) -> std::option::Option<i32> {
17084 match self {
17085 Self::Unspecified => std::option::Option::Some(0),
17086 Self::High => std::option::Option::Some(1),
17087 Self::Low => std::option::Option::Some(2),
17088 Self::None => std::option::Option::Some(3),
17089 Self::UnknownValue(u) => u.0.value(),
17090 }
17091 }
17092
17093 /// Gets the enum value as a string.
17094 ///
17095 /// Returns `None` if the enum contains an unknown value deserialized from
17096 /// the integer representation of enums.
17097 pub fn name(&self) -> std::option::Option<&str> {
17098 match self {
17099 Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
17100 Self::High => std::option::Option::Some("IMPACT_HIGH"),
17101 Self::Low => std::option::Option::Some("IMPACT_LOW"),
17102 Self::None => std::option::Option::Some("IMPACT_NONE"),
17103 Self::UnknownValue(u) => u.0.name(),
17104 }
17105 }
17106 }
17107
17108 impl std::default::Default for Impact {
17109 fn default() -> Self {
17110 use std::convert::From;
17111 Self::from(0)
17112 }
17113 }
17114
17115 impl std::fmt::Display for Impact {
17116 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17117 wkt::internal::display_enum(f, self.name(), self.value())
17118 }
17119 }
17120
17121 impl std::convert::From<i32> for Impact {
17122 fn from(value: i32) -> Self {
17123 match value {
17124 0 => Self::Unspecified,
17125 1 => Self::High,
17126 2 => Self::Low,
17127 3 => Self::None,
17128 _ => Self::UnknownValue(impact::UnknownValue(
17129 wkt::internal::UnknownEnumValue::Integer(value),
17130 )),
17131 }
17132 }
17133 }
17134
17135 impl std::convert::From<&str> for Impact {
17136 fn from(value: &str) -> Self {
17137 use std::string::ToString;
17138 match value {
17139 "IMPACT_UNSPECIFIED" => Self::Unspecified,
17140 "IMPACT_HIGH" => Self::High,
17141 "IMPACT_LOW" => Self::Low,
17142 "IMPACT_NONE" => Self::None,
17143 _ => Self::UnknownValue(impact::UnknownValue(
17144 wkt::internal::UnknownEnumValue::String(value.to_string()),
17145 )),
17146 }
17147 }
17148 }
17149
17150 impl serde::ser::Serialize for Impact {
17151 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17152 where
17153 S: serde::Serializer,
17154 {
17155 match self {
17156 Self::Unspecified => serializer.serialize_i32(0),
17157 Self::High => serializer.serialize_i32(1),
17158 Self::Low => serializer.serialize_i32(2),
17159 Self::None => serializer.serialize_i32(3),
17160 Self::UnknownValue(u) => u.0.serialize(serializer),
17161 }
17162 }
17163 }
17164
17165 impl<'de> serde::de::Deserialize<'de> for Impact {
17166 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17167 where
17168 D: serde::Deserializer<'de>,
17169 {
17170 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
17171 ".google.cloud.osconfig.v1.CVSSv3.Impact",
17172 ))
17173 }
17174 }
17175}
17176
17177/// The view for inventory objects.
17178///
17179/// # Working with unknown values
17180///
17181/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17182/// additional enum variants at any time. Adding new variants is not considered
17183/// a breaking change. Applications should write their code in anticipation of:
17184///
17185/// - New values appearing in future releases of the client library, **and**
17186/// - New values received dynamically, without application changes.
17187///
17188/// Please consult the [Working with enums] section in the user guide for some
17189/// guidelines.
17190///
17191/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17192#[derive(Clone, Debug, PartialEq)]
17193#[non_exhaustive]
17194pub enum InventoryView {
17195 /// The default value.
17196 /// The API defaults to the BASIC view.
17197 Unspecified,
17198 /// Returns the basic inventory information that includes `os_info`.
17199 Basic,
17200 /// Returns all fields.
17201 Full,
17202 /// If set, the enum was initialized with an unknown value.
17203 ///
17204 /// Applications can examine the value using [InventoryView::value] or
17205 /// [InventoryView::name].
17206 UnknownValue(inventory_view::UnknownValue),
17207}
17208
17209#[doc(hidden)]
17210pub mod inventory_view {
17211 #[allow(unused_imports)]
17212 use super::*;
17213 #[derive(Clone, Debug, PartialEq)]
17214 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17215}
17216
17217impl InventoryView {
17218 /// Gets the enum value.
17219 ///
17220 /// Returns `None` if the enum contains an unknown value deserialized from
17221 /// the string representation of enums.
17222 pub fn value(&self) -> std::option::Option<i32> {
17223 match self {
17224 Self::Unspecified => std::option::Option::Some(0),
17225 Self::Basic => std::option::Option::Some(1),
17226 Self::Full => std::option::Option::Some(2),
17227 Self::UnknownValue(u) => u.0.value(),
17228 }
17229 }
17230
17231 /// Gets the enum value as a string.
17232 ///
17233 /// Returns `None` if the enum contains an unknown value deserialized from
17234 /// the integer representation of enums.
17235 pub fn name(&self) -> std::option::Option<&str> {
17236 match self {
17237 Self::Unspecified => std::option::Option::Some("INVENTORY_VIEW_UNSPECIFIED"),
17238 Self::Basic => std::option::Option::Some("BASIC"),
17239 Self::Full => std::option::Option::Some("FULL"),
17240 Self::UnknownValue(u) => u.0.name(),
17241 }
17242 }
17243}
17244
17245impl std::default::Default for InventoryView {
17246 fn default() -> Self {
17247 use std::convert::From;
17248 Self::from(0)
17249 }
17250}
17251
17252impl std::fmt::Display for InventoryView {
17253 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17254 wkt::internal::display_enum(f, self.name(), self.value())
17255 }
17256}
17257
17258impl std::convert::From<i32> for InventoryView {
17259 fn from(value: i32) -> Self {
17260 match value {
17261 0 => Self::Unspecified,
17262 1 => Self::Basic,
17263 2 => Self::Full,
17264 _ => Self::UnknownValue(inventory_view::UnknownValue(
17265 wkt::internal::UnknownEnumValue::Integer(value),
17266 )),
17267 }
17268 }
17269}
17270
17271impl std::convert::From<&str> for InventoryView {
17272 fn from(value: &str) -> Self {
17273 use std::string::ToString;
17274 match value {
17275 "INVENTORY_VIEW_UNSPECIFIED" => Self::Unspecified,
17276 "BASIC" => Self::Basic,
17277 "FULL" => Self::Full,
17278 _ => Self::UnknownValue(inventory_view::UnknownValue(
17279 wkt::internal::UnknownEnumValue::String(value.to_string()),
17280 )),
17281 }
17282 }
17283}
17284
17285impl serde::ser::Serialize for InventoryView {
17286 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17287 where
17288 S: serde::Serializer,
17289 {
17290 match self {
17291 Self::Unspecified => serializer.serialize_i32(0),
17292 Self::Basic => serializer.serialize_i32(1),
17293 Self::Full => serializer.serialize_i32(2),
17294 Self::UnknownValue(u) => u.0.serialize(serializer),
17295 }
17296 }
17297}
17298
17299impl<'de> serde::de::Deserialize<'de> for InventoryView {
17300 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17301 where
17302 D: serde::Deserializer<'de>,
17303 {
17304 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InventoryView>::new(
17305 ".google.cloud.osconfig.v1.InventoryView",
17306 ))
17307 }
17308}