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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
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 project_id = "project_id";
83 /// # let location_id = "location_id";
84 /// # let instance_id = "instance_id";
85 /// let x = Inventory::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/inventory"));
86 /// ```
87 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
88 self.name = v.into();
89 self
90 }
91
92 /// Sets the value of [os_info][crate::model::Inventory::os_info].
93 ///
94 /// # Example
95 /// ```ignore,no_run
96 /// # use google_cloud_osconfig_v1::model::Inventory;
97 /// use google_cloud_osconfig_v1::model::inventory::OsInfo;
98 /// let x = Inventory::new().set_os_info(OsInfo::default()/* use setters */);
99 /// ```
100 pub fn set_os_info<T>(mut self, v: T) -> Self
101 where
102 T: std::convert::Into<crate::model::inventory::OsInfo>,
103 {
104 self.os_info = std::option::Option::Some(v.into());
105 self
106 }
107
108 /// Sets or clears the value of [os_info][crate::model::Inventory::os_info].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_osconfig_v1::model::Inventory;
113 /// use google_cloud_osconfig_v1::model::inventory::OsInfo;
114 /// let x = Inventory::new().set_or_clear_os_info(Some(OsInfo::default()/* use setters */));
115 /// let x = Inventory::new().set_or_clear_os_info(None::<OsInfo>);
116 /// ```
117 pub fn set_or_clear_os_info<T>(mut self, v: std::option::Option<T>) -> Self
118 where
119 T: std::convert::Into<crate::model::inventory::OsInfo>,
120 {
121 self.os_info = v.map(|x| x.into());
122 self
123 }
124
125 /// Sets the value of [items][crate::model::Inventory::items].
126 ///
127 /// # Example
128 /// ```ignore,no_run
129 /// # use google_cloud_osconfig_v1::model::Inventory;
130 /// use google_cloud_osconfig_v1::model::inventory::Item;
131 /// let x = Inventory::new().set_items([
132 /// ("key0", Item::default()/* use setters */),
133 /// ("key1", Item::default()/* use (different) setters */),
134 /// ]);
135 /// ```
136 pub fn set_items<T, K, V>(mut self, v: T) -> Self
137 where
138 T: std::iter::IntoIterator<Item = (K, V)>,
139 K: std::convert::Into<std::string::String>,
140 V: std::convert::Into<crate::model::inventory::Item>,
141 {
142 use std::iter::Iterator;
143 self.items = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
144 self
145 }
146
147 /// Sets the value of [update_time][crate::model::Inventory::update_time].
148 ///
149 /// # Example
150 /// ```ignore,no_run
151 /// # use google_cloud_osconfig_v1::model::Inventory;
152 /// use wkt::Timestamp;
153 /// let x = Inventory::new().set_update_time(Timestamp::default()/* use setters */);
154 /// ```
155 pub fn set_update_time<T>(mut self, v: T) -> Self
156 where
157 T: std::convert::Into<wkt::Timestamp>,
158 {
159 self.update_time = std::option::Option::Some(v.into());
160 self
161 }
162
163 /// Sets or clears the value of [update_time][crate::model::Inventory::update_time].
164 ///
165 /// # Example
166 /// ```ignore,no_run
167 /// # use google_cloud_osconfig_v1::model::Inventory;
168 /// use wkt::Timestamp;
169 /// let x = Inventory::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
170 /// let x = Inventory::new().set_or_clear_update_time(None::<Timestamp>);
171 /// ```
172 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
173 where
174 T: std::convert::Into<wkt::Timestamp>,
175 {
176 self.update_time = v.map(|x| x.into());
177 self
178 }
179}
180
181impl wkt::message::Message for Inventory {
182 fn typename() -> &'static str {
183 "type.googleapis.com/google.cloud.osconfig.v1.Inventory"
184 }
185}
186
187/// Defines additional types related to [Inventory].
188pub mod inventory {
189 #[allow(unused_imports)]
190 use super::*;
191
192 /// Operating system information for the VM.
193 #[derive(Clone, Default, PartialEq)]
194 #[non_exhaustive]
195 pub struct OsInfo {
196 /// The VM hostname.
197 pub hostname: std::string::String,
198
199 /// The operating system long name.
200 /// For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019
201 /// Datacenter'.
202 pub long_name: std::string::String,
203
204 /// The operating system short name.
205 /// For example, 'windows' or 'debian'.
206 pub short_name: std::string::String,
207
208 /// The version of the operating system.
209 pub version: std::string::String,
210
211 /// The system architecture of the operating system.
212 pub architecture: std::string::String,
213
214 /// The kernel version of the operating system.
215 pub kernel_version: std::string::String,
216
217 /// The kernel release of the operating system.
218 pub kernel_release: std::string::String,
219
220 /// The current version of the OS Config agent running on the VM.
221 pub osconfig_agent_version: std::string::String,
222
223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
224 }
225
226 impl OsInfo {
227 /// Creates a new default instance.
228 pub fn new() -> Self {
229 std::default::Default::default()
230 }
231
232 /// Sets the value of [hostname][crate::model::inventory::OsInfo::hostname].
233 ///
234 /// # Example
235 /// ```ignore,no_run
236 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
237 /// let x = OsInfo::new().set_hostname("example");
238 /// ```
239 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
240 self.hostname = v.into();
241 self
242 }
243
244 /// Sets the value of [long_name][crate::model::inventory::OsInfo::long_name].
245 ///
246 /// # Example
247 /// ```ignore,no_run
248 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
249 /// let x = OsInfo::new().set_long_name("example");
250 /// ```
251 pub fn set_long_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
252 self.long_name = v.into();
253 self
254 }
255
256 /// Sets the value of [short_name][crate::model::inventory::OsInfo::short_name].
257 ///
258 /// # Example
259 /// ```ignore,no_run
260 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
261 /// let x = OsInfo::new().set_short_name("example");
262 /// ```
263 pub fn set_short_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
264 self.short_name = v.into();
265 self
266 }
267
268 /// Sets the value of [version][crate::model::inventory::OsInfo::version].
269 ///
270 /// # Example
271 /// ```ignore,no_run
272 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
273 /// let x = OsInfo::new().set_version("example");
274 /// ```
275 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
276 self.version = v.into();
277 self
278 }
279
280 /// Sets the value of [architecture][crate::model::inventory::OsInfo::architecture].
281 ///
282 /// # Example
283 /// ```ignore,no_run
284 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
285 /// let x = OsInfo::new().set_architecture("example");
286 /// ```
287 pub fn set_architecture<T: std::convert::Into<std::string::String>>(
288 mut self,
289 v: T,
290 ) -> Self {
291 self.architecture = v.into();
292 self
293 }
294
295 /// Sets the value of [kernel_version][crate::model::inventory::OsInfo::kernel_version].
296 ///
297 /// # Example
298 /// ```ignore,no_run
299 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
300 /// let x = OsInfo::new().set_kernel_version("example");
301 /// ```
302 pub fn set_kernel_version<T: std::convert::Into<std::string::String>>(
303 mut self,
304 v: T,
305 ) -> Self {
306 self.kernel_version = v.into();
307 self
308 }
309
310 /// Sets the value of [kernel_release][crate::model::inventory::OsInfo::kernel_release].
311 ///
312 /// # Example
313 /// ```ignore,no_run
314 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
315 /// let x = OsInfo::new().set_kernel_release("example");
316 /// ```
317 pub fn set_kernel_release<T: std::convert::Into<std::string::String>>(
318 mut self,
319 v: T,
320 ) -> Self {
321 self.kernel_release = v.into();
322 self
323 }
324
325 /// Sets the value of [osconfig_agent_version][crate::model::inventory::OsInfo::osconfig_agent_version].
326 ///
327 /// # Example
328 /// ```ignore,no_run
329 /// # use google_cloud_osconfig_v1::model::inventory::OsInfo;
330 /// let x = OsInfo::new().set_osconfig_agent_version("example");
331 /// ```
332 pub fn set_osconfig_agent_version<T: std::convert::Into<std::string::String>>(
333 mut self,
334 v: T,
335 ) -> Self {
336 self.osconfig_agent_version = v.into();
337 self
338 }
339 }
340
341 impl wkt::message::Message for OsInfo {
342 fn typename() -> &'static str {
343 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.OsInfo"
344 }
345 }
346
347 /// A single piece of inventory on a VM.
348 #[derive(Clone, Default, PartialEq)]
349 #[non_exhaustive]
350 pub struct Item {
351 /// Identifier for this item, unique across items for this VM.
352 pub id: std::string::String,
353
354 /// The origin of this inventory item.
355 pub origin_type: crate::model::inventory::item::OriginType,
356
357 /// When this inventory item was first detected.
358 pub create_time: std::option::Option<wkt::Timestamp>,
359
360 /// When this inventory item was last modified.
361 pub update_time: std::option::Option<wkt::Timestamp>,
362
363 /// The specific type of inventory, correlating to its specific details.
364 pub r#type: crate::model::inventory::item::Type,
365
366 /// Specific details of this inventory item based on its type.
367 pub details: std::option::Option<crate::model::inventory::item::Details>,
368
369 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
370 }
371
372 impl Item {
373 /// Creates a new default instance.
374 pub fn new() -> Self {
375 std::default::Default::default()
376 }
377
378 /// Sets the value of [id][crate::model::inventory::Item::id].
379 ///
380 /// # Example
381 /// ```ignore,no_run
382 /// # use google_cloud_osconfig_v1::model::inventory::Item;
383 /// let x = Item::new().set_id("example");
384 /// ```
385 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
386 self.id = v.into();
387 self
388 }
389
390 /// Sets the value of [origin_type][crate::model::inventory::Item::origin_type].
391 ///
392 /// # Example
393 /// ```ignore,no_run
394 /// # use google_cloud_osconfig_v1::model::inventory::Item;
395 /// use google_cloud_osconfig_v1::model::inventory::item::OriginType;
396 /// let x0 = Item::new().set_origin_type(OriginType::InventoryReport);
397 /// ```
398 pub fn set_origin_type<T: std::convert::Into<crate::model::inventory::item::OriginType>>(
399 mut self,
400 v: T,
401 ) -> Self {
402 self.origin_type = v.into();
403 self
404 }
405
406 /// Sets the value of [create_time][crate::model::inventory::Item::create_time].
407 ///
408 /// # Example
409 /// ```ignore,no_run
410 /// # use google_cloud_osconfig_v1::model::inventory::Item;
411 /// use wkt::Timestamp;
412 /// let x = Item::new().set_create_time(Timestamp::default()/* use setters */);
413 /// ```
414 pub fn set_create_time<T>(mut self, v: T) -> Self
415 where
416 T: std::convert::Into<wkt::Timestamp>,
417 {
418 self.create_time = std::option::Option::Some(v.into());
419 self
420 }
421
422 /// Sets or clears the value of [create_time][crate::model::inventory::Item::create_time].
423 ///
424 /// # Example
425 /// ```ignore,no_run
426 /// # use google_cloud_osconfig_v1::model::inventory::Item;
427 /// use wkt::Timestamp;
428 /// let x = Item::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
429 /// let x = Item::new().set_or_clear_create_time(None::<Timestamp>);
430 /// ```
431 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
432 where
433 T: std::convert::Into<wkt::Timestamp>,
434 {
435 self.create_time = v.map(|x| x.into());
436 self
437 }
438
439 /// Sets the value of [update_time][crate::model::inventory::Item::update_time].
440 ///
441 /// # Example
442 /// ```ignore,no_run
443 /// # use google_cloud_osconfig_v1::model::inventory::Item;
444 /// use wkt::Timestamp;
445 /// let x = Item::new().set_update_time(Timestamp::default()/* use setters */);
446 /// ```
447 pub fn set_update_time<T>(mut self, v: T) -> Self
448 where
449 T: std::convert::Into<wkt::Timestamp>,
450 {
451 self.update_time = std::option::Option::Some(v.into());
452 self
453 }
454
455 /// Sets or clears the value of [update_time][crate::model::inventory::Item::update_time].
456 ///
457 /// # Example
458 /// ```ignore,no_run
459 /// # use google_cloud_osconfig_v1::model::inventory::Item;
460 /// use wkt::Timestamp;
461 /// let x = Item::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
462 /// let x = Item::new().set_or_clear_update_time(None::<Timestamp>);
463 /// ```
464 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
465 where
466 T: std::convert::Into<wkt::Timestamp>,
467 {
468 self.update_time = v.map(|x| x.into());
469 self
470 }
471
472 /// Sets the value of [r#type][crate::model::inventory::Item::type].
473 ///
474 /// # Example
475 /// ```ignore,no_run
476 /// # use google_cloud_osconfig_v1::model::inventory::Item;
477 /// use google_cloud_osconfig_v1::model::inventory::item::Type;
478 /// let x0 = Item::new().set_type(Type::InstalledPackage);
479 /// let x1 = Item::new().set_type(Type::AvailablePackage);
480 /// ```
481 pub fn set_type<T: std::convert::Into<crate::model::inventory::item::Type>>(
482 mut self,
483 v: T,
484 ) -> Self {
485 self.r#type = v.into();
486 self
487 }
488
489 /// Sets the value of [details][crate::model::inventory::Item::details].
490 ///
491 /// Note that all the setters affecting `details` are mutually
492 /// exclusive.
493 ///
494 /// # Example
495 /// ```ignore,no_run
496 /// # use google_cloud_osconfig_v1::model::inventory::Item;
497 /// use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
498 /// let x = Item::new().set_details(Some(
499 /// google_cloud_osconfig_v1::model::inventory::item::Details::InstalledPackage(SoftwarePackage::default().into())));
500 /// ```
501 pub fn set_details<
502 T: std::convert::Into<std::option::Option<crate::model::inventory::item::Details>>,
503 >(
504 mut self,
505 v: T,
506 ) -> Self {
507 self.details = v.into();
508 self
509 }
510
511 /// The value of [details][crate::model::inventory::Item::details]
512 /// if it holds a `InstalledPackage`, `None` if the field is not set or
513 /// holds a different branch.
514 pub fn installed_package(
515 &self,
516 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::SoftwarePackage>>
517 {
518 #[allow(unreachable_patterns)]
519 self.details.as_ref().and_then(|v| match v {
520 crate::model::inventory::item::Details::InstalledPackage(v) => {
521 std::option::Option::Some(v)
522 }
523 _ => std::option::Option::None,
524 })
525 }
526
527 /// Sets the value of [details][crate::model::inventory::Item::details]
528 /// to hold a `InstalledPackage`.
529 ///
530 /// Note that all the setters affecting `details` are
531 /// mutually exclusive.
532 ///
533 /// # Example
534 /// ```ignore,no_run
535 /// # use google_cloud_osconfig_v1::model::inventory::Item;
536 /// use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
537 /// let x = Item::new().set_installed_package(SoftwarePackage::default()/* use setters */);
538 /// assert!(x.installed_package().is_some());
539 /// assert!(x.available_package().is_none());
540 /// ```
541 pub fn set_installed_package<
542 T: std::convert::Into<std::boxed::Box<crate::model::inventory::SoftwarePackage>>,
543 >(
544 mut self,
545 v: T,
546 ) -> Self {
547 self.details = std::option::Option::Some(
548 crate::model::inventory::item::Details::InstalledPackage(v.into()),
549 );
550 self
551 }
552
553 /// The value of [details][crate::model::inventory::Item::details]
554 /// if it holds a `AvailablePackage`, `None` if the field is not set or
555 /// holds a different branch.
556 pub fn available_package(
557 &self,
558 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::SoftwarePackage>>
559 {
560 #[allow(unreachable_patterns)]
561 self.details.as_ref().and_then(|v| match v {
562 crate::model::inventory::item::Details::AvailablePackage(v) => {
563 std::option::Option::Some(v)
564 }
565 _ => std::option::Option::None,
566 })
567 }
568
569 /// Sets the value of [details][crate::model::inventory::Item::details]
570 /// to hold a `AvailablePackage`.
571 ///
572 /// Note that all the setters affecting `details` are
573 /// mutually exclusive.
574 ///
575 /// # Example
576 /// ```ignore,no_run
577 /// # use google_cloud_osconfig_v1::model::inventory::Item;
578 /// use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
579 /// let x = Item::new().set_available_package(SoftwarePackage::default()/* use setters */);
580 /// assert!(x.available_package().is_some());
581 /// assert!(x.installed_package().is_none());
582 /// ```
583 pub fn set_available_package<
584 T: std::convert::Into<std::boxed::Box<crate::model::inventory::SoftwarePackage>>,
585 >(
586 mut self,
587 v: T,
588 ) -> Self {
589 self.details = std::option::Option::Some(
590 crate::model::inventory::item::Details::AvailablePackage(v.into()),
591 );
592 self
593 }
594 }
595
596 impl wkt::message::Message for Item {
597 fn typename() -> &'static str {
598 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.Item"
599 }
600 }
601
602 /// Defines additional types related to [Item].
603 pub mod item {
604 #[allow(unused_imports)]
605 use super::*;
606
607 /// The origin of a specific inventory item.
608 ///
609 /// # Working with unknown values
610 ///
611 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
612 /// additional enum variants at any time. Adding new variants is not considered
613 /// a breaking change. Applications should write their code in anticipation of:
614 ///
615 /// - New values appearing in future releases of the client library, **and**
616 /// - New values received dynamically, without application changes.
617 ///
618 /// Please consult the [Working with enums] section in the user guide for some
619 /// guidelines.
620 ///
621 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
622 #[derive(Clone, Debug, PartialEq)]
623 #[non_exhaustive]
624 pub enum OriginType {
625 /// Invalid. An origin type must be specified.
626 Unspecified,
627 /// This inventory item was discovered as the result of the agent
628 /// reporting inventory via the reporting API.
629 InventoryReport,
630 /// If set, the enum was initialized with an unknown value.
631 ///
632 /// Applications can examine the value using [OriginType::value] or
633 /// [OriginType::name].
634 UnknownValue(origin_type::UnknownValue),
635 }
636
637 #[doc(hidden)]
638 pub mod origin_type {
639 #[allow(unused_imports)]
640 use super::*;
641 #[derive(Clone, Debug, PartialEq)]
642 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
643 }
644
645 impl OriginType {
646 /// Gets the enum value.
647 ///
648 /// Returns `None` if the enum contains an unknown value deserialized from
649 /// the string representation of enums.
650 pub fn value(&self) -> std::option::Option<i32> {
651 match self {
652 Self::Unspecified => std::option::Option::Some(0),
653 Self::InventoryReport => std::option::Option::Some(1),
654 Self::UnknownValue(u) => u.0.value(),
655 }
656 }
657
658 /// Gets the enum value as a string.
659 ///
660 /// Returns `None` if the enum contains an unknown value deserialized from
661 /// the integer representation of enums.
662 pub fn name(&self) -> std::option::Option<&str> {
663 match self {
664 Self::Unspecified => std::option::Option::Some("ORIGIN_TYPE_UNSPECIFIED"),
665 Self::InventoryReport => std::option::Option::Some("INVENTORY_REPORT"),
666 Self::UnknownValue(u) => u.0.name(),
667 }
668 }
669 }
670
671 impl std::default::Default for OriginType {
672 fn default() -> Self {
673 use std::convert::From;
674 Self::from(0)
675 }
676 }
677
678 impl std::fmt::Display for OriginType {
679 fn fmt(
680 &self,
681 f: &mut std::fmt::Formatter<'_>,
682 ) -> std::result::Result<(), std::fmt::Error> {
683 wkt::internal::display_enum(f, self.name(), self.value())
684 }
685 }
686
687 impl std::convert::From<i32> for OriginType {
688 fn from(value: i32) -> Self {
689 match value {
690 0 => Self::Unspecified,
691 1 => Self::InventoryReport,
692 _ => Self::UnknownValue(origin_type::UnknownValue(
693 wkt::internal::UnknownEnumValue::Integer(value),
694 )),
695 }
696 }
697 }
698
699 impl std::convert::From<&str> for OriginType {
700 fn from(value: &str) -> Self {
701 use std::string::ToString;
702 match value {
703 "ORIGIN_TYPE_UNSPECIFIED" => Self::Unspecified,
704 "INVENTORY_REPORT" => Self::InventoryReport,
705 _ => Self::UnknownValue(origin_type::UnknownValue(
706 wkt::internal::UnknownEnumValue::String(value.to_string()),
707 )),
708 }
709 }
710 }
711
712 impl serde::ser::Serialize for OriginType {
713 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
714 where
715 S: serde::Serializer,
716 {
717 match self {
718 Self::Unspecified => serializer.serialize_i32(0),
719 Self::InventoryReport => serializer.serialize_i32(1),
720 Self::UnknownValue(u) => u.0.serialize(serializer),
721 }
722 }
723 }
724
725 impl<'de> serde::de::Deserialize<'de> for OriginType {
726 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
727 where
728 D: serde::Deserializer<'de>,
729 {
730 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OriginType>::new(
731 ".google.cloud.osconfig.v1.Inventory.Item.OriginType",
732 ))
733 }
734 }
735
736 /// The different types of inventory that are tracked on a VM.
737 ///
738 /// # Working with unknown values
739 ///
740 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
741 /// additional enum variants at any time. Adding new variants is not considered
742 /// a breaking change. Applications should write their code in anticipation of:
743 ///
744 /// - New values appearing in future releases of the client library, **and**
745 /// - New values received dynamically, without application changes.
746 ///
747 /// Please consult the [Working with enums] section in the user guide for some
748 /// guidelines.
749 ///
750 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
751 #[derive(Clone, Debug, PartialEq)]
752 #[non_exhaustive]
753 pub enum Type {
754 /// Invalid. An type must be specified.
755 Unspecified,
756 /// This represents a package that is installed on the VM.
757 InstalledPackage,
758 /// This represents an update that is available for a package.
759 AvailablePackage,
760 /// If set, the enum was initialized with an unknown value.
761 ///
762 /// Applications can examine the value using [Type::value] or
763 /// [Type::name].
764 UnknownValue(r#type::UnknownValue),
765 }
766
767 #[doc(hidden)]
768 pub mod r#type {
769 #[allow(unused_imports)]
770 use super::*;
771 #[derive(Clone, Debug, PartialEq)]
772 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
773 }
774
775 impl Type {
776 /// Gets the enum value.
777 ///
778 /// Returns `None` if the enum contains an unknown value deserialized from
779 /// the string representation of enums.
780 pub fn value(&self) -> std::option::Option<i32> {
781 match self {
782 Self::Unspecified => std::option::Option::Some(0),
783 Self::InstalledPackage => std::option::Option::Some(1),
784 Self::AvailablePackage => std::option::Option::Some(2),
785 Self::UnknownValue(u) => u.0.value(),
786 }
787 }
788
789 /// Gets the enum value as a string.
790 ///
791 /// Returns `None` if the enum contains an unknown value deserialized from
792 /// the integer representation of enums.
793 pub fn name(&self) -> std::option::Option<&str> {
794 match self {
795 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
796 Self::InstalledPackage => std::option::Option::Some("INSTALLED_PACKAGE"),
797 Self::AvailablePackage => std::option::Option::Some("AVAILABLE_PACKAGE"),
798 Self::UnknownValue(u) => u.0.name(),
799 }
800 }
801 }
802
803 impl std::default::Default for Type {
804 fn default() -> Self {
805 use std::convert::From;
806 Self::from(0)
807 }
808 }
809
810 impl std::fmt::Display for Type {
811 fn fmt(
812 &self,
813 f: &mut std::fmt::Formatter<'_>,
814 ) -> std::result::Result<(), std::fmt::Error> {
815 wkt::internal::display_enum(f, self.name(), self.value())
816 }
817 }
818
819 impl std::convert::From<i32> for Type {
820 fn from(value: i32) -> Self {
821 match value {
822 0 => Self::Unspecified,
823 1 => Self::InstalledPackage,
824 2 => Self::AvailablePackage,
825 _ => Self::UnknownValue(r#type::UnknownValue(
826 wkt::internal::UnknownEnumValue::Integer(value),
827 )),
828 }
829 }
830 }
831
832 impl std::convert::From<&str> for Type {
833 fn from(value: &str) -> Self {
834 use std::string::ToString;
835 match value {
836 "TYPE_UNSPECIFIED" => Self::Unspecified,
837 "INSTALLED_PACKAGE" => Self::InstalledPackage,
838 "AVAILABLE_PACKAGE" => Self::AvailablePackage,
839 _ => Self::UnknownValue(r#type::UnknownValue(
840 wkt::internal::UnknownEnumValue::String(value.to_string()),
841 )),
842 }
843 }
844 }
845
846 impl serde::ser::Serialize for Type {
847 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
848 where
849 S: serde::Serializer,
850 {
851 match self {
852 Self::Unspecified => serializer.serialize_i32(0),
853 Self::InstalledPackage => serializer.serialize_i32(1),
854 Self::AvailablePackage => serializer.serialize_i32(2),
855 Self::UnknownValue(u) => u.0.serialize(serializer),
856 }
857 }
858 }
859
860 impl<'de> serde::de::Deserialize<'de> for Type {
861 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
862 where
863 D: serde::Deserializer<'de>,
864 {
865 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
866 ".google.cloud.osconfig.v1.Inventory.Item.Type",
867 ))
868 }
869 }
870
871 /// Specific details of this inventory item based on its type.
872 #[derive(Clone, Debug, PartialEq)]
873 #[non_exhaustive]
874 pub enum Details {
875 /// Software package present on the VM instance.
876 InstalledPackage(std::boxed::Box<crate::model::inventory::SoftwarePackage>),
877 /// Software package available to be installed on the VM instance.
878 AvailablePackage(std::boxed::Box<crate::model::inventory::SoftwarePackage>),
879 }
880 }
881
882 /// Software package information of the operating system.
883 #[derive(Clone, Default, PartialEq)]
884 #[non_exhaustive]
885 pub struct SoftwarePackage {
886 /// Information about the different types of software packages.
887 pub details: std::option::Option<crate::model::inventory::software_package::Details>,
888
889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
890 }
891
892 impl SoftwarePackage {
893 /// Creates a new default instance.
894 pub fn new() -> Self {
895 std::default::Default::default()
896 }
897
898 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details].
899 ///
900 /// Note that all the setters affecting `details` are mutually
901 /// exclusive.
902 ///
903 /// # Example
904 /// ```ignore,no_run
905 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
906 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
907 /// let x = SoftwarePackage::new().set_details(Some(
908 /// google_cloud_osconfig_v1::model::inventory::software_package::Details::YumPackage(VersionedPackage::default().into())));
909 /// ```
910 pub fn set_details<
911 T: std::convert::Into<
912 std::option::Option<crate::model::inventory::software_package::Details>,
913 >,
914 >(
915 mut self,
916 v: T,
917 ) -> Self {
918 self.details = v.into();
919 self
920 }
921
922 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
923 /// if it holds a `YumPackage`, `None` if the field is not set or
924 /// holds a different branch.
925 pub fn yum_package(
926 &self,
927 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
928 {
929 #[allow(unreachable_patterns)]
930 self.details.as_ref().and_then(|v| match v {
931 crate::model::inventory::software_package::Details::YumPackage(v) => {
932 std::option::Option::Some(v)
933 }
934 _ => std::option::Option::None,
935 })
936 }
937
938 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
939 /// to hold a `YumPackage`.
940 ///
941 /// Note that all the setters affecting `details` are
942 /// mutually exclusive.
943 ///
944 /// # Example
945 /// ```ignore,no_run
946 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
947 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
948 /// let x = SoftwarePackage::new().set_yum_package(VersionedPackage::default()/* use setters */);
949 /// assert!(x.yum_package().is_some());
950 /// assert!(x.apt_package().is_none());
951 /// assert!(x.zypper_package().is_none());
952 /// assert!(x.googet_package().is_none());
953 /// assert!(x.zypper_patch().is_none());
954 /// assert!(x.wua_package().is_none());
955 /// assert!(x.qfe_package().is_none());
956 /// assert!(x.cos_package().is_none());
957 /// assert!(x.windows_application().is_none());
958 /// ```
959 pub fn set_yum_package<
960 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
961 >(
962 mut self,
963 v: T,
964 ) -> Self {
965 self.details = std::option::Option::Some(
966 crate::model::inventory::software_package::Details::YumPackage(v.into()),
967 );
968 self
969 }
970
971 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
972 /// if it holds a `AptPackage`, `None` if the field is not set or
973 /// holds a different branch.
974 pub fn apt_package(
975 &self,
976 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
977 {
978 #[allow(unreachable_patterns)]
979 self.details.as_ref().and_then(|v| match v {
980 crate::model::inventory::software_package::Details::AptPackage(v) => {
981 std::option::Option::Some(v)
982 }
983 _ => std::option::Option::None,
984 })
985 }
986
987 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
988 /// to hold a `AptPackage`.
989 ///
990 /// Note that all the setters affecting `details` are
991 /// mutually exclusive.
992 ///
993 /// # Example
994 /// ```ignore,no_run
995 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
996 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
997 /// let x = SoftwarePackage::new().set_apt_package(VersionedPackage::default()/* use setters */);
998 /// assert!(x.apt_package().is_some());
999 /// assert!(x.yum_package().is_none());
1000 /// assert!(x.zypper_package().is_none());
1001 /// assert!(x.googet_package().is_none());
1002 /// assert!(x.zypper_patch().is_none());
1003 /// assert!(x.wua_package().is_none());
1004 /// assert!(x.qfe_package().is_none());
1005 /// assert!(x.cos_package().is_none());
1006 /// assert!(x.windows_application().is_none());
1007 /// ```
1008 pub fn set_apt_package<
1009 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1010 >(
1011 mut self,
1012 v: T,
1013 ) -> Self {
1014 self.details = std::option::Option::Some(
1015 crate::model::inventory::software_package::Details::AptPackage(v.into()),
1016 );
1017 self
1018 }
1019
1020 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1021 /// if it holds a `ZypperPackage`, `None` if the field is not set or
1022 /// holds a different branch.
1023 pub fn zypper_package(
1024 &self,
1025 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
1026 {
1027 #[allow(unreachable_patterns)]
1028 self.details.as_ref().and_then(|v| match v {
1029 crate::model::inventory::software_package::Details::ZypperPackage(v) => {
1030 std::option::Option::Some(v)
1031 }
1032 _ => std::option::Option::None,
1033 })
1034 }
1035
1036 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1037 /// to hold a `ZypperPackage`.
1038 ///
1039 /// Note that all the setters affecting `details` are
1040 /// mutually exclusive.
1041 ///
1042 /// # Example
1043 /// ```ignore,no_run
1044 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1045 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1046 /// let x = SoftwarePackage::new().set_zypper_package(VersionedPackage::default()/* use setters */);
1047 /// assert!(x.zypper_package().is_some());
1048 /// assert!(x.yum_package().is_none());
1049 /// assert!(x.apt_package().is_none());
1050 /// assert!(x.googet_package().is_none());
1051 /// assert!(x.zypper_patch().is_none());
1052 /// assert!(x.wua_package().is_none());
1053 /// assert!(x.qfe_package().is_none());
1054 /// assert!(x.cos_package().is_none());
1055 /// assert!(x.windows_application().is_none());
1056 /// ```
1057 pub fn set_zypper_package<
1058 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1059 >(
1060 mut self,
1061 v: T,
1062 ) -> Self {
1063 self.details = std::option::Option::Some(
1064 crate::model::inventory::software_package::Details::ZypperPackage(v.into()),
1065 );
1066 self
1067 }
1068
1069 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1070 /// if it holds a `GoogetPackage`, `None` if the field is not set or
1071 /// holds a different branch.
1072 pub fn googet_package(
1073 &self,
1074 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
1075 {
1076 #[allow(unreachable_patterns)]
1077 self.details.as_ref().and_then(|v| match v {
1078 crate::model::inventory::software_package::Details::GoogetPackage(v) => {
1079 std::option::Option::Some(v)
1080 }
1081 _ => std::option::Option::None,
1082 })
1083 }
1084
1085 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1086 /// to hold a `GoogetPackage`.
1087 ///
1088 /// Note that all the setters affecting `details` are
1089 /// mutually exclusive.
1090 ///
1091 /// # Example
1092 /// ```ignore,no_run
1093 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1094 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1095 /// let x = SoftwarePackage::new().set_googet_package(VersionedPackage::default()/* use setters */);
1096 /// assert!(x.googet_package().is_some());
1097 /// assert!(x.yum_package().is_none());
1098 /// assert!(x.apt_package().is_none());
1099 /// assert!(x.zypper_package().is_none());
1100 /// assert!(x.zypper_patch().is_none());
1101 /// assert!(x.wua_package().is_none());
1102 /// assert!(x.qfe_package().is_none());
1103 /// assert!(x.cos_package().is_none());
1104 /// assert!(x.windows_application().is_none());
1105 /// ```
1106 pub fn set_googet_package<
1107 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1108 >(
1109 mut self,
1110 v: T,
1111 ) -> Self {
1112 self.details = std::option::Option::Some(
1113 crate::model::inventory::software_package::Details::GoogetPackage(v.into()),
1114 );
1115 self
1116 }
1117
1118 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1119 /// if it holds a `ZypperPatch`, `None` if the field is not set or
1120 /// holds a different branch.
1121 pub fn zypper_patch(
1122 &self,
1123 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::ZypperPatch>> {
1124 #[allow(unreachable_patterns)]
1125 self.details.as_ref().and_then(|v| match v {
1126 crate::model::inventory::software_package::Details::ZypperPatch(v) => {
1127 std::option::Option::Some(v)
1128 }
1129 _ => std::option::Option::None,
1130 })
1131 }
1132
1133 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1134 /// to hold a `ZypperPatch`.
1135 ///
1136 /// Note that all the setters affecting `details` are
1137 /// mutually exclusive.
1138 ///
1139 /// # Example
1140 /// ```ignore,no_run
1141 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1142 /// use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1143 /// let x = SoftwarePackage::new().set_zypper_patch(ZypperPatch::default()/* use setters */);
1144 /// assert!(x.zypper_patch().is_some());
1145 /// assert!(x.yum_package().is_none());
1146 /// assert!(x.apt_package().is_none());
1147 /// assert!(x.zypper_package().is_none());
1148 /// assert!(x.googet_package().is_none());
1149 /// assert!(x.wua_package().is_none());
1150 /// assert!(x.qfe_package().is_none());
1151 /// assert!(x.cos_package().is_none());
1152 /// assert!(x.windows_application().is_none());
1153 /// ```
1154 pub fn set_zypper_patch<
1155 T: std::convert::Into<std::boxed::Box<crate::model::inventory::ZypperPatch>>,
1156 >(
1157 mut self,
1158 v: T,
1159 ) -> Self {
1160 self.details = std::option::Option::Some(
1161 crate::model::inventory::software_package::Details::ZypperPatch(v.into()),
1162 );
1163 self
1164 }
1165
1166 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1167 /// if it holds a `WuaPackage`, `None` if the field is not set or
1168 /// holds a different branch.
1169 pub fn wua_package(
1170 &self,
1171 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::WindowsUpdatePackage>>
1172 {
1173 #[allow(unreachable_patterns)]
1174 self.details.as_ref().and_then(|v| match v {
1175 crate::model::inventory::software_package::Details::WuaPackage(v) => {
1176 std::option::Option::Some(v)
1177 }
1178 _ => std::option::Option::None,
1179 })
1180 }
1181
1182 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1183 /// to hold a `WuaPackage`.
1184 ///
1185 /// Note that all the setters affecting `details` are
1186 /// mutually exclusive.
1187 ///
1188 /// # Example
1189 /// ```ignore,no_run
1190 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1191 /// use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1192 /// let x = SoftwarePackage::new().set_wua_package(WindowsUpdatePackage::default()/* use setters */);
1193 /// assert!(x.wua_package().is_some());
1194 /// assert!(x.yum_package().is_none());
1195 /// assert!(x.apt_package().is_none());
1196 /// assert!(x.zypper_package().is_none());
1197 /// assert!(x.googet_package().is_none());
1198 /// assert!(x.zypper_patch().is_none());
1199 /// assert!(x.qfe_package().is_none());
1200 /// assert!(x.cos_package().is_none());
1201 /// assert!(x.windows_application().is_none());
1202 /// ```
1203 pub fn set_wua_package<
1204 T: std::convert::Into<std::boxed::Box<crate::model::inventory::WindowsUpdatePackage>>,
1205 >(
1206 mut self,
1207 v: T,
1208 ) -> Self {
1209 self.details = std::option::Option::Some(
1210 crate::model::inventory::software_package::Details::WuaPackage(v.into()),
1211 );
1212 self
1213 }
1214
1215 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1216 /// if it holds a `QfePackage`, `None` if the field is not set or
1217 /// holds a different branch.
1218 pub fn qfe_package(
1219 &self,
1220 ) -> std::option::Option<
1221 &std::boxed::Box<crate::model::inventory::WindowsQuickFixEngineeringPackage>,
1222 > {
1223 #[allow(unreachable_patterns)]
1224 self.details.as_ref().and_then(|v| match v {
1225 crate::model::inventory::software_package::Details::QfePackage(v) => {
1226 std::option::Option::Some(v)
1227 }
1228 _ => std::option::Option::None,
1229 })
1230 }
1231
1232 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1233 /// to hold a `QfePackage`.
1234 ///
1235 /// Note that all the setters affecting `details` are
1236 /// mutually exclusive.
1237 ///
1238 /// # Example
1239 /// ```ignore,no_run
1240 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1241 /// use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1242 /// let x = SoftwarePackage::new().set_qfe_package(WindowsQuickFixEngineeringPackage::default()/* use setters */);
1243 /// assert!(x.qfe_package().is_some());
1244 /// assert!(x.yum_package().is_none());
1245 /// assert!(x.apt_package().is_none());
1246 /// assert!(x.zypper_package().is_none());
1247 /// assert!(x.googet_package().is_none());
1248 /// assert!(x.zypper_patch().is_none());
1249 /// assert!(x.wua_package().is_none());
1250 /// assert!(x.cos_package().is_none());
1251 /// assert!(x.windows_application().is_none());
1252 /// ```
1253 pub fn set_qfe_package<
1254 T: std::convert::Into<
1255 std::boxed::Box<crate::model::inventory::WindowsQuickFixEngineeringPackage>,
1256 >,
1257 >(
1258 mut self,
1259 v: T,
1260 ) -> Self {
1261 self.details = std::option::Option::Some(
1262 crate::model::inventory::software_package::Details::QfePackage(v.into()),
1263 );
1264 self
1265 }
1266
1267 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1268 /// if it holds a `CosPackage`, `None` if the field is not set or
1269 /// holds a different branch.
1270 pub fn cos_package(
1271 &self,
1272 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::VersionedPackage>>
1273 {
1274 #[allow(unreachable_patterns)]
1275 self.details.as_ref().and_then(|v| match v {
1276 crate::model::inventory::software_package::Details::CosPackage(v) => {
1277 std::option::Option::Some(v)
1278 }
1279 _ => std::option::Option::None,
1280 })
1281 }
1282
1283 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1284 /// to hold a `CosPackage`.
1285 ///
1286 /// Note that all the setters affecting `details` are
1287 /// mutually exclusive.
1288 ///
1289 /// # Example
1290 /// ```ignore,no_run
1291 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1292 /// use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1293 /// let x = SoftwarePackage::new().set_cos_package(VersionedPackage::default()/* use setters */);
1294 /// assert!(x.cos_package().is_some());
1295 /// assert!(x.yum_package().is_none());
1296 /// assert!(x.apt_package().is_none());
1297 /// assert!(x.zypper_package().is_none());
1298 /// assert!(x.googet_package().is_none());
1299 /// assert!(x.zypper_patch().is_none());
1300 /// assert!(x.wua_package().is_none());
1301 /// assert!(x.qfe_package().is_none());
1302 /// assert!(x.windows_application().is_none());
1303 /// ```
1304 pub fn set_cos_package<
1305 T: std::convert::Into<std::boxed::Box<crate::model::inventory::VersionedPackage>>,
1306 >(
1307 mut self,
1308 v: T,
1309 ) -> Self {
1310 self.details = std::option::Option::Some(
1311 crate::model::inventory::software_package::Details::CosPackage(v.into()),
1312 );
1313 self
1314 }
1315
1316 /// The value of [details][crate::model::inventory::SoftwarePackage::details]
1317 /// if it holds a `WindowsApplication`, `None` if the field is not set or
1318 /// holds a different branch.
1319 pub fn windows_application(
1320 &self,
1321 ) -> std::option::Option<&std::boxed::Box<crate::model::inventory::WindowsApplication>>
1322 {
1323 #[allow(unreachable_patterns)]
1324 self.details.as_ref().and_then(|v| match v {
1325 crate::model::inventory::software_package::Details::WindowsApplication(v) => {
1326 std::option::Option::Some(v)
1327 }
1328 _ => std::option::Option::None,
1329 })
1330 }
1331
1332 /// Sets the value of [details][crate::model::inventory::SoftwarePackage::details]
1333 /// to hold a `WindowsApplication`.
1334 ///
1335 /// Note that all the setters affecting `details` are
1336 /// mutually exclusive.
1337 ///
1338 /// # Example
1339 /// ```ignore,no_run
1340 /// # use google_cloud_osconfig_v1::model::inventory::SoftwarePackage;
1341 /// use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
1342 /// let x = SoftwarePackage::new().set_windows_application(WindowsApplication::default()/* use setters */);
1343 /// assert!(x.windows_application().is_some());
1344 /// assert!(x.yum_package().is_none());
1345 /// assert!(x.apt_package().is_none());
1346 /// assert!(x.zypper_package().is_none());
1347 /// assert!(x.googet_package().is_none());
1348 /// assert!(x.zypper_patch().is_none());
1349 /// assert!(x.wua_package().is_none());
1350 /// assert!(x.qfe_package().is_none());
1351 /// assert!(x.cos_package().is_none());
1352 /// ```
1353 pub fn set_windows_application<
1354 T: std::convert::Into<std::boxed::Box<crate::model::inventory::WindowsApplication>>,
1355 >(
1356 mut self,
1357 v: T,
1358 ) -> Self {
1359 self.details = std::option::Option::Some(
1360 crate::model::inventory::software_package::Details::WindowsApplication(v.into()),
1361 );
1362 self
1363 }
1364 }
1365
1366 impl wkt::message::Message for SoftwarePackage {
1367 fn typename() -> &'static str {
1368 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.SoftwarePackage"
1369 }
1370 }
1371
1372 /// Defines additional types related to [SoftwarePackage].
1373 pub mod software_package {
1374 #[allow(unused_imports)]
1375 use super::*;
1376
1377 /// Information about the different types of software packages.
1378 #[derive(Clone, Debug, PartialEq)]
1379 #[non_exhaustive]
1380 pub enum Details {
1381 /// Yum package info.
1382 /// For details about the yum package manager, see
1383 /// <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum>.
1384 YumPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1385 /// Details of an APT package.
1386 /// For details about the apt package manager, see
1387 /// <https://wiki.debian.org/Apt>.
1388 AptPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1389 /// Details of a Zypper package.
1390 /// For details about the Zypper package manager, see
1391 /// <https://en.opensuse.org/SDB:Zypper_manual>.
1392 ZypperPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1393 /// Details of a Googet package.
1394 /// For details about the googet package manager, see
1395 /// <https://github.com/google/googet>.
1396 GoogetPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1397 /// Details of a Zypper patch.
1398 /// For details about the Zypper package manager, see
1399 /// <https://en.opensuse.org/SDB:Zypper_manual>.
1400 ZypperPatch(std::boxed::Box<crate::model::inventory::ZypperPatch>),
1401 /// Details of a Windows Update package.
1402 /// See <https://docs.microsoft.com/en-us/windows/win32/api/_wua/> for
1403 /// information about Windows Update.
1404 WuaPackage(std::boxed::Box<crate::model::inventory::WindowsUpdatePackage>),
1405 /// Details of a Windows Quick Fix engineering package.
1406 /// See
1407 /// <https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering>
1408 /// for info in Windows Quick Fix Engineering.
1409 QfePackage(std::boxed::Box<crate::model::inventory::WindowsQuickFixEngineeringPackage>),
1410 /// Details of a COS package.
1411 CosPackage(std::boxed::Box<crate::model::inventory::VersionedPackage>),
1412 /// Details of Windows Application.
1413 WindowsApplication(std::boxed::Box<crate::model::inventory::WindowsApplication>),
1414 }
1415 }
1416
1417 /// Information related to the a standard versioned package. This includes
1418 /// package info for APT, Yum, Zypper, and Googet package managers.
1419 #[derive(Clone, Default, PartialEq)]
1420 #[non_exhaustive]
1421 pub struct VersionedPackage {
1422 /// The name of the package.
1423 pub package_name: std::string::String,
1424
1425 /// The system architecture this package is intended for.
1426 pub architecture: std::string::String,
1427
1428 /// The version of the package.
1429 pub version: std::string::String,
1430
1431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1432 }
1433
1434 impl VersionedPackage {
1435 /// Creates a new default instance.
1436 pub fn new() -> Self {
1437 std::default::Default::default()
1438 }
1439
1440 /// Sets the value of [package_name][crate::model::inventory::VersionedPackage::package_name].
1441 ///
1442 /// # Example
1443 /// ```ignore,no_run
1444 /// # use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1445 /// let x = VersionedPackage::new().set_package_name("example");
1446 /// ```
1447 pub fn set_package_name<T: std::convert::Into<std::string::String>>(
1448 mut self,
1449 v: T,
1450 ) -> Self {
1451 self.package_name = v.into();
1452 self
1453 }
1454
1455 /// Sets the value of [architecture][crate::model::inventory::VersionedPackage::architecture].
1456 ///
1457 /// # Example
1458 /// ```ignore,no_run
1459 /// # use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1460 /// let x = VersionedPackage::new().set_architecture("example");
1461 /// ```
1462 pub fn set_architecture<T: std::convert::Into<std::string::String>>(
1463 mut self,
1464 v: T,
1465 ) -> Self {
1466 self.architecture = v.into();
1467 self
1468 }
1469
1470 /// Sets the value of [version][crate::model::inventory::VersionedPackage::version].
1471 ///
1472 /// # Example
1473 /// ```ignore,no_run
1474 /// # use google_cloud_osconfig_v1::model::inventory::VersionedPackage;
1475 /// let x = VersionedPackage::new().set_version("example");
1476 /// ```
1477 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1478 self.version = v.into();
1479 self
1480 }
1481 }
1482
1483 impl wkt::message::Message for VersionedPackage {
1484 fn typename() -> &'static str {
1485 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.VersionedPackage"
1486 }
1487 }
1488
1489 /// Details related to a Zypper Patch.
1490 #[derive(Clone, Default, PartialEq)]
1491 #[non_exhaustive]
1492 pub struct ZypperPatch {
1493 /// The name of the patch.
1494 pub patch_name: std::string::String,
1495
1496 /// The category of the patch.
1497 pub category: std::string::String,
1498
1499 /// The severity specified for this patch
1500 pub severity: std::string::String,
1501
1502 /// Any summary information provided about this patch.
1503 pub summary: std::string::String,
1504
1505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1506 }
1507
1508 impl ZypperPatch {
1509 /// Creates a new default instance.
1510 pub fn new() -> Self {
1511 std::default::Default::default()
1512 }
1513
1514 /// Sets the value of [patch_name][crate::model::inventory::ZypperPatch::patch_name].
1515 ///
1516 /// # Example
1517 /// ```ignore,no_run
1518 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1519 /// let x = ZypperPatch::new().set_patch_name("example");
1520 /// ```
1521 pub fn set_patch_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1522 self.patch_name = v.into();
1523 self
1524 }
1525
1526 /// Sets the value of [category][crate::model::inventory::ZypperPatch::category].
1527 ///
1528 /// # Example
1529 /// ```ignore,no_run
1530 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1531 /// let x = ZypperPatch::new().set_category("example");
1532 /// ```
1533 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1534 self.category = v.into();
1535 self
1536 }
1537
1538 /// Sets the value of [severity][crate::model::inventory::ZypperPatch::severity].
1539 ///
1540 /// # Example
1541 /// ```ignore,no_run
1542 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1543 /// let x = ZypperPatch::new().set_severity("example");
1544 /// ```
1545 pub fn set_severity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1546 self.severity = v.into();
1547 self
1548 }
1549
1550 /// Sets the value of [summary][crate::model::inventory::ZypperPatch::summary].
1551 ///
1552 /// # Example
1553 /// ```ignore,no_run
1554 /// # use google_cloud_osconfig_v1::model::inventory::ZypperPatch;
1555 /// let x = ZypperPatch::new().set_summary("example");
1556 /// ```
1557 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1558 self.summary = v.into();
1559 self
1560 }
1561 }
1562
1563 impl wkt::message::Message for ZypperPatch {
1564 fn typename() -> &'static str {
1565 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.ZypperPatch"
1566 }
1567 }
1568
1569 /// Details related to a Windows Update package.
1570 /// Field data and names are taken from Windows Update API IUpdate Interface:
1571 /// <https://docs.microsoft.com/en-us/windows/win32/api/_wua/>
1572 /// Descriptive fields like title, and description are localized based on
1573 /// the locale of the VM being updated.
1574 #[derive(Clone, Default, PartialEq)]
1575 #[non_exhaustive]
1576 pub struct WindowsUpdatePackage {
1577 /// The localized title of the update package.
1578 pub title: std::string::String,
1579
1580 /// The localized description of the update package.
1581 pub description: std::string::String,
1582
1583 /// The categories that are associated with this update package.
1584 pub categories:
1585 std::vec::Vec<crate::model::inventory::windows_update_package::WindowsUpdateCategory>,
1586
1587 /// A collection of Microsoft Knowledge Base article IDs that are associated
1588 /// with the update package.
1589 pub kb_article_ids: std::vec::Vec<std::string::String>,
1590
1591 /// A hyperlink to the language-specific support information for the update.
1592 pub support_url: std::string::String,
1593
1594 /// A collection of URLs that provide more information about the update
1595 /// package.
1596 pub more_info_urls: std::vec::Vec<std::string::String>,
1597
1598 /// Gets the identifier of an update package. Stays the same across
1599 /// revisions.
1600 pub update_id: std::string::String,
1601
1602 /// The revision number of this update package.
1603 pub revision_number: i32,
1604
1605 /// The last published date of the update, in (UTC) date and time.
1606 pub last_deployment_change_time: std::option::Option<wkt::Timestamp>,
1607
1608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1609 }
1610
1611 impl WindowsUpdatePackage {
1612 /// Creates a new default instance.
1613 pub fn new() -> Self {
1614 std::default::Default::default()
1615 }
1616
1617 /// Sets the value of [title][crate::model::inventory::WindowsUpdatePackage::title].
1618 ///
1619 /// # Example
1620 /// ```ignore,no_run
1621 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1622 /// let x = WindowsUpdatePackage::new().set_title("example");
1623 /// ```
1624 pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1625 self.title = v.into();
1626 self
1627 }
1628
1629 /// Sets the value of [description][crate::model::inventory::WindowsUpdatePackage::description].
1630 ///
1631 /// # Example
1632 /// ```ignore,no_run
1633 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1634 /// let x = WindowsUpdatePackage::new().set_description("example");
1635 /// ```
1636 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1637 self.description = v.into();
1638 self
1639 }
1640
1641 /// Sets the value of [categories][crate::model::inventory::WindowsUpdatePackage::categories].
1642 ///
1643 /// # Example
1644 /// ```ignore,no_run
1645 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1646 /// use google_cloud_osconfig_v1::model::inventory::windows_update_package::WindowsUpdateCategory;
1647 /// let x = WindowsUpdatePackage::new()
1648 /// .set_categories([
1649 /// WindowsUpdateCategory::default()/* use setters */,
1650 /// WindowsUpdateCategory::default()/* use (different) setters */,
1651 /// ]);
1652 /// ```
1653 pub fn set_categories<T, V>(mut self, v: T) -> Self
1654 where
1655 T: std::iter::IntoIterator<Item = V>,
1656 V: std::convert::Into<
1657 crate::model::inventory::windows_update_package::WindowsUpdateCategory,
1658 >,
1659 {
1660 use std::iter::Iterator;
1661 self.categories = v.into_iter().map(|i| i.into()).collect();
1662 self
1663 }
1664
1665 /// Sets the value of [kb_article_ids][crate::model::inventory::WindowsUpdatePackage::kb_article_ids].
1666 ///
1667 /// # Example
1668 /// ```ignore,no_run
1669 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1670 /// let x = WindowsUpdatePackage::new().set_kb_article_ids(["a", "b", "c"]);
1671 /// ```
1672 pub fn set_kb_article_ids<T, V>(mut self, v: T) -> Self
1673 where
1674 T: std::iter::IntoIterator<Item = V>,
1675 V: std::convert::Into<std::string::String>,
1676 {
1677 use std::iter::Iterator;
1678 self.kb_article_ids = v.into_iter().map(|i| i.into()).collect();
1679 self
1680 }
1681
1682 /// Sets the value of [support_url][crate::model::inventory::WindowsUpdatePackage::support_url].
1683 ///
1684 /// # Example
1685 /// ```ignore,no_run
1686 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1687 /// let x = WindowsUpdatePackage::new().set_support_url("example");
1688 /// ```
1689 pub fn set_support_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1690 self.support_url = v.into();
1691 self
1692 }
1693
1694 /// Sets the value of [more_info_urls][crate::model::inventory::WindowsUpdatePackage::more_info_urls].
1695 ///
1696 /// # Example
1697 /// ```ignore,no_run
1698 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1699 /// let x = WindowsUpdatePackage::new().set_more_info_urls(["a", "b", "c"]);
1700 /// ```
1701 pub fn set_more_info_urls<T, V>(mut self, v: T) -> Self
1702 where
1703 T: std::iter::IntoIterator<Item = V>,
1704 V: std::convert::Into<std::string::String>,
1705 {
1706 use std::iter::Iterator;
1707 self.more_info_urls = v.into_iter().map(|i| i.into()).collect();
1708 self
1709 }
1710
1711 /// Sets the value of [update_id][crate::model::inventory::WindowsUpdatePackage::update_id].
1712 ///
1713 /// # Example
1714 /// ```ignore,no_run
1715 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1716 /// let x = WindowsUpdatePackage::new().set_update_id("example");
1717 /// ```
1718 pub fn set_update_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1719 self.update_id = v.into();
1720 self
1721 }
1722
1723 /// Sets the value of [revision_number][crate::model::inventory::WindowsUpdatePackage::revision_number].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1728 /// let x = WindowsUpdatePackage::new().set_revision_number(42);
1729 /// ```
1730 pub fn set_revision_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1731 self.revision_number = v.into();
1732 self
1733 }
1734
1735 /// Sets the value of [last_deployment_change_time][crate::model::inventory::WindowsUpdatePackage::last_deployment_change_time].
1736 ///
1737 /// # Example
1738 /// ```ignore,no_run
1739 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1740 /// use wkt::Timestamp;
1741 /// let x = WindowsUpdatePackage::new().set_last_deployment_change_time(Timestamp::default()/* use setters */);
1742 /// ```
1743 pub fn set_last_deployment_change_time<T>(mut self, v: T) -> Self
1744 where
1745 T: std::convert::Into<wkt::Timestamp>,
1746 {
1747 self.last_deployment_change_time = std::option::Option::Some(v.into());
1748 self
1749 }
1750
1751 /// Sets or clears the value of [last_deployment_change_time][crate::model::inventory::WindowsUpdatePackage::last_deployment_change_time].
1752 ///
1753 /// # Example
1754 /// ```ignore,no_run
1755 /// # use google_cloud_osconfig_v1::model::inventory::WindowsUpdatePackage;
1756 /// use wkt::Timestamp;
1757 /// let x = WindowsUpdatePackage::new().set_or_clear_last_deployment_change_time(Some(Timestamp::default()/* use setters */));
1758 /// let x = WindowsUpdatePackage::new().set_or_clear_last_deployment_change_time(None::<Timestamp>);
1759 /// ```
1760 pub fn set_or_clear_last_deployment_change_time<T>(
1761 mut self,
1762 v: std::option::Option<T>,
1763 ) -> Self
1764 where
1765 T: std::convert::Into<wkt::Timestamp>,
1766 {
1767 self.last_deployment_change_time = v.map(|x| x.into());
1768 self
1769 }
1770 }
1771
1772 impl wkt::message::Message for WindowsUpdatePackage {
1773 fn typename() -> &'static str {
1774 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsUpdatePackage"
1775 }
1776 }
1777
1778 /// Defines additional types related to [WindowsUpdatePackage].
1779 pub mod windows_update_package {
1780 #[allow(unused_imports)]
1781 use super::*;
1782
1783 /// Categories specified by the Windows Update.
1784 #[derive(Clone, Default, PartialEq)]
1785 #[non_exhaustive]
1786 pub struct WindowsUpdateCategory {
1787 /// The identifier of the windows update category.
1788 pub id: std::string::String,
1789
1790 /// The name of the windows update category.
1791 pub name: std::string::String,
1792
1793 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1794 }
1795
1796 impl WindowsUpdateCategory {
1797 /// Creates a new default instance.
1798 pub fn new() -> Self {
1799 std::default::Default::default()
1800 }
1801
1802 /// Sets the value of [id][crate::model::inventory::windows_update_package::WindowsUpdateCategory::id].
1803 ///
1804 /// # Example
1805 /// ```ignore,no_run
1806 /// # use google_cloud_osconfig_v1::model::inventory::windows_update_package::WindowsUpdateCategory;
1807 /// let x = WindowsUpdateCategory::new().set_id("example");
1808 /// ```
1809 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1810 self.id = v.into();
1811 self
1812 }
1813
1814 /// Sets the value of [name][crate::model::inventory::windows_update_package::WindowsUpdateCategory::name].
1815 ///
1816 /// # Example
1817 /// ```ignore,no_run
1818 /// # use google_cloud_osconfig_v1::model::inventory::windows_update_package::WindowsUpdateCategory;
1819 /// let x = WindowsUpdateCategory::new().set_name("example");
1820 /// ```
1821 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1822 self.name = v.into();
1823 self
1824 }
1825 }
1826
1827 impl wkt::message::Message for WindowsUpdateCategory {
1828 fn typename() -> &'static str {
1829 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsUpdatePackage.WindowsUpdateCategory"
1830 }
1831 }
1832 }
1833
1834 /// Information related to a Quick Fix Engineering package.
1835 /// Fields are taken from Windows QuickFixEngineering Interface and match
1836 /// the source names:
1837 /// <https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering>
1838 #[derive(Clone, Default, PartialEq)]
1839 #[non_exhaustive]
1840 pub struct WindowsQuickFixEngineeringPackage {
1841 /// A short textual description of the QFE update.
1842 pub caption: std::string::String,
1843
1844 /// A textual description of the QFE update.
1845 pub description: std::string::String,
1846
1847 /// Unique identifier associated with a particular QFE update.
1848 pub hot_fix_id: std::string::String,
1849
1850 /// Date that the QFE update was installed. Mapped from installed_on field.
1851 pub install_time: std::option::Option<wkt::Timestamp>,
1852
1853 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1854 }
1855
1856 impl WindowsQuickFixEngineeringPackage {
1857 /// Creates a new default instance.
1858 pub fn new() -> Self {
1859 std::default::Default::default()
1860 }
1861
1862 /// Sets the value of [caption][crate::model::inventory::WindowsQuickFixEngineeringPackage::caption].
1863 ///
1864 /// # Example
1865 /// ```ignore,no_run
1866 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1867 /// let x = WindowsQuickFixEngineeringPackage::new().set_caption("example");
1868 /// ```
1869 pub fn set_caption<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1870 self.caption = v.into();
1871 self
1872 }
1873
1874 /// Sets the value of [description][crate::model::inventory::WindowsQuickFixEngineeringPackage::description].
1875 ///
1876 /// # Example
1877 /// ```ignore,no_run
1878 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1879 /// let x = WindowsQuickFixEngineeringPackage::new().set_description("example");
1880 /// ```
1881 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1882 self.description = v.into();
1883 self
1884 }
1885
1886 /// Sets the value of [hot_fix_id][crate::model::inventory::WindowsQuickFixEngineeringPackage::hot_fix_id].
1887 ///
1888 /// # Example
1889 /// ```ignore,no_run
1890 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1891 /// let x = WindowsQuickFixEngineeringPackage::new().set_hot_fix_id("example");
1892 /// ```
1893 pub fn set_hot_fix_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1894 self.hot_fix_id = v.into();
1895 self
1896 }
1897
1898 /// Sets the value of [install_time][crate::model::inventory::WindowsQuickFixEngineeringPackage::install_time].
1899 ///
1900 /// # Example
1901 /// ```ignore,no_run
1902 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1903 /// use wkt::Timestamp;
1904 /// let x = WindowsQuickFixEngineeringPackage::new().set_install_time(Timestamp::default()/* use setters */);
1905 /// ```
1906 pub fn set_install_time<T>(mut self, v: T) -> Self
1907 where
1908 T: std::convert::Into<wkt::Timestamp>,
1909 {
1910 self.install_time = std::option::Option::Some(v.into());
1911 self
1912 }
1913
1914 /// Sets or clears the value of [install_time][crate::model::inventory::WindowsQuickFixEngineeringPackage::install_time].
1915 ///
1916 /// # Example
1917 /// ```ignore,no_run
1918 /// # use google_cloud_osconfig_v1::model::inventory::WindowsQuickFixEngineeringPackage;
1919 /// use wkt::Timestamp;
1920 /// let x = WindowsQuickFixEngineeringPackage::new().set_or_clear_install_time(Some(Timestamp::default()/* use setters */));
1921 /// let x = WindowsQuickFixEngineeringPackage::new().set_or_clear_install_time(None::<Timestamp>);
1922 /// ```
1923 pub fn set_or_clear_install_time<T>(mut self, v: std::option::Option<T>) -> Self
1924 where
1925 T: std::convert::Into<wkt::Timestamp>,
1926 {
1927 self.install_time = v.map(|x| x.into());
1928 self
1929 }
1930 }
1931
1932 impl wkt::message::Message for WindowsQuickFixEngineeringPackage {
1933 fn typename() -> &'static str {
1934 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsQuickFixEngineeringPackage"
1935 }
1936 }
1937
1938 /// Contains information about a Windows application that is retrieved from the
1939 /// Windows Registry. For more information about these fields, see:
1940 /// <https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key>
1941 #[derive(Clone, Default, PartialEq)]
1942 #[non_exhaustive]
1943 pub struct WindowsApplication {
1944 /// The name of the application or product.
1945 pub display_name: std::string::String,
1946
1947 /// The version of the product or application in string format.
1948 pub display_version: std::string::String,
1949
1950 /// The name of the manufacturer for the product or application.
1951 pub publisher: std::string::String,
1952
1953 /// The last time this product received service. The value of this property
1954 /// is replaced each time a patch is applied or removed from the product or
1955 /// the command-line option is used to repair the product.
1956 pub install_date: std::option::Option<google_cloud_type::model::Date>,
1957
1958 /// The internet address for technical support.
1959 pub help_link: std::string::String,
1960
1961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1962 }
1963
1964 impl WindowsApplication {
1965 /// Creates a new default instance.
1966 pub fn new() -> Self {
1967 std::default::Default::default()
1968 }
1969
1970 /// Sets the value of [display_name][crate::model::inventory::WindowsApplication::display_name].
1971 ///
1972 /// # Example
1973 /// ```ignore,no_run
1974 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
1975 /// let x = WindowsApplication::new().set_display_name("example");
1976 /// ```
1977 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
1978 mut self,
1979 v: T,
1980 ) -> Self {
1981 self.display_name = v.into();
1982 self
1983 }
1984
1985 /// Sets the value of [display_version][crate::model::inventory::WindowsApplication::display_version].
1986 ///
1987 /// # Example
1988 /// ```ignore,no_run
1989 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
1990 /// let x = WindowsApplication::new().set_display_version("example");
1991 /// ```
1992 pub fn set_display_version<T: std::convert::Into<std::string::String>>(
1993 mut self,
1994 v: T,
1995 ) -> Self {
1996 self.display_version = v.into();
1997 self
1998 }
1999
2000 /// Sets the value of [publisher][crate::model::inventory::WindowsApplication::publisher].
2001 ///
2002 /// # Example
2003 /// ```ignore,no_run
2004 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2005 /// let x = WindowsApplication::new().set_publisher("example");
2006 /// ```
2007 pub fn set_publisher<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2008 self.publisher = v.into();
2009 self
2010 }
2011
2012 /// Sets the value of [install_date][crate::model::inventory::WindowsApplication::install_date].
2013 ///
2014 /// # Example
2015 /// ```ignore,no_run
2016 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2017 /// use google_cloud_type::model::Date;
2018 /// let x = WindowsApplication::new().set_install_date(Date::default()/* use setters */);
2019 /// ```
2020 pub fn set_install_date<T>(mut self, v: T) -> Self
2021 where
2022 T: std::convert::Into<google_cloud_type::model::Date>,
2023 {
2024 self.install_date = std::option::Option::Some(v.into());
2025 self
2026 }
2027
2028 /// Sets or clears the value of [install_date][crate::model::inventory::WindowsApplication::install_date].
2029 ///
2030 /// # Example
2031 /// ```ignore,no_run
2032 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2033 /// use google_cloud_type::model::Date;
2034 /// let x = WindowsApplication::new().set_or_clear_install_date(Some(Date::default()/* use setters */));
2035 /// let x = WindowsApplication::new().set_or_clear_install_date(None::<Date>);
2036 /// ```
2037 pub fn set_or_clear_install_date<T>(mut self, v: std::option::Option<T>) -> Self
2038 where
2039 T: std::convert::Into<google_cloud_type::model::Date>,
2040 {
2041 self.install_date = v.map(|x| x.into());
2042 self
2043 }
2044
2045 /// Sets the value of [help_link][crate::model::inventory::WindowsApplication::help_link].
2046 ///
2047 /// # Example
2048 /// ```ignore,no_run
2049 /// # use google_cloud_osconfig_v1::model::inventory::WindowsApplication;
2050 /// let x = WindowsApplication::new().set_help_link("example");
2051 /// ```
2052 pub fn set_help_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2053 self.help_link = v.into();
2054 self
2055 }
2056 }
2057
2058 impl wkt::message::Message for WindowsApplication {
2059 fn typename() -> &'static str {
2060 "type.googleapis.com/google.cloud.osconfig.v1.Inventory.WindowsApplication"
2061 }
2062 }
2063}
2064
2065/// A request message for getting inventory data for the specified VM.
2066#[derive(Clone, Default, PartialEq)]
2067#[non_exhaustive]
2068pub struct GetInventoryRequest {
2069 /// Required. API resource name for inventory resource.
2070 ///
2071 /// Format:
2072 /// `projects/{project}/locations/{location}/instances/{instance}/inventory`
2073 ///
2074 /// For `{project}`, either `project-number` or `project-id` can be provided.
2075 /// For `{instance}`, either Compute Engine `instance-id` or `instance-name`
2076 /// can be provided.
2077 pub name: std::string::String,
2078
2079 /// Inventory view indicating what information should be included in the
2080 /// inventory resource. If unspecified, the default view is BASIC.
2081 pub view: crate::model::InventoryView,
2082
2083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2084}
2085
2086impl GetInventoryRequest {
2087 /// Creates a new default instance.
2088 pub fn new() -> Self {
2089 std::default::Default::default()
2090 }
2091
2092 /// Sets the value of [name][crate::model::GetInventoryRequest::name].
2093 ///
2094 /// # Example
2095 /// ```ignore,no_run
2096 /// # use google_cloud_osconfig_v1::model::GetInventoryRequest;
2097 /// # let project_id = "project_id";
2098 /// # let location_id = "location_id";
2099 /// # let instance_id = "instance_id";
2100 /// let x = GetInventoryRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/inventory"));
2101 /// ```
2102 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2103 self.name = v.into();
2104 self
2105 }
2106
2107 /// Sets the value of [view][crate::model::GetInventoryRequest::view].
2108 ///
2109 /// # Example
2110 /// ```ignore,no_run
2111 /// # use google_cloud_osconfig_v1::model::GetInventoryRequest;
2112 /// use google_cloud_osconfig_v1::model::InventoryView;
2113 /// let x0 = GetInventoryRequest::new().set_view(InventoryView::Basic);
2114 /// let x1 = GetInventoryRequest::new().set_view(InventoryView::Full);
2115 /// ```
2116 pub fn set_view<T: std::convert::Into<crate::model::InventoryView>>(mut self, v: T) -> Self {
2117 self.view = v.into();
2118 self
2119 }
2120}
2121
2122impl wkt::message::Message for GetInventoryRequest {
2123 fn typename() -> &'static str {
2124 "type.googleapis.com/google.cloud.osconfig.v1.GetInventoryRequest"
2125 }
2126}
2127
2128/// A request message for listing inventory data for all VMs in the specified
2129/// location.
2130#[derive(Clone, Default, PartialEq)]
2131#[non_exhaustive]
2132pub struct ListInventoriesRequest {
2133 /// Required. The parent resource name.
2134 ///
2135 /// Format: `projects/{project}/locations/{location}/instances/-`
2136 ///
2137 /// For `{project}`, either `project-number` or `project-id` can be provided.
2138 pub parent: std::string::String,
2139
2140 /// Inventory view indicating what information should be included in the
2141 /// inventory resource. If unspecified, the default view is BASIC.
2142 pub view: crate::model::InventoryView,
2143
2144 /// The maximum number of results to return.
2145 pub page_size: i32,
2146
2147 /// A pagination token returned from a previous call to
2148 /// `ListInventories` that indicates where this listing
2149 /// should continue from.
2150 pub page_token: std::string::String,
2151
2152 /// If provided, this field specifies the criteria that must be met by a
2153 /// `Inventory` API resource to be included in the response.
2154 pub filter: std::string::String,
2155
2156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2157}
2158
2159impl ListInventoriesRequest {
2160 /// Creates a new default instance.
2161 pub fn new() -> Self {
2162 std::default::Default::default()
2163 }
2164
2165 /// Sets the value of [parent][crate::model::ListInventoriesRequest::parent].
2166 ///
2167 /// # Example
2168 /// ```ignore,no_run
2169 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2170 /// let x = ListInventoriesRequest::new().set_parent("example");
2171 /// ```
2172 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2173 self.parent = v.into();
2174 self
2175 }
2176
2177 /// Sets the value of [view][crate::model::ListInventoriesRequest::view].
2178 ///
2179 /// # Example
2180 /// ```ignore,no_run
2181 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2182 /// use google_cloud_osconfig_v1::model::InventoryView;
2183 /// let x0 = ListInventoriesRequest::new().set_view(InventoryView::Basic);
2184 /// let x1 = ListInventoriesRequest::new().set_view(InventoryView::Full);
2185 /// ```
2186 pub fn set_view<T: std::convert::Into<crate::model::InventoryView>>(mut self, v: T) -> Self {
2187 self.view = v.into();
2188 self
2189 }
2190
2191 /// Sets the value of [page_size][crate::model::ListInventoriesRequest::page_size].
2192 ///
2193 /// # Example
2194 /// ```ignore,no_run
2195 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2196 /// let x = ListInventoriesRequest::new().set_page_size(42);
2197 /// ```
2198 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2199 self.page_size = v.into();
2200 self
2201 }
2202
2203 /// Sets the value of [page_token][crate::model::ListInventoriesRequest::page_token].
2204 ///
2205 /// # Example
2206 /// ```ignore,no_run
2207 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2208 /// let x = ListInventoriesRequest::new().set_page_token("example");
2209 /// ```
2210 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2211 self.page_token = v.into();
2212 self
2213 }
2214
2215 /// Sets the value of [filter][crate::model::ListInventoriesRequest::filter].
2216 ///
2217 /// # Example
2218 /// ```ignore,no_run
2219 /// # use google_cloud_osconfig_v1::model::ListInventoriesRequest;
2220 /// let x = ListInventoriesRequest::new().set_filter("example");
2221 /// ```
2222 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2223 self.filter = v.into();
2224 self
2225 }
2226}
2227
2228impl wkt::message::Message for ListInventoriesRequest {
2229 fn typename() -> &'static str {
2230 "type.googleapis.com/google.cloud.osconfig.v1.ListInventoriesRequest"
2231 }
2232}
2233
2234/// A response message for listing inventory data for all VMs in a specified
2235/// location.
2236#[derive(Clone, Default, PartialEq)]
2237#[non_exhaustive]
2238pub struct ListInventoriesResponse {
2239 /// List of inventory objects.
2240 pub inventories: std::vec::Vec<crate::model::Inventory>,
2241
2242 /// The pagination token to retrieve the next page of inventory objects.
2243 pub next_page_token: std::string::String,
2244
2245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2246}
2247
2248impl ListInventoriesResponse {
2249 /// Creates a new default instance.
2250 pub fn new() -> Self {
2251 std::default::Default::default()
2252 }
2253
2254 /// Sets the value of [inventories][crate::model::ListInventoriesResponse::inventories].
2255 ///
2256 /// # Example
2257 /// ```ignore,no_run
2258 /// # use google_cloud_osconfig_v1::model::ListInventoriesResponse;
2259 /// use google_cloud_osconfig_v1::model::Inventory;
2260 /// let x = ListInventoriesResponse::new()
2261 /// .set_inventories([
2262 /// Inventory::default()/* use setters */,
2263 /// Inventory::default()/* use (different) setters */,
2264 /// ]);
2265 /// ```
2266 pub fn set_inventories<T, V>(mut self, v: T) -> Self
2267 where
2268 T: std::iter::IntoIterator<Item = V>,
2269 V: std::convert::Into<crate::model::Inventory>,
2270 {
2271 use std::iter::Iterator;
2272 self.inventories = v.into_iter().map(|i| i.into()).collect();
2273 self
2274 }
2275
2276 /// Sets the value of [next_page_token][crate::model::ListInventoriesResponse::next_page_token].
2277 ///
2278 /// # Example
2279 /// ```ignore,no_run
2280 /// # use google_cloud_osconfig_v1::model::ListInventoriesResponse;
2281 /// let x = ListInventoriesResponse::new().set_next_page_token("example");
2282 /// ```
2283 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2284 self.next_page_token = v.into();
2285 self
2286 }
2287}
2288
2289impl wkt::message::Message for ListInventoriesResponse {
2290 fn typename() -> &'static str {
2291 "type.googleapis.com/google.cloud.osconfig.v1.ListInventoriesResponse"
2292 }
2293}
2294
2295#[doc(hidden)]
2296impl google_cloud_gax::paginator::internal::PageableResponse for ListInventoriesResponse {
2297 type PageItem = crate::model::Inventory;
2298
2299 fn items(self) -> std::vec::Vec<Self::PageItem> {
2300 self.inventories
2301 }
2302
2303 fn next_page_token(&self) -> std::string::String {
2304 use std::clone::Clone;
2305 self.next_page_token.clone()
2306 }
2307}
2308
2309/// An OS policy defines the desired state configuration for a VM.
2310#[derive(Clone, Default, PartialEq)]
2311#[non_exhaustive]
2312pub struct OSPolicy {
2313 /// Required. The id of the OS policy with the following restrictions:
2314 ///
2315 /// * Must contain only lowercase letters, numbers, and hyphens.
2316 /// * Must start with a letter.
2317 /// * Must be between 1-63 characters.
2318 /// * Must end with a number or a letter.
2319 /// * Must be unique within the assignment.
2320 pub id: std::string::String,
2321
2322 /// Policy description.
2323 /// Length of the description is limited to 1024 characters.
2324 pub description: std::string::String,
2325
2326 /// Required. Policy mode
2327 pub mode: crate::model::os_policy::Mode,
2328
2329 /// Required. List of resource groups for the policy.
2330 /// For a particular VM, resource groups are evaluated in the order specified
2331 /// and the first resource group that is applicable is selected and the rest
2332 /// are ignored.
2333 ///
2334 /// If none of the resource groups are applicable for a VM, the VM is
2335 /// considered to be non-compliant w.r.t this policy. This behavior can be
2336 /// toggled by the flag `allow_no_resource_group_match`
2337 pub resource_groups: std::vec::Vec<crate::model::os_policy::ResourceGroup>,
2338
2339 /// This flag determines the OS policy compliance status when none of the
2340 /// resource groups within the policy are applicable for a VM. Set this value
2341 /// to `true` if the policy needs to be reported as compliant even if the
2342 /// policy has nothing to validate or enforce.
2343 pub allow_no_resource_group_match: bool,
2344
2345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2346}
2347
2348impl OSPolicy {
2349 /// Creates a new default instance.
2350 pub fn new() -> Self {
2351 std::default::Default::default()
2352 }
2353
2354 /// Sets the value of [id][crate::model::OSPolicy::id].
2355 ///
2356 /// # Example
2357 /// ```ignore,no_run
2358 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2359 /// let x = OSPolicy::new().set_id("example");
2360 /// ```
2361 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2362 self.id = v.into();
2363 self
2364 }
2365
2366 /// Sets the value of [description][crate::model::OSPolicy::description].
2367 ///
2368 /// # Example
2369 /// ```ignore,no_run
2370 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2371 /// let x = OSPolicy::new().set_description("example");
2372 /// ```
2373 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2374 self.description = v.into();
2375 self
2376 }
2377
2378 /// Sets the value of [mode][crate::model::OSPolicy::mode].
2379 ///
2380 /// # Example
2381 /// ```ignore,no_run
2382 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2383 /// use google_cloud_osconfig_v1::model::os_policy::Mode;
2384 /// let x0 = OSPolicy::new().set_mode(Mode::Validation);
2385 /// let x1 = OSPolicy::new().set_mode(Mode::Enforcement);
2386 /// ```
2387 pub fn set_mode<T: std::convert::Into<crate::model::os_policy::Mode>>(mut self, v: T) -> Self {
2388 self.mode = v.into();
2389 self
2390 }
2391
2392 /// Sets the value of [resource_groups][crate::model::OSPolicy::resource_groups].
2393 ///
2394 /// # Example
2395 /// ```ignore,no_run
2396 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2397 /// use google_cloud_osconfig_v1::model::os_policy::ResourceGroup;
2398 /// let x = OSPolicy::new()
2399 /// .set_resource_groups([
2400 /// ResourceGroup::default()/* use setters */,
2401 /// ResourceGroup::default()/* use (different) setters */,
2402 /// ]);
2403 /// ```
2404 pub fn set_resource_groups<T, V>(mut self, v: T) -> Self
2405 where
2406 T: std::iter::IntoIterator<Item = V>,
2407 V: std::convert::Into<crate::model::os_policy::ResourceGroup>,
2408 {
2409 use std::iter::Iterator;
2410 self.resource_groups = v.into_iter().map(|i| i.into()).collect();
2411 self
2412 }
2413
2414 /// Sets the value of [allow_no_resource_group_match][crate::model::OSPolicy::allow_no_resource_group_match].
2415 ///
2416 /// # Example
2417 /// ```ignore,no_run
2418 /// # use google_cloud_osconfig_v1::model::OSPolicy;
2419 /// let x = OSPolicy::new().set_allow_no_resource_group_match(true);
2420 /// ```
2421 pub fn set_allow_no_resource_group_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2422 self.allow_no_resource_group_match = v.into();
2423 self
2424 }
2425}
2426
2427impl wkt::message::Message for OSPolicy {
2428 fn typename() -> &'static str {
2429 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy"
2430 }
2431}
2432
2433/// Defines additional types related to [OSPolicy].
2434pub mod os_policy {
2435 #[allow(unused_imports)]
2436 use super::*;
2437
2438 /// Filtering criteria to select VMs based on inventory details.
2439 #[derive(Clone, Default, PartialEq)]
2440 #[non_exhaustive]
2441 pub struct InventoryFilter {
2442 /// Required. The OS short name
2443 pub os_short_name: std::string::String,
2444
2445 /// The OS version
2446 ///
2447 /// Prefix matches are supported if asterisk(*) is provided as the
2448 /// last character. For example, to match all versions with a major
2449 /// version of `7`, specify the following value for this field `7.*`
2450 ///
2451 /// An empty string matches all OS versions.
2452 pub os_version: std::string::String,
2453
2454 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2455 }
2456
2457 impl InventoryFilter {
2458 /// Creates a new default instance.
2459 pub fn new() -> Self {
2460 std::default::Default::default()
2461 }
2462
2463 /// Sets the value of [os_short_name][crate::model::os_policy::InventoryFilter::os_short_name].
2464 ///
2465 /// # Example
2466 /// ```ignore,no_run
2467 /// # use google_cloud_osconfig_v1::model::os_policy::InventoryFilter;
2468 /// let x = InventoryFilter::new().set_os_short_name("example");
2469 /// ```
2470 pub fn set_os_short_name<T: std::convert::Into<std::string::String>>(
2471 mut self,
2472 v: T,
2473 ) -> Self {
2474 self.os_short_name = v.into();
2475 self
2476 }
2477
2478 /// Sets the value of [os_version][crate::model::os_policy::InventoryFilter::os_version].
2479 ///
2480 /// # Example
2481 /// ```ignore,no_run
2482 /// # use google_cloud_osconfig_v1::model::os_policy::InventoryFilter;
2483 /// let x = InventoryFilter::new().set_os_version("example");
2484 /// ```
2485 pub fn set_os_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2486 self.os_version = v.into();
2487 self
2488 }
2489 }
2490
2491 impl wkt::message::Message for InventoryFilter {
2492 fn typename() -> &'static str {
2493 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.InventoryFilter"
2494 }
2495 }
2496
2497 /// An OS policy resource is used to define the desired state configuration
2498 /// and provides a specific functionality like installing/removing packages,
2499 /// executing a script etc.
2500 ///
2501 /// The system ensures that resources are always in their desired state by
2502 /// taking necessary actions if they have drifted from their desired state.
2503 #[derive(Clone, Default, PartialEq)]
2504 #[non_exhaustive]
2505 pub struct Resource {
2506 /// Required. The id of the resource with the following restrictions:
2507 ///
2508 /// * Must contain only lowercase letters, numbers, and hyphens.
2509 /// * Must start with a letter.
2510 /// * Must be between 1-63 characters.
2511 /// * Must end with a number or a letter.
2512 /// * Must be unique within the OS policy.
2513 pub id: std::string::String,
2514
2515 /// Resource type.
2516 pub resource_type: std::option::Option<crate::model::os_policy::resource::ResourceType>,
2517
2518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2519 }
2520
2521 impl Resource {
2522 /// Creates a new default instance.
2523 pub fn new() -> Self {
2524 std::default::Default::default()
2525 }
2526
2527 /// Sets the value of [id][crate::model::os_policy::Resource::id].
2528 ///
2529 /// # Example
2530 /// ```ignore,no_run
2531 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2532 /// let x = Resource::new().set_id("example");
2533 /// ```
2534 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2535 self.id = v.into();
2536 self
2537 }
2538
2539 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type].
2540 ///
2541 /// Note that all the setters affecting `resource_type` are mutually
2542 /// exclusive.
2543 ///
2544 /// # Example
2545 /// ```ignore,no_run
2546 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2547 /// use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
2548 /// let x = Resource::new().set_resource_type(Some(
2549 /// google_cloud_osconfig_v1::model::os_policy::resource::ResourceType::Pkg(PackageResource::default().into())));
2550 /// ```
2551 pub fn set_resource_type<
2552 T: std::convert::Into<
2553 std::option::Option<crate::model::os_policy::resource::ResourceType>,
2554 >,
2555 >(
2556 mut self,
2557 v: T,
2558 ) -> Self {
2559 self.resource_type = v.into();
2560 self
2561 }
2562
2563 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2564 /// if it holds a `Pkg`, `None` if the field is not set or
2565 /// holds a different branch.
2566 pub fn pkg(
2567 &self,
2568 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::PackageResource>>
2569 {
2570 #[allow(unreachable_patterns)]
2571 self.resource_type.as_ref().and_then(|v| match v {
2572 crate::model::os_policy::resource::ResourceType::Pkg(v) => {
2573 std::option::Option::Some(v)
2574 }
2575 _ => std::option::Option::None,
2576 })
2577 }
2578
2579 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2580 /// to hold a `Pkg`.
2581 ///
2582 /// Note that all the setters affecting `resource_type` are
2583 /// mutually exclusive.
2584 ///
2585 /// # Example
2586 /// ```ignore,no_run
2587 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2588 /// use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
2589 /// let x = Resource::new().set_pkg(PackageResource::default()/* use setters */);
2590 /// assert!(x.pkg().is_some());
2591 /// assert!(x.repository().is_none());
2592 /// assert!(x.exec().is_none());
2593 /// assert!(x.file().is_none());
2594 /// ```
2595 pub fn set_pkg<
2596 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::PackageResource>>,
2597 >(
2598 mut self,
2599 v: T,
2600 ) -> Self {
2601 self.resource_type = std::option::Option::Some(
2602 crate::model::os_policy::resource::ResourceType::Pkg(v.into()),
2603 );
2604 self
2605 }
2606
2607 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2608 /// if it holds a `Repository`, `None` if the field is not set or
2609 /// holds a different branch.
2610 pub fn repository(
2611 &self,
2612 ) -> std::option::Option<
2613 &std::boxed::Box<crate::model::os_policy::resource::RepositoryResource>,
2614 > {
2615 #[allow(unreachable_patterns)]
2616 self.resource_type.as_ref().and_then(|v| match v {
2617 crate::model::os_policy::resource::ResourceType::Repository(v) => {
2618 std::option::Option::Some(v)
2619 }
2620 _ => std::option::Option::None,
2621 })
2622 }
2623
2624 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2625 /// to hold a `Repository`.
2626 ///
2627 /// Note that all the setters affecting `resource_type` are
2628 /// mutually exclusive.
2629 ///
2630 /// # Example
2631 /// ```ignore,no_run
2632 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2633 /// use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
2634 /// let x = Resource::new().set_repository(RepositoryResource::default()/* use setters */);
2635 /// assert!(x.repository().is_some());
2636 /// assert!(x.pkg().is_none());
2637 /// assert!(x.exec().is_none());
2638 /// assert!(x.file().is_none());
2639 /// ```
2640 pub fn set_repository<
2641 T: std::convert::Into<
2642 std::boxed::Box<crate::model::os_policy::resource::RepositoryResource>,
2643 >,
2644 >(
2645 mut self,
2646 v: T,
2647 ) -> Self {
2648 self.resource_type = std::option::Option::Some(
2649 crate::model::os_policy::resource::ResourceType::Repository(v.into()),
2650 );
2651 self
2652 }
2653
2654 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2655 /// if it holds a `Exec`, `None` if the field is not set or
2656 /// holds a different branch.
2657 pub fn exec(
2658 &self,
2659 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::ExecResource>>
2660 {
2661 #[allow(unreachable_patterns)]
2662 self.resource_type.as_ref().and_then(|v| match v {
2663 crate::model::os_policy::resource::ResourceType::Exec(v) => {
2664 std::option::Option::Some(v)
2665 }
2666 _ => std::option::Option::None,
2667 })
2668 }
2669
2670 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2671 /// to hold a `Exec`.
2672 ///
2673 /// Note that all the setters affecting `resource_type` are
2674 /// mutually exclusive.
2675 ///
2676 /// # Example
2677 /// ```ignore,no_run
2678 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2679 /// use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
2680 /// let x = Resource::new().set_exec(ExecResource::default()/* use setters */);
2681 /// assert!(x.exec().is_some());
2682 /// assert!(x.pkg().is_none());
2683 /// assert!(x.repository().is_none());
2684 /// assert!(x.file().is_none());
2685 /// ```
2686 pub fn set_exec<
2687 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::ExecResource>>,
2688 >(
2689 mut self,
2690 v: T,
2691 ) -> Self {
2692 self.resource_type = std::option::Option::Some(
2693 crate::model::os_policy::resource::ResourceType::Exec(v.into()),
2694 );
2695 self
2696 }
2697
2698 /// The value of [resource_type][crate::model::os_policy::Resource::resource_type]
2699 /// if it holds a `File`, `None` if the field is not set or
2700 /// holds a different branch.
2701 pub fn file(
2702 &self,
2703 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::FileResource>>
2704 {
2705 #[allow(unreachable_patterns)]
2706 self.resource_type.as_ref().and_then(|v| match v {
2707 crate::model::os_policy::resource::ResourceType::File(v) => {
2708 std::option::Option::Some(v)
2709 }
2710 _ => std::option::Option::None,
2711 })
2712 }
2713
2714 /// Sets the value of [resource_type][crate::model::os_policy::Resource::resource_type]
2715 /// to hold a `File`.
2716 ///
2717 /// Note that all the setters affecting `resource_type` are
2718 /// mutually exclusive.
2719 ///
2720 /// # Example
2721 /// ```ignore,no_run
2722 /// # use google_cloud_osconfig_v1::model::os_policy::Resource;
2723 /// use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
2724 /// let x = Resource::new().set_file(FileResource::default()/* use setters */);
2725 /// assert!(x.file().is_some());
2726 /// assert!(x.pkg().is_none());
2727 /// assert!(x.repository().is_none());
2728 /// assert!(x.exec().is_none());
2729 /// ```
2730 pub fn set_file<
2731 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::FileResource>>,
2732 >(
2733 mut self,
2734 v: T,
2735 ) -> Self {
2736 self.resource_type = std::option::Option::Some(
2737 crate::model::os_policy::resource::ResourceType::File(v.into()),
2738 );
2739 self
2740 }
2741 }
2742
2743 impl wkt::message::Message for Resource {
2744 fn typename() -> &'static str {
2745 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource"
2746 }
2747 }
2748
2749 /// Defines additional types related to [Resource].
2750 pub mod resource {
2751 #[allow(unused_imports)]
2752 use super::*;
2753
2754 /// A remote or local file.
2755 #[derive(Clone, Default, PartialEq)]
2756 #[non_exhaustive]
2757 pub struct File {
2758 /// Defaults to false. When false, files are subject to validations
2759 /// based on the file type:
2760 ///
2761 /// Remote: A checksum must be specified.
2762 /// Cloud Storage: An object generation number must be specified.
2763 pub allow_insecure: bool,
2764
2765 /// A specific type of file.
2766 pub r#type: std::option::Option<crate::model::os_policy::resource::file::Type>,
2767
2768 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2769 }
2770
2771 impl File {
2772 /// Creates a new default instance.
2773 pub fn new() -> Self {
2774 std::default::Default::default()
2775 }
2776
2777 /// Sets the value of [allow_insecure][crate::model::os_policy::resource::File::allow_insecure].
2778 ///
2779 /// # Example
2780 /// ```ignore,no_run
2781 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2782 /// let x = File::new().set_allow_insecure(true);
2783 /// ```
2784 pub fn set_allow_insecure<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2785 self.allow_insecure = v.into();
2786 self
2787 }
2788
2789 /// Sets the value of [r#type][crate::model::os_policy::resource::File::type].
2790 ///
2791 /// Note that all the setters affecting `r#type` are mutually
2792 /// exclusive.
2793 ///
2794 /// # Example
2795 /// ```ignore,no_run
2796 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2797 /// use google_cloud_osconfig_v1::model::os_policy::resource::file::Type;
2798 /// let x = File::new().set_type(Some(Type::LocalPath("example".to_string())));
2799 /// ```
2800 pub fn set_type<
2801 T: std::convert::Into<
2802 std::option::Option<crate::model::os_policy::resource::file::Type>,
2803 >,
2804 >(
2805 mut self,
2806 v: T,
2807 ) -> Self {
2808 self.r#type = v.into();
2809 self
2810 }
2811
2812 /// The value of [r#type][crate::model::os_policy::resource::File::r#type]
2813 /// if it holds a `Remote`, `None` if the field is not set or
2814 /// holds a different branch.
2815 pub fn remote(
2816 &self,
2817 ) -> std::option::Option<
2818 &std::boxed::Box<crate::model::os_policy::resource::file::Remote>,
2819 > {
2820 #[allow(unreachable_patterns)]
2821 self.r#type.as_ref().and_then(|v| match v {
2822 crate::model::os_policy::resource::file::Type::Remote(v) => {
2823 std::option::Option::Some(v)
2824 }
2825 _ => std::option::Option::None,
2826 })
2827 }
2828
2829 /// Sets the value of [r#type][crate::model::os_policy::resource::File::r#type]
2830 /// to hold a `Remote`.
2831 ///
2832 /// Note that all the setters affecting `r#type` are
2833 /// mutually exclusive.
2834 ///
2835 /// # Example
2836 /// ```ignore,no_run
2837 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2838 /// use google_cloud_osconfig_v1::model::os_policy::resource::file::Remote;
2839 /// let x = File::new().set_remote(Remote::default()/* use setters */);
2840 /// assert!(x.remote().is_some());
2841 /// assert!(x.gcs().is_none());
2842 /// assert!(x.local_path().is_none());
2843 /// ```
2844 pub fn set_remote<
2845 T: std::convert::Into<
2846 std::boxed::Box<crate::model::os_policy::resource::file::Remote>,
2847 >,
2848 >(
2849 mut self,
2850 v: T,
2851 ) -> Self {
2852 self.r#type = std::option::Option::Some(
2853 crate::model::os_policy::resource::file::Type::Remote(v.into()),
2854 );
2855 self
2856 }
2857
2858 /// The value of [r#type][crate::model::os_policy::resource::File::r#type]
2859 /// if it holds a `Gcs`, `None` if the field is not set or
2860 /// holds a different branch.
2861 pub fn gcs(
2862 &self,
2863 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::file::Gcs>>
2864 {
2865 #[allow(unreachable_patterns)]
2866 self.r#type.as_ref().and_then(|v| match v {
2867 crate::model::os_policy::resource::file::Type::Gcs(v) => {
2868 std::option::Option::Some(v)
2869 }
2870 _ => std::option::Option::None,
2871 })
2872 }
2873
2874 /// Sets the value of [r#type][crate::model::os_policy::resource::File::r#type]
2875 /// to hold a `Gcs`.
2876 ///
2877 /// Note that all the setters affecting `r#type` are
2878 /// mutually exclusive.
2879 ///
2880 /// # Example
2881 /// ```ignore,no_run
2882 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2883 /// use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
2884 /// let x = File::new().set_gcs(Gcs::default()/* use setters */);
2885 /// assert!(x.gcs().is_some());
2886 /// assert!(x.remote().is_none());
2887 /// assert!(x.local_path().is_none());
2888 /// ```
2889 pub fn set_gcs<
2890 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::file::Gcs>>,
2891 >(
2892 mut self,
2893 v: T,
2894 ) -> Self {
2895 self.r#type = std::option::Option::Some(
2896 crate::model::os_policy::resource::file::Type::Gcs(v.into()),
2897 );
2898 self
2899 }
2900
2901 /// The value of [r#type][crate::model::os_policy::resource::File::r#type]
2902 /// if it holds a `LocalPath`, `None` if the field is not set or
2903 /// holds a different branch.
2904 pub fn local_path(&self) -> std::option::Option<&std::string::String> {
2905 #[allow(unreachable_patterns)]
2906 self.r#type.as_ref().and_then(|v| match v {
2907 crate::model::os_policy::resource::file::Type::LocalPath(v) => {
2908 std::option::Option::Some(v)
2909 }
2910 _ => std::option::Option::None,
2911 })
2912 }
2913
2914 /// Sets the value of [r#type][crate::model::os_policy::resource::File::r#type]
2915 /// to hold a `LocalPath`.
2916 ///
2917 /// Note that all the setters affecting `r#type` are
2918 /// mutually exclusive.
2919 ///
2920 /// # Example
2921 /// ```ignore,no_run
2922 /// # use google_cloud_osconfig_v1::model::os_policy::resource::File;
2923 /// let x = File::new().set_local_path("example");
2924 /// assert!(x.local_path().is_some());
2925 /// assert!(x.remote().is_none());
2926 /// assert!(x.gcs().is_none());
2927 /// ```
2928 pub fn set_local_path<T: std::convert::Into<std::string::String>>(
2929 mut self,
2930 v: T,
2931 ) -> Self {
2932 self.r#type = std::option::Option::Some(
2933 crate::model::os_policy::resource::file::Type::LocalPath(v.into()),
2934 );
2935 self
2936 }
2937 }
2938
2939 impl wkt::message::Message for File {
2940 fn typename() -> &'static str {
2941 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.File"
2942 }
2943 }
2944
2945 /// Defines additional types related to [File].
2946 pub mod file {
2947 #[allow(unused_imports)]
2948 use super::*;
2949
2950 /// Specifies a file available via some URI.
2951 #[derive(Clone, Default, PartialEq)]
2952 #[non_exhaustive]
2953 pub struct Remote {
2954 /// Required. URI from which to fetch the object. It should contain both
2955 /// the protocol and path following the format `{protocol}://{location}`.
2956 pub uri: std::string::String,
2957
2958 /// SHA256 checksum of the remote file.
2959 pub sha256_checksum: std::string::String,
2960
2961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2962 }
2963
2964 impl Remote {
2965 /// Creates a new default instance.
2966 pub fn new() -> Self {
2967 std::default::Default::default()
2968 }
2969
2970 /// Sets the value of [uri][crate::model::os_policy::resource::file::Remote::uri].
2971 ///
2972 /// # Example
2973 /// ```ignore,no_run
2974 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Remote;
2975 /// let x = Remote::new().set_uri("example");
2976 /// ```
2977 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2978 self.uri = v.into();
2979 self
2980 }
2981
2982 /// Sets the value of [sha256_checksum][crate::model::os_policy::resource::file::Remote::sha256_checksum].
2983 ///
2984 /// # Example
2985 /// ```ignore,no_run
2986 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Remote;
2987 /// let x = Remote::new().set_sha256_checksum("example");
2988 /// ```
2989 pub fn set_sha256_checksum<T: std::convert::Into<std::string::String>>(
2990 mut self,
2991 v: T,
2992 ) -> Self {
2993 self.sha256_checksum = v.into();
2994 self
2995 }
2996 }
2997
2998 impl wkt::message::Message for Remote {
2999 fn typename() -> &'static str {
3000 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.File.Remote"
3001 }
3002 }
3003
3004 /// Specifies a file available as a Cloud Storage Object.
3005 #[derive(Clone, Default, PartialEq)]
3006 #[non_exhaustive]
3007 pub struct Gcs {
3008 /// Required. Bucket of the Cloud Storage object.
3009 pub bucket: std::string::String,
3010
3011 /// Required. Name of the Cloud Storage object.
3012 pub object: std::string::String,
3013
3014 /// Generation number of the Cloud Storage object.
3015 pub generation: i64,
3016
3017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3018 }
3019
3020 impl Gcs {
3021 /// Creates a new default instance.
3022 pub fn new() -> Self {
3023 std::default::Default::default()
3024 }
3025
3026 /// Sets the value of [bucket][crate::model::os_policy::resource::file::Gcs::bucket].
3027 ///
3028 /// # Example
3029 /// ```ignore,no_run
3030 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
3031 /// let x = Gcs::new().set_bucket("example");
3032 /// ```
3033 pub fn set_bucket<T: std::convert::Into<std::string::String>>(
3034 mut self,
3035 v: T,
3036 ) -> Self {
3037 self.bucket = v.into();
3038 self
3039 }
3040
3041 /// Sets the value of [object][crate::model::os_policy::resource::file::Gcs::object].
3042 ///
3043 /// # Example
3044 /// ```ignore,no_run
3045 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
3046 /// let x = Gcs::new().set_object("example");
3047 /// ```
3048 pub fn set_object<T: std::convert::Into<std::string::String>>(
3049 mut self,
3050 v: T,
3051 ) -> Self {
3052 self.object = v.into();
3053 self
3054 }
3055
3056 /// Sets the value of [generation][crate::model::os_policy::resource::file::Gcs::generation].
3057 ///
3058 /// # Example
3059 /// ```ignore,no_run
3060 /// # use google_cloud_osconfig_v1::model::os_policy::resource::file::Gcs;
3061 /// let x = Gcs::new().set_generation(42);
3062 /// ```
3063 pub fn set_generation<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3064 self.generation = v.into();
3065 self
3066 }
3067 }
3068
3069 impl wkt::message::Message for Gcs {
3070 fn typename() -> &'static str {
3071 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.File.Gcs"
3072 }
3073 }
3074
3075 /// A specific type of file.
3076 #[derive(Clone, Debug, PartialEq)]
3077 #[non_exhaustive]
3078 pub enum Type {
3079 /// A generic remote file.
3080 Remote(std::boxed::Box<crate::model::os_policy::resource::file::Remote>),
3081 /// A Cloud Storage object.
3082 Gcs(std::boxed::Box<crate::model::os_policy::resource::file::Gcs>),
3083 /// A local path within the VM to use.
3084 LocalPath(std::string::String),
3085 }
3086 }
3087
3088 /// A resource that manages a system package.
3089 #[derive(Clone, Default, PartialEq)]
3090 #[non_exhaustive]
3091 pub struct PackageResource {
3092 /// Required. The desired state the agent should maintain for this package.
3093 pub desired_state: crate::model::os_policy::resource::package_resource::DesiredState,
3094
3095 /// A system package.
3096 pub system_package: std::option::Option<
3097 crate::model::os_policy::resource::package_resource::SystemPackage,
3098 >,
3099
3100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3101 }
3102
3103 impl PackageResource {
3104 /// Creates a new default instance.
3105 pub fn new() -> Self {
3106 std::default::Default::default()
3107 }
3108
3109 /// Sets the value of [desired_state][crate::model::os_policy::resource::PackageResource::desired_state].
3110 ///
3111 /// # Example
3112 /// ```ignore,no_run
3113 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3114 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::DesiredState;
3115 /// let x0 = PackageResource::new().set_desired_state(DesiredState::Installed);
3116 /// let x1 = PackageResource::new().set_desired_state(DesiredState::Removed);
3117 /// ```
3118 pub fn set_desired_state<
3119 T: std::convert::Into<
3120 crate::model::os_policy::resource::package_resource::DesiredState,
3121 >,
3122 >(
3123 mut self,
3124 v: T,
3125 ) -> Self {
3126 self.desired_state = v.into();
3127 self
3128 }
3129
3130 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package].
3131 ///
3132 /// Note that all the setters affecting `system_package` are mutually
3133 /// exclusive.
3134 ///
3135 /// # Example
3136 /// ```ignore,no_run
3137 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3138 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Apt;
3139 /// let x = PackageResource::new().set_system_package(Some(
3140 /// google_cloud_osconfig_v1::model::os_policy::resource::package_resource::SystemPackage::Apt(Apt::default().into())));
3141 /// ```
3142 pub fn set_system_package<
3143 T: std::convert::Into<
3144 std::option::Option<
3145 crate::model::os_policy::resource::package_resource::SystemPackage,
3146 >,
3147 >,
3148 >(
3149 mut self,
3150 v: T,
3151 ) -> Self {
3152 self.system_package = v.into();
3153 self
3154 }
3155
3156 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3157 /// if it holds a `Apt`, `None` if the field is not set or
3158 /// holds a different branch.
3159 pub fn apt(
3160 &self,
3161 ) -> std::option::Option<
3162 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Apt>,
3163 > {
3164 #[allow(unreachable_patterns)]
3165 self.system_package.as_ref().and_then(|v| match v {
3166 crate::model::os_policy::resource::package_resource::SystemPackage::Apt(v) => {
3167 std::option::Option::Some(v)
3168 }
3169 _ => std::option::Option::None,
3170 })
3171 }
3172
3173 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3174 /// to hold a `Apt`.
3175 ///
3176 /// Note that all the setters affecting `system_package` are
3177 /// mutually exclusive.
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3182 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Apt;
3183 /// let x = PackageResource::new().set_apt(Apt::default()/* use setters */);
3184 /// assert!(x.apt().is_some());
3185 /// assert!(x.deb().is_none());
3186 /// assert!(x.yum().is_none());
3187 /// assert!(x.zypper().is_none());
3188 /// assert!(x.rpm().is_none());
3189 /// assert!(x.googet().is_none());
3190 /// assert!(x.msi().is_none());
3191 /// ```
3192 pub fn set_apt<
3193 T: std::convert::Into<
3194 std::boxed::Box<crate::model::os_policy::resource::package_resource::Apt>,
3195 >,
3196 >(
3197 mut self,
3198 v: T,
3199 ) -> Self {
3200 self.system_package = std::option::Option::Some(
3201 crate::model::os_policy::resource::package_resource::SystemPackage::Apt(
3202 v.into(),
3203 ),
3204 );
3205 self
3206 }
3207
3208 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3209 /// if it holds a `Deb`, `None` if the field is not set or
3210 /// holds a different branch.
3211 pub fn deb(
3212 &self,
3213 ) -> std::option::Option<
3214 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Deb>,
3215 > {
3216 #[allow(unreachable_patterns)]
3217 self.system_package.as_ref().and_then(|v| match v {
3218 crate::model::os_policy::resource::package_resource::SystemPackage::Deb(v) => {
3219 std::option::Option::Some(v)
3220 }
3221 _ => std::option::Option::None,
3222 })
3223 }
3224
3225 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3226 /// to hold a `Deb`.
3227 ///
3228 /// Note that all the setters affecting `system_package` are
3229 /// mutually exclusive.
3230 ///
3231 /// # Example
3232 /// ```ignore,no_run
3233 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3234 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3235 /// let x = PackageResource::new().set_deb(Deb::default()/* use setters */);
3236 /// assert!(x.deb().is_some());
3237 /// assert!(x.apt().is_none());
3238 /// assert!(x.yum().is_none());
3239 /// assert!(x.zypper().is_none());
3240 /// assert!(x.rpm().is_none());
3241 /// assert!(x.googet().is_none());
3242 /// assert!(x.msi().is_none());
3243 /// ```
3244 pub fn set_deb<
3245 T: std::convert::Into<
3246 std::boxed::Box<crate::model::os_policy::resource::package_resource::Deb>,
3247 >,
3248 >(
3249 mut self,
3250 v: T,
3251 ) -> Self {
3252 self.system_package = std::option::Option::Some(
3253 crate::model::os_policy::resource::package_resource::SystemPackage::Deb(
3254 v.into(),
3255 ),
3256 );
3257 self
3258 }
3259
3260 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3261 /// if it holds a `Yum`, `None` if the field is not set or
3262 /// holds a different branch.
3263 pub fn yum(
3264 &self,
3265 ) -> std::option::Option<
3266 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Yum>,
3267 > {
3268 #[allow(unreachable_patterns)]
3269 self.system_package.as_ref().and_then(|v| match v {
3270 crate::model::os_policy::resource::package_resource::SystemPackage::Yum(v) => {
3271 std::option::Option::Some(v)
3272 }
3273 _ => std::option::Option::None,
3274 })
3275 }
3276
3277 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3278 /// to hold a `Yum`.
3279 ///
3280 /// Note that all the setters affecting `system_package` are
3281 /// mutually exclusive.
3282 ///
3283 /// # Example
3284 /// ```ignore,no_run
3285 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3286 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Yum;
3287 /// let x = PackageResource::new().set_yum(Yum::default()/* use setters */);
3288 /// assert!(x.yum().is_some());
3289 /// assert!(x.apt().is_none());
3290 /// assert!(x.deb().is_none());
3291 /// assert!(x.zypper().is_none());
3292 /// assert!(x.rpm().is_none());
3293 /// assert!(x.googet().is_none());
3294 /// assert!(x.msi().is_none());
3295 /// ```
3296 pub fn set_yum<
3297 T: std::convert::Into<
3298 std::boxed::Box<crate::model::os_policy::resource::package_resource::Yum>,
3299 >,
3300 >(
3301 mut self,
3302 v: T,
3303 ) -> Self {
3304 self.system_package = std::option::Option::Some(
3305 crate::model::os_policy::resource::package_resource::SystemPackage::Yum(
3306 v.into(),
3307 ),
3308 );
3309 self
3310 }
3311
3312 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3313 /// if it holds a `Zypper`, `None` if the field is not set or
3314 /// holds a different branch.
3315 pub fn zypper(
3316 &self,
3317 ) -> std::option::Option<
3318 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Zypper>,
3319 > {
3320 #[allow(unreachable_patterns)]
3321 self.system_package.as_ref().and_then(|v| match v {
3322 crate::model::os_policy::resource::package_resource::SystemPackage::Zypper(
3323 v,
3324 ) => std::option::Option::Some(v),
3325 _ => std::option::Option::None,
3326 })
3327 }
3328
3329 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3330 /// to hold a `Zypper`.
3331 ///
3332 /// Note that all the setters affecting `system_package` are
3333 /// mutually exclusive.
3334 ///
3335 /// # Example
3336 /// ```ignore,no_run
3337 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3338 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Zypper;
3339 /// let x = PackageResource::new().set_zypper(Zypper::default()/* use setters */);
3340 /// assert!(x.zypper().is_some());
3341 /// assert!(x.apt().is_none());
3342 /// assert!(x.deb().is_none());
3343 /// assert!(x.yum().is_none());
3344 /// assert!(x.rpm().is_none());
3345 /// assert!(x.googet().is_none());
3346 /// assert!(x.msi().is_none());
3347 /// ```
3348 pub fn set_zypper<
3349 T: std::convert::Into<
3350 std::boxed::Box<
3351 crate::model::os_policy::resource::package_resource::Zypper,
3352 >,
3353 >,
3354 >(
3355 mut self,
3356 v: T,
3357 ) -> Self {
3358 self.system_package = std::option::Option::Some(
3359 crate::model::os_policy::resource::package_resource::SystemPackage::Zypper(
3360 v.into(),
3361 ),
3362 );
3363 self
3364 }
3365
3366 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3367 /// if it holds a `Rpm`, `None` if the field is not set or
3368 /// holds a different branch.
3369 pub fn rpm(
3370 &self,
3371 ) -> std::option::Option<
3372 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Rpm>,
3373 > {
3374 #[allow(unreachable_patterns)]
3375 self.system_package.as_ref().and_then(|v| match v {
3376 crate::model::os_policy::resource::package_resource::SystemPackage::Rpm(v) => {
3377 std::option::Option::Some(v)
3378 }
3379 _ => std::option::Option::None,
3380 })
3381 }
3382
3383 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3384 /// to hold a `Rpm`.
3385 ///
3386 /// Note that all the setters affecting `system_package` are
3387 /// mutually exclusive.
3388 ///
3389 /// # Example
3390 /// ```ignore,no_run
3391 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3392 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3393 /// let x = PackageResource::new().set_rpm(Rpm::default()/* use setters */);
3394 /// assert!(x.rpm().is_some());
3395 /// assert!(x.apt().is_none());
3396 /// assert!(x.deb().is_none());
3397 /// assert!(x.yum().is_none());
3398 /// assert!(x.zypper().is_none());
3399 /// assert!(x.googet().is_none());
3400 /// assert!(x.msi().is_none());
3401 /// ```
3402 pub fn set_rpm<
3403 T: std::convert::Into<
3404 std::boxed::Box<crate::model::os_policy::resource::package_resource::Rpm>,
3405 >,
3406 >(
3407 mut self,
3408 v: T,
3409 ) -> Self {
3410 self.system_package = std::option::Option::Some(
3411 crate::model::os_policy::resource::package_resource::SystemPackage::Rpm(
3412 v.into(),
3413 ),
3414 );
3415 self
3416 }
3417
3418 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3419 /// if it holds a `Googet`, `None` if the field is not set or
3420 /// holds a different branch.
3421 pub fn googet(
3422 &self,
3423 ) -> std::option::Option<
3424 &std::boxed::Box<crate::model::os_policy::resource::package_resource::GooGet>,
3425 > {
3426 #[allow(unreachable_patterns)]
3427 self.system_package.as_ref().and_then(|v| match v {
3428 crate::model::os_policy::resource::package_resource::SystemPackage::Googet(
3429 v,
3430 ) => std::option::Option::Some(v),
3431 _ => std::option::Option::None,
3432 })
3433 }
3434
3435 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3436 /// to hold a `Googet`.
3437 ///
3438 /// Note that all the setters affecting `system_package` are
3439 /// mutually exclusive.
3440 ///
3441 /// # Example
3442 /// ```ignore,no_run
3443 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3444 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::GooGet;
3445 /// let x = PackageResource::new().set_googet(GooGet::default()/* use setters */);
3446 /// assert!(x.googet().is_some());
3447 /// assert!(x.apt().is_none());
3448 /// assert!(x.deb().is_none());
3449 /// assert!(x.yum().is_none());
3450 /// assert!(x.zypper().is_none());
3451 /// assert!(x.rpm().is_none());
3452 /// assert!(x.msi().is_none());
3453 /// ```
3454 pub fn set_googet<
3455 T: std::convert::Into<
3456 std::boxed::Box<
3457 crate::model::os_policy::resource::package_resource::GooGet,
3458 >,
3459 >,
3460 >(
3461 mut self,
3462 v: T,
3463 ) -> Self {
3464 self.system_package = std::option::Option::Some(
3465 crate::model::os_policy::resource::package_resource::SystemPackage::Googet(
3466 v.into(),
3467 ),
3468 );
3469 self
3470 }
3471
3472 /// The value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3473 /// if it holds a `Msi`, `None` if the field is not set or
3474 /// holds a different branch.
3475 pub fn msi(
3476 &self,
3477 ) -> std::option::Option<
3478 &std::boxed::Box<crate::model::os_policy::resource::package_resource::Msi>,
3479 > {
3480 #[allow(unreachable_patterns)]
3481 self.system_package.as_ref().and_then(|v| match v {
3482 crate::model::os_policy::resource::package_resource::SystemPackage::Msi(v) => {
3483 std::option::Option::Some(v)
3484 }
3485 _ => std::option::Option::None,
3486 })
3487 }
3488
3489 /// Sets the value of [system_package][crate::model::os_policy::resource::PackageResource::system_package]
3490 /// to hold a `Msi`.
3491 ///
3492 /// Note that all the setters affecting `system_package` are
3493 /// mutually exclusive.
3494 ///
3495 /// # Example
3496 /// ```ignore,no_run
3497 /// # use google_cloud_osconfig_v1::model::os_policy::resource::PackageResource;
3498 /// use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3499 /// let x = PackageResource::new().set_msi(Msi::default()/* use setters */);
3500 /// assert!(x.msi().is_some());
3501 /// assert!(x.apt().is_none());
3502 /// assert!(x.deb().is_none());
3503 /// assert!(x.yum().is_none());
3504 /// assert!(x.zypper().is_none());
3505 /// assert!(x.rpm().is_none());
3506 /// assert!(x.googet().is_none());
3507 /// ```
3508 pub fn set_msi<
3509 T: std::convert::Into<
3510 std::boxed::Box<crate::model::os_policy::resource::package_resource::Msi>,
3511 >,
3512 >(
3513 mut self,
3514 v: T,
3515 ) -> Self {
3516 self.system_package = std::option::Option::Some(
3517 crate::model::os_policy::resource::package_resource::SystemPackage::Msi(
3518 v.into(),
3519 ),
3520 );
3521 self
3522 }
3523 }
3524
3525 impl wkt::message::Message for PackageResource {
3526 fn typename() -> &'static str {
3527 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource"
3528 }
3529 }
3530
3531 /// Defines additional types related to [PackageResource].
3532 pub mod package_resource {
3533 #[allow(unused_imports)]
3534 use super::*;
3535
3536 /// A deb package file. dpkg packages only support INSTALLED state.
3537 #[derive(Clone, Default, PartialEq)]
3538 #[non_exhaustive]
3539 pub struct Deb {
3540 /// Required. A deb package.
3541 pub source: std::option::Option<crate::model::os_policy::resource::File>,
3542
3543 /// Whether dependencies should also be installed.
3544 ///
3545 /// - install when false: `dpkg -i package`
3546 /// - install when true: `apt-get update && apt-get -y install
3547 /// package.deb`
3548 pub pull_deps: bool,
3549
3550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3551 }
3552
3553 impl Deb {
3554 /// Creates a new default instance.
3555 pub fn new() -> Self {
3556 std::default::Default::default()
3557 }
3558
3559 /// Sets the value of [source][crate::model::os_policy::resource::package_resource::Deb::source].
3560 ///
3561 /// # Example
3562 /// ```ignore,no_run
3563 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3564 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3565 /// let x = Deb::new().set_source(File::default()/* use setters */);
3566 /// ```
3567 pub fn set_source<T>(mut self, v: T) -> Self
3568 where
3569 T: std::convert::Into<crate::model::os_policy::resource::File>,
3570 {
3571 self.source = std::option::Option::Some(v.into());
3572 self
3573 }
3574
3575 /// Sets or clears the value of [source][crate::model::os_policy::resource::package_resource::Deb::source].
3576 ///
3577 /// # Example
3578 /// ```ignore,no_run
3579 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3580 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3581 /// let x = Deb::new().set_or_clear_source(Some(File::default()/* use setters */));
3582 /// let x = Deb::new().set_or_clear_source(None::<File>);
3583 /// ```
3584 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3585 where
3586 T: std::convert::Into<crate::model::os_policy::resource::File>,
3587 {
3588 self.source = v.map(|x| x.into());
3589 self
3590 }
3591
3592 /// Sets the value of [pull_deps][crate::model::os_policy::resource::package_resource::Deb::pull_deps].
3593 ///
3594 /// # Example
3595 /// ```ignore,no_run
3596 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Deb;
3597 /// let x = Deb::new().set_pull_deps(true);
3598 /// ```
3599 pub fn set_pull_deps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3600 self.pull_deps = v.into();
3601 self
3602 }
3603 }
3604
3605 impl wkt::message::Message for Deb {
3606 fn typename() -> &'static str {
3607 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.Deb"
3608 }
3609 }
3610
3611 /// A package managed by APT.
3612 ///
3613 /// - install: `apt-get update && apt-get -y install [name]`
3614 /// - remove: `apt-get -y remove [name]`
3615 #[derive(Clone, Default, PartialEq)]
3616 #[non_exhaustive]
3617 pub struct Apt {
3618 /// Required. Package name.
3619 pub name: std::string::String,
3620
3621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3622 }
3623
3624 impl Apt {
3625 /// Creates a new default instance.
3626 pub fn new() -> Self {
3627 std::default::Default::default()
3628 }
3629
3630 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::Apt::name].
3631 ///
3632 /// # Example
3633 /// ```ignore,no_run
3634 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Apt;
3635 /// let x = Apt::new().set_name("example");
3636 /// ```
3637 pub fn set_name<T: std::convert::Into<std::string::String>>(
3638 mut self,
3639 v: T,
3640 ) -> Self {
3641 self.name = v.into();
3642 self
3643 }
3644 }
3645
3646 impl wkt::message::Message for Apt {
3647 fn typename() -> &'static str {
3648 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.APT"
3649 }
3650 }
3651
3652 /// An RPM package file. RPM packages only support INSTALLED state.
3653 #[derive(Clone, Default, PartialEq)]
3654 #[non_exhaustive]
3655 pub struct Rpm {
3656 /// Required. An rpm package.
3657 pub source: std::option::Option<crate::model::os_policy::resource::File>,
3658
3659 /// Whether dependencies should also be installed.
3660 ///
3661 /// - install when false: `rpm --upgrade --replacepkgs package.rpm`
3662 /// - install when true: `yum -y install package.rpm` or
3663 /// `zypper -y install package.rpm`
3664 pub pull_deps: bool,
3665
3666 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3667 }
3668
3669 impl Rpm {
3670 /// Creates a new default instance.
3671 pub fn new() -> Self {
3672 std::default::Default::default()
3673 }
3674
3675 /// Sets the value of [source][crate::model::os_policy::resource::package_resource::Rpm::source].
3676 ///
3677 /// # Example
3678 /// ```ignore,no_run
3679 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3680 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3681 /// let x = Rpm::new().set_source(File::default()/* use setters */);
3682 /// ```
3683 pub fn set_source<T>(mut self, v: T) -> Self
3684 where
3685 T: std::convert::Into<crate::model::os_policy::resource::File>,
3686 {
3687 self.source = std::option::Option::Some(v.into());
3688 self
3689 }
3690
3691 /// Sets or clears the value of [source][crate::model::os_policy::resource::package_resource::Rpm::source].
3692 ///
3693 /// # Example
3694 /// ```ignore,no_run
3695 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3696 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3697 /// let x = Rpm::new().set_or_clear_source(Some(File::default()/* use setters */));
3698 /// let x = Rpm::new().set_or_clear_source(None::<File>);
3699 /// ```
3700 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3701 where
3702 T: std::convert::Into<crate::model::os_policy::resource::File>,
3703 {
3704 self.source = v.map(|x| x.into());
3705 self
3706 }
3707
3708 /// Sets the value of [pull_deps][crate::model::os_policy::resource::package_resource::Rpm::pull_deps].
3709 ///
3710 /// # Example
3711 /// ```ignore,no_run
3712 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Rpm;
3713 /// let x = Rpm::new().set_pull_deps(true);
3714 /// ```
3715 pub fn set_pull_deps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3716 self.pull_deps = v.into();
3717 self
3718 }
3719 }
3720
3721 impl wkt::message::Message for Rpm {
3722 fn typename() -> &'static str {
3723 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.RPM"
3724 }
3725 }
3726
3727 /// A package managed by YUM.
3728 ///
3729 /// - install: `yum -y install package`
3730 /// - remove: `yum -y remove package`
3731 #[derive(Clone, Default, PartialEq)]
3732 #[non_exhaustive]
3733 pub struct Yum {
3734 /// Required. Package name.
3735 pub name: std::string::String,
3736
3737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3738 }
3739
3740 impl Yum {
3741 /// Creates a new default instance.
3742 pub fn new() -> Self {
3743 std::default::Default::default()
3744 }
3745
3746 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::Yum::name].
3747 ///
3748 /// # Example
3749 /// ```ignore,no_run
3750 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Yum;
3751 /// let x = Yum::new().set_name("example");
3752 /// ```
3753 pub fn set_name<T: std::convert::Into<std::string::String>>(
3754 mut self,
3755 v: T,
3756 ) -> Self {
3757 self.name = v.into();
3758 self
3759 }
3760 }
3761
3762 impl wkt::message::Message for Yum {
3763 fn typename() -> &'static str {
3764 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.YUM"
3765 }
3766 }
3767
3768 /// A package managed by Zypper.
3769 ///
3770 /// - install: `zypper -y install package`
3771 /// - remove: `zypper -y rm package`
3772 #[derive(Clone, Default, PartialEq)]
3773 #[non_exhaustive]
3774 pub struct Zypper {
3775 /// Required. Package name.
3776 pub name: std::string::String,
3777
3778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3779 }
3780
3781 impl Zypper {
3782 /// Creates a new default instance.
3783 pub fn new() -> Self {
3784 std::default::Default::default()
3785 }
3786
3787 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::Zypper::name].
3788 ///
3789 /// # Example
3790 /// ```ignore,no_run
3791 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Zypper;
3792 /// let x = Zypper::new().set_name("example");
3793 /// ```
3794 pub fn set_name<T: std::convert::Into<std::string::String>>(
3795 mut self,
3796 v: T,
3797 ) -> Self {
3798 self.name = v.into();
3799 self
3800 }
3801 }
3802
3803 impl wkt::message::Message for Zypper {
3804 fn typename() -> &'static str {
3805 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.Zypper"
3806 }
3807 }
3808
3809 /// A package managed by GooGet.
3810 ///
3811 /// - install: `googet -noconfirm install package`
3812 /// - remove: `googet -noconfirm remove package`
3813 #[derive(Clone, Default, PartialEq)]
3814 #[non_exhaustive]
3815 pub struct GooGet {
3816 /// Required. Package name.
3817 pub name: std::string::String,
3818
3819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3820 }
3821
3822 impl GooGet {
3823 /// Creates a new default instance.
3824 pub fn new() -> Self {
3825 std::default::Default::default()
3826 }
3827
3828 /// Sets the value of [name][crate::model::os_policy::resource::package_resource::GooGet::name].
3829 ///
3830 /// # Example
3831 /// ```ignore,no_run
3832 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::GooGet;
3833 /// let x = GooGet::new().set_name("example");
3834 /// ```
3835 pub fn set_name<T: std::convert::Into<std::string::String>>(
3836 mut self,
3837 v: T,
3838 ) -> Self {
3839 self.name = v.into();
3840 self
3841 }
3842 }
3843
3844 impl wkt::message::Message for GooGet {
3845 fn typename() -> &'static str {
3846 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.GooGet"
3847 }
3848 }
3849
3850 /// An MSI package. MSI packages only support INSTALLED state.
3851 #[derive(Clone, Default, PartialEq)]
3852 #[non_exhaustive]
3853 pub struct Msi {
3854 /// Required. The MSI package.
3855 pub source: std::option::Option<crate::model::os_policy::resource::File>,
3856
3857 /// Additional properties to use during installation.
3858 /// This should be in the format of Property=Setting.
3859 /// Appended to the defaults of `ACTION=INSTALL
3860 /// REBOOT=ReallySuppress`.
3861 pub properties: std::vec::Vec<std::string::String>,
3862
3863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3864 }
3865
3866 impl Msi {
3867 /// Creates a new default instance.
3868 pub fn new() -> Self {
3869 std::default::Default::default()
3870 }
3871
3872 /// Sets the value of [source][crate::model::os_policy::resource::package_resource::Msi::source].
3873 ///
3874 /// # Example
3875 /// ```ignore,no_run
3876 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3877 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3878 /// let x = Msi::new().set_source(File::default()/* use setters */);
3879 /// ```
3880 pub fn set_source<T>(mut self, v: T) -> Self
3881 where
3882 T: std::convert::Into<crate::model::os_policy::resource::File>,
3883 {
3884 self.source = std::option::Option::Some(v.into());
3885 self
3886 }
3887
3888 /// Sets or clears the value of [source][crate::model::os_policy::resource::package_resource::Msi::source].
3889 ///
3890 /// # Example
3891 /// ```ignore,no_run
3892 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3893 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
3894 /// let x = Msi::new().set_or_clear_source(Some(File::default()/* use setters */));
3895 /// let x = Msi::new().set_or_clear_source(None::<File>);
3896 /// ```
3897 pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
3898 where
3899 T: std::convert::Into<crate::model::os_policy::resource::File>,
3900 {
3901 self.source = v.map(|x| x.into());
3902 self
3903 }
3904
3905 /// Sets the value of [properties][crate::model::os_policy::resource::package_resource::Msi::properties].
3906 ///
3907 /// # Example
3908 /// ```ignore,no_run
3909 /// # use google_cloud_osconfig_v1::model::os_policy::resource::package_resource::Msi;
3910 /// let x = Msi::new().set_properties(["a", "b", "c"]);
3911 /// ```
3912 pub fn set_properties<T, V>(mut self, v: T) -> Self
3913 where
3914 T: std::iter::IntoIterator<Item = V>,
3915 V: std::convert::Into<std::string::String>,
3916 {
3917 use std::iter::Iterator;
3918 self.properties = v.into_iter().map(|i| i.into()).collect();
3919 self
3920 }
3921 }
3922
3923 impl wkt::message::Message for Msi {
3924 fn typename() -> &'static str {
3925 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.MSI"
3926 }
3927 }
3928
3929 /// The desired state that the OS Config agent maintains on the VM.
3930 ///
3931 /// # Working with unknown values
3932 ///
3933 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3934 /// additional enum variants at any time. Adding new variants is not considered
3935 /// a breaking change. Applications should write their code in anticipation of:
3936 ///
3937 /// - New values appearing in future releases of the client library, **and**
3938 /// - New values received dynamically, without application changes.
3939 ///
3940 /// Please consult the [Working with enums] section in the user guide for some
3941 /// guidelines.
3942 ///
3943 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3944 #[derive(Clone, Debug, PartialEq)]
3945 #[non_exhaustive]
3946 pub enum DesiredState {
3947 /// Unspecified is invalid.
3948 Unspecified,
3949 /// Ensure that the package is installed.
3950 Installed,
3951 /// The agent ensures that the package is not installed and
3952 /// uninstalls it if detected.
3953 Removed,
3954 /// If set, the enum was initialized with an unknown value.
3955 ///
3956 /// Applications can examine the value using [DesiredState::value] or
3957 /// [DesiredState::name].
3958 UnknownValue(desired_state::UnknownValue),
3959 }
3960
3961 #[doc(hidden)]
3962 pub mod desired_state {
3963 #[allow(unused_imports)]
3964 use super::*;
3965 #[derive(Clone, Debug, PartialEq)]
3966 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3967 }
3968
3969 impl DesiredState {
3970 /// Gets the enum value.
3971 ///
3972 /// Returns `None` if the enum contains an unknown value deserialized from
3973 /// the string representation of enums.
3974 pub fn value(&self) -> std::option::Option<i32> {
3975 match self {
3976 Self::Unspecified => std::option::Option::Some(0),
3977 Self::Installed => std::option::Option::Some(1),
3978 Self::Removed => std::option::Option::Some(2),
3979 Self::UnknownValue(u) => u.0.value(),
3980 }
3981 }
3982
3983 /// Gets the enum value as a string.
3984 ///
3985 /// Returns `None` if the enum contains an unknown value deserialized from
3986 /// the integer representation of enums.
3987 pub fn name(&self) -> std::option::Option<&str> {
3988 match self {
3989 Self::Unspecified => std::option::Option::Some("DESIRED_STATE_UNSPECIFIED"),
3990 Self::Installed => std::option::Option::Some("INSTALLED"),
3991 Self::Removed => std::option::Option::Some("REMOVED"),
3992 Self::UnknownValue(u) => u.0.name(),
3993 }
3994 }
3995 }
3996
3997 impl std::default::Default for DesiredState {
3998 fn default() -> Self {
3999 use std::convert::From;
4000 Self::from(0)
4001 }
4002 }
4003
4004 impl std::fmt::Display for DesiredState {
4005 fn fmt(
4006 &self,
4007 f: &mut std::fmt::Formatter<'_>,
4008 ) -> std::result::Result<(), std::fmt::Error> {
4009 wkt::internal::display_enum(f, self.name(), self.value())
4010 }
4011 }
4012
4013 impl std::convert::From<i32> for DesiredState {
4014 fn from(value: i32) -> Self {
4015 match value {
4016 0 => Self::Unspecified,
4017 1 => Self::Installed,
4018 2 => Self::Removed,
4019 _ => Self::UnknownValue(desired_state::UnknownValue(
4020 wkt::internal::UnknownEnumValue::Integer(value),
4021 )),
4022 }
4023 }
4024 }
4025
4026 impl std::convert::From<&str> for DesiredState {
4027 fn from(value: &str) -> Self {
4028 use std::string::ToString;
4029 match value {
4030 "DESIRED_STATE_UNSPECIFIED" => Self::Unspecified,
4031 "INSTALLED" => Self::Installed,
4032 "REMOVED" => Self::Removed,
4033 _ => Self::UnknownValue(desired_state::UnknownValue(
4034 wkt::internal::UnknownEnumValue::String(value.to_string()),
4035 )),
4036 }
4037 }
4038 }
4039
4040 impl serde::ser::Serialize for DesiredState {
4041 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4042 where
4043 S: serde::Serializer,
4044 {
4045 match self {
4046 Self::Unspecified => serializer.serialize_i32(0),
4047 Self::Installed => serializer.serialize_i32(1),
4048 Self::Removed => serializer.serialize_i32(2),
4049 Self::UnknownValue(u) => u.0.serialize(serializer),
4050 }
4051 }
4052 }
4053
4054 impl<'de> serde::de::Deserialize<'de> for DesiredState {
4055 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4056 where
4057 D: serde::Deserializer<'de>,
4058 {
4059 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DesiredState>::new(
4060 ".google.cloud.osconfig.v1.OSPolicy.Resource.PackageResource.DesiredState",
4061 ))
4062 }
4063 }
4064
4065 /// A system package.
4066 #[derive(Clone, Debug, PartialEq)]
4067 #[non_exhaustive]
4068 pub enum SystemPackage {
4069 /// A package managed by Apt.
4070 Apt(std::boxed::Box<crate::model::os_policy::resource::package_resource::Apt>),
4071 /// A deb package file.
4072 Deb(std::boxed::Box<crate::model::os_policy::resource::package_resource::Deb>),
4073 /// A package managed by YUM.
4074 Yum(std::boxed::Box<crate::model::os_policy::resource::package_resource::Yum>),
4075 /// A package managed by Zypper.
4076 Zypper(
4077 std::boxed::Box<crate::model::os_policy::resource::package_resource::Zypper>,
4078 ),
4079 /// An rpm package file.
4080 Rpm(std::boxed::Box<crate::model::os_policy::resource::package_resource::Rpm>),
4081 /// A package managed by GooGet.
4082 Googet(
4083 std::boxed::Box<crate::model::os_policy::resource::package_resource::GooGet>,
4084 ),
4085 /// An MSI package.
4086 Msi(std::boxed::Box<crate::model::os_policy::resource::package_resource::Msi>),
4087 }
4088 }
4089
4090 /// A resource that manages a package repository.
4091 #[derive(Clone, Default, PartialEq)]
4092 #[non_exhaustive]
4093 pub struct RepositoryResource {
4094 /// A specific type of repository.
4095 pub repository: std::option::Option<
4096 crate::model::os_policy::resource::repository_resource::Repository,
4097 >,
4098
4099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4100 }
4101
4102 impl RepositoryResource {
4103 /// Creates a new default instance.
4104 pub fn new() -> Self {
4105 std::default::Default::default()
4106 }
4107
4108 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository].
4109 ///
4110 /// Note that all the setters affecting `repository` are mutually
4111 /// exclusive.
4112 ///
4113 /// # Example
4114 /// ```ignore,no_run
4115 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4116 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4117 /// let x = RepositoryResource::new().set_repository(Some(
4118 /// google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::Repository::Apt(AptRepository::default().into())));
4119 /// ```
4120 pub fn set_repository<
4121 T: std::convert::Into<
4122 std::option::Option<
4123 crate::model::os_policy::resource::repository_resource::Repository,
4124 >,
4125 >,
4126 >(
4127 mut self,
4128 v: T,
4129 ) -> Self {
4130 self.repository = v.into();
4131 self
4132 }
4133
4134 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4135 /// if it holds a `Apt`, `None` if the field is not set or
4136 /// holds a different branch.
4137 pub fn apt(
4138 &self,
4139 ) -> std::option::Option<
4140 &std::boxed::Box<
4141 crate::model::os_policy::resource::repository_resource::AptRepository,
4142 >,
4143 > {
4144 #[allow(unreachable_patterns)]
4145 self.repository.as_ref().and_then(|v| match v {
4146 crate::model::os_policy::resource::repository_resource::Repository::Apt(v) => {
4147 std::option::Option::Some(v)
4148 }
4149 _ => std::option::Option::None,
4150 })
4151 }
4152
4153 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4154 /// to hold a `Apt`.
4155 ///
4156 /// Note that all the setters affecting `repository` are
4157 /// mutually exclusive.
4158 ///
4159 /// # Example
4160 /// ```ignore,no_run
4161 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4162 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4163 /// let x = RepositoryResource::new().set_apt(AptRepository::default()/* use setters */);
4164 /// assert!(x.apt().is_some());
4165 /// assert!(x.yum().is_none());
4166 /// assert!(x.zypper().is_none());
4167 /// assert!(x.goo().is_none());
4168 /// ```
4169 pub fn set_apt<
4170 T: std::convert::Into<
4171 std::boxed::Box<
4172 crate::model::os_policy::resource::repository_resource::AptRepository,
4173 >,
4174 >,
4175 >(
4176 mut self,
4177 v: T,
4178 ) -> Self {
4179 self.repository = std::option::Option::Some(
4180 crate::model::os_policy::resource::repository_resource::Repository::Apt(
4181 v.into(),
4182 ),
4183 );
4184 self
4185 }
4186
4187 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4188 /// if it holds a `Yum`, `None` if the field is not set or
4189 /// holds a different branch.
4190 pub fn yum(
4191 &self,
4192 ) -> std::option::Option<
4193 &std::boxed::Box<
4194 crate::model::os_policy::resource::repository_resource::YumRepository,
4195 >,
4196 > {
4197 #[allow(unreachable_patterns)]
4198 self.repository.as_ref().and_then(|v| match v {
4199 crate::model::os_policy::resource::repository_resource::Repository::Yum(v) => {
4200 std::option::Option::Some(v)
4201 }
4202 _ => std::option::Option::None,
4203 })
4204 }
4205
4206 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4207 /// to hold a `Yum`.
4208 ///
4209 /// Note that all the setters affecting `repository` are
4210 /// mutually exclusive.
4211 ///
4212 /// # Example
4213 /// ```ignore,no_run
4214 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4215 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4216 /// let x = RepositoryResource::new().set_yum(YumRepository::default()/* use setters */);
4217 /// assert!(x.yum().is_some());
4218 /// assert!(x.apt().is_none());
4219 /// assert!(x.zypper().is_none());
4220 /// assert!(x.goo().is_none());
4221 /// ```
4222 pub fn set_yum<
4223 T: std::convert::Into<
4224 std::boxed::Box<
4225 crate::model::os_policy::resource::repository_resource::YumRepository,
4226 >,
4227 >,
4228 >(
4229 mut self,
4230 v: T,
4231 ) -> Self {
4232 self.repository = std::option::Option::Some(
4233 crate::model::os_policy::resource::repository_resource::Repository::Yum(
4234 v.into(),
4235 ),
4236 );
4237 self
4238 }
4239
4240 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4241 /// if it holds a `Zypper`, `None` if the field is not set or
4242 /// holds a different branch.
4243 pub fn zypper(
4244 &self,
4245 ) -> std::option::Option<
4246 &std::boxed::Box<
4247 crate::model::os_policy::resource::repository_resource::ZypperRepository,
4248 >,
4249 > {
4250 #[allow(unreachable_patterns)]
4251 self.repository.as_ref().and_then(|v| match v {
4252 crate::model::os_policy::resource::repository_resource::Repository::Zypper(
4253 v,
4254 ) => std::option::Option::Some(v),
4255 _ => std::option::Option::None,
4256 })
4257 }
4258
4259 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4260 /// to hold a `Zypper`.
4261 ///
4262 /// Note that all the setters affecting `repository` are
4263 /// mutually exclusive.
4264 ///
4265 /// # Example
4266 /// ```ignore,no_run
4267 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4268 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4269 /// let x = RepositoryResource::new().set_zypper(ZypperRepository::default()/* use setters */);
4270 /// assert!(x.zypper().is_some());
4271 /// assert!(x.apt().is_none());
4272 /// assert!(x.yum().is_none());
4273 /// assert!(x.goo().is_none());
4274 /// ```
4275 pub fn set_zypper<T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::repository_resource::ZypperRepository>>>(mut self, v: T) -> Self{
4276 self.repository = std::option::Option::Some(
4277 crate::model::os_policy::resource::repository_resource::Repository::Zypper(
4278 v.into(),
4279 ),
4280 );
4281 self
4282 }
4283
4284 /// The value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4285 /// if it holds a `Goo`, `None` if the field is not set or
4286 /// holds a different branch.
4287 pub fn goo(
4288 &self,
4289 ) -> std::option::Option<
4290 &std::boxed::Box<
4291 crate::model::os_policy::resource::repository_resource::GooRepository,
4292 >,
4293 > {
4294 #[allow(unreachable_patterns)]
4295 self.repository.as_ref().and_then(|v| match v {
4296 crate::model::os_policy::resource::repository_resource::Repository::Goo(v) => {
4297 std::option::Option::Some(v)
4298 }
4299 _ => std::option::Option::None,
4300 })
4301 }
4302
4303 /// Sets the value of [repository][crate::model::os_policy::resource::RepositoryResource::repository]
4304 /// to hold a `Goo`.
4305 ///
4306 /// Note that all the setters affecting `repository` are
4307 /// mutually exclusive.
4308 ///
4309 /// # Example
4310 /// ```ignore,no_run
4311 /// # use google_cloud_osconfig_v1::model::os_policy::resource::RepositoryResource;
4312 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::GooRepository;
4313 /// let x = RepositoryResource::new().set_goo(GooRepository::default()/* use setters */);
4314 /// assert!(x.goo().is_some());
4315 /// assert!(x.apt().is_none());
4316 /// assert!(x.yum().is_none());
4317 /// assert!(x.zypper().is_none());
4318 /// ```
4319 pub fn set_goo<
4320 T: std::convert::Into<
4321 std::boxed::Box<
4322 crate::model::os_policy::resource::repository_resource::GooRepository,
4323 >,
4324 >,
4325 >(
4326 mut self,
4327 v: T,
4328 ) -> Self {
4329 self.repository = std::option::Option::Some(
4330 crate::model::os_policy::resource::repository_resource::Repository::Goo(
4331 v.into(),
4332 ),
4333 );
4334 self
4335 }
4336 }
4337
4338 impl wkt::message::Message for RepositoryResource {
4339 fn typename() -> &'static str {
4340 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource"
4341 }
4342 }
4343
4344 /// Defines additional types related to [RepositoryResource].
4345 pub mod repository_resource {
4346 #[allow(unused_imports)]
4347 use super::*;
4348
4349 /// Represents a single apt package repository. These will be added to
4350 /// a repo file that will be managed at
4351 /// `/etc/apt/sources.list.d/google_osconfig.list`.
4352 #[derive(Clone, Default, PartialEq)]
4353 #[non_exhaustive]
4354 pub struct AptRepository {
4355
4356 /// Required. Type of archive files in this repository.
4357 pub archive_type: crate::model::os_policy::resource::repository_resource::apt_repository::ArchiveType,
4358
4359 /// Required. URI for this repository.
4360 pub uri: std::string::String,
4361
4362 /// Required. Distribution of this repository.
4363 pub distribution: std::string::String,
4364
4365 /// Required. List of components for this repository. Must contain at
4366 /// least one item.
4367 pub components: std::vec::Vec<std::string::String>,
4368
4369 /// URI of the key file for this repository. The agent maintains a
4370 /// keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`.
4371 pub gpg_key: std::string::String,
4372
4373 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4374 }
4375
4376 impl AptRepository {
4377 /// Creates a new default instance.
4378 pub fn new() -> Self {
4379 std::default::Default::default()
4380 }
4381
4382 /// Sets the value of [archive_type][crate::model::os_policy::resource::repository_resource::AptRepository::archive_type].
4383 ///
4384 /// # Example
4385 /// ```ignore,no_run
4386 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4387 /// use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::apt_repository::ArchiveType;
4388 /// let x0 = AptRepository::new().set_archive_type(ArchiveType::Deb);
4389 /// let x1 = AptRepository::new().set_archive_type(ArchiveType::DebSrc);
4390 /// ```
4391 pub fn set_archive_type<T: std::convert::Into<crate::model::os_policy::resource::repository_resource::apt_repository::ArchiveType>>(mut self, v: T) -> Self{
4392 self.archive_type = v.into();
4393 self
4394 }
4395
4396 /// Sets the value of [uri][crate::model::os_policy::resource::repository_resource::AptRepository::uri].
4397 ///
4398 /// # Example
4399 /// ```ignore,no_run
4400 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4401 /// let x = AptRepository::new().set_uri("example");
4402 /// ```
4403 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4404 self.uri = v.into();
4405 self
4406 }
4407
4408 /// Sets the value of [distribution][crate::model::os_policy::resource::repository_resource::AptRepository::distribution].
4409 ///
4410 /// # Example
4411 /// ```ignore,no_run
4412 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4413 /// let x = AptRepository::new().set_distribution("example");
4414 /// ```
4415 pub fn set_distribution<T: std::convert::Into<std::string::String>>(
4416 mut self,
4417 v: T,
4418 ) -> Self {
4419 self.distribution = v.into();
4420 self
4421 }
4422
4423 /// Sets the value of [components][crate::model::os_policy::resource::repository_resource::AptRepository::components].
4424 ///
4425 /// # Example
4426 /// ```ignore,no_run
4427 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4428 /// let x = AptRepository::new().set_components(["a", "b", "c"]);
4429 /// ```
4430 pub fn set_components<T, V>(mut self, v: T) -> Self
4431 where
4432 T: std::iter::IntoIterator<Item = V>,
4433 V: std::convert::Into<std::string::String>,
4434 {
4435 use std::iter::Iterator;
4436 self.components = v.into_iter().map(|i| i.into()).collect();
4437 self
4438 }
4439
4440 /// Sets the value of [gpg_key][crate::model::os_policy::resource::repository_resource::AptRepository::gpg_key].
4441 ///
4442 /// # Example
4443 /// ```ignore,no_run
4444 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::AptRepository;
4445 /// let x = AptRepository::new().set_gpg_key("example");
4446 /// ```
4447 pub fn set_gpg_key<T: std::convert::Into<std::string::String>>(
4448 mut self,
4449 v: T,
4450 ) -> Self {
4451 self.gpg_key = v.into();
4452 self
4453 }
4454 }
4455
4456 impl wkt::message::Message for AptRepository {
4457 fn typename() -> &'static str {
4458 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.AptRepository"
4459 }
4460 }
4461
4462 /// Defines additional types related to [AptRepository].
4463 pub mod apt_repository {
4464 #[allow(unused_imports)]
4465 use super::*;
4466
4467 /// Type of archive.
4468 ///
4469 /// # Working with unknown values
4470 ///
4471 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4472 /// additional enum variants at any time. Adding new variants is not considered
4473 /// a breaking change. Applications should write their code in anticipation of:
4474 ///
4475 /// - New values appearing in future releases of the client library, **and**
4476 /// - New values received dynamically, without application changes.
4477 ///
4478 /// Please consult the [Working with enums] section in the user guide for some
4479 /// guidelines.
4480 ///
4481 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4482 #[derive(Clone, Debug, PartialEq)]
4483 #[non_exhaustive]
4484 pub enum ArchiveType {
4485 /// Unspecified is invalid.
4486 Unspecified,
4487 /// Deb indicates that the archive contains binary files.
4488 Deb,
4489 /// Deb-src indicates that the archive contains source files.
4490 DebSrc,
4491 /// If set, the enum was initialized with an unknown value.
4492 ///
4493 /// Applications can examine the value using [ArchiveType::value] or
4494 /// [ArchiveType::name].
4495 UnknownValue(archive_type::UnknownValue),
4496 }
4497
4498 #[doc(hidden)]
4499 pub mod archive_type {
4500 #[allow(unused_imports)]
4501 use super::*;
4502 #[derive(Clone, Debug, PartialEq)]
4503 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4504 }
4505
4506 impl ArchiveType {
4507 /// Gets the enum value.
4508 ///
4509 /// Returns `None` if the enum contains an unknown value deserialized from
4510 /// the string representation of enums.
4511 pub fn value(&self) -> std::option::Option<i32> {
4512 match self {
4513 Self::Unspecified => std::option::Option::Some(0),
4514 Self::Deb => std::option::Option::Some(1),
4515 Self::DebSrc => std::option::Option::Some(2),
4516 Self::UnknownValue(u) => u.0.value(),
4517 }
4518 }
4519
4520 /// Gets the enum value as a string.
4521 ///
4522 /// Returns `None` if the enum contains an unknown value deserialized from
4523 /// the integer representation of enums.
4524 pub fn name(&self) -> std::option::Option<&str> {
4525 match self {
4526 Self::Unspecified => {
4527 std::option::Option::Some("ARCHIVE_TYPE_UNSPECIFIED")
4528 }
4529 Self::Deb => std::option::Option::Some("DEB"),
4530 Self::DebSrc => std::option::Option::Some("DEB_SRC"),
4531 Self::UnknownValue(u) => u.0.name(),
4532 }
4533 }
4534 }
4535
4536 impl std::default::Default for ArchiveType {
4537 fn default() -> Self {
4538 use std::convert::From;
4539 Self::from(0)
4540 }
4541 }
4542
4543 impl std::fmt::Display for ArchiveType {
4544 fn fmt(
4545 &self,
4546 f: &mut std::fmt::Formatter<'_>,
4547 ) -> std::result::Result<(), std::fmt::Error> {
4548 wkt::internal::display_enum(f, self.name(), self.value())
4549 }
4550 }
4551
4552 impl std::convert::From<i32> for ArchiveType {
4553 fn from(value: i32) -> Self {
4554 match value {
4555 0 => Self::Unspecified,
4556 1 => Self::Deb,
4557 2 => Self::DebSrc,
4558 _ => Self::UnknownValue(archive_type::UnknownValue(
4559 wkt::internal::UnknownEnumValue::Integer(value),
4560 )),
4561 }
4562 }
4563 }
4564
4565 impl std::convert::From<&str> for ArchiveType {
4566 fn from(value: &str) -> Self {
4567 use std::string::ToString;
4568 match value {
4569 "ARCHIVE_TYPE_UNSPECIFIED" => Self::Unspecified,
4570 "DEB" => Self::Deb,
4571 "DEB_SRC" => Self::DebSrc,
4572 _ => Self::UnknownValue(archive_type::UnknownValue(
4573 wkt::internal::UnknownEnumValue::String(value.to_string()),
4574 )),
4575 }
4576 }
4577 }
4578
4579 impl serde::ser::Serialize for ArchiveType {
4580 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4581 where
4582 S: serde::Serializer,
4583 {
4584 match self {
4585 Self::Unspecified => serializer.serialize_i32(0),
4586 Self::Deb => serializer.serialize_i32(1),
4587 Self::DebSrc => serializer.serialize_i32(2),
4588 Self::UnknownValue(u) => u.0.serialize(serializer),
4589 }
4590 }
4591 }
4592
4593 impl<'de> serde::de::Deserialize<'de> for ArchiveType {
4594 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4595 where
4596 D: serde::Deserializer<'de>,
4597 {
4598 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ArchiveType>::new(
4599 ".google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.AptRepository.ArchiveType"))
4600 }
4601 }
4602 }
4603
4604 /// Represents a single yum package repository. These are added to a
4605 /// repo file that is managed at
4606 /// `/etc/yum.repos.d/google_osconfig.repo`.
4607 #[derive(Clone, Default, PartialEq)]
4608 #[non_exhaustive]
4609 pub struct YumRepository {
4610 /// Required. A one word, unique name for this repository. This is the
4611 /// `repo id` in the yum config file and also the `display_name` if
4612 /// `display_name` is omitted. This id is also used as the unique
4613 /// identifier when checking for resource conflicts.
4614 pub id: std::string::String,
4615
4616 /// The display name of the repository.
4617 pub display_name: std::string::String,
4618
4619 /// Required. The location of the repository directory.
4620 pub base_url: std::string::String,
4621
4622 /// URIs of GPG keys.
4623 pub gpg_keys: std::vec::Vec<std::string::String>,
4624
4625 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4626 }
4627
4628 impl YumRepository {
4629 /// Creates a new default instance.
4630 pub fn new() -> Self {
4631 std::default::Default::default()
4632 }
4633
4634 /// Sets the value of [id][crate::model::os_policy::resource::repository_resource::YumRepository::id].
4635 ///
4636 /// # Example
4637 /// ```ignore,no_run
4638 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4639 /// let x = YumRepository::new().set_id("example");
4640 /// ```
4641 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4642 self.id = v.into();
4643 self
4644 }
4645
4646 /// Sets the value of [display_name][crate::model::os_policy::resource::repository_resource::YumRepository::display_name].
4647 ///
4648 /// # Example
4649 /// ```ignore,no_run
4650 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4651 /// let x = YumRepository::new().set_display_name("example");
4652 /// ```
4653 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
4654 mut self,
4655 v: T,
4656 ) -> Self {
4657 self.display_name = v.into();
4658 self
4659 }
4660
4661 /// Sets the value of [base_url][crate::model::os_policy::resource::repository_resource::YumRepository::base_url].
4662 ///
4663 /// # Example
4664 /// ```ignore,no_run
4665 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4666 /// let x = YumRepository::new().set_base_url("example");
4667 /// ```
4668 pub fn set_base_url<T: std::convert::Into<std::string::String>>(
4669 mut self,
4670 v: T,
4671 ) -> Self {
4672 self.base_url = v.into();
4673 self
4674 }
4675
4676 /// Sets the value of [gpg_keys][crate::model::os_policy::resource::repository_resource::YumRepository::gpg_keys].
4677 ///
4678 /// # Example
4679 /// ```ignore,no_run
4680 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::YumRepository;
4681 /// let x = YumRepository::new().set_gpg_keys(["a", "b", "c"]);
4682 /// ```
4683 pub fn set_gpg_keys<T, V>(mut self, v: T) -> Self
4684 where
4685 T: std::iter::IntoIterator<Item = V>,
4686 V: std::convert::Into<std::string::String>,
4687 {
4688 use std::iter::Iterator;
4689 self.gpg_keys = v.into_iter().map(|i| i.into()).collect();
4690 self
4691 }
4692 }
4693
4694 impl wkt::message::Message for YumRepository {
4695 fn typename() -> &'static str {
4696 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.YumRepository"
4697 }
4698 }
4699
4700 /// Represents a single zypper package repository. These are added to a
4701 /// repo file that is managed at
4702 /// `/etc/zypp/repos.d/google_osconfig.repo`.
4703 #[derive(Clone, Default, PartialEq)]
4704 #[non_exhaustive]
4705 pub struct ZypperRepository {
4706 /// Required. A one word, unique name for this repository. This is the
4707 /// `repo id` in the zypper config file and also the `display_name` if
4708 /// `display_name` is omitted. This id is also used as the unique
4709 /// identifier when checking for GuestPolicy conflicts.
4710 pub id: std::string::String,
4711
4712 /// The display name of the repository.
4713 pub display_name: std::string::String,
4714
4715 /// Required. The location of the repository directory.
4716 pub base_url: std::string::String,
4717
4718 /// URIs of GPG keys.
4719 pub gpg_keys: std::vec::Vec<std::string::String>,
4720
4721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4722 }
4723
4724 impl ZypperRepository {
4725 /// Creates a new default instance.
4726 pub fn new() -> Self {
4727 std::default::Default::default()
4728 }
4729
4730 /// Sets the value of [id][crate::model::os_policy::resource::repository_resource::ZypperRepository::id].
4731 ///
4732 /// # Example
4733 /// ```ignore,no_run
4734 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4735 /// let x = ZypperRepository::new().set_id("example");
4736 /// ```
4737 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4738 self.id = v.into();
4739 self
4740 }
4741
4742 /// Sets the value of [display_name][crate::model::os_policy::resource::repository_resource::ZypperRepository::display_name].
4743 ///
4744 /// # Example
4745 /// ```ignore,no_run
4746 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4747 /// let x = ZypperRepository::new().set_display_name("example");
4748 /// ```
4749 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
4750 mut self,
4751 v: T,
4752 ) -> Self {
4753 self.display_name = v.into();
4754 self
4755 }
4756
4757 /// Sets the value of [base_url][crate::model::os_policy::resource::repository_resource::ZypperRepository::base_url].
4758 ///
4759 /// # Example
4760 /// ```ignore,no_run
4761 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4762 /// let x = ZypperRepository::new().set_base_url("example");
4763 /// ```
4764 pub fn set_base_url<T: std::convert::Into<std::string::String>>(
4765 mut self,
4766 v: T,
4767 ) -> Self {
4768 self.base_url = v.into();
4769 self
4770 }
4771
4772 /// Sets the value of [gpg_keys][crate::model::os_policy::resource::repository_resource::ZypperRepository::gpg_keys].
4773 ///
4774 /// # Example
4775 /// ```ignore,no_run
4776 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::ZypperRepository;
4777 /// let x = ZypperRepository::new().set_gpg_keys(["a", "b", "c"]);
4778 /// ```
4779 pub fn set_gpg_keys<T, V>(mut self, v: T) -> Self
4780 where
4781 T: std::iter::IntoIterator<Item = V>,
4782 V: std::convert::Into<std::string::String>,
4783 {
4784 use std::iter::Iterator;
4785 self.gpg_keys = v.into_iter().map(|i| i.into()).collect();
4786 self
4787 }
4788 }
4789
4790 impl wkt::message::Message for ZypperRepository {
4791 fn typename() -> &'static str {
4792 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.ZypperRepository"
4793 }
4794 }
4795
4796 /// Represents a Goo package repository. These are added to a repo file
4797 /// that is managed at
4798 /// `C:/ProgramData/GooGet/repos/google_osconfig.repo`.
4799 #[derive(Clone, Default, PartialEq)]
4800 #[non_exhaustive]
4801 pub struct GooRepository {
4802 /// Required. The name of the repository.
4803 pub name: std::string::String,
4804
4805 /// Required. The url of the repository.
4806 pub url: std::string::String,
4807
4808 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4809 }
4810
4811 impl GooRepository {
4812 /// Creates a new default instance.
4813 pub fn new() -> Self {
4814 std::default::Default::default()
4815 }
4816
4817 /// Sets the value of [name][crate::model::os_policy::resource::repository_resource::GooRepository::name].
4818 ///
4819 /// # Example
4820 /// ```ignore,no_run
4821 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::GooRepository;
4822 /// let x = GooRepository::new().set_name("example");
4823 /// ```
4824 pub fn set_name<T: std::convert::Into<std::string::String>>(
4825 mut self,
4826 v: T,
4827 ) -> Self {
4828 self.name = v.into();
4829 self
4830 }
4831
4832 /// Sets the value of [url][crate::model::os_policy::resource::repository_resource::GooRepository::url].
4833 ///
4834 /// # Example
4835 /// ```ignore,no_run
4836 /// # use google_cloud_osconfig_v1::model::os_policy::resource::repository_resource::GooRepository;
4837 /// let x = GooRepository::new().set_url("example");
4838 /// ```
4839 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4840 self.url = v.into();
4841 self
4842 }
4843 }
4844
4845 impl wkt::message::Message for GooRepository {
4846 fn typename() -> &'static str {
4847 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.GooRepository"
4848 }
4849 }
4850
4851 /// A specific type of repository.
4852 #[derive(Clone, Debug, PartialEq)]
4853 #[non_exhaustive]
4854 pub enum Repository {
4855 /// An Apt Repository.
4856 Apt(
4857 std::boxed::Box<
4858 crate::model::os_policy::resource::repository_resource::AptRepository,
4859 >,
4860 ),
4861 /// A Yum Repository.
4862 Yum(
4863 std::boxed::Box<
4864 crate::model::os_policy::resource::repository_resource::YumRepository,
4865 >,
4866 ),
4867 /// A Zypper Repository.
4868 Zypper(
4869 std::boxed::Box<
4870 crate::model::os_policy::resource::repository_resource::ZypperRepository,
4871 >,
4872 ),
4873 /// A Goo Repository.
4874 Goo(
4875 std::boxed::Box<
4876 crate::model::os_policy::resource::repository_resource::GooRepository,
4877 >,
4878 ),
4879 }
4880 }
4881
4882 /// A resource that allows executing scripts on the VM.
4883 ///
4884 /// The `ExecResource` has 2 stages: `validate` and `enforce` and both stages
4885 /// accept a script as an argument to execute.
4886 ///
4887 /// When the `ExecResource` is applied by the agent, it first executes the
4888 /// script in the `validate` stage. The `validate` stage can signal that the
4889 /// `ExecResource` is already in the desired state by returning an exit code
4890 /// of `100`. If the `ExecResource` is not in the desired state, it should
4891 /// return an exit code of `101`. Any other exit code returned by this stage
4892 /// is considered an error.
4893 ///
4894 /// If the `ExecResource` is not in the desired state based on the exit code
4895 /// from the `validate` stage, the agent proceeds to execute the script from
4896 /// the `enforce` stage. If the `ExecResource` is already in the desired
4897 /// state, the `enforce` stage will not be run.
4898 /// Similar to `validate` stage, the `enforce` stage should return an exit
4899 /// code of `100` to indicate that the resource in now in its desired state.
4900 /// Any other exit code is considered an error.
4901 ///
4902 /// NOTE: An exit code of `100` was chosen over `0` (and `101` vs `1`) to
4903 /// have an explicit indicator of `in desired state`, `not in desired state`
4904 /// and errors. Because, for example, Powershell will always return an exit
4905 /// code of `0` unless an `exit` statement is provided in the script. So, for
4906 /// reasons of consistency and being explicit, exit codes `100` and `101`
4907 /// were chosen.
4908 #[derive(Clone, Default, PartialEq)]
4909 #[non_exhaustive]
4910 pub struct ExecResource {
4911 /// Required. What to run to validate this resource is in the desired
4912 /// state. An exit code of 100 indicates "in desired state", and exit code
4913 /// of 101 indicates "not in desired state". Any other exit code indicates
4914 /// a failure running validate.
4915 pub validate:
4916 std::option::Option<crate::model::os_policy::resource::exec_resource::Exec>,
4917
4918 /// What to run to bring this resource into the desired state.
4919 /// An exit code of 100 indicates "success", any other exit code indicates
4920 /// a failure running enforce.
4921 pub enforce:
4922 std::option::Option<crate::model::os_policy::resource::exec_resource::Exec>,
4923
4924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4925 }
4926
4927 impl ExecResource {
4928 /// Creates a new default instance.
4929 pub fn new() -> Self {
4930 std::default::Default::default()
4931 }
4932
4933 /// Sets the value of [validate][crate::model::os_policy::resource::ExecResource::validate].
4934 ///
4935 /// # Example
4936 /// ```ignore,no_run
4937 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4938 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4939 /// let x = ExecResource::new().set_validate(Exec::default()/* use setters */);
4940 /// ```
4941 pub fn set_validate<T>(mut self, v: T) -> Self
4942 where
4943 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4944 {
4945 self.validate = std::option::Option::Some(v.into());
4946 self
4947 }
4948
4949 /// Sets or clears the value of [validate][crate::model::os_policy::resource::ExecResource::validate].
4950 ///
4951 /// # Example
4952 /// ```ignore,no_run
4953 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4954 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4955 /// let x = ExecResource::new().set_or_clear_validate(Some(Exec::default()/* use setters */));
4956 /// let x = ExecResource::new().set_or_clear_validate(None::<Exec>);
4957 /// ```
4958 pub fn set_or_clear_validate<T>(mut self, v: std::option::Option<T>) -> Self
4959 where
4960 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4961 {
4962 self.validate = v.map(|x| x.into());
4963 self
4964 }
4965
4966 /// Sets the value of [enforce][crate::model::os_policy::resource::ExecResource::enforce].
4967 ///
4968 /// # Example
4969 /// ```ignore,no_run
4970 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4971 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4972 /// let x = ExecResource::new().set_enforce(Exec::default()/* use setters */);
4973 /// ```
4974 pub fn set_enforce<T>(mut self, v: T) -> Self
4975 where
4976 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4977 {
4978 self.enforce = std::option::Option::Some(v.into());
4979 self
4980 }
4981
4982 /// Sets or clears the value of [enforce][crate::model::os_policy::resource::ExecResource::enforce].
4983 ///
4984 /// # Example
4985 /// ```ignore,no_run
4986 /// # use google_cloud_osconfig_v1::model::os_policy::resource::ExecResource;
4987 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
4988 /// let x = ExecResource::new().set_or_clear_enforce(Some(Exec::default()/* use setters */));
4989 /// let x = ExecResource::new().set_or_clear_enforce(None::<Exec>);
4990 /// ```
4991 pub fn set_or_clear_enforce<T>(mut self, v: std::option::Option<T>) -> Self
4992 where
4993 T: std::convert::Into<crate::model::os_policy::resource::exec_resource::Exec>,
4994 {
4995 self.enforce = v.map(|x| x.into());
4996 self
4997 }
4998 }
4999
5000 impl wkt::message::Message for ExecResource {
5001 fn typename() -> &'static str {
5002 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.ExecResource"
5003 }
5004 }
5005
5006 /// Defines additional types related to [ExecResource].
5007 pub mod exec_resource {
5008 #[allow(unused_imports)]
5009 use super::*;
5010
5011 /// A file or script to execute.
5012 #[derive(Clone, Default, PartialEq)]
5013 #[non_exhaustive]
5014 pub struct Exec {
5015 /// Optional arguments to pass to the source during execution.
5016 pub args: std::vec::Vec<std::string::String>,
5017
5018 /// Required. The script interpreter to use.
5019 pub interpreter:
5020 crate::model::os_policy::resource::exec_resource::exec::Interpreter,
5021
5022 /// Only recorded for enforce Exec.
5023 /// Path to an output file (that is created by this Exec) whose
5024 /// content will be recorded in OSPolicyResourceCompliance after a
5025 /// successful run. Absence or failure to read this file will result in
5026 /// this ExecResource being non-compliant. Output file size is limited to
5027 /// 100K bytes.
5028 pub output_file_path: std::string::String,
5029
5030 /// What to execute.
5031 pub source: std::option::Option<
5032 crate::model::os_policy::resource::exec_resource::exec::Source,
5033 >,
5034
5035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5036 }
5037
5038 impl Exec {
5039 /// Creates a new default instance.
5040 pub fn new() -> Self {
5041 std::default::Default::default()
5042 }
5043
5044 /// Sets the value of [args][crate::model::os_policy::resource::exec_resource::Exec::args].
5045 ///
5046 /// # Example
5047 /// ```ignore,no_run
5048 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5049 /// let x = Exec::new().set_args(["a", "b", "c"]);
5050 /// ```
5051 pub fn set_args<T, V>(mut self, v: T) -> Self
5052 where
5053 T: std::iter::IntoIterator<Item = V>,
5054 V: std::convert::Into<std::string::String>,
5055 {
5056 use std::iter::Iterator;
5057 self.args = v.into_iter().map(|i| i.into()).collect();
5058 self
5059 }
5060
5061 /// Sets the value of [interpreter][crate::model::os_policy::resource::exec_resource::Exec::interpreter].
5062 ///
5063 /// # Example
5064 /// ```ignore,no_run
5065 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5066 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::exec::Interpreter;
5067 /// let x0 = Exec::new().set_interpreter(Interpreter::None);
5068 /// let x1 = Exec::new().set_interpreter(Interpreter::Shell);
5069 /// let x2 = Exec::new().set_interpreter(Interpreter::Powershell);
5070 /// ```
5071 pub fn set_interpreter<
5072 T: std::convert::Into<
5073 crate::model::os_policy::resource::exec_resource::exec::Interpreter,
5074 >,
5075 >(
5076 mut self,
5077 v: T,
5078 ) -> Self {
5079 self.interpreter = v.into();
5080 self
5081 }
5082
5083 /// Sets the value of [output_file_path][crate::model::os_policy::resource::exec_resource::Exec::output_file_path].
5084 ///
5085 /// # Example
5086 /// ```ignore,no_run
5087 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5088 /// let x = Exec::new().set_output_file_path("example");
5089 /// ```
5090 pub fn set_output_file_path<T: std::convert::Into<std::string::String>>(
5091 mut self,
5092 v: T,
5093 ) -> Self {
5094 self.output_file_path = v.into();
5095 self
5096 }
5097
5098 /// Sets the value of [source][crate::model::os_policy::resource::exec_resource::Exec::source].
5099 ///
5100 /// Note that all the setters affecting `source` are mutually
5101 /// exclusive.
5102 ///
5103 /// # Example
5104 /// ```ignore,no_run
5105 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5106 /// use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::exec::Source;
5107 /// let x = Exec::new().set_source(Some(Source::Script("example".to_string())));
5108 /// ```
5109 pub fn set_source<
5110 T: std::convert::Into<
5111 std::option::Option<
5112 crate::model::os_policy::resource::exec_resource::exec::Source,
5113 >,
5114 >,
5115 >(
5116 mut self,
5117 v: T,
5118 ) -> Self {
5119 self.source = v.into();
5120 self
5121 }
5122
5123 /// The value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5124 /// if it holds a `File`, `None` if the field is not set or
5125 /// holds a different branch.
5126 pub fn file(
5127 &self,
5128 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::File>>
5129 {
5130 #[allow(unreachable_patterns)]
5131 self.source.as_ref().and_then(|v| match v {
5132 crate::model::os_policy::resource::exec_resource::exec::Source::File(v) => {
5133 std::option::Option::Some(v)
5134 }
5135 _ => std::option::Option::None,
5136 })
5137 }
5138
5139 /// Sets the value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5140 /// to hold a `File`.
5141 ///
5142 /// Note that all the setters affecting `source` are
5143 /// mutually exclusive.
5144 ///
5145 /// # Example
5146 /// ```ignore,no_run
5147 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5148 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
5149 /// let x = Exec::new().set_file(File::default()/* use setters */);
5150 /// assert!(x.file().is_some());
5151 /// assert!(x.script().is_none());
5152 /// ```
5153 pub fn set_file<
5154 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::File>>,
5155 >(
5156 mut self,
5157 v: T,
5158 ) -> Self {
5159 self.source = std::option::Option::Some(
5160 crate::model::os_policy::resource::exec_resource::exec::Source::File(
5161 v.into(),
5162 ),
5163 );
5164 self
5165 }
5166
5167 /// The value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5168 /// if it holds a `Script`, `None` if the field is not set or
5169 /// holds a different branch.
5170 pub fn script(&self) -> std::option::Option<&std::string::String> {
5171 #[allow(unreachable_patterns)]
5172 self.source.as_ref().and_then(|v| match v {
5173 crate::model::os_policy::resource::exec_resource::exec::Source::Script(
5174 v,
5175 ) => std::option::Option::Some(v),
5176 _ => std::option::Option::None,
5177 })
5178 }
5179
5180 /// Sets the value of [source][crate::model::os_policy::resource::exec_resource::Exec::source]
5181 /// to hold a `Script`.
5182 ///
5183 /// Note that all the setters affecting `source` are
5184 /// mutually exclusive.
5185 ///
5186 /// # Example
5187 /// ```ignore,no_run
5188 /// # use google_cloud_osconfig_v1::model::os_policy::resource::exec_resource::Exec;
5189 /// let x = Exec::new().set_script("example");
5190 /// assert!(x.script().is_some());
5191 /// assert!(x.file().is_none());
5192 /// ```
5193 pub fn set_script<T: std::convert::Into<std::string::String>>(
5194 mut self,
5195 v: T,
5196 ) -> Self {
5197 self.source = std::option::Option::Some(
5198 crate::model::os_policy::resource::exec_resource::exec::Source::Script(
5199 v.into(),
5200 ),
5201 );
5202 self
5203 }
5204 }
5205
5206 impl wkt::message::Message for Exec {
5207 fn typename() -> &'static str {
5208 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.ExecResource.Exec"
5209 }
5210 }
5211
5212 /// Defines additional types related to [Exec].
5213 pub mod exec {
5214 #[allow(unused_imports)]
5215 use super::*;
5216
5217 /// The interpreter to use.
5218 ///
5219 /// # Working with unknown values
5220 ///
5221 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5222 /// additional enum variants at any time. Adding new variants is not considered
5223 /// a breaking change. Applications should write their code in anticipation of:
5224 ///
5225 /// - New values appearing in future releases of the client library, **and**
5226 /// - New values received dynamically, without application changes.
5227 ///
5228 /// Please consult the [Working with enums] section in the user guide for some
5229 /// guidelines.
5230 ///
5231 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5232 #[derive(Clone, Debug, PartialEq)]
5233 #[non_exhaustive]
5234 pub enum Interpreter {
5235 /// Invalid value, the request will return validation error.
5236 Unspecified,
5237 /// If an interpreter is not specified, the
5238 /// source is executed directly. This execution, without an
5239 /// interpreter, only succeeds for executables and scripts that have <a
5240 /// href="https://en.wikipedia.org/wiki/Shebang_(Unix)"
5241 /// class="external"\>shebang lines</a>.
5242 None,
5243 /// Indicates that the script runs with `/bin/sh` on Linux and
5244 /// `cmd.exe` on Windows.
5245 Shell,
5246 /// Indicates that the script runs with PowerShell.
5247 Powershell,
5248 /// If set, the enum was initialized with an unknown value.
5249 ///
5250 /// Applications can examine the value using [Interpreter::value] or
5251 /// [Interpreter::name].
5252 UnknownValue(interpreter::UnknownValue),
5253 }
5254
5255 #[doc(hidden)]
5256 pub mod interpreter {
5257 #[allow(unused_imports)]
5258 use super::*;
5259 #[derive(Clone, Debug, PartialEq)]
5260 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5261 }
5262
5263 impl Interpreter {
5264 /// Gets the enum value.
5265 ///
5266 /// Returns `None` if the enum contains an unknown value deserialized from
5267 /// the string representation of enums.
5268 pub fn value(&self) -> std::option::Option<i32> {
5269 match self {
5270 Self::Unspecified => std::option::Option::Some(0),
5271 Self::None => std::option::Option::Some(1),
5272 Self::Shell => std::option::Option::Some(2),
5273 Self::Powershell => std::option::Option::Some(3),
5274 Self::UnknownValue(u) => u.0.value(),
5275 }
5276 }
5277
5278 /// Gets the enum value as a string.
5279 ///
5280 /// Returns `None` if the enum contains an unknown value deserialized from
5281 /// the integer representation of enums.
5282 pub fn name(&self) -> std::option::Option<&str> {
5283 match self {
5284 Self::Unspecified => {
5285 std::option::Option::Some("INTERPRETER_UNSPECIFIED")
5286 }
5287 Self::None => std::option::Option::Some("NONE"),
5288 Self::Shell => std::option::Option::Some("SHELL"),
5289 Self::Powershell => std::option::Option::Some("POWERSHELL"),
5290 Self::UnknownValue(u) => u.0.name(),
5291 }
5292 }
5293 }
5294
5295 impl std::default::Default for Interpreter {
5296 fn default() -> Self {
5297 use std::convert::From;
5298 Self::from(0)
5299 }
5300 }
5301
5302 impl std::fmt::Display for Interpreter {
5303 fn fmt(
5304 &self,
5305 f: &mut std::fmt::Formatter<'_>,
5306 ) -> std::result::Result<(), std::fmt::Error> {
5307 wkt::internal::display_enum(f, self.name(), self.value())
5308 }
5309 }
5310
5311 impl std::convert::From<i32> for Interpreter {
5312 fn from(value: i32) -> Self {
5313 match value {
5314 0 => Self::Unspecified,
5315 1 => Self::None,
5316 2 => Self::Shell,
5317 3 => Self::Powershell,
5318 _ => Self::UnknownValue(interpreter::UnknownValue(
5319 wkt::internal::UnknownEnumValue::Integer(value),
5320 )),
5321 }
5322 }
5323 }
5324
5325 impl std::convert::From<&str> for Interpreter {
5326 fn from(value: &str) -> Self {
5327 use std::string::ToString;
5328 match value {
5329 "INTERPRETER_UNSPECIFIED" => Self::Unspecified,
5330 "NONE" => Self::None,
5331 "SHELL" => Self::Shell,
5332 "POWERSHELL" => Self::Powershell,
5333 _ => Self::UnknownValue(interpreter::UnknownValue(
5334 wkt::internal::UnknownEnumValue::String(value.to_string()),
5335 )),
5336 }
5337 }
5338 }
5339
5340 impl serde::ser::Serialize for Interpreter {
5341 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5342 where
5343 S: serde::Serializer,
5344 {
5345 match self {
5346 Self::Unspecified => serializer.serialize_i32(0),
5347 Self::None => serializer.serialize_i32(1),
5348 Self::Shell => serializer.serialize_i32(2),
5349 Self::Powershell => serializer.serialize_i32(3),
5350 Self::UnknownValue(u) => u.0.serialize(serializer),
5351 }
5352 }
5353 }
5354
5355 impl<'de> serde::de::Deserialize<'de> for Interpreter {
5356 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5357 where
5358 D: serde::Deserializer<'de>,
5359 {
5360 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Interpreter>::new(
5361 ".google.cloud.osconfig.v1.OSPolicy.Resource.ExecResource.Exec.Interpreter"))
5362 }
5363 }
5364
5365 /// What to execute.
5366 #[derive(Clone, Debug, PartialEq)]
5367 #[non_exhaustive]
5368 pub enum Source {
5369 /// A remote or local file.
5370 File(std::boxed::Box<crate::model::os_policy::resource::File>),
5371 /// An inline script.
5372 /// The size of the script is limited to 1024 characters.
5373 Script(std::string::String),
5374 }
5375 }
5376 }
5377
5378 /// A resource that manages the state of a file.
5379 #[derive(Clone, Default, PartialEq)]
5380 #[non_exhaustive]
5381 pub struct FileResource {
5382 /// Required. The absolute path of the file within the VM.
5383 pub path: std::string::String,
5384
5385 /// Required. Desired state of the file.
5386 pub state: crate::model::os_policy::resource::file_resource::DesiredState,
5387
5388 /// Consists of three octal digits which represent, in
5389 /// order, the permissions of the owner, group, and other users for the
5390 /// file (similarly to the numeric mode used in the linux chmod
5391 /// utility). Each digit represents a three bit number with the 4 bit
5392 /// corresponding to the read permissions, the 2 bit corresponds to the
5393 /// write bit, and the one bit corresponds to the execute permission.
5394 /// Default behavior is 755.
5395 ///
5396 /// Below are some examples of permissions and their associated values:
5397 /// read, write, and execute: 7
5398 /// read and execute: 5
5399 /// read and write: 6
5400 /// read only: 4
5401 pub permissions: std::string::String,
5402
5403 /// The source for the contents of the file.
5404 pub source:
5405 std::option::Option<crate::model::os_policy::resource::file_resource::Source>,
5406
5407 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5408 }
5409
5410 impl FileResource {
5411 /// Creates a new default instance.
5412 pub fn new() -> Self {
5413 std::default::Default::default()
5414 }
5415
5416 /// Sets the value of [path][crate::model::os_policy::resource::FileResource::path].
5417 ///
5418 /// # Example
5419 /// ```ignore,no_run
5420 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5421 /// let x = FileResource::new().set_path("example");
5422 /// ```
5423 pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5424 self.path = v.into();
5425 self
5426 }
5427
5428 /// Sets the value of [state][crate::model::os_policy::resource::FileResource::state].
5429 ///
5430 /// # Example
5431 /// ```ignore,no_run
5432 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5433 /// use google_cloud_osconfig_v1::model::os_policy::resource::file_resource::DesiredState;
5434 /// let x0 = FileResource::new().set_state(DesiredState::Present);
5435 /// let x1 = FileResource::new().set_state(DesiredState::Absent);
5436 /// let x2 = FileResource::new().set_state(DesiredState::ContentsMatch);
5437 /// ```
5438 pub fn set_state<
5439 T: std::convert::Into<crate::model::os_policy::resource::file_resource::DesiredState>,
5440 >(
5441 mut self,
5442 v: T,
5443 ) -> Self {
5444 self.state = v.into();
5445 self
5446 }
5447
5448 /// Sets the value of [permissions][crate::model::os_policy::resource::FileResource::permissions].
5449 ///
5450 /// # Example
5451 /// ```ignore,no_run
5452 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5453 /// let x = FileResource::new().set_permissions("example");
5454 /// ```
5455 pub fn set_permissions<T: std::convert::Into<std::string::String>>(
5456 mut self,
5457 v: T,
5458 ) -> Self {
5459 self.permissions = v.into();
5460 self
5461 }
5462
5463 /// Sets the value of [source][crate::model::os_policy::resource::FileResource::source].
5464 ///
5465 /// Note that all the setters affecting `source` are mutually
5466 /// exclusive.
5467 ///
5468 /// # Example
5469 /// ```ignore,no_run
5470 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5471 /// use google_cloud_osconfig_v1::model::os_policy::resource::file_resource::Source;
5472 /// let x = FileResource::new().set_source(Some(Source::Content("example".to_string())));
5473 /// ```
5474 pub fn set_source<
5475 T: std::convert::Into<
5476 std::option::Option<
5477 crate::model::os_policy::resource::file_resource::Source,
5478 >,
5479 >,
5480 >(
5481 mut self,
5482 v: T,
5483 ) -> Self {
5484 self.source = v.into();
5485 self
5486 }
5487
5488 /// The value of [source][crate::model::os_policy::resource::FileResource::source]
5489 /// if it holds a `File`, `None` if the field is not set or
5490 /// holds a different branch.
5491 pub fn file(
5492 &self,
5493 ) -> std::option::Option<&std::boxed::Box<crate::model::os_policy::resource::File>>
5494 {
5495 #[allow(unreachable_patterns)]
5496 self.source.as_ref().and_then(|v| match v {
5497 crate::model::os_policy::resource::file_resource::Source::File(v) => {
5498 std::option::Option::Some(v)
5499 }
5500 _ => std::option::Option::None,
5501 })
5502 }
5503
5504 /// Sets the value of [source][crate::model::os_policy::resource::FileResource::source]
5505 /// to hold a `File`.
5506 ///
5507 /// Note that all the setters affecting `source` are
5508 /// mutually exclusive.
5509 ///
5510 /// # Example
5511 /// ```ignore,no_run
5512 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5513 /// use google_cloud_osconfig_v1::model::os_policy::resource::File;
5514 /// let x = FileResource::new().set_file(File::default()/* use setters */);
5515 /// assert!(x.file().is_some());
5516 /// assert!(x.content().is_none());
5517 /// ```
5518 pub fn set_file<
5519 T: std::convert::Into<std::boxed::Box<crate::model::os_policy::resource::File>>,
5520 >(
5521 mut self,
5522 v: T,
5523 ) -> Self {
5524 self.source = std::option::Option::Some(
5525 crate::model::os_policy::resource::file_resource::Source::File(v.into()),
5526 );
5527 self
5528 }
5529
5530 /// The value of [source][crate::model::os_policy::resource::FileResource::source]
5531 /// if it holds a `Content`, `None` if the field is not set or
5532 /// holds a different branch.
5533 pub fn content(&self) -> std::option::Option<&std::string::String> {
5534 #[allow(unreachable_patterns)]
5535 self.source.as_ref().and_then(|v| match v {
5536 crate::model::os_policy::resource::file_resource::Source::Content(v) => {
5537 std::option::Option::Some(v)
5538 }
5539 _ => std::option::Option::None,
5540 })
5541 }
5542
5543 /// Sets the value of [source][crate::model::os_policy::resource::FileResource::source]
5544 /// to hold a `Content`.
5545 ///
5546 /// Note that all the setters affecting `source` are
5547 /// mutually exclusive.
5548 ///
5549 /// # Example
5550 /// ```ignore,no_run
5551 /// # use google_cloud_osconfig_v1::model::os_policy::resource::FileResource;
5552 /// let x = FileResource::new().set_content("example");
5553 /// assert!(x.content().is_some());
5554 /// assert!(x.file().is_none());
5555 /// ```
5556 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5557 self.source = std::option::Option::Some(
5558 crate::model::os_policy::resource::file_resource::Source::Content(v.into()),
5559 );
5560 self
5561 }
5562 }
5563
5564 impl wkt::message::Message for FileResource {
5565 fn typename() -> &'static str {
5566 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.Resource.FileResource"
5567 }
5568 }
5569
5570 /// Defines additional types related to [FileResource].
5571 pub mod file_resource {
5572 #[allow(unused_imports)]
5573 use super::*;
5574
5575 /// Desired state of the file.
5576 ///
5577 /// # Working with unknown values
5578 ///
5579 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5580 /// additional enum variants at any time. Adding new variants is not considered
5581 /// a breaking change. Applications should write their code in anticipation of:
5582 ///
5583 /// - New values appearing in future releases of the client library, **and**
5584 /// - New values received dynamically, without application changes.
5585 ///
5586 /// Please consult the [Working with enums] section in the user guide for some
5587 /// guidelines.
5588 ///
5589 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5590 #[derive(Clone, Debug, PartialEq)]
5591 #[non_exhaustive]
5592 pub enum DesiredState {
5593 /// Unspecified is invalid.
5594 Unspecified,
5595 /// Ensure file at path is present.
5596 Present,
5597 /// Ensure file at path is absent.
5598 Absent,
5599 /// Ensure the contents of the file at path matches. If the file does
5600 /// not exist it will be created.
5601 ContentsMatch,
5602 /// If set, the enum was initialized with an unknown value.
5603 ///
5604 /// Applications can examine the value using [DesiredState::value] or
5605 /// [DesiredState::name].
5606 UnknownValue(desired_state::UnknownValue),
5607 }
5608
5609 #[doc(hidden)]
5610 pub mod desired_state {
5611 #[allow(unused_imports)]
5612 use super::*;
5613 #[derive(Clone, Debug, PartialEq)]
5614 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5615 }
5616
5617 impl DesiredState {
5618 /// Gets the enum value.
5619 ///
5620 /// Returns `None` if the enum contains an unknown value deserialized from
5621 /// the string representation of enums.
5622 pub fn value(&self) -> std::option::Option<i32> {
5623 match self {
5624 Self::Unspecified => std::option::Option::Some(0),
5625 Self::Present => std::option::Option::Some(1),
5626 Self::Absent => std::option::Option::Some(2),
5627 Self::ContentsMatch => std::option::Option::Some(3),
5628 Self::UnknownValue(u) => u.0.value(),
5629 }
5630 }
5631
5632 /// Gets the enum value as a string.
5633 ///
5634 /// Returns `None` if the enum contains an unknown value deserialized from
5635 /// the integer representation of enums.
5636 pub fn name(&self) -> std::option::Option<&str> {
5637 match self {
5638 Self::Unspecified => std::option::Option::Some("DESIRED_STATE_UNSPECIFIED"),
5639 Self::Present => std::option::Option::Some("PRESENT"),
5640 Self::Absent => std::option::Option::Some("ABSENT"),
5641 Self::ContentsMatch => std::option::Option::Some("CONTENTS_MATCH"),
5642 Self::UnknownValue(u) => u.0.name(),
5643 }
5644 }
5645 }
5646
5647 impl std::default::Default for DesiredState {
5648 fn default() -> Self {
5649 use std::convert::From;
5650 Self::from(0)
5651 }
5652 }
5653
5654 impl std::fmt::Display for DesiredState {
5655 fn fmt(
5656 &self,
5657 f: &mut std::fmt::Formatter<'_>,
5658 ) -> std::result::Result<(), std::fmt::Error> {
5659 wkt::internal::display_enum(f, self.name(), self.value())
5660 }
5661 }
5662
5663 impl std::convert::From<i32> for DesiredState {
5664 fn from(value: i32) -> Self {
5665 match value {
5666 0 => Self::Unspecified,
5667 1 => Self::Present,
5668 2 => Self::Absent,
5669 3 => Self::ContentsMatch,
5670 _ => Self::UnknownValue(desired_state::UnknownValue(
5671 wkt::internal::UnknownEnumValue::Integer(value),
5672 )),
5673 }
5674 }
5675 }
5676
5677 impl std::convert::From<&str> for DesiredState {
5678 fn from(value: &str) -> Self {
5679 use std::string::ToString;
5680 match value {
5681 "DESIRED_STATE_UNSPECIFIED" => Self::Unspecified,
5682 "PRESENT" => Self::Present,
5683 "ABSENT" => Self::Absent,
5684 "CONTENTS_MATCH" => Self::ContentsMatch,
5685 _ => Self::UnknownValue(desired_state::UnknownValue(
5686 wkt::internal::UnknownEnumValue::String(value.to_string()),
5687 )),
5688 }
5689 }
5690 }
5691
5692 impl serde::ser::Serialize for DesiredState {
5693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5694 where
5695 S: serde::Serializer,
5696 {
5697 match self {
5698 Self::Unspecified => serializer.serialize_i32(0),
5699 Self::Present => serializer.serialize_i32(1),
5700 Self::Absent => serializer.serialize_i32(2),
5701 Self::ContentsMatch => serializer.serialize_i32(3),
5702 Self::UnknownValue(u) => u.0.serialize(serializer),
5703 }
5704 }
5705 }
5706
5707 impl<'de> serde::de::Deserialize<'de> for DesiredState {
5708 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5709 where
5710 D: serde::Deserializer<'de>,
5711 {
5712 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DesiredState>::new(
5713 ".google.cloud.osconfig.v1.OSPolicy.Resource.FileResource.DesiredState",
5714 ))
5715 }
5716 }
5717
5718 /// The source for the contents of the file.
5719 #[derive(Clone, Debug, PartialEq)]
5720 #[non_exhaustive]
5721 pub enum Source {
5722 /// A remote or local source.
5723 File(std::boxed::Box<crate::model::os_policy::resource::File>),
5724 /// A a file with this content.
5725 /// The size of the content is limited to 1024 characters.
5726 Content(std::string::String),
5727 }
5728 }
5729
5730 /// Resource type.
5731 #[derive(Clone, Debug, PartialEq)]
5732 #[non_exhaustive]
5733 pub enum ResourceType {
5734 /// Package resource
5735 Pkg(std::boxed::Box<crate::model::os_policy::resource::PackageResource>),
5736 /// Package repository resource
5737 Repository(std::boxed::Box<crate::model::os_policy::resource::RepositoryResource>),
5738 /// Exec resource
5739 Exec(std::boxed::Box<crate::model::os_policy::resource::ExecResource>),
5740 /// File resource
5741 File(std::boxed::Box<crate::model::os_policy::resource::FileResource>),
5742 }
5743 }
5744
5745 /// Resource groups provide a mechanism to group OS policy resources.
5746 ///
5747 /// Resource groups enable OS policy authors to create a single OS policy
5748 /// to be applied to VMs running different operating Systems.
5749 ///
5750 /// When the OS policy is applied to a target VM, the appropriate resource
5751 /// group within the OS policy is selected based on the `OSFilter` specified
5752 /// within the resource group.
5753 #[derive(Clone, Default, PartialEq)]
5754 #[non_exhaustive]
5755 pub struct ResourceGroup {
5756 /// List of inventory filters for the resource group.
5757 ///
5758 /// The resources in this resource group are applied to the target VM if it
5759 /// satisfies at least one of the following inventory filters.
5760 ///
5761 /// For example, to apply this resource group to VMs running either `RHEL` or
5762 /// `CentOS` operating systems, specify 2 items for the list with following
5763 /// values:
5764 /// inventory_filters[0].os_short_name='rhel' and
5765 /// inventory_filters[1].os_short_name='centos'
5766 ///
5767 /// If the list is empty, this resource group will be applied to the target
5768 /// VM unconditionally.
5769 pub inventory_filters: std::vec::Vec<crate::model::os_policy::InventoryFilter>,
5770
5771 /// Required. List of resources configured for this resource group.
5772 /// The resources are executed in the exact order specified here.
5773 pub resources: std::vec::Vec<crate::model::os_policy::Resource>,
5774
5775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5776 }
5777
5778 impl ResourceGroup {
5779 /// Creates a new default instance.
5780 pub fn new() -> Self {
5781 std::default::Default::default()
5782 }
5783
5784 /// Sets the value of [inventory_filters][crate::model::os_policy::ResourceGroup::inventory_filters].
5785 ///
5786 /// # Example
5787 /// ```ignore,no_run
5788 /// # use google_cloud_osconfig_v1::model::os_policy::ResourceGroup;
5789 /// use google_cloud_osconfig_v1::model::os_policy::InventoryFilter;
5790 /// let x = ResourceGroup::new()
5791 /// .set_inventory_filters([
5792 /// InventoryFilter::default()/* use setters */,
5793 /// InventoryFilter::default()/* use (different) setters */,
5794 /// ]);
5795 /// ```
5796 pub fn set_inventory_filters<T, V>(mut self, v: T) -> Self
5797 where
5798 T: std::iter::IntoIterator<Item = V>,
5799 V: std::convert::Into<crate::model::os_policy::InventoryFilter>,
5800 {
5801 use std::iter::Iterator;
5802 self.inventory_filters = v.into_iter().map(|i| i.into()).collect();
5803 self
5804 }
5805
5806 /// Sets the value of [resources][crate::model::os_policy::ResourceGroup::resources].
5807 ///
5808 /// # Example
5809 /// ```ignore,no_run
5810 /// # use google_cloud_osconfig_v1::model::os_policy::ResourceGroup;
5811 /// use google_cloud_osconfig_v1::model::os_policy::Resource;
5812 /// let x = ResourceGroup::new()
5813 /// .set_resources([
5814 /// Resource::default()/* use setters */,
5815 /// Resource::default()/* use (different) setters */,
5816 /// ]);
5817 /// ```
5818 pub fn set_resources<T, V>(mut self, v: T) -> Self
5819 where
5820 T: std::iter::IntoIterator<Item = V>,
5821 V: std::convert::Into<crate::model::os_policy::Resource>,
5822 {
5823 use std::iter::Iterator;
5824 self.resources = v.into_iter().map(|i| i.into()).collect();
5825 self
5826 }
5827 }
5828
5829 impl wkt::message::Message for ResourceGroup {
5830 fn typename() -> &'static str {
5831 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicy.ResourceGroup"
5832 }
5833 }
5834
5835 /// Policy mode
5836 ///
5837 /// # Working with unknown values
5838 ///
5839 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5840 /// additional enum variants at any time. Adding new variants is not considered
5841 /// a breaking change. Applications should write their code in anticipation of:
5842 ///
5843 /// - New values appearing in future releases of the client library, **and**
5844 /// - New values received dynamically, without application changes.
5845 ///
5846 /// Please consult the [Working with enums] section in the user guide for some
5847 /// guidelines.
5848 ///
5849 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5850 #[derive(Clone, Debug, PartialEq)]
5851 #[non_exhaustive]
5852 pub enum Mode {
5853 /// Invalid mode
5854 Unspecified,
5855 /// This mode checks if the configuration resources in the policy are in
5856 /// their desired state. No actions are performed if they are not in the
5857 /// desired state. This mode is used for reporting purposes.
5858 Validation,
5859 /// This mode checks if the configuration resources in the policy are in
5860 /// their desired state, and if not, enforces the desired state.
5861 Enforcement,
5862 /// If set, the enum was initialized with an unknown value.
5863 ///
5864 /// Applications can examine the value using [Mode::value] or
5865 /// [Mode::name].
5866 UnknownValue(mode::UnknownValue),
5867 }
5868
5869 #[doc(hidden)]
5870 pub mod mode {
5871 #[allow(unused_imports)]
5872 use super::*;
5873 #[derive(Clone, Debug, PartialEq)]
5874 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5875 }
5876
5877 impl Mode {
5878 /// Gets the enum value.
5879 ///
5880 /// Returns `None` if the enum contains an unknown value deserialized from
5881 /// the string representation of enums.
5882 pub fn value(&self) -> std::option::Option<i32> {
5883 match self {
5884 Self::Unspecified => std::option::Option::Some(0),
5885 Self::Validation => std::option::Option::Some(1),
5886 Self::Enforcement => std::option::Option::Some(2),
5887 Self::UnknownValue(u) => u.0.value(),
5888 }
5889 }
5890
5891 /// Gets the enum value as a string.
5892 ///
5893 /// Returns `None` if the enum contains an unknown value deserialized from
5894 /// the integer representation of enums.
5895 pub fn name(&self) -> std::option::Option<&str> {
5896 match self {
5897 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
5898 Self::Validation => std::option::Option::Some("VALIDATION"),
5899 Self::Enforcement => std::option::Option::Some("ENFORCEMENT"),
5900 Self::UnknownValue(u) => u.0.name(),
5901 }
5902 }
5903 }
5904
5905 impl std::default::Default for Mode {
5906 fn default() -> Self {
5907 use std::convert::From;
5908 Self::from(0)
5909 }
5910 }
5911
5912 impl std::fmt::Display for Mode {
5913 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5914 wkt::internal::display_enum(f, self.name(), self.value())
5915 }
5916 }
5917
5918 impl std::convert::From<i32> for Mode {
5919 fn from(value: i32) -> Self {
5920 match value {
5921 0 => Self::Unspecified,
5922 1 => Self::Validation,
5923 2 => Self::Enforcement,
5924 _ => Self::UnknownValue(mode::UnknownValue(
5925 wkt::internal::UnknownEnumValue::Integer(value),
5926 )),
5927 }
5928 }
5929 }
5930
5931 impl std::convert::From<&str> for Mode {
5932 fn from(value: &str) -> Self {
5933 use std::string::ToString;
5934 match value {
5935 "MODE_UNSPECIFIED" => Self::Unspecified,
5936 "VALIDATION" => Self::Validation,
5937 "ENFORCEMENT" => Self::Enforcement,
5938 _ => Self::UnknownValue(mode::UnknownValue(
5939 wkt::internal::UnknownEnumValue::String(value.to_string()),
5940 )),
5941 }
5942 }
5943 }
5944
5945 impl serde::ser::Serialize for Mode {
5946 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5947 where
5948 S: serde::Serializer,
5949 {
5950 match self {
5951 Self::Unspecified => serializer.serialize_i32(0),
5952 Self::Validation => serializer.serialize_i32(1),
5953 Self::Enforcement => serializer.serialize_i32(2),
5954 Self::UnknownValue(u) => u.0.serialize(serializer),
5955 }
5956 }
5957 }
5958
5959 impl<'de> serde::de::Deserialize<'de> for Mode {
5960 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5961 where
5962 D: serde::Deserializer<'de>,
5963 {
5964 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
5965 ".google.cloud.osconfig.v1.OSPolicy.Mode",
5966 ))
5967 }
5968 }
5969}
5970
5971/// Get a report of the OS policy assignment for a VM instance.
5972#[derive(Clone, Default, PartialEq)]
5973#[non_exhaustive]
5974pub struct GetOSPolicyAssignmentReportRequest {
5975 /// Required. API resource name for OS policy assignment report.
5976 ///
5977 /// Format:
5978 /// `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`
5979 ///
5980 /// For `{project}`, either `project-number` or `project-id` can be provided.
5981 /// For `{instance_id}`, either Compute Engine `instance-id` or `instance-name`
5982 /// can be provided.
5983 /// For `{assignment_id}`, the OSPolicyAssignment id must be provided.
5984 pub name: std::string::String,
5985
5986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5987}
5988
5989impl GetOSPolicyAssignmentReportRequest {
5990 /// Creates a new default instance.
5991 pub fn new() -> Self {
5992 std::default::Default::default()
5993 }
5994
5995 /// Sets the value of [name][crate::model::GetOSPolicyAssignmentReportRequest::name].
5996 ///
5997 /// # Example
5998 /// ```ignore,no_run
5999 /// # use google_cloud_osconfig_v1::model::GetOSPolicyAssignmentReportRequest;
6000 /// # let project_id = "project_id";
6001 /// # let location_id = "location_id";
6002 /// # let instance_id = "instance_id";
6003 /// # let assignment_id = "assignment_id";
6004 /// let x = GetOSPolicyAssignmentReportRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/osPolicyAssignments/{assignment_id}/report"));
6005 /// ```
6006 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6007 self.name = v.into();
6008 self
6009 }
6010}
6011
6012impl wkt::message::Message for GetOSPolicyAssignmentReportRequest {
6013 fn typename() -> &'static str {
6014 "type.googleapis.com/google.cloud.osconfig.v1.GetOSPolicyAssignmentReportRequest"
6015 }
6016}
6017
6018/// List the OS policy assignment reports for VM instances.
6019#[derive(Clone, Default, PartialEq)]
6020#[non_exhaustive]
6021pub struct ListOSPolicyAssignmentReportsRequest {
6022 /// Required. The parent resource name.
6023 ///
6024 /// Format:
6025 /// `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`
6026 ///
6027 /// For `{project}`, either `project-number` or `project-id` can be provided.
6028 /// For `{instance}`, either `instance-name`, `instance-id`, or `-` can be
6029 /// provided. If '-' is provided, the response will include
6030 /// OSPolicyAssignmentReports for all instances in the project/location.
6031 /// For `{assignment}`, either `assignment-id` or `-` can be provided. If '-'
6032 /// is provided, the response will include OSPolicyAssignmentReports for all
6033 /// OSPolicyAssignments in the project/location.
6034 /// Either {instance} or {assignment} must be `-`.
6035 ///
6036 /// For example:
6037 /// `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports`
6038 /// returns all reports for the instance
6039 /// `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports`
6040 /// returns all the reports for the given assignment across all instances.
6041 /// `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports`
6042 /// returns all the reports for all assignments across all instances.
6043 pub parent: std::string::String,
6044
6045 /// The maximum number of results to return.
6046 pub page_size: i32,
6047
6048 /// If provided, this field specifies the criteria that must be met by the
6049 /// `OSPolicyAssignmentReport` API resource that is included in the response.
6050 pub filter: std::string::String,
6051
6052 /// A pagination token returned from a previous call to the
6053 /// `ListOSPolicyAssignmentReports` method that indicates where this listing
6054 /// should continue from.
6055 pub page_token: std::string::String,
6056
6057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6058}
6059
6060impl ListOSPolicyAssignmentReportsRequest {
6061 /// Creates a new default instance.
6062 pub fn new() -> Self {
6063 std::default::Default::default()
6064 }
6065
6066 /// Sets the value of [parent][crate::model::ListOSPolicyAssignmentReportsRequest::parent].
6067 ///
6068 /// # Example
6069 /// ```ignore,no_run
6070 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6071 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_parent("example");
6072 /// ```
6073 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6074 self.parent = v.into();
6075 self
6076 }
6077
6078 /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentReportsRequest::page_size].
6079 ///
6080 /// # Example
6081 /// ```ignore,no_run
6082 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6083 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_page_size(42);
6084 /// ```
6085 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6086 self.page_size = v.into();
6087 self
6088 }
6089
6090 /// Sets the value of [filter][crate::model::ListOSPolicyAssignmentReportsRequest::filter].
6091 ///
6092 /// # Example
6093 /// ```ignore,no_run
6094 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6095 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_filter("example");
6096 /// ```
6097 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6098 self.filter = v.into();
6099 self
6100 }
6101
6102 /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentReportsRequest::page_token].
6103 ///
6104 /// # Example
6105 /// ```ignore,no_run
6106 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsRequest;
6107 /// let x = ListOSPolicyAssignmentReportsRequest::new().set_page_token("example");
6108 /// ```
6109 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6110 self.page_token = v.into();
6111 self
6112 }
6113}
6114
6115impl wkt::message::Message for ListOSPolicyAssignmentReportsRequest {
6116 fn typename() -> &'static str {
6117 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsRequest"
6118 }
6119}
6120
6121/// A response message for listing OS Policy assignment reports including the
6122/// page of results and page token.
6123#[derive(Clone, Default, PartialEq)]
6124#[non_exhaustive]
6125pub struct ListOSPolicyAssignmentReportsResponse {
6126 /// List of OS policy assignment reports.
6127 pub os_policy_assignment_reports: std::vec::Vec<crate::model::OSPolicyAssignmentReport>,
6128
6129 /// The pagination token to retrieve the next page of OS policy assignment
6130 /// report objects.
6131 pub next_page_token: std::string::String,
6132
6133 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6134}
6135
6136impl ListOSPolicyAssignmentReportsResponse {
6137 /// Creates a new default instance.
6138 pub fn new() -> Self {
6139 std::default::Default::default()
6140 }
6141
6142 /// Sets the value of [os_policy_assignment_reports][crate::model::ListOSPolicyAssignmentReportsResponse::os_policy_assignment_reports].
6143 ///
6144 /// # Example
6145 /// ```ignore,no_run
6146 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsResponse;
6147 /// use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6148 /// let x = ListOSPolicyAssignmentReportsResponse::new()
6149 /// .set_os_policy_assignment_reports([
6150 /// OSPolicyAssignmentReport::default()/* use setters */,
6151 /// OSPolicyAssignmentReport::default()/* use (different) setters */,
6152 /// ]);
6153 /// ```
6154 pub fn set_os_policy_assignment_reports<T, V>(mut self, v: T) -> Self
6155 where
6156 T: std::iter::IntoIterator<Item = V>,
6157 V: std::convert::Into<crate::model::OSPolicyAssignmentReport>,
6158 {
6159 use std::iter::Iterator;
6160 self.os_policy_assignment_reports = v.into_iter().map(|i| i.into()).collect();
6161 self
6162 }
6163
6164 /// Sets the value of [next_page_token][crate::model::ListOSPolicyAssignmentReportsResponse::next_page_token].
6165 ///
6166 /// # Example
6167 /// ```ignore,no_run
6168 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentReportsResponse;
6169 /// let x = ListOSPolicyAssignmentReportsResponse::new().set_next_page_token("example");
6170 /// ```
6171 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6172 self.next_page_token = v.into();
6173 self
6174 }
6175}
6176
6177impl wkt::message::Message for ListOSPolicyAssignmentReportsResponse {
6178 fn typename() -> &'static str {
6179 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentReportsResponse"
6180 }
6181}
6182
6183#[doc(hidden)]
6184impl google_cloud_gax::paginator::internal::PageableResponse
6185 for ListOSPolicyAssignmentReportsResponse
6186{
6187 type PageItem = crate::model::OSPolicyAssignmentReport;
6188
6189 fn items(self) -> std::vec::Vec<Self::PageItem> {
6190 self.os_policy_assignment_reports
6191 }
6192
6193 fn next_page_token(&self) -> std::string::String {
6194 use std::clone::Clone;
6195 self.next_page_token.clone()
6196 }
6197}
6198
6199/// A report of the OS policy assignment status for a given instance.
6200#[derive(Clone, Default, PartialEq)]
6201#[non_exhaustive]
6202pub struct OSPolicyAssignmentReport {
6203 /// The `OSPolicyAssignmentReport` API resource name.
6204 ///
6205 /// Format:
6206 /// `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report`
6207 pub name: std::string::String,
6208
6209 /// The Compute Engine VM instance name.
6210 pub instance: std::string::String,
6211
6212 /// Reference to the `OSPolicyAssignment` API resource that the `OSPolicy`
6213 /// belongs to.
6214 ///
6215 /// Format:
6216 /// `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
6217 pub os_policy_assignment: std::string::String,
6218
6219 /// Compliance data for each `OSPolicy` that is applied to the VM.
6220 pub os_policy_compliances:
6221 std::vec::Vec<crate::model::os_policy_assignment_report::OSPolicyCompliance>,
6222
6223 /// Timestamp for when the report was last generated.
6224 pub update_time: std::option::Option<wkt::Timestamp>,
6225
6226 /// Unique identifier of the last attempted run to apply the OS policies
6227 /// associated with this assignment on the VM.
6228 ///
6229 /// This ID is logged by the OS Config agent while applying the OS
6230 /// policies associated with this assignment on the VM.
6231 /// NOTE: If the service is unable to successfully connect to the agent for
6232 /// this run, then this id will not be available in the agent logs.
6233 pub last_run_id: std::string::String,
6234
6235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6236}
6237
6238impl OSPolicyAssignmentReport {
6239 /// Creates a new default instance.
6240 pub fn new() -> Self {
6241 std::default::Default::default()
6242 }
6243
6244 /// Sets the value of [name][crate::model::OSPolicyAssignmentReport::name].
6245 ///
6246 /// # Example
6247 /// ```ignore,no_run
6248 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6249 /// # let project_id = "project_id";
6250 /// # let location_id = "location_id";
6251 /// # let instance_id = "instance_id";
6252 /// # let assignment_id = "assignment_id";
6253 /// let x = OSPolicyAssignmentReport::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/osPolicyAssignments/{assignment_id}/report"));
6254 /// ```
6255 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6256 self.name = v.into();
6257 self
6258 }
6259
6260 /// Sets the value of [instance][crate::model::OSPolicyAssignmentReport::instance].
6261 ///
6262 /// # Example
6263 /// ```ignore,no_run
6264 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6265 /// let x = OSPolicyAssignmentReport::new().set_instance("example");
6266 /// ```
6267 pub fn set_instance<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6268 self.instance = v.into();
6269 self
6270 }
6271
6272 /// Sets the value of [os_policy_assignment][crate::model::OSPolicyAssignmentReport::os_policy_assignment].
6273 ///
6274 /// # Example
6275 /// ```ignore,no_run
6276 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6277 /// # let project_id = "project_id";
6278 /// # let location_id = "location_id";
6279 /// # let os_policy_assignment_id = "os_policy_assignment_id";
6280 /// let x = OSPolicyAssignmentReport::new().set_os_policy_assignment(format!("projects/{project_id}/locations/{location_id}/osPolicyAssignments/{os_policy_assignment_id}"));
6281 /// ```
6282 pub fn set_os_policy_assignment<T: std::convert::Into<std::string::String>>(
6283 mut self,
6284 v: T,
6285 ) -> Self {
6286 self.os_policy_assignment = v.into();
6287 self
6288 }
6289
6290 /// Sets the value of [os_policy_compliances][crate::model::OSPolicyAssignmentReport::os_policy_compliances].
6291 ///
6292 /// # Example
6293 /// ```ignore,no_run
6294 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6295 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6296 /// let x = OSPolicyAssignmentReport::new()
6297 /// .set_os_policy_compliances([
6298 /// OSPolicyCompliance::default()/* use setters */,
6299 /// OSPolicyCompliance::default()/* use (different) setters */,
6300 /// ]);
6301 /// ```
6302 pub fn set_os_policy_compliances<T, V>(mut self, v: T) -> Self
6303 where
6304 T: std::iter::IntoIterator<Item = V>,
6305 V: std::convert::Into<crate::model::os_policy_assignment_report::OSPolicyCompliance>,
6306 {
6307 use std::iter::Iterator;
6308 self.os_policy_compliances = v.into_iter().map(|i| i.into()).collect();
6309 self
6310 }
6311
6312 /// Sets the value of [update_time][crate::model::OSPolicyAssignmentReport::update_time].
6313 ///
6314 /// # Example
6315 /// ```ignore,no_run
6316 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6317 /// use wkt::Timestamp;
6318 /// let x = OSPolicyAssignmentReport::new().set_update_time(Timestamp::default()/* use setters */);
6319 /// ```
6320 pub fn set_update_time<T>(mut self, v: T) -> Self
6321 where
6322 T: std::convert::Into<wkt::Timestamp>,
6323 {
6324 self.update_time = std::option::Option::Some(v.into());
6325 self
6326 }
6327
6328 /// Sets or clears the value of [update_time][crate::model::OSPolicyAssignmentReport::update_time].
6329 ///
6330 /// # Example
6331 /// ```ignore,no_run
6332 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6333 /// use wkt::Timestamp;
6334 /// let x = OSPolicyAssignmentReport::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
6335 /// let x = OSPolicyAssignmentReport::new().set_or_clear_update_time(None::<Timestamp>);
6336 /// ```
6337 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
6338 where
6339 T: std::convert::Into<wkt::Timestamp>,
6340 {
6341 self.update_time = v.map(|x| x.into());
6342 self
6343 }
6344
6345 /// Sets the value of [last_run_id][crate::model::OSPolicyAssignmentReport::last_run_id].
6346 ///
6347 /// # Example
6348 /// ```ignore,no_run
6349 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentReport;
6350 /// let x = OSPolicyAssignmentReport::new().set_last_run_id("example");
6351 /// ```
6352 pub fn set_last_run_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6353 self.last_run_id = v.into();
6354 self
6355 }
6356}
6357
6358impl wkt::message::Message for OSPolicyAssignmentReport {
6359 fn typename() -> &'static str {
6360 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport"
6361 }
6362}
6363
6364/// Defines additional types related to [OSPolicyAssignmentReport].
6365pub mod os_policy_assignment_report {
6366 #[allow(unused_imports)]
6367 use super::*;
6368
6369 /// Compliance data for an OS policy
6370 #[derive(Clone, Default, PartialEq)]
6371 #[non_exhaustive]
6372 pub struct OSPolicyCompliance {
6373
6374 /// The OS policy id
6375 pub os_policy_id: std::string::String,
6376
6377 /// The compliance state of the OS policy.
6378 pub compliance_state: crate::model::os_policy_assignment_report::os_policy_compliance::ComplianceState,
6379
6380 /// The reason for the OS policy to be in an unknown compliance state.
6381 /// This field is always populated when `compliance_state` is `UNKNOWN`.
6382 ///
6383 /// If populated, the field can contain one of the following values:
6384 ///
6385 /// * `vm-not-running`: The VM was not running.
6386 /// * `os-policies-not-supported-by-agent`: The version of the OS Config
6387 /// agent running on the VM does not support running OS policies.
6388 /// * `no-agent-detected`: The OS Config agent is not detected for the VM.
6389 /// * `resource-execution-errors`: The OS Config agent encountered errors
6390 /// while executing one or more resources in the policy. See
6391 /// `os_policy_resource_compliances` for details.
6392 /// * `task-timeout`: The task sent to the agent to apply the policy timed
6393 /// out.
6394 /// * `unexpected-agent-state`: The OS Config agent did not report the final
6395 /// status of the task that attempted to apply the policy. Instead, the agent
6396 /// unexpectedly started working on a different task. This mostly happens
6397 /// when the agent or VM unexpectedly restarts while applying OS policies.
6398 /// * `internal-service-errors`: Internal service errors were encountered
6399 /// while attempting to apply the policy.
6400 pub compliance_state_reason: std::string::String,
6401
6402 /// Compliance data for each resource within the policy that is applied to
6403 /// the VM.
6404 pub os_policy_resource_compliances: std::vec::Vec<crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance>,
6405
6406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6407 }
6408
6409 impl OSPolicyCompliance {
6410 /// Creates a new default instance.
6411 pub fn new() -> Self {
6412 std::default::Default::default()
6413 }
6414
6415 /// Sets the value of [os_policy_id][crate::model::os_policy_assignment_report::OSPolicyCompliance::os_policy_id].
6416 ///
6417 /// # Example
6418 /// ```ignore,no_run
6419 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6420 /// let x = OSPolicyCompliance::new().set_os_policy_id("example");
6421 /// ```
6422 pub fn set_os_policy_id<T: std::convert::Into<std::string::String>>(
6423 mut self,
6424 v: T,
6425 ) -> Self {
6426 self.os_policy_id = v.into();
6427 self
6428 }
6429
6430 /// Sets the value of [compliance_state][crate::model::os_policy_assignment_report::OSPolicyCompliance::compliance_state].
6431 ///
6432 /// # Example
6433 /// ```ignore,no_run
6434 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6435 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::ComplianceState;
6436 /// let x0 = OSPolicyCompliance::new().set_compliance_state(ComplianceState::Compliant);
6437 /// let x1 = OSPolicyCompliance::new().set_compliance_state(ComplianceState::NonCompliant);
6438 /// ```
6439 pub fn set_compliance_state<T: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::ComplianceState>>(mut self, v: T) -> Self{
6440 self.compliance_state = v.into();
6441 self
6442 }
6443
6444 /// Sets the value of [compliance_state_reason][crate::model::os_policy_assignment_report::OSPolicyCompliance::compliance_state_reason].
6445 ///
6446 /// # Example
6447 /// ```ignore,no_run
6448 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6449 /// let x = OSPolicyCompliance::new().set_compliance_state_reason("example");
6450 /// ```
6451 pub fn set_compliance_state_reason<T: std::convert::Into<std::string::String>>(
6452 mut self,
6453 v: T,
6454 ) -> Self {
6455 self.compliance_state_reason = v.into();
6456 self
6457 }
6458
6459 /// Sets the value of [os_policy_resource_compliances][crate::model::os_policy_assignment_report::OSPolicyCompliance::os_policy_resource_compliances].
6460 ///
6461 /// # Example
6462 /// ```ignore,no_run
6463 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::OSPolicyCompliance;
6464 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6465 /// let x = OSPolicyCompliance::new()
6466 /// .set_os_policy_resource_compliances([
6467 /// OSPolicyResourceCompliance::default()/* use setters */,
6468 /// OSPolicyResourceCompliance::default()/* use (different) setters */,
6469 /// ]);
6470 /// ```
6471 pub fn set_os_policy_resource_compliances<T, V>(mut self, v: T) -> Self
6472 where
6473 T: std::iter::IntoIterator<Item = V>,
6474 V: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance>
6475 {
6476 use std::iter::Iterator;
6477 self.os_policy_resource_compliances = v.into_iter().map(|i| i.into()).collect();
6478 self
6479 }
6480 }
6481
6482 impl wkt::message::Message for OSPolicyCompliance {
6483 fn typename() -> &'static str {
6484 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance"
6485 }
6486 }
6487
6488 /// Defines additional types related to [OSPolicyCompliance].
6489 pub mod os_policy_compliance {
6490 #[allow(unused_imports)]
6491 use super::*;
6492
6493 /// Compliance data for an OS policy resource.
6494 #[derive(Clone, Default, PartialEq)]
6495 #[non_exhaustive]
6496 pub struct OSPolicyResourceCompliance {
6497
6498 /// The ID of the OS policy resource.
6499 pub os_policy_resource_id: std::string::String,
6500
6501 /// Ordered list of configuration completed by the agent for the OS policy
6502 /// resource.
6503 pub config_steps: std::vec::Vec<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep>,
6504
6505 /// The compliance state of the resource.
6506 pub compliance_state: crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ComplianceState,
6507
6508 /// A reason for the resource to be in the given compliance state.
6509 /// This field is always populated when `compliance_state` is `UNKNOWN`.
6510 ///
6511 /// The following values are supported when `compliance_state == UNKNOWN`
6512 ///
6513 /// * `execution-errors`: Errors were encountered by the agent while
6514 /// executing the resource and the compliance state couldn't be
6515 /// determined.
6516 /// * `execution-skipped-by-agent`: Resource execution was skipped by the
6517 /// agent because errors were encountered while executing prior resources
6518 /// in the OS policy.
6519 /// * `os-policy-execution-attempt-failed`: The execution of the OS policy
6520 /// containing this resource failed and the compliance state couldn't be
6521 /// determined.
6522 pub compliance_state_reason: std::string::String,
6523
6524 /// Resource specific output.
6525 pub output: std::option::Option<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output>,
6526
6527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6528 }
6529
6530 impl OSPolicyResourceCompliance {
6531 /// Creates a new default instance.
6532 pub fn new() -> Self {
6533 std::default::Default::default()
6534 }
6535
6536 /// Sets the value of [os_policy_resource_id][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::os_policy_resource_id].
6537 ///
6538 /// # Example
6539 /// ```ignore,no_run
6540 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6541 /// let x = OSPolicyResourceCompliance::new().set_os_policy_resource_id("example");
6542 /// ```
6543 pub fn set_os_policy_resource_id<T: std::convert::Into<std::string::String>>(
6544 mut self,
6545 v: T,
6546 ) -> Self {
6547 self.os_policy_resource_id = v.into();
6548 self
6549 }
6550
6551 /// Sets the value of [config_steps][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::config_steps].
6552 ///
6553 /// # Example
6554 /// ```ignore,no_run
6555 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6556 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep;
6557 /// let x = OSPolicyResourceCompliance::new()
6558 /// .set_config_steps([
6559 /// OSPolicyResourceConfigStep::default()/* use setters */,
6560 /// OSPolicyResourceConfigStep::default()/* use (different) setters */,
6561 /// ]);
6562 /// ```
6563 pub fn set_config_steps<T, V>(mut self, v: T) -> Self
6564 where
6565 T: std::iter::IntoIterator<Item = V>,
6566 V: std::convert::Into<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep>
6567 {
6568 use std::iter::Iterator;
6569 self.config_steps = v.into_iter().map(|i| i.into()).collect();
6570 self
6571 }
6572
6573 /// Sets the value of [compliance_state][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::compliance_state].
6574 ///
6575 /// # Example
6576 /// ```ignore,no_run
6577 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6578 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ComplianceState;
6579 /// let x0 = OSPolicyResourceCompliance::new().set_compliance_state(ComplianceState::Compliant);
6580 /// let x1 = OSPolicyResourceCompliance::new().set_compliance_state(ComplianceState::NonCompliant);
6581 /// ```
6582 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{
6583 self.compliance_state = v.into();
6584 self
6585 }
6586
6587 /// Sets the value of [compliance_state_reason][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::compliance_state_reason].
6588 ///
6589 /// # Example
6590 /// ```ignore,no_run
6591 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6592 /// let x = OSPolicyResourceCompliance::new().set_compliance_state_reason("example");
6593 /// ```
6594 pub fn set_compliance_state_reason<T: std::convert::Into<std::string::String>>(
6595 mut self,
6596 v: T,
6597 ) -> Self {
6598 self.compliance_state_reason = v.into();
6599 self
6600 }
6601
6602 /// Sets the value of [output][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::output].
6603 ///
6604 /// Note that all the setters affecting `output` are mutually
6605 /// exclusive.
6606 ///
6607 /// # Example
6608 /// ```ignore,no_run
6609 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6610 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput;
6611 /// let x = OSPolicyResourceCompliance::new().set_output(Some(
6612 /// google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output::ExecResourceOutput(ExecResourceOutput::default().into())));
6613 /// ```
6614 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
6615 {
6616 self.output = v.into();
6617 self
6618 }
6619
6620 /// The value of [output][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::output]
6621 /// if it holds a `ExecResourceOutput`, `None` if the field is not set or
6622 /// holds a different branch.
6623 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>>{
6624 #[allow(unreachable_patterns)]
6625 self.output.as_ref().and_then(|v| match v {
6626 crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output::ExecResourceOutput(v) => std::option::Option::Some(v),
6627 _ => std::option::Option::None,
6628 })
6629 }
6630
6631 /// Sets the value of [output][crate::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance::output]
6632 /// to hold a `ExecResourceOutput`.
6633 ///
6634 /// Note that all the setters affecting `output` are
6635 /// mutually exclusive.
6636 ///
6637 /// # Example
6638 /// ```ignore,no_run
6639 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::OSPolicyResourceCompliance;
6640 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput;
6641 /// let x = OSPolicyResourceCompliance::new().set_exec_resource_output(ExecResourceOutput::default()/* use setters */);
6642 /// assert!(x.exec_resource_output().is_some());
6643 /// ```
6644 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{
6645 self.output = std::option::Option::Some(
6646 crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::Output::ExecResourceOutput(
6647 v.into()
6648 )
6649 );
6650 self
6651 }
6652 }
6653
6654 impl wkt::message::Message for OSPolicyResourceCompliance {
6655 fn typename() -> &'static str {
6656 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance"
6657 }
6658 }
6659
6660 /// Defines additional types related to [OSPolicyResourceCompliance].
6661 pub mod os_policy_resource_compliance {
6662 #[allow(unused_imports)]
6663 use super::*;
6664
6665 /// Step performed by the OS Config agent for configuring an
6666 /// `OSPolicy` resource to its desired state.
6667 #[derive(Clone, Default, PartialEq)]
6668 #[non_exhaustive]
6669 pub struct OSPolicyResourceConfigStep {
6670
6671 /// Configuration step type.
6672 pub r#type: crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::os_policy_resource_config_step::Type,
6673
6674 /// An error message recorded during the execution of this step.
6675 /// Only populated if errors were encountered during this step execution.
6676 pub error_message: std::string::String,
6677
6678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6679 }
6680
6681 impl OSPolicyResourceConfigStep {
6682 /// Creates a new default instance.
6683 pub fn new() -> Self {
6684 std::default::Default::default()
6685 }
6686
6687 /// Sets the value of [r#type][crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep::type].
6688 ///
6689 /// # Example
6690 /// ```ignore,no_run
6691 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep;
6692 /// use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::os_policy_resource_config_step::Type;
6693 /// let x0 = OSPolicyResourceConfigStep::new().set_type(Type::Validation);
6694 /// let x1 = OSPolicyResourceConfigStep::new().set_type(Type::DesiredStateCheck);
6695 /// let x2 = OSPolicyResourceConfigStep::new().set_type(Type::DesiredStateEnforcement);
6696 /// ```
6697 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{
6698 self.r#type = v.into();
6699 self
6700 }
6701
6702 /// Sets the value of [error_message][crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep::error_message].
6703 ///
6704 /// # Example
6705 /// ```ignore,no_run
6706 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::OSPolicyResourceConfigStep;
6707 /// let x = OSPolicyResourceConfigStep::new().set_error_message("example");
6708 /// ```
6709 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
6710 mut self,
6711 v: T,
6712 ) -> Self {
6713 self.error_message = v.into();
6714 self
6715 }
6716 }
6717
6718 impl wkt::message::Message for OSPolicyResourceConfigStep {
6719 fn typename() -> &'static str {
6720 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.OSPolicyResourceConfigStep"
6721 }
6722 }
6723
6724 /// Defines additional types related to [OSPolicyResourceConfigStep].
6725 pub mod os_policy_resource_config_step {
6726 #[allow(unused_imports)]
6727 use super::*;
6728
6729 /// Supported configuration step types
6730 ///
6731 /// # Working with unknown values
6732 ///
6733 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6734 /// additional enum variants at any time. Adding new variants is not considered
6735 /// a breaking change. Applications should write their code in anticipation of:
6736 ///
6737 /// - New values appearing in future releases of the client library, **and**
6738 /// - New values received dynamically, without application changes.
6739 ///
6740 /// Please consult the [Working with enums] section in the user guide for some
6741 /// guidelines.
6742 ///
6743 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6744 #[derive(Clone, Debug, PartialEq)]
6745 #[non_exhaustive]
6746 pub enum Type {
6747 /// Default value. This value is unused.
6748 Unspecified,
6749 /// Checks for resource conflicts such as schema errors.
6750 Validation,
6751 /// Checks the current status of the desired state for a resource.
6752 DesiredStateCheck,
6753 /// Enforces the desired state for a resource that is not in desired
6754 /// state.
6755 DesiredStateEnforcement,
6756 /// Re-checks the status of the desired state. This check is done
6757 /// for a resource after the enforcement of all OS policies.
6758 ///
6759 /// This step is used to determine the final desired state status for
6760 /// the resource. It accounts for any resources that might have drifted
6761 /// from their desired state due to side effects from executing other
6762 /// resources.
6763 DesiredStateCheckPostEnforcement,
6764 /// If set, the enum was initialized with an unknown value.
6765 ///
6766 /// Applications can examine the value using [Type::value] or
6767 /// [Type::name].
6768 UnknownValue(r#type::UnknownValue),
6769 }
6770
6771 #[doc(hidden)]
6772 pub mod r#type {
6773 #[allow(unused_imports)]
6774 use super::*;
6775 #[derive(Clone, Debug, PartialEq)]
6776 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6777 }
6778
6779 impl Type {
6780 /// Gets the enum value.
6781 ///
6782 /// Returns `None` if the enum contains an unknown value deserialized from
6783 /// the string representation of enums.
6784 pub fn value(&self) -> std::option::Option<i32> {
6785 match self {
6786 Self::Unspecified => std::option::Option::Some(0),
6787 Self::Validation => std::option::Option::Some(1),
6788 Self::DesiredStateCheck => std::option::Option::Some(2),
6789 Self::DesiredStateEnforcement => std::option::Option::Some(3),
6790 Self::DesiredStateCheckPostEnforcement => std::option::Option::Some(4),
6791 Self::UnknownValue(u) => u.0.value(),
6792 }
6793 }
6794
6795 /// Gets the enum value as a string.
6796 ///
6797 /// Returns `None` if the enum contains an unknown value deserialized from
6798 /// the integer representation of enums.
6799 pub fn name(&self) -> std::option::Option<&str> {
6800 match self {
6801 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
6802 Self::Validation => std::option::Option::Some("VALIDATION"),
6803 Self::DesiredStateCheck => {
6804 std::option::Option::Some("DESIRED_STATE_CHECK")
6805 }
6806 Self::DesiredStateEnforcement => {
6807 std::option::Option::Some("DESIRED_STATE_ENFORCEMENT")
6808 }
6809 Self::DesiredStateCheckPostEnforcement => {
6810 std::option::Option::Some("DESIRED_STATE_CHECK_POST_ENFORCEMENT")
6811 }
6812 Self::UnknownValue(u) => u.0.name(),
6813 }
6814 }
6815 }
6816
6817 impl std::default::Default for Type {
6818 fn default() -> Self {
6819 use std::convert::From;
6820 Self::from(0)
6821 }
6822 }
6823
6824 impl std::fmt::Display for Type {
6825 fn fmt(
6826 &self,
6827 f: &mut std::fmt::Formatter<'_>,
6828 ) -> std::result::Result<(), std::fmt::Error> {
6829 wkt::internal::display_enum(f, self.name(), self.value())
6830 }
6831 }
6832
6833 impl std::convert::From<i32> for Type {
6834 fn from(value: i32) -> Self {
6835 match value {
6836 0 => Self::Unspecified,
6837 1 => Self::Validation,
6838 2 => Self::DesiredStateCheck,
6839 3 => Self::DesiredStateEnforcement,
6840 4 => Self::DesiredStateCheckPostEnforcement,
6841 _ => Self::UnknownValue(r#type::UnknownValue(
6842 wkt::internal::UnknownEnumValue::Integer(value),
6843 )),
6844 }
6845 }
6846 }
6847
6848 impl std::convert::From<&str> for Type {
6849 fn from(value: &str) -> Self {
6850 use std::string::ToString;
6851 match value {
6852 "TYPE_UNSPECIFIED" => Self::Unspecified,
6853 "VALIDATION" => Self::Validation,
6854 "DESIRED_STATE_CHECK" => Self::DesiredStateCheck,
6855 "DESIRED_STATE_ENFORCEMENT" => Self::DesiredStateEnforcement,
6856 "DESIRED_STATE_CHECK_POST_ENFORCEMENT" => {
6857 Self::DesiredStateCheckPostEnforcement
6858 }
6859 _ => Self::UnknownValue(r#type::UnknownValue(
6860 wkt::internal::UnknownEnumValue::String(value.to_string()),
6861 )),
6862 }
6863 }
6864 }
6865
6866 impl serde::ser::Serialize for Type {
6867 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6868 where
6869 S: serde::Serializer,
6870 {
6871 match self {
6872 Self::Unspecified => serializer.serialize_i32(0),
6873 Self::Validation => serializer.serialize_i32(1),
6874 Self::DesiredStateCheck => serializer.serialize_i32(2),
6875 Self::DesiredStateEnforcement => serializer.serialize_i32(3),
6876 Self::DesiredStateCheckPostEnforcement => serializer.serialize_i32(4),
6877 Self::UnknownValue(u) => u.0.serialize(serializer),
6878 }
6879 }
6880 }
6881
6882 impl<'de> serde::de::Deserialize<'de> for Type {
6883 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6884 where
6885 D: serde::Deserializer<'de>,
6886 {
6887 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
6888 ".google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.OSPolicyResourceConfigStep.Type"))
6889 }
6890 }
6891 }
6892
6893 /// ExecResource specific output.
6894 #[derive(Clone, Default, PartialEq)]
6895 #[non_exhaustive]
6896 pub struct ExecResourceOutput {
6897 /// Output from enforcement phase output file (if run).
6898 /// Output size is limited to 100K bytes.
6899 pub enforcement_output: ::bytes::Bytes,
6900
6901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6902 }
6903
6904 impl ExecResourceOutput {
6905 /// Creates a new default instance.
6906 pub fn new() -> Self {
6907 std::default::Default::default()
6908 }
6909
6910 /// Sets the value of [enforcement_output][crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput::enforcement_output].
6911 ///
6912 /// # Example
6913 /// ```ignore,no_run
6914 /// # use google_cloud_osconfig_v1::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput;
6915 /// let x = ExecResourceOutput::new().set_enforcement_output(bytes::Bytes::from_static(b"example"));
6916 /// ```
6917 pub fn set_enforcement_output<T: std::convert::Into<::bytes::Bytes>>(
6918 mut self,
6919 v: T,
6920 ) -> Self {
6921 self.enforcement_output = v.into();
6922 self
6923 }
6924 }
6925
6926 impl wkt::message::Message for ExecResourceOutput {
6927 fn typename() -> &'static str {
6928 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.ExecResourceOutput"
6929 }
6930 }
6931
6932 /// Possible compliance states for a resource.
6933 ///
6934 /// # Working with unknown values
6935 ///
6936 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6937 /// additional enum variants at any time. Adding new variants is not considered
6938 /// a breaking change. Applications should write their code in anticipation of:
6939 ///
6940 /// - New values appearing in future releases of the client library, **and**
6941 /// - New values received dynamically, without application changes.
6942 ///
6943 /// Please consult the [Working with enums] section in the user guide for some
6944 /// guidelines.
6945 ///
6946 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6947 #[derive(Clone, Debug, PartialEq)]
6948 #[non_exhaustive]
6949 pub enum ComplianceState {
6950 /// The resource is in an unknown compliance state.
6951 ///
6952 /// To get more details about why the policy is in this state, review
6953 /// the output of the `compliance_state_reason` field.
6954 Unknown,
6955 /// Resource is compliant.
6956 Compliant,
6957 /// Resource is non-compliant.
6958 NonCompliant,
6959 /// If set, the enum was initialized with an unknown value.
6960 ///
6961 /// Applications can examine the value using [ComplianceState::value] or
6962 /// [ComplianceState::name].
6963 UnknownValue(compliance_state::UnknownValue),
6964 }
6965
6966 #[doc(hidden)]
6967 pub mod compliance_state {
6968 #[allow(unused_imports)]
6969 use super::*;
6970 #[derive(Clone, Debug, PartialEq)]
6971 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6972 }
6973
6974 impl ComplianceState {
6975 /// Gets the enum value.
6976 ///
6977 /// Returns `None` if the enum contains an unknown value deserialized from
6978 /// the string representation of enums.
6979 pub fn value(&self) -> std::option::Option<i32> {
6980 match self {
6981 Self::Unknown => std::option::Option::Some(0),
6982 Self::Compliant => std::option::Option::Some(1),
6983 Self::NonCompliant => std::option::Option::Some(2),
6984 Self::UnknownValue(u) => u.0.value(),
6985 }
6986 }
6987
6988 /// Gets the enum value as a string.
6989 ///
6990 /// Returns `None` if the enum contains an unknown value deserialized from
6991 /// the integer representation of enums.
6992 pub fn name(&self) -> std::option::Option<&str> {
6993 match self {
6994 Self::Unknown => std::option::Option::Some("UNKNOWN"),
6995 Self::Compliant => std::option::Option::Some("COMPLIANT"),
6996 Self::NonCompliant => std::option::Option::Some("NON_COMPLIANT"),
6997 Self::UnknownValue(u) => u.0.name(),
6998 }
6999 }
7000 }
7001
7002 impl std::default::Default for ComplianceState {
7003 fn default() -> Self {
7004 use std::convert::From;
7005 Self::from(0)
7006 }
7007 }
7008
7009 impl std::fmt::Display for ComplianceState {
7010 fn fmt(
7011 &self,
7012 f: &mut std::fmt::Formatter<'_>,
7013 ) -> std::result::Result<(), std::fmt::Error> {
7014 wkt::internal::display_enum(f, self.name(), self.value())
7015 }
7016 }
7017
7018 impl std::convert::From<i32> for ComplianceState {
7019 fn from(value: i32) -> Self {
7020 match value {
7021 0 => Self::Unknown,
7022 1 => Self::Compliant,
7023 2 => Self::NonCompliant,
7024 _ => Self::UnknownValue(compliance_state::UnknownValue(
7025 wkt::internal::UnknownEnumValue::Integer(value),
7026 )),
7027 }
7028 }
7029 }
7030
7031 impl std::convert::From<&str> for ComplianceState {
7032 fn from(value: &str) -> Self {
7033 use std::string::ToString;
7034 match value {
7035 "UNKNOWN" => Self::Unknown,
7036 "COMPLIANT" => Self::Compliant,
7037 "NON_COMPLIANT" => Self::NonCompliant,
7038 _ => Self::UnknownValue(compliance_state::UnknownValue(
7039 wkt::internal::UnknownEnumValue::String(value.to_string()),
7040 )),
7041 }
7042 }
7043 }
7044
7045 impl serde::ser::Serialize for ComplianceState {
7046 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7047 where
7048 S: serde::Serializer,
7049 {
7050 match self {
7051 Self::Unknown => serializer.serialize_i32(0),
7052 Self::Compliant => serializer.serialize_i32(1),
7053 Self::NonCompliant => serializer.serialize_i32(2),
7054 Self::UnknownValue(u) => u.0.serialize(serializer),
7055 }
7056 }
7057 }
7058
7059 impl<'de> serde::de::Deserialize<'de> for ComplianceState {
7060 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7061 where
7062 D: serde::Deserializer<'de>,
7063 {
7064 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComplianceState>::new(
7065 ".google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.OSPolicyResourceCompliance.ComplianceState"))
7066 }
7067 }
7068
7069 /// Resource specific output.
7070 #[derive(Clone, Debug, PartialEq)]
7071 #[non_exhaustive]
7072 pub enum Output {
7073 /// ExecResource specific output.
7074 ExecResourceOutput(std::boxed::Box<crate::model::os_policy_assignment_report::os_policy_compliance::os_policy_resource_compliance::ExecResourceOutput>),
7075 }
7076 }
7077
7078 /// Possible compliance states for an os policy.
7079 ///
7080 /// # Working with unknown values
7081 ///
7082 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7083 /// additional enum variants at any time. Adding new variants is not considered
7084 /// a breaking change. Applications should write their code in anticipation of:
7085 ///
7086 /// - New values appearing in future releases of the client library, **and**
7087 /// - New values received dynamically, without application changes.
7088 ///
7089 /// Please consult the [Working with enums] section in the user guide for some
7090 /// guidelines.
7091 ///
7092 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7093 #[derive(Clone, Debug, PartialEq)]
7094 #[non_exhaustive]
7095 pub enum ComplianceState {
7096 /// The policy is in an unknown compliance state.
7097 ///
7098 /// Refer to the field `compliance_state_reason` to learn the exact reason
7099 /// for the policy to be in this compliance state.
7100 Unknown,
7101 /// Policy is compliant.
7102 ///
7103 /// The policy is compliant if all the underlying resources are also
7104 /// compliant.
7105 Compliant,
7106 /// Policy is non-compliant.
7107 ///
7108 /// The policy is non-compliant if one or more underlying resources are
7109 /// non-compliant.
7110 NonCompliant,
7111 /// If set, the enum was initialized with an unknown value.
7112 ///
7113 /// Applications can examine the value using [ComplianceState::value] or
7114 /// [ComplianceState::name].
7115 UnknownValue(compliance_state::UnknownValue),
7116 }
7117
7118 #[doc(hidden)]
7119 pub mod compliance_state {
7120 #[allow(unused_imports)]
7121 use super::*;
7122 #[derive(Clone, Debug, PartialEq)]
7123 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7124 }
7125
7126 impl ComplianceState {
7127 /// Gets the enum value.
7128 ///
7129 /// Returns `None` if the enum contains an unknown value deserialized from
7130 /// the string representation of enums.
7131 pub fn value(&self) -> std::option::Option<i32> {
7132 match self {
7133 Self::Unknown => std::option::Option::Some(0),
7134 Self::Compliant => std::option::Option::Some(1),
7135 Self::NonCompliant => std::option::Option::Some(2),
7136 Self::UnknownValue(u) => u.0.value(),
7137 }
7138 }
7139
7140 /// Gets the enum value as a string.
7141 ///
7142 /// Returns `None` if the enum contains an unknown value deserialized from
7143 /// the integer representation of enums.
7144 pub fn name(&self) -> std::option::Option<&str> {
7145 match self {
7146 Self::Unknown => std::option::Option::Some("UNKNOWN"),
7147 Self::Compliant => std::option::Option::Some("COMPLIANT"),
7148 Self::NonCompliant => std::option::Option::Some("NON_COMPLIANT"),
7149 Self::UnknownValue(u) => u.0.name(),
7150 }
7151 }
7152 }
7153
7154 impl std::default::Default for ComplianceState {
7155 fn default() -> Self {
7156 use std::convert::From;
7157 Self::from(0)
7158 }
7159 }
7160
7161 impl std::fmt::Display for ComplianceState {
7162 fn fmt(
7163 &self,
7164 f: &mut std::fmt::Formatter<'_>,
7165 ) -> std::result::Result<(), std::fmt::Error> {
7166 wkt::internal::display_enum(f, self.name(), self.value())
7167 }
7168 }
7169
7170 impl std::convert::From<i32> for ComplianceState {
7171 fn from(value: i32) -> Self {
7172 match value {
7173 0 => Self::Unknown,
7174 1 => Self::Compliant,
7175 2 => Self::NonCompliant,
7176 _ => Self::UnknownValue(compliance_state::UnknownValue(
7177 wkt::internal::UnknownEnumValue::Integer(value),
7178 )),
7179 }
7180 }
7181 }
7182
7183 impl std::convert::From<&str> for ComplianceState {
7184 fn from(value: &str) -> Self {
7185 use std::string::ToString;
7186 match value {
7187 "UNKNOWN" => Self::Unknown,
7188 "COMPLIANT" => Self::Compliant,
7189 "NON_COMPLIANT" => Self::NonCompliant,
7190 _ => Self::UnknownValue(compliance_state::UnknownValue(
7191 wkt::internal::UnknownEnumValue::String(value.to_string()),
7192 )),
7193 }
7194 }
7195 }
7196
7197 impl serde::ser::Serialize for ComplianceState {
7198 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7199 where
7200 S: serde::Serializer,
7201 {
7202 match self {
7203 Self::Unknown => serializer.serialize_i32(0),
7204 Self::Compliant => serializer.serialize_i32(1),
7205 Self::NonCompliant => serializer.serialize_i32(2),
7206 Self::UnknownValue(u) => u.0.serialize(serializer),
7207 }
7208 }
7209 }
7210
7211 impl<'de> serde::de::Deserialize<'de> for ComplianceState {
7212 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7213 where
7214 D: serde::Deserializer<'de>,
7215 {
7216 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComplianceState>::new(
7217 ".google.cloud.osconfig.v1.OSPolicyAssignmentReport.OSPolicyCompliance.ComplianceState"))
7218 }
7219 }
7220 }
7221}
7222
7223/// OS policy assignment is an API resource that is used to
7224/// apply a set of OS policies to a dynamically targeted group of Compute Engine
7225/// VM instances.
7226///
7227/// An OS policy is used to define the desired state configuration for a
7228/// Compute Engine VM instance through a set of configuration resources that
7229/// provide capabilities such as installing or removing software packages, or
7230/// executing a script.
7231///
7232/// For more information, see [OS policy and OS policy
7233/// assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).
7234#[derive(Clone, Default, PartialEq)]
7235#[non_exhaustive]
7236pub struct OSPolicyAssignment {
7237 /// Resource name.
7238 ///
7239 /// Format:
7240 /// `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`
7241 ///
7242 /// This field is ignored when you create an OS policy assignment.
7243 pub name: std::string::String,
7244
7245 /// OS policy assignment description.
7246 /// Length of the description is limited to 1024 characters.
7247 pub description: std::string::String,
7248
7249 /// Required. List of OS policies to be applied to the VMs.
7250 pub os_policies: std::vec::Vec<crate::model::OSPolicy>,
7251
7252 /// Required. Filter to select VMs.
7253 pub instance_filter: std::option::Option<crate::model::os_policy_assignment::InstanceFilter>,
7254
7255 /// Required. Rollout to deploy the OS policy assignment.
7256 /// A rollout is triggered in the following situations:
7257 ///
7258 /// 1. OSPolicyAssignment is created.
7259 /// 1. OSPolicyAssignment is updated and the update contains changes to one of
7260 /// the following fields:
7261 /// - instance_filter
7262 /// - os_policies
7263 /// 1. OSPolicyAssignment is deleted.
7264 pub rollout: std::option::Option<crate::model::os_policy_assignment::Rollout>,
7265
7266 /// Output only. The assignment revision ID
7267 /// A new revision is committed whenever a rollout is triggered for a OS policy
7268 /// assignment
7269 pub revision_id: std::string::String,
7270
7271 /// Output only. The timestamp that the revision was created.
7272 pub revision_create_time: std::option::Option<wkt::Timestamp>,
7273
7274 /// The etag for this OS policy assignment.
7275 /// If this is provided on update, it must match the server's etag.
7276 pub etag: std::string::String,
7277
7278 /// Output only. OS policy assignment rollout state
7279 pub rollout_state: crate::model::os_policy_assignment::RolloutState,
7280
7281 /// Output only. Indicates that this revision has been successfully rolled out
7282 /// in this zone and new VMs will be assigned OS policies from this revision.
7283 ///
7284 /// For a given OS policy assignment, there is only one revision with a value
7285 /// of `true` for this field.
7286 pub baseline: bool,
7287
7288 /// Output only. Indicates that this revision deletes the OS policy assignment.
7289 pub deleted: bool,
7290
7291 /// Output only. Indicates that reconciliation is in progress for the revision.
7292 /// This value is `true` when the `rollout_state` is one of:
7293 ///
7294 /// * IN_PROGRESS
7295 /// * CANCELLING
7296 pub reconciling: bool,
7297
7298 /// Output only. Server generated unique id for the OS policy assignment
7299 /// resource.
7300 pub uid: std::string::String,
7301
7302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7303}
7304
7305impl OSPolicyAssignment {
7306 /// Creates a new default instance.
7307 pub fn new() -> Self {
7308 std::default::Default::default()
7309 }
7310
7311 /// Sets the value of [name][crate::model::OSPolicyAssignment::name].
7312 ///
7313 /// # Example
7314 /// ```ignore,no_run
7315 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7316 /// # let project_id = "project_id";
7317 /// # let location_id = "location_id";
7318 /// # let os_policy_assignment_id = "os_policy_assignment_id";
7319 /// let x = OSPolicyAssignment::new().set_name(format!("projects/{project_id}/locations/{location_id}/osPolicyAssignments/{os_policy_assignment_id}"));
7320 /// ```
7321 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7322 self.name = v.into();
7323 self
7324 }
7325
7326 /// Sets the value of [description][crate::model::OSPolicyAssignment::description].
7327 ///
7328 /// # Example
7329 /// ```ignore,no_run
7330 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7331 /// let x = OSPolicyAssignment::new().set_description("example");
7332 /// ```
7333 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7334 self.description = v.into();
7335 self
7336 }
7337
7338 /// Sets the value of [os_policies][crate::model::OSPolicyAssignment::os_policies].
7339 ///
7340 /// # Example
7341 /// ```ignore,no_run
7342 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7343 /// use google_cloud_osconfig_v1::model::OSPolicy;
7344 /// let x = OSPolicyAssignment::new()
7345 /// .set_os_policies([
7346 /// OSPolicy::default()/* use setters */,
7347 /// OSPolicy::default()/* use (different) setters */,
7348 /// ]);
7349 /// ```
7350 pub fn set_os_policies<T, V>(mut self, v: T) -> Self
7351 where
7352 T: std::iter::IntoIterator<Item = V>,
7353 V: std::convert::Into<crate::model::OSPolicy>,
7354 {
7355 use std::iter::Iterator;
7356 self.os_policies = v.into_iter().map(|i| i.into()).collect();
7357 self
7358 }
7359
7360 /// Sets the value of [instance_filter][crate::model::OSPolicyAssignment::instance_filter].
7361 ///
7362 /// # Example
7363 /// ```ignore,no_run
7364 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7365 /// use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7366 /// let x = OSPolicyAssignment::new().set_instance_filter(InstanceFilter::default()/* use setters */);
7367 /// ```
7368 pub fn set_instance_filter<T>(mut self, v: T) -> Self
7369 where
7370 T: std::convert::Into<crate::model::os_policy_assignment::InstanceFilter>,
7371 {
7372 self.instance_filter = std::option::Option::Some(v.into());
7373 self
7374 }
7375
7376 /// Sets or clears the value of [instance_filter][crate::model::OSPolicyAssignment::instance_filter].
7377 ///
7378 /// # Example
7379 /// ```ignore,no_run
7380 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7381 /// use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7382 /// let x = OSPolicyAssignment::new().set_or_clear_instance_filter(Some(InstanceFilter::default()/* use setters */));
7383 /// let x = OSPolicyAssignment::new().set_or_clear_instance_filter(None::<InstanceFilter>);
7384 /// ```
7385 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
7386 where
7387 T: std::convert::Into<crate::model::os_policy_assignment::InstanceFilter>,
7388 {
7389 self.instance_filter = v.map(|x| x.into());
7390 self
7391 }
7392
7393 /// Sets the value of [rollout][crate::model::OSPolicyAssignment::rollout].
7394 ///
7395 /// # Example
7396 /// ```ignore,no_run
7397 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7398 /// use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7399 /// let x = OSPolicyAssignment::new().set_rollout(Rollout::default()/* use setters */);
7400 /// ```
7401 pub fn set_rollout<T>(mut self, v: T) -> Self
7402 where
7403 T: std::convert::Into<crate::model::os_policy_assignment::Rollout>,
7404 {
7405 self.rollout = std::option::Option::Some(v.into());
7406 self
7407 }
7408
7409 /// Sets or clears the value of [rollout][crate::model::OSPolicyAssignment::rollout].
7410 ///
7411 /// # Example
7412 /// ```ignore,no_run
7413 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7414 /// use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7415 /// let x = OSPolicyAssignment::new().set_or_clear_rollout(Some(Rollout::default()/* use setters */));
7416 /// let x = OSPolicyAssignment::new().set_or_clear_rollout(None::<Rollout>);
7417 /// ```
7418 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
7419 where
7420 T: std::convert::Into<crate::model::os_policy_assignment::Rollout>,
7421 {
7422 self.rollout = v.map(|x| x.into());
7423 self
7424 }
7425
7426 /// Sets the value of [revision_id][crate::model::OSPolicyAssignment::revision_id].
7427 ///
7428 /// # Example
7429 /// ```ignore,no_run
7430 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7431 /// let x = OSPolicyAssignment::new().set_revision_id("example");
7432 /// ```
7433 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7434 self.revision_id = v.into();
7435 self
7436 }
7437
7438 /// Sets the value of [revision_create_time][crate::model::OSPolicyAssignment::revision_create_time].
7439 ///
7440 /// # Example
7441 /// ```ignore,no_run
7442 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7443 /// use wkt::Timestamp;
7444 /// let x = OSPolicyAssignment::new().set_revision_create_time(Timestamp::default()/* use setters */);
7445 /// ```
7446 pub fn set_revision_create_time<T>(mut self, v: T) -> Self
7447 where
7448 T: std::convert::Into<wkt::Timestamp>,
7449 {
7450 self.revision_create_time = std::option::Option::Some(v.into());
7451 self
7452 }
7453
7454 /// Sets or clears the value of [revision_create_time][crate::model::OSPolicyAssignment::revision_create_time].
7455 ///
7456 /// # Example
7457 /// ```ignore,no_run
7458 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7459 /// use wkt::Timestamp;
7460 /// let x = OSPolicyAssignment::new().set_or_clear_revision_create_time(Some(Timestamp::default()/* use setters */));
7461 /// let x = OSPolicyAssignment::new().set_or_clear_revision_create_time(None::<Timestamp>);
7462 /// ```
7463 pub fn set_or_clear_revision_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7464 where
7465 T: std::convert::Into<wkt::Timestamp>,
7466 {
7467 self.revision_create_time = v.map(|x| x.into());
7468 self
7469 }
7470
7471 /// Sets the value of [etag][crate::model::OSPolicyAssignment::etag].
7472 ///
7473 /// # Example
7474 /// ```ignore,no_run
7475 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7476 /// let x = OSPolicyAssignment::new().set_etag("example");
7477 /// ```
7478 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7479 self.etag = v.into();
7480 self
7481 }
7482
7483 /// Sets the value of [rollout_state][crate::model::OSPolicyAssignment::rollout_state].
7484 ///
7485 /// # Example
7486 /// ```ignore,no_run
7487 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7488 /// use google_cloud_osconfig_v1::model::os_policy_assignment::RolloutState;
7489 /// let x0 = OSPolicyAssignment::new().set_rollout_state(RolloutState::InProgress);
7490 /// let x1 = OSPolicyAssignment::new().set_rollout_state(RolloutState::Cancelling);
7491 /// let x2 = OSPolicyAssignment::new().set_rollout_state(RolloutState::Cancelled);
7492 /// ```
7493 pub fn set_rollout_state<
7494 T: std::convert::Into<crate::model::os_policy_assignment::RolloutState>,
7495 >(
7496 mut self,
7497 v: T,
7498 ) -> Self {
7499 self.rollout_state = v.into();
7500 self
7501 }
7502
7503 /// Sets the value of [baseline][crate::model::OSPolicyAssignment::baseline].
7504 ///
7505 /// # Example
7506 /// ```ignore,no_run
7507 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7508 /// let x = OSPolicyAssignment::new().set_baseline(true);
7509 /// ```
7510 pub fn set_baseline<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7511 self.baseline = v.into();
7512 self
7513 }
7514
7515 /// Sets the value of [deleted][crate::model::OSPolicyAssignment::deleted].
7516 ///
7517 /// # Example
7518 /// ```ignore,no_run
7519 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7520 /// let x = OSPolicyAssignment::new().set_deleted(true);
7521 /// ```
7522 pub fn set_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7523 self.deleted = v.into();
7524 self
7525 }
7526
7527 /// Sets the value of [reconciling][crate::model::OSPolicyAssignment::reconciling].
7528 ///
7529 /// # Example
7530 /// ```ignore,no_run
7531 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7532 /// let x = OSPolicyAssignment::new().set_reconciling(true);
7533 /// ```
7534 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7535 self.reconciling = v.into();
7536 self
7537 }
7538
7539 /// Sets the value of [uid][crate::model::OSPolicyAssignment::uid].
7540 ///
7541 /// # Example
7542 /// ```ignore,no_run
7543 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignment;
7544 /// let x = OSPolicyAssignment::new().set_uid("example");
7545 /// ```
7546 pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7547 self.uid = v.into();
7548 self
7549 }
7550}
7551
7552impl wkt::message::Message for OSPolicyAssignment {
7553 fn typename() -> &'static str {
7554 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment"
7555 }
7556}
7557
7558/// Defines additional types related to [OSPolicyAssignment].
7559pub mod os_policy_assignment {
7560 #[allow(unused_imports)]
7561 use super::*;
7562
7563 /// Message representing label set.
7564 ///
7565 /// * A label is a key value pair set for a VM.
7566 /// * A LabelSet is a set of labels.
7567 /// * Labels within a LabelSet are ANDed. In other words, a LabelSet is
7568 /// applicable for a VM only if it matches all the labels in the
7569 /// LabelSet.
7570 /// * Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will
7571 /// only be applicable for those VMs with both labels
7572 /// present.
7573 #[derive(Clone, Default, PartialEq)]
7574 #[non_exhaustive]
7575 pub struct LabelSet {
7576 /// Labels are identified by key/value pairs in this map.
7577 /// A VM should contain all the key/value pairs specified in this
7578 /// map to be selected.
7579 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
7580
7581 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7582 }
7583
7584 impl LabelSet {
7585 /// Creates a new default instance.
7586 pub fn new() -> Self {
7587 std::default::Default::default()
7588 }
7589
7590 /// Sets the value of [labels][crate::model::os_policy_assignment::LabelSet::labels].
7591 ///
7592 /// # Example
7593 /// ```ignore,no_run
7594 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::LabelSet;
7595 /// let x = LabelSet::new().set_labels([
7596 /// ("key0", "abc"),
7597 /// ("key1", "xyz"),
7598 /// ]);
7599 /// ```
7600 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7601 where
7602 T: std::iter::IntoIterator<Item = (K, V)>,
7603 K: std::convert::Into<std::string::String>,
7604 V: std::convert::Into<std::string::String>,
7605 {
7606 use std::iter::Iterator;
7607 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7608 self
7609 }
7610 }
7611
7612 impl wkt::message::Message for LabelSet {
7613 fn typename() -> &'static str {
7614 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.LabelSet"
7615 }
7616 }
7617
7618 /// Filters to select target VMs for an assignment.
7619 ///
7620 /// If more than one filter criteria is specified below, a VM will be selected
7621 /// if and only if it satisfies all of them.
7622 #[derive(Clone, Default, PartialEq)]
7623 #[non_exhaustive]
7624 pub struct InstanceFilter {
7625 /// Target all VMs in the project. If true, no other criteria is
7626 /// permitted.
7627 pub all: bool,
7628
7629 /// List of label sets used for VM inclusion.
7630 ///
7631 /// If the list has more than one `LabelSet`, the VM is included if any
7632 /// of the label sets are applicable for the VM.
7633 pub inclusion_labels: std::vec::Vec<crate::model::os_policy_assignment::LabelSet>,
7634
7635 /// List of label sets used for VM exclusion.
7636 ///
7637 /// If the list has more than one label set, the VM is excluded if any
7638 /// of the label sets are applicable for the VM.
7639 pub exclusion_labels: std::vec::Vec<crate::model::os_policy_assignment::LabelSet>,
7640
7641 /// List of inventories to select VMs.
7642 ///
7643 /// A VM is selected if its inventory data matches at least one of the
7644 /// following inventories.
7645 pub inventories:
7646 std::vec::Vec<crate::model::os_policy_assignment::instance_filter::Inventory>,
7647
7648 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7649 }
7650
7651 impl InstanceFilter {
7652 /// Creates a new default instance.
7653 pub fn new() -> Self {
7654 std::default::Default::default()
7655 }
7656
7657 /// Sets the value of [all][crate::model::os_policy_assignment::InstanceFilter::all].
7658 ///
7659 /// # Example
7660 /// ```ignore,no_run
7661 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7662 /// let x = InstanceFilter::new().set_all(true);
7663 /// ```
7664 pub fn set_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7665 self.all = v.into();
7666 self
7667 }
7668
7669 /// Sets the value of [inclusion_labels][crate::model::os_policy_assignment::InstanceFilter::inclusion_labels].
7670 ///
7671 /// # Example
7672 /// ```ignore,no_run
7673 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7674 /// use google_cloud_osconfig_v1::model::os_policy_assignment::LabelSet;
7675 /// let x = InstanceFilter::new()
7676 /// .set_inclusion_labels([
7677 /// LabelSet::default()/* use setters */,
7678 /// LabelSet::default()/* use (different) setters */,
7679 /// ]);
7680 /// ```
7681 pub fn set_inclusion_labels<T, V>(mut self, v: T) -> Self
7682 where
7683 T: std::iter::IntoIterator<Item = V>,
7684 V: std::convert::Into<crate::model::os_policy_assignment::LabelSet>,
7685 {
7686 use std::iter::Iterator;
7687 self.inclusion_labels = v.into_iter().map(|i| i.into()).collect();
7688 self
7689 }
7690
7691 /// Sets the value of [exclusion_labels][crate::model::os_policy_assignment::InstanceFilter::exclusion_labels].
7692 ///
7693 /// # Example
7694 /// ```ignore,no_run
7695 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7696 /// use google_cloud_osconfig_v1::model::os_policy_assignment::LabelSet;
7697 /// let x = InstanceFilter::new()
7698 /// .set_exclusion_labels([
7699 /// LabelSet::default()/* use setters */,
7700 /// LabelSet::default()/* use (different) setters */,
7701 /// ]);
7702 /// ```
7703 pub fn set_exclusion_labels<T, V>(mut self, v: T) -> Self
7704 where
7705 T: std::iter::IntoIterator<Item = V>,
7706 V: std::convert::Into<crate::model::os_policy_assignment::LabelSet>,
7707 {
7708 use std::iter::Iterator;
7709 self.exclusion_labels = v.into_iter().map(|i| i.into()).collect();
7710 self
7711 }
7712
7713 /// Sets the value of [inventories][crate::model::os_policy_assignment::InstanceFilter::inventories].
7714 ///
7715 /// # Example
7716 /// ```ignore,no_run
7717 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::InstanceFilter;
7718 /// use google_cloud_osconfig_v1::model::os_policy_assignment::instance_filter::Inventory;
7719 /// let x = InstanceFilter::new()
7720 /// .set_inventories([
7721 /// Inventory::default()/* use setters */,
7722 /// Inventory::default()/* use (different) setters */,
7723 /// ]);
7724 /// ```
7725 pub fn set_inventories<T, V>(mut self, v: T) -> Self
7726 where
7727 T: std::iter::IntoIterator<Item = V>,
7728 V: std::convert::Into<crate::model::os_policy_assignment::instance_filter::Inventory>,
7729 {
7730 use std::iter::Iterator;
7731 self.inventories = v.into_iter().map(|i| i.into()).collect();
7732 self
7733 }
7734 }
7735
7736 impl wkt::message::Message for InstanceFilter {
7737 fn typename() -> &'static str {
7738 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.InstanceFilter"
7739 }
7740 }
7741
7742 /// Defines additional types related to [InstanceFilter].
7743 pub mod instance_filter {
7744 #[allow(unused_imports)]
7745 use super::*;
7746
7747 /// VM inventory details.
7748 #[derive(Clone, Default, PartialEq)]
7749 #[non_exhaustive]
7750 pub struct Inventory {
7751 /// Required. The OS short name
7752 pub os_short_name: std::string::String,
7753
7754 /// The OS version
7755 ///
7756 /// Prefix matches are supported if asterisk(*) is provided as the
7757 /// last character. For example, to match all versions with a major
7758 /// version of `7`, specify the following value for this field `7.*`
7759 ///
7760 /// An empty string matches all OS versions.
7761 pub os_version: std::string::String,
7762
7763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7764 }
7765
7766 impl Inventory {
7767 /// Creates a new default instance.
7768 pub fn new() -> Self {
7769 std::default::Default::default()
7770 }
7771
7772 /// Sets the value of [os_short_name][crate::model::os_policy_assignment::instance_filter::Inventory::os_short_name].
7773 ///
7774 /// # Example
7775 /// ```ignore,no_run
7776 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::instance_filter::Inventory;
7777 /// let x = Inventory::new().set_os_short_name("example");
7778 /// ```
7779 pub fn set_os_short_name<T: std::convert::Into<std::string::String>>(
7780 mut self,
7781 v: T,
7782 ) -> Self {
7783 self.os_short_name = v.into();
7784 self
7785 }
7786
7787 /// Sets the value of [os_version][crate::model::os_policy_assignment::instance_filter::Inventory::os_version].
7788 ///
7789 /// # Example
7790 /// ```ignore,no_run
7791 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::instance_filter::Inventory;
7792 /// let x = Inventory::new().set_os_version("example");
7793 /// ```
7794 pub fn set_os_version<T: std::convert::Into<std::string::String>>(
7795 mut self,
7796 v: T,
7797 ) -> Self {
7798 self.os_version = v.into();
7799 self
7800 }
7801 }
7802
7803 impl wkt::message::Message for Inventory {
7804 fn typename() -> &'static str {
7805 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.InstanceFilter.Inventory"
7806 }
7807 }
7808 }
7809
7810 /// Message to configure the rollout at the zonal level for the OS policy
7811 /// assignment.
7812 #[derive(Clone, Default, PartialEq)]
7813 #[non_exhaustive]
7814 pub struct Rollout {
7815 /// Required. The maximum number (or percentage) of VMs per zone to disrupt
7816 /// at any given moment.
7817 pub disruption_budget: std::option::Option<crate::model::FixedOrPercent>,
7818
7819 /// Required. This determines the minimum duration of time to wait after the
7820 /// configuration changes are applied through the current rollout. A
7821 /// VM continues to count towards the `disruption_budget` at least
7822 /// until this duration of time has passed after configuration changes are
7823 /// applied.
7824 pub min_wait_duration: std::option::Option<wkt::Duration>,
7825
7826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7827 }
7828
7829 impl Rollout {
7830 /// Creates a new default instance.
7831 pub fn new() -> Self {
7832 std::default::Default::default()
7833 }
7834
7835 /// Sets the value of [disruption_budget][crate::model::os_policy_assignment::Rollout::disruption_budget].
7836 ///
7837 /// # Example
7838 /// ```ignore,no_run
7839 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7840 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
7841 /// let x = Rollout::new().set_disruption_budget(FixedOrPercent::default()/* use setters */);
7842 /// ```
7843 pub fn set_disruption_budget<T>(mut self, v: T) -> Self
7844 where
7845 T: std::convert::Into<crate::model::FixedOrPercent>,
7846 {
7847 self.disruption_budget = std::option::Option::Some(v.into());
7848 self
7849 }
7850
7851 /// Sets or clears the value of [disruption_budget][crate::model::os_policy_assignment::Rollout::disruption_budget].
7852 ///
7853 /// # Example
7854 /// ```ignore,no_run
7855 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7856 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
7857 /// let x = Rollout::new().set_or_clear_disruption_budget(Some(FixedOrPercent::default()/* use setters */));
7858 /// let x = Rollout::new().set_or_clear_disruption_budget(None::<FixedOrPercent>);
7859 /// ```
7860 pub fn set_or_clear_disruption_budget<T>(mut self, v: std::option::Option<T>) -> Self
7861 where
7862 T: std::convert::Into<crate::model::FixedOrPercent>,
7863 {
7864 self.disruption_budget = v.map(|x| x.into());
7865 self
7866 }
7867
7868 /// Sets the value of [min_wait_duration][crate::model::os_policy_assignment::Rollout::min_wait_duration].
7869 ///
7870 /// # Example
7871 /// ```ignore,no_run
7872 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7873 /// use wkt::Duration;
7874 /// let x = Rollout::new().set_min_wait_duration(Duration::default()/* use setters */);
7875 /// ```
7876 pub fn set_min_wait_duration<T>(mut self, v: T) -> Self
7877 where
7878 T: std::convert::Into<wkt::Duration>,
7879 {
7880 self.min_wait_duration = std::option::Option::Some(v.into());
7881 self
7882 }
7883
7884 /// Sets or clears the value of [min_wait_duration][crate::model::os_policy_assignment::Rollout::min_wait_duration].
7885 ///
7886 /// # Example
7887 /// ```ignore,no_run
7888 /// # use google_cloud_osconfig_v1::model::os_policy_assignment::Rollout;
7889 /// use wkt::Duration;
7890 /// let x = Rollout::new().set_or_clear_min_wait_duration(Some(Duration::default()/* use setters */));
7891 /// let x = Rollout::new().set_or_clear_min_wait_duration(None::<Duration>);
7892 /// ```
7893 pub fn set_or_clear_min_wait_duration<T>(mut self, v: std::option::Option<T>) -> Self
7894 where
7895 T: std::convert::Into<wkt::Duration>,
7896 {
7897 self.min_wait_duration = v.map(|x| x.into());
7898 self
7899 }
7900 }
7901
7902 impl wkt::message::Message for Rollout {
7903 fn typename() -> &'static str {
7904 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignment.Rollout"
7905 }
7906 }
7907
7908 /// OS policy assignment rollout state
7909 ///
7910 /// # Working with unknown values
7911 ///
7912 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7913 /// additional enum variants at any time. Adding new variants is not considered
7914 /// a breaking change. Applications should write their code in anticipation of:
7915 ///
7916 /// - New values appearing in future releases of the client library, **and**
7917 /// - New values received dynamically, without application changes.
7918 ///
7919 /// Please consult the [Working with enums] section in the user guide for some
7920 /// guidelines.
7921 ///
7922 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7923 #[derive(Clone, Debug, PartialEq)]
7924 #[non_exhaustive]
7925 pub enum RolloutState {
7926 /// Invalid value
7927 Unspecified,
7928 /// The rollout is in progress.
7929 InProgress,
7930 /// The rollout is being cancelled.
7931 Cancelling,
7932 /// The rollout is cancelled.
7933 Cancelled,
7934 /// The rollout has completed successfully.
7935 Succeeded,
7936 /// If set, the enum was initialized with an unknown value.
7937 ///
7938 /// Applications can examine the value using [RolloutState::value] or
7939 /// [RolloutState::name].
7940 UnknownValue(rollout_state::UnknownValue),
7941 }
7942
7943 #[doc(hidden)]
7944 pub mod rollout_state {
7945 #[allow(unused_imports)]
7946 use super::*;
7947 #[derive(Clone, Debug, PartialEq)]
7948 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7949 }
7950
7951 impl RolloutState {
7952 /// Gets the enum value.
7953 ///
7954 /// Returns `None` if the enum contains an unknown value deserialized from
7955 /// the string representation of enums.
7956 pub fn value(&self) -> std::option::Option<i32> {
7957 match self {
7958 Self::Unspecified => std::option::Option::Some(0),
7959 Self::InProgress => std::option::Option::Some(1),
7960 Self::Cancelling => std::option::Option::Some(2),
7961 Self::Cancelled => std::option::Option::Some(3),
7962 Self::Succeeded => std::option::Option::Some(4),
7963 Self::UnknownValue(u) => u.0.value(),
7964 }
7965 }
7966
7967 /// Gets the enum value as a string.
7968 ///
7969 /// Returns `None` if the enum contains an unknown value deserialized from
7970 /// the integer representation of enums.
7971 pub fn name(&self) -> std::option::Option<&str> {
7972 match self {
7973 Self::Unspecified => std::option::Option::Some("ROLLOUT_STATE_UNSPECIFIED"),
7974 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
7975 Self::Cancelling => std::option::Option::Some("CANCELLING"),
7976 Self::Cancelled => std::option::Option::Some("CANCELLED"),
7977 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
7978 Self::UnknownValue(u) => u.0.name(),
7979 }
7980 }
7981 }
7982
7983 impl std::default::Default for RolloutState {
7984 fn default() -> Self {
7985 use std::convert::From;
7986 Self::from(0)
7987 }
7988 }
7989
7990 impl std::fmt::Display for RolloutState {
7991 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7992 wkt::internal::display_enum(f, self.name(), self.value())
7993 }
7994 }
7995
7996 impl std::convert::From<i32> for RolloutState {
7997 fn from(value: i32) -> Self {
7998 match value {
7999 0 => Self::Unspecified,
8000 1 => Self::InProgress,
8001 2 => Self::Cancelling,
8002 3 => Self::Cancelled,
8003 4 => Self::Succeeded,
8004 _ => Self::UnknownValue(rollout_state::UnknownValue(
8005 wkt::internal::UnknownEnumValue::Integer(value),
8006 )),
8007 }
8008 }
8009 }
8010
8011 impl std::convert::From<&str> for RolloutState {
8012 fn from(value: &str) -> Self {
8013 use std::string::ToString;
8014 match value {
8015 "ROLLOUT_STATE_UNSPECIFIED" => Self::Unspecified,
8016 "IN_PROGRESS" => Self::InProgress,
8017 "CANCELLING" => Self::Cancelling,
8018 "CANCELLED" => Self::Cancelled,
8019 "SUCCEEDED" => Self::Succeeded,
8020 _ => Self::UnknownValue(rollout_state::UnknownValue(
8021 wkt::internal::UnknownEnumValue::String(value.to_string()),
8022 )),
8023 }
8024 }
8025 }
8026
8027 impl serde::ser::Serialize for RolloutState {
8028 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8029 where
8030 S: serde::Serializer,
8031 {
8032 match self {
8033 Self::Unspecified => serializer.serialize_i32(0),
8034 Self::InProgress => serializer.serialize_i32(1),
8035 Self::Cancelling => serializer.serialize_i32(2),
8036 Self::Cancelled => serializer.serialize_i32(3),
8037 Self::Succeeded => serializer.serialize_i32(4),
8038 Self::UnknownValue(u) => u.0.serialize(serializer),
8039 }
8040 }
8041 }
8042
8043 impl<'de> serde::de::Deserialize<'de> for RolloutState {
8044 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8045 where
8046 D: serde::Deserializer<'de>,
8047 {
8048 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RolloutState>::new(
8049 ".google.cloud.osconfig.v1.OSPolicyAssignment.RolloutState",
8050 ))
8051 }
8052 }
8053}
8054
8055/// OS policy assignment operation metadata provided by OS policy assignment API
8056/// methods that return long running operations.
8057#[derive(Clone, Default, PartialEq)]
8058#[non_exhaustive]
8059pub struct OSPolicyAssignmentOperationMetadata {
8060 /// Reference to the `OSPolicyAssignment` API resource.
8061 ///
8062 /// Format:
8063 /// `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
8064 pub os_policy_assignment: std::string::String,
8065
8066 /// The OS policy assignment API method.
8067 pub api_method: crate::model::os_policy_assignment_operation_metadata::APIMethod,
8068
8069 /// State of the rollout
8070 pub rollout_state: crate::model::os_policy_assignment_operation_metadata::RolloutState,
8071
8072 /// Rollout start time
8073 pub rollout_start_time: std::option::Option<wkt::Timestamp>,
8074
8075 /// Rollout update time
8076 pub rollout_update_time: std::option::Option<wkt::Timestamp>,
8077
8078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8079}
8080
8081impl OSPolicyAssignmentOperationMetadata {
8082 /// Creates a new default instance.
8083 pub fn new() -> Self {
8084 std::default::Default::default()
8085 }
8086
8087 /// Sets the value of [os_policy_assignment][crate::model::OSPolicyAssignmentOperationMetadata::os_policy_assignment].
8088 ///
8089 /// # Example
8090 /// ```ignore,no_run
8091 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8092 /// # let project_id = "project_id";
8093 /// # let location_id = "location_id";
8094 /// # let os_policy_assignment_id = "os_policy_assignment_id";
8095 /// let x = OSPolicyAssignmentOperationMetadata::new().set_os_policy_assignment(format!("projects/{project_id}/locations/{location_id}/osPolicyAssignments/{os_policy_assignment_id}"));
8096 /// ```
8097 pub fn set_os_policy_assignment<T: std::convert::Into<std::string::String>>(
8098 mut self,
8099 v: T,
8100 ) -> Self {
8101 self.os_policy_assignment = v.into();
8102 self
8103 }
8104
8105 /// Sets the value of [api_method][crate::model::OSPolicyAssignmentOperationMetadata::api_method].
8106 ///
8107 /// # Example
8108 /// ```ignore,no_run
8109 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8110 /// use google_cloud_osconfig_v1::model::os_policy_assignment_operation_metadata::APIMethod;
8111 /// let x0 = OSPolicyAssignmentOperationMetadata::new().set_api_method(APIMethod::Create);
8112 /// let x1 = OSPolicyAssignmentOperationMetadata::new().set_api_method(APIMethod::Update);
8113 /// let x2 = OSPolicyAssignmentOperationMetadata::new().set_api_method(APIMethod::Delete);
8114 /// ```
8115 pub fn set_api_method<
8116 T: std::convert::Into<crate::model::os_policy_assignment_operation_metadata::APIMethod>,
8117 >(
8118 mut self,
8119 v: T,
8120 ) -> Self {
8121 self.api_method = v.into();
8122 self
8123 }
8124
8125 /// Sets the value of [rollout_state][crate::model::OSPolicyAssignmentOperationMetadata::rollout_state].
8126 ///
8127 /// # Example
8128 /// ```ignore,no_run
8129 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8130 /// use google_cloud_osconfig_v1::model::os_policy_assignment_operation_metadata::RolloutState;
8131 /// let x0 = OSPolicyAssignmentOperationMetadata::new().set_rollout_state(RolloutState::InProgress);
8132 /// let x1 = OSPolicyAssignmentOperationMetadata::new().set_rollout_state(RolloutState::Cancelling);
8133 /// let x2 = OSPolicyAssignmentOperationMetadata::new().set_rollout_state(RolloutState::Cancelled);
8134 /// ```
8135 pub fn set_rollout_state<
8136 T: std::convert::Into<crate::model::os_policy_assignment_operation_metadata::RolloutState>,
8137 >(
8138 mut self,
8139 v: T,
8140 ) -> Self {
8141 self.rollout_state = v.into();
8142 self
8143 }
8144
8145 /// Sets the value of [rollout_start_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_start_time].
8146 ///
8147 /// # Example
8148 /// ```ignore,no_run
8149 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8150 /// use wkt::Timestamp;
8151 /// let x = OSPolicyAssignmentOperationMetadata::new().set_rollout_start_time(Timestamp::default()/* use setters */);
8152 /// ```
8153 pub fn set_rollout_start_time<T>(mut self, v: T) -> Self
8154 where
8155 T: std::convert::Into<wkt::Timestamp>,
8156 {
8157 self.rollout_start_time = std::option::Option::Some(v.into());
8158 self
8159 }
8160
8161 /// Sets or clears the value of [rollout_start_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_start_time].
8162 ///
8163 /// # Example
8164 /// ```ignore,no_run
8165 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8166 /// use wkt::Timestamp;
8167 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_start_time(Some(Timestamp::default()/* use setters */));
8168 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_start_time(None::<Timestamp>);
8169 /// ```
8170 pub fn set_or_clear_rollout_start_time<T>(mut self, v: std::option::Option<T>) -> Self
8171 where
8172 T: std::convert::Into<wkt::Timestamp>,
8173 {
8174 self.rollout_start_time = v.map(|x| x.into());
8175 self
8176 }
8177
8178 /// Sets the value of [rollout_update_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_update_time].
8179 ///
8180 /// # Example
8181 /// ```ignore,no_run
8182 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8183 /// use wkt::Timestamp;
8184 /// let x = OSPolicyAssignmentOperationMetadata::new().set_rollout_update_time(Timestamp::default()/* use setters */);
8185 /// ```
8186 pub fn set_rollout_update_time<T>(mut self, v: T) -> Self
8187 where
8188 T: std::convert::Into<wkt::Timestamp>,
8189 {
8190 self.rollout_update_time = std::option::Option::Some(v.into());
8191 self
8192 }
8193
8194 /// Sets or clears the value of [rollout_update_time][crate::model::OSPolicyAssignmentOperationMetadata::rollout_update_time].
8195 ///
8196 /// # Example
8197 /// ```ignore,no_run
8198 /// # use google_cloud_osconfig_v1::model::OSPolicyAssignmentOperationMetadata;
8199 /// use wkt::Timestamp;
8200 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_update_time(Some(Timestamp::default()/* use setters */));
8201 /// let x = OSPolicyAssignmentOperationMetadata::new().set_or_clear_rollout_update_time(None::<Timestamp>);
8202 /// ```
8203 pub fn set_or_clear_rollout_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8204 where
8205 T: std::convert::Into<wkt::Timestamp>,
8206 {
8207 self.rollout_update_time = v.map(|x| x.into());
8208 self
8209 }
8210}
8211
8212impl wkt::message::Message for OSPolicyAssignmentOperationMetadata {
8213 fn typename() -> &'static str {
8214 "type.googleapis.com/google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata"
8215 }
8216}
8217
8218/// Defines additional types related to [OSPolicyAssignmentOperationMetadata].
8219pub mod os_policy_assignment_operation_metadata {
8220 #[allow(unused_imports)]
8221 use super::*;
8222
8223 /// The OS policy assignment API method.
8224 ///
8225 /// # Working with unknown values
8226 ///
8227 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8228 /// additional enum variants at any time. Adding new variants is not considered
8229 /// a breaking change. Applications should write their code in anticipation of:
8230 ///
8231 /// - New values appearing in future releases of the client library, **and**
8232 /// - New values received dynamically, without application changes.
8233 ///
8234 /// Please consult the [Working with enums] section in the user guide for some
8235 /// guidelines.
8236 ///
8237 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8238 #[derive(Clone, Debug, PartialEq)]
8239 #[non_exhaustive]
8240 pub enum APIMethod {
8241 /// Invalid value
8242 Unspecified,
8243 /// Create OS policy assignment API method
8244 Create,
8245 /// Update OS policy assignment API method
8246 Update,
8247 /// Delete OS policy assignment API method
8248 Delete,
8249 /// If set, the enum was initialized with an unknown value.
8250 ///
8251 /// Applications can examine the value using [APIMethod::value] or
8252 /// [APIMethod::name].
8253 UnknownValue(api_method::UnknownValue),
8254 }
8255
8256 #[doc(hidden)]
8257 pub mod api_method {
8258 #[allow(unused_imports)]
8259 use super::*;
8260 #[derive(Clone, Debug, PartialEq)]
8261 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8262 }
8263
8264 impl APIMethod {
8265 /// Gets the enum value.
8266 ///
8267 /// Returns `None` if the enum contains an unknown value deserialized from
8268 /// the string representation of enums.
8269 pub fn value(&self) -> std::option::Option<i32> {
8270 match self {
8271 Self::Unspecified => std::option::Option::Some(0),
8272 Self::Create => std::option::Option::Some(1),
8273 Self::Update => std::option::Option::Some(2),
8274 Self::Delete => std::option::Option::Some(3),
8275 Self::UnknownValue(u) => u.0.value(),
8276 }
8277 }
8278
8279 /// Gets the enum value as a string.
8280 ///
8281 /// Returns `None` if the enum contains an unknown value deserialized from
8282 /// the integer representation of enums.
8283 pub fn name(&self) -> std::option::Option<&str> {
8284 match self {
8285 Self::Unspecified => std::option::Option::Some("API_METHOD_UNSPECIFIED"),
8286 Self::Create => std::option::Option::Some("CREATE"),
8287 Self::Update => std::option::Option::Some("UPDATE"),
8288 Self::Delete => std::option::Option::Some("DELETE"),
8289 Self::UnknownValue(u) => u.0.name(),
8290 }
8291 }
8292 }
8293
8294 impl std::default::Default for APIMethod {
8295 fn default() -> Self {
8296 use std::convert::From;
8297 Self::from(0)
8298 }
8299 }
8300
8301 impl std::fmt::Display for APIMethod {
8302 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8303 wkt::internal::display_enum(f, self.name(), self.value())
8304 }
8305 }
8306
8307 impl std::convert::From<i32> for APIMethod {
8308 fn from(value: i32) -> Self {
8309 match value {
8310 0 => Self::Unspecified,
8311 1 => Self::Create,
8312 2 => Self::Update,
8313 3 => Self::Delete,
8314 _ => Self::UnknownValue(api_method::UnknownValue(
8315 wkt::internal::UnknownEnumValue::Integer(value),
8316 )),
8317 }
8318 }
8319 }
8320
8321 impl std::convert::From<&str> for APIMethod {
8322 fn from(value: &str) -> Self {
8323 use std::string::ToString;
8324 match value {
8325 "API_METHOD_UNSPECIFIED" => Self::Unspecified,
8326 "CREATE" => Self::Create,
8327 "UPDATE" => Self::Update,
8328 "DELETE" => Self::Delete,
8329 _ => Self::UnknownValue(api_method::UnknownValue(
8330 wkt::internal::UnknownEnumValue::String(value.to_string()),
8331 )),
8332 }
8333 }
8334 }
8335
8336 impl serde::ser::Serialize for APIMethod {
8337 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8338 where
8339 S: serde::Serializer,
8340 {
8341 match self {
8342 Self::Unspecified => serializer.serialize_i32(0),
8343 Self::Create => serializer.serialize_i32(1),
8344 Self::Update => serializer.serialize_i32(2),
8345 Self::Delete => serializer.serialize_i32(3),
8346 Self::UnknownValue(u) => u.0.serialize(serializer),
8347 }
8348 }
8349 }
8350
8351 impl<'de> serde::de::Deserialize<'de> for APIMethod {
8352 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8353 where
8354 D: serde::Deserializer<'de>,
8355 {
8356 deserializer.deserialize_any(wkt::internal::EnumVisitor::<APIMethod>::new(
8357 ".google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata.APIMethod",
8358 ))
8359 }
8360 }
8361
8362 /// State of the rollout
8363 ///
8364 /// # Working with unknown values
8365 ///
8366 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8367 /// additional enum variants at any time. Adding new variants is not considered
8368 /// a breaking change. Applications should write their code in anticipation of:
8369 ///
8370 /// - New values appearing in future releases of the client library, **and**
8371 /// - New values received dynamically, without application changes.
8372 ///
8373 /// Please consult the [Working with enums] section in the user guide for some
8374 /// guidelines.
8375 ///
8376 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8377 #[derive(Clone, Debug, PartialEq)]
8378 #[non_exhaustive]
8379 pub enum RolloutState {
8380 /// Invalid value
8381 Unspecified,
8382 /// The rollout is in progress.
8383 InProgress,
8384 /// The rollout is being cancelled.
8385 Cancelling,
8386 /// The rollout is cancelled.
8387 Cancelled,
8388 /// The rollout has completed successfully.
8389 Succeeded,
8390 /// If set, the enum was initialized with an unknown value.
8391 ///
8392 /// Applications can examine the value using [RolloutState::value] or
8393 /// [RolloutState::name].
8394 UnknownValue(rollout_state::UnknownValue),
8395 }
8396
8397 #[doc(hidden)]
8398 pub mod rollout_state {
8399 #[allow(unused_imports)]
8400 use super::*;
8401 #[derive(Clone, Debug, PartialEq)]
8402 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8403 }
8404
8405 impl RolloutState {
8406 /// Gets the enum value.
8407 ///
8408 /// Returns `None` if the enum contains an unknown value deserialized from
8409 /// the string representation of enums.
8410 pub fn value(&self) -> std::option::Option<i32> {
8411 match self {
8412 Self::Unspecified => std::option::Option::Some(0),
8413 Self::InProgress => std::option::Option::Some(1),
8414 Self::Cancelling => std::option::Option::Some(2),
8415 Self::Cancelled => std::option::Option::Some(3),
8416 Self::Succeeded => std::option::Option::Some(4),
8417 Self::UnknownValue(u) => u.0.value(),
8418 }
8419 }
8420
8421 /// Gets the enum value as a string.
8422 ///
8423 /// Returns `None` if the enum contains an unknown value deserialized from
8424 /// the integer representation of enums.
8425 pub fn name(&self) -> std::option::Option<&str> {
8426 match self {
8427 Self::Unspecified => std::option::Option::Some("ROLLOUT_STATE_UNSPECIFIED"),
8428 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
8429 Self::Cancelling => std::option::Option::Some("CANCELLING"),
8430 Self::Cancelled => std::option::Option::Some("CANCELLED"),
8431 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
8432 Self::UnknownValue(u) => u.0.name(),
8433 }
8434 }
8435 }
8436
8437 impl std::default::Default for RolloutState {
8438 fn default() -> Self {
8439 use std::convert::From;
8440 Self::from(0)
8441 }
8442 }
8443
8444 impl std::fmt::Display for RolloutState {
8445 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8446 wkt::internal::display_enum(f, self.name(), self.value())
8447 }
8448 }
8449
8450 impl std::convert::From<i32> for RolloutState {
8451 fn from(value: i32) -> Self {
8452 match value {
8453 0 => Self::Unspecified,
8454 1 => Self::InProgress,
8455 2 => Self::Cancelling,
8456 3 => Self::Cancelled,
8457 4 => Self::Succeeded,
8458 _ => Self::UnknownValue(rollout_state::UnknownValue(
8459 wkt::internal::UnknownEnumValue::Integer(value),
8460 )),
8461 }
8462 }
8463 }
8464
8465 impl std::convert::From<&str> for RolloutState {
8466 fn from(value: &str) -> Self {
8467 use std::string::ToString;
8468 match value {
8469 "ROLLOUT_STATE_UNSPECIFIED" => Self::Unspecified,
8470 "IN_PROGRESS" => Self::InProgress,
8471 "CANCELLING" => Self::Cancelling,
8472 "CANCELLED" => Self::Cancelled,
8473 "SUCCEEDED" => Self::Succeeded,
8474 _ => Self::UnknownValue(rollout_state::UnknownValue(
8475 wkt::internal::UnknownEnumValue::String(value.to_string()),
8476 )),
8477 }
8478 }
8479 }
8480
8481 impl serde::ser::Serialize for RolloutState {
8482 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8483 where
8484 S: serde::Serializer,
8485 {
8486 match self {
8487 Self::Unspecified => serializer.serialize_i32(0),
8488 Self::InProgress => serializer.serialize_i32(1),
8489 Self::Cancelling => serializer.serialize_i32(2),
8490 Self::Cancelled => serializer.serialize_i32(3),
8491 Self::Succeeded => serializer.serialize_i32(4),
8492 Self::UnknownValue(u) => u.0.serialize(serializer),
8493 }
8494 }
8495 }
8496
8497 impl<'de> serde::de::Deserialize<'de> for RolloutState {
8498 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8499 where
8500 D: serde::Deserializer<'de>,
8501 {
8502 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RolloutState>::new(
8503 ".google.cloud.osconfig.v1.OSPolicyAssignmentOperationMetadata.RolloutState",
8504 ))
8505 }
8506 }
8507}
8508
8509/// A request message to create an OS policy assignment
8510#[derive(Clone, Default, PartialEq)]
8511#[non_exhaustive]
8512pub struct CreateOSPolicyAssignmentRequest {
8513 /// Required. The parent resource name in the form:
8514 /// projects/{project}/locations/{location}
8515 pub parent: std::string::String,
8516
8517 /// Required. The OS policy assignment to be created.
8518 pub os_policy_assignment: std::option::Option<crate::model::OSPolicyAssignment>,
8519
8520 /// Required. The logical name of the OS policy assignment in the project
8521 /// with the following restrictions:
8522 ///
8523 /// * Must contain only lowercase letters, numbers, and hyphens.
8524 /// * Must start with a letter.
8525 /// * Must be between 1-63 characters.
8526 /// * Must end with a number or a letter.
8527 /// * Must be unique within the project.
8528 pub os_policy_assignment_id: std::string::String,
8529
8530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8531}
8532
8533impl CreateOSPolicyAssignmentRequest {
8534 /// Creates a new default instance.
8535 pub fn new() -> Self {
8536 std::default::Default::default()
8537 }
8538
8539 /// Sets the value of [parent][crate::model::CreateOSPolicyAssignmentRequest::parent].
8540 ///
8541 /// # Example
8542 /// ```ignore,no_run
8543 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8544 /// let x = CreateOSPolicyAssignmentRequest::new().set_parent("example");
8545 /// ```
8546 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8547 self.parent = v.into();
8548 self
8549 }
8550
8551 /// Sets the value of [os_policy_assignment][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment].
8552 ///
8553 /// # Example
8554 /// ```ignore,no_run
8555 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8556 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8557 /// let x = CreateOSPolicyAssignmentRequest::new().set_os_policy_assignment(OSPolicyAssignment::default()/* use setters */);
8558 /// ```
8559 pub fn set_os_policy_assignment<T>(mut self, v: T) -> Self
8560 where
8561 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8562 {
8563 self.os_policy_assignment = std::option::Option::Some(v.into());
8564 self
8565 }
8566
8567 /// Sets or clears the value of [os_policy_assignment][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment].
8568 ///
8569 /// # Example
8570 /// ```ignore,no_run
8571 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8572 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8573 /// let x = CreateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(Some(OSPolicyAssignment::default()/* use setters */));
8574 /// let x = CreateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(None::<OSPolicyAssignment>);
8575 /// ```
8576 pub fn set_or_clear_os_policy_assignment<T>(mut self, v: std::option::Option<T>) -> Self
8577 where
8578 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8579 {
8580 self.os_policy_assignment = v.map(|x| x.into());
8581 self
8582 }
8583
8584 /// Sets the value of [os_policy_assignment_id][crate::model::CreateOSPolicyAssignmentRequest::os_policy_assignment_id].
8585 ///
8586 /// # Example
8587 /// ```ignore,no_run
8588 /// # use google_cloud_osconfig_v1::model::CreateOSPolicyAssignmentRequest;
8589 /// let x = CreateOSPolicyAssignmentRequest::new().set_os_policy_assignment_id("example");
8590 /// ```
8591 pub fn set_os_policy_assignment_id<T: std::convert::Into<std::string::String>>(
8592 mut self,
8593 v: T,
8594 ) -> Self {
8595 self.os_policy_assignment_id = v.into();
8596 self
8597 }
8598}
8599
8600impl wkt::message::Message for CreateOSPolicyAssignmentRequest {
8601 fn typename() -> &'static str {
8602 "type.googleapis.com/google.cloud.osconfig.v1.CreateOSPolicyAssignmentRequest"
8603 }
8604}
8605
8606/// A request message to update an OS policy assignment
8607#[derive(Clone, Default, PartialEq)]
8608#[non_exhaustive]
8609pub struct UpdateOSPolicyAssignmentRequest {
8610 /// Required. The updated OS policy assignment.
8611 pub os_policy_assignment: std::option::Option<crate::model::OSPolicyAssignment>,
8612
8613 /// Optional. Field mask that controls which fields of the assignment should be
8614 /// updated.
8615 pub update_mask: std::option::Option<wkt::FieldMask>,
8616
8617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8618}
8619
8620impl UpdateOSPolicyAssignmentRequest {
8621 /// Creates a new default instance.
8622 pub fn new() -> Self {
8623 std::default::Default::default()
8624 }
8625
8626 /// Sets the value of [os_policy_assignment][crate::model::UpdateOSPolicyAssignmentRequest::os_policy_assignment].
8627 ///
8628 /// # Example
8629 /// ```ignore,no_run
8630 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8631 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8632 /// let x = UpdateOSPolicyAssignmentRequest::new().set_os_policy_assignment(OSPolicyAssignment::default()/* use setters */);
8633 /// ```
8634 pub fn set_os_policy_assignment<T>(mut self, v: T) -> Self
8635 where
8636 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8637 {
8638 self.os_policy_assignment = std::option::Option::Some(v.into());
8639 self
8640 }
8641
8642 /// Sets or clears the value of [os_policy_assignment][crate::model::UpdateOSPolicyAssignmentRequest::os_policy_assignment].
8643 ///
8644 /// # Example
8645 /// ```ignore,no_run
8646 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8647 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8648 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(Some(OSPolicyAssignment::default()/* use setters */));
8649 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_os_policy_assignment(None::<OSPolicyAssignment>);
8650 /// ```
8651 pub fn set_or_clear_os_policy_assignment<T>(mut self, v: std::option::Option<T>) -> Self
8652 where
8653 T: std::convert::Into<crate::model::OSPolicyAssignment>,
8654 {
8655 self.os_policy_assignment = v.map(|x| x.into());
8656 self
8657 }
8658
8659 /// Sets the value of [update_mask][crate::model::UpdateOSPolicyAssignmentRequest::update_mask].
8660 ///
8661 /// # Example
8662 /// ```ignore,no_run
8663 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8664 /// use wkt::FieldMask;
8665 /// let x = UpdateOSPolicyAssignmentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
8666 /// ```
8667 pub fn set_update_mask<T>(mut self, v: T) -> Self
8668 where
8669 T: std::convert::Into<wkt::FieldMask>,
8670 {
8671 self.update_mask = std::option::Option::Some(v.into());
8672 self
8673 }
8674
8675 /// Sets or clears the value of [update_mask][crate::model::UpdateOSPolicyAssignmentRequest::update_mask].
8676 ///
8677 /// # Example
8678 /// ```ignore,no_run
8679 /// # use google_cloud_osconfig_v1::model::UpdateOSPolicyAssignmentRequest;
8680 /// use wkt::FieldMask;
8681 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
8682 /// let x = UpdateOSPolicyAssignmentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
8683 /// ```
8684 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8685 where
8686 T: std::convert::Into<wkt::FieldMask>,
8687 {
8688 self.update_mask = v.map(|x| x.into());
8689 self
8690 }
8691}
8692
8693impl wkt::message::Message for UpdateOSPolicyAssignmentRequest {
8694 fn typename() -> &'static str {
8695 "type.googleapis.com/google.cloud.osconfig.v1.UpdateOSPolicyAssignmentRequest"
8696 }
8697}
8698
8699/// A request message to get an OS policy assignment
8700#[derive(Clone, Default, PartialEq)]
8701#[non_exhaustive]
8702pub struct GetOSPolicyAssignmentRequest {
8703 /// Required. The resource name of OS policy assignment.
8704 ///
8705 /// Format:
8706 /// `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}`
8707 pub name: std::string::String,
8708
8709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8710}
8711
8712impl GetOSPolicyAssignmentRequest {
8713 /// Creates a new default instance.
8714 pub fn new() -> Self {
8715 std::default::Default::default()
8716 }
8717
8718 /// Sets the value of [name][crate::model::GetOSPolicyAssignmentRequest::name].
8719 ///
8720 /// # Example
8721 /// ```ignore,no_run
8722 /// # use google_cloud_osconfig_v1::model::GetOSPolicyAssignmentRequest;
8723 /// # let project_id = "project_id";
8724 /// # let location_id = "location_id";
8725 /// # let os_policy_assignment_id = "os_policy_assignment_id";
8726 /// let x = GetOSPolicyAssignmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/osPolicyAssignments/{os_policy_assignment_id}"));
8727 /// ```
8728 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8729 self.name = v.into();
8730 self
8731 }
8732}
8733
8734impl wkt::message::Message for GetOSPolicyAssignmentRequest {
8735 fn typename() -> &'static str {
8736 "type.googleapis.com/google.cloud.osconfig.v1.GetOSPolicyAssignmentRequest"
8737 }
8738}
8739
8740/// A request message to list OS policy assignments for a parent resource
8741#[derive(Clone, Default, PartialEq)]
8742#[non_exhaustive]
8743pub struct ListOSPolicyAssignmentsRequest {
8744 /// Required. The parent resource name.
8745 pub parent: std::string::String,
8746
8747 /// The maximum number of assignments to return.
8748 pub page_size: i32,
8749
8750 /// A pagination token returned from a previous call to
8751 /// `ListOSPolicyAssignments` that indicates where this listing should continue
8752 /// from.
8753 pub page_token: std::string::String,
8754
8755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8756}
8757
8758impl ListOSPolicyAssignmentsRequest {
8759 /// Creates a new default instance.
8760 pub fn new() -> Self {
8761 std::default::Default::default()
8762 }
8763
8764 /// Sets the value of [parent][crate::model::ListOSPolicyAssignmentsRequest::parent].
8765 ///
8766 /// # Example
8767 /// ```ignore,no_run
8768 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsRequest;
8769 /// let x = ListOSPolicyAssignmentsRequest::new().set_parent("example");
8770 /// ```
8771 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8772 self.parent = v.into();
8773 self
8774 }
8775
8776 /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentsRequest::page_size].
8777 ///
8778 /// # Example
8779 /// ```ignore,no_run
8780 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsRequest;
8781 /// let x = ListOSPolicyAssignmentsRequest::new().set_page_size(42);
8782 /// ```
8783 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8784 self.page_size = v.into();
8785 self
8786 }
8787
8788 /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentsRequest::page_token].
8789 ///
8790 /// # Example
8791 /// ```ignore,no_run
8792 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsRequest;
8793 /// let x = ListOSPolicyAssignmentsRequest::new().set_page_token("example");
8794 /// ```
8795 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8796 self.page_token = v.into();
8797 self
8798 }
8799}
8800
8801impl wkt::message::Message for ListOSPolicyAssignmentsRequest {
8802 fn typename() -> &'static str {
8803 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentsRequest"
8804 }
8805}
8806
8807/// A response message for listing all assignments under given parent.
8808#[derive(Clone, Default, PartialEq)]
8809#[non_exhaustive]
8810pub struct ListOSPolicyAssignmentsResponse {
8811 /// The list of assignments
8812 pub os_policy_assignments: std::vec::Vec<crate::model::OSPolicyAssignment>,
8813
8814 /// The pagination token to retrieve the next page of OS policy assignments.
8815 pub next_page_token: std::string::String,
8816
8817 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8818}
8819
8820impl ListOSPolicyAssignmentsResponse {
8821 /// Creates a new default instance.
8822 pub fn new() -> Self {
8823 std::default::Default::default()
8824 }
8825
8826 /// Sets the value of [os_policy_assignments][crate::model::ListOSPolicyAssignmentsResponse::os_policy_assignments].
8827 ///
8828 /// # Example
8829 /// ```ignore,no_run
8830 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsResponse;
8831 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8832 /// let x = ListOSPolicyAssignmentsResponse::new()
8833 /// .set_os_policy_assignments([
8834 /// OSPolicyAssignment::default()/* use setters */,
8835 /// OSPolicyAssignment::default()/* use (different) setters */,
8836 /// ]);
8837 /// ```
8838 pub fn set_os_policy_assignments<T, V>(mut self, v: T) -> Self
8839 where
8840 T: std::iter::IntoIterator<Item = V>,
8841 V: std::convert::Into<crate::model::OSPolicyAssignment>,
8842 {
8843 use std::iter::Iterator;
8844 self.os_policy_assignments = v.into_iter().map(|i| i.into()).collect();
8845 self
8846 }
8847
8848 /// Sets the value of [next_page_token][crate::model::ListOSPolicyAssignmentsResponse::next_page_token].
8849 ///
8850 /// # Example
8851 /// ```ignore,no_run
8852 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentsResponse;
8853 /// let x = ListOSPolicyAssignmentsResponse::new().set_next_page_token("example");
8854 /// ```
8855 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8856 self.next_page_token = v.into();
8857 self
8858 }
8859}
8860
8861impl wkt::message::Message for ListOSPolicyAssignmentsResponse {
8862 fn typename() -> &'static str {
8863 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentsResponse"
8864 }
8865}
8866
8867#[doc(hidden)]
8868impl google_cloud_gax::paginator::internal::PageableResponse for ListOSPolicyAssignmentsResponse {
8869 type PageItem = crate::model::OSPolicyAssignment;
8870
8871 fn items(self) -> std::vec::Vec<Self::PageItem> {
8872 self.os_policy_assignments
8873 }
8874
8875 fn next_page_token(&self) -> std::string::String {
8876 use std::clone::Clone;
8877 self.next_page_token.clone()
8878 }
8879}
8880
8881/// A request message to list revisions for a OS policy assignment
8882#[derive(Clone, Default, PartialEq)]
8883#[non_exhaustive]
8884pub struct ListOSPolicyAssignmentRevisionsRequest {
8885 /// Required. The name of the OS policy assignment to list revisions for.
8886 pub name: std::string::String,
8887
8888 /// The maximum number of revisions to return.
8889 pub page_size: i32,
8890
8891 /// A pagination token returned from a previous call to
8892 /// `ListOSPolicyAssignmentRevisions` that indicates where this listing should
8893 /// continue from.
8894 pub page_token: std::string::String,
8895
8896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8897}
8898
8899impl ListOSPolicyAssignmentRevisionsRequest {
8900 /// Creates a new default instance.
8901 pub fn new() -> Self {
8902 std::default::Default::default()
8903 }
8904
8905 /// Sets the value of [name][crate::model::ListOSPolicyAssignmentRevisionsRequest::name].
8906 ///
8907 /// # Example
8908 /// ```ignore,no_run
8909 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsRequest;
8910 /// # let project_id = "project_id";
8911 /// # let location_id = "location_id";
8912 /// # let os_policy_assignment_id = "os_policy_assignment_id";
8913 /// let x = ListOSPolicyAssignmentRevisionsRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/osPolicyAssignments/{os_policy_assignment_id}"));
8914 /// ```
8915 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8916 self.name = v.into();
8917 self
8918 }
8919
8920 /// Sets the value of [page_size][crate::model::ListOSPolicyAssignmentRevisionsRequest::page_size].
8921 ///
8922 /// # Example
8923 /// ```ignore,no_run
8924 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsRequest;
8925 /// let x = ListOSPolicyAssignmentRevisionsRequest::new().set_page_size(42);
8926 /// ```
8927 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8928 self.page_size = v.into();
8929 self
8930 }
8931
8932 /// Sets the value of [page_token][crate::model::ListOSPolicyAssignmentRevisionsRequest::page_token].
8933 ///
8934 /// # Example
8935 /// ```ignore,no_run
8936 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsRequest;
8937 /// let x = ListOSPolicyAssignmentRevisionsRequest::new().set_page_token("example");
8938 /// ```
8939 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8940 self.page_token = v.into();
8941 self
8942 }
8943}
8944
8945impl wkt::message::Message for ListOSPolicyAssignmentRevisionsRequest {
8946 fn typename() -> &'static str {
8947 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsRequest"
8948 }
8949}
8950
8951/// A response message for listing all revisions for a OS policy assignment.
8952#[derive(Clone, Default, PartialEq)]
8953#[non_exhaustive]
8954pub struct ListOSPolicyAssignmentRevisionsResponse {
8955 /// The OS policy assignment revisions
8956 pub os_policy_assignments: std::vec::Vec<crate::model::OSPolicyAssignment>,
8957
8958 /// The pagination token to retrieve the next page of OS policy assignment
8959 /// revisions.
8960 pub next_page_token: std::string::String,
8961
8962 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8963}
8964
8965impl ListOSPolicyAssignmentRevisionsResponse {
8966 /// Creates a new default instance.
8967 pub fn new() -> Self {
8968 std::default::Default::default()
8969 }
8970
8971 /// Sets the value of [os_policy_assignments][crate::model::ListOSPolicyAssignmentRevisionsResponse::os_policy_assignments].
8972 ///
8973 /// # Example
8974 /// ```ignore,no_run
8975 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsResponse;
8976 /// use google_cloud_osconfig_v1::model::OSPolicyAssignment;
8977 /// let x = ListOSPolicyAssignmentRevisionsResponse::new()
8978 /// .set_os_policy_assignments([
8979 /// OSPolicyAssignment::default()/* use setters */,
8980 /// OSPolicyAssignment::default()/* use (different) setters */,
8981 /// ]);
8982 /// ```
8983 pub fn set_os_policy_assignments<T, V>(mut self, v: T) -> Self
8984 where
8985 T: std::iter::IntoIterator<Item = V>,
8986 V: std::convert::Into<crate::model::OSPolicyAssignment>,
8987 {
8988 use std::iter::Iterator;
8989 self.os_policy_assignments = v.into_iter().map(|i| i.into()).collect();
8990 self
8991 }
8992
8993 /// Sets the value of [next_page_token][crate::model::ListOSPolicyAssignmentRevisionsResponse::next_page_token].
8994 ///
8995 /// # Example
8996 /// ```ignore,no_run
8997 /// # use google_cloud_osconfig_v1::model::ListOSPolicyAssignmentRevisionsResponse;
8998 /// let x = ListOSPolicyAssignmentRevisionsResponse::new().set_next_page_token("example");
8999 /// ```
9000 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9001 self.next_page_token = v.into();
9002 self
9003 }
9004}
9005
9006impl wkt::message::Message for ListOSPolicyAssignmentRevisionsResponse {
9007 fn typename() -> &'static str {
9008 "type.googleapis.com/google.cloud.osconfig.v1.ListOSPolicyAssignmentRevisionsResponse"
9009 }
9010}
9011
9012#[doc(hidden)]
9013impl google_cloud_gax::paginator::internal::PageableResponse
9014 for ListOSPolicyAssignmentRevisionsResponse
9015{
9016 type PageItem = crate::model::OSPolicyAssignment;
9017
9018 fn items(self) -> std::vec::Vec<Self::PageItem> {
9019 self.os_policy_assignments
9020 }
9021
9022 fn next_page_token(&self) -> std::string::String {
9023 use std::clone::Clone;
9024 self.next_page_token.clone()
9025 }
9026}
9027
9028/// A request message for deleting a OS policy assignment.
9029#[derive(Clone, Default, PartialEq)]
9030#[non_exhaustive]
9031pub struct DeleteOSPolicyAssignmentRequest {
9032 /// Required. The name of the OS policy assignment to be deleted
9033 pub name: std::string::String,
9034
9035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9036}
9037
9038impl DeleteOSPolicyAssignmentRequest {
9039 /// Creates a new default instance.
9040 pub fn new() -> Self {
9041 std::default::Default::default()
9042 }
9043
9044 /// Sets the value of [name][crate::model::DeleteOSPolicyAssignmentRequest::name].
9045 ///
9046 /// # Example
9047 /// ```ignore,no_run
9048 /// # use google_cloud_osconfig_v1::model::DeleteOSPolicyAssignmentRequest;
9049 /// # let project_id = "project_id";
9050 /// # let location_id = "location_id";
9051 /// # let os_policy_assignment_id = "os_policy_assignment_id";
9052 /// let x = DeleteOSPolicyAssignmentRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/osPolicyAssignments/{os_policy_assignment_id}"));
9053 /// ```
9054 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9055 self.name = v.into();
9056 self
9057 }
9058}
9059
9060impl wkt::message::Message for DeleteOSPolicyAssignmentRequest {
9061 fn typename() -> &'static str {
9062 "type.googleapis.com/google.cloud.osconfig.v1.DeleteOSPolicyAssignmentRequest"
9063 }
9064}
9065
9066/// Message encapsulating a value that can be either absolute ("fixed") or
9067/// relative ("percent") to a value.
9068#[derive(Clone, Default, PartialEq)]
9069#[non_exhaustive]
9070pub struct FixedOrPercent {
9071 /// Type of the value.
9072 pub mode: std::option::Option<crate::model::fixed_or_percent::Mode>,
9073
9074 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9075}
9076
9077impl FixedOrPercent {
9078 /// Creates a new default instance.
9079 pub fn new() -> Self {
9080 std::default::Default::default()
9081 }
9082
9083 /// Sets the value of [mode][crate::model::FixedOrPercent::mode].
9084 ///
9085 /// Note that all the setters affecting `mode` are mutually
9086 /// exclusive.
9087 ///
9088 /// # Example
9089 /// ```ignore,no_run
9090 /// # use google_cloud_osconfig_v1::model::FixedOrPercent;
9091 /// use google_cloud_osconfig_v1::model::fixed_or_percent::Mode;
9092 /// let x = FixedOrPercent::new().set_mode(Some(Mode::Fixed(42)));
9093 /// ```
9094 pub fn set_mode<
9095 T: std::convert::Into<std::option::Option<crate::model::fixed_or_percent::Mode>>,
9096 >(
9097 mut self,
9098 v: T,
9099 ) -> Self {
9100 self.mode = v.into();
9101 self
9102 }
9103
9104 /// The value of [mode][crate::model::FixedOrPercent::mode]
9105 /// if it holds a `Fixed`, `None` if the field is not set or
9106 /// holds a different branch.
9107 pub fn fixed(&self) -> std::option::Option<&i32> {
9108 #[allow(unreachable_patterns)]
9109 self.mode.as_ref().and_then(|v| match v {
9110 crate::model::fixed_or_percent::Mode::Fixed(v) => std::option::Option::Some(v),
9111 _ => std::option::Option::None,
9112 })
9113 }
9114
9115 /// Sets the value of [mode][crate::model::FixedOrPercent::mode]
9116 /// to hold a `Fixed`.
9117 ///
9118 /// Note that all the setters affecting `mode` are
9119 /// mutually exclusive.
9120 ///
9121 /// # Example
9122 /// ```ignore,no_run
9123 /// # use google_cloud_osconfig_v1::model::FixedOrPercent;
9124 /// let x = FixedOrPercent::new().set_fixed(42);
9125 /// assert!(x.fixed().is_some());
9126 /// assert!(x.percent().is_none());
9127 /// ```
9128 pub fn set_fixed<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9129 self.mode =
9130 std::option::Option::Some(crate::model::fixed_or_percent::Mode::Fixed(v.into()));
9131 self
9132 }
9133
9134 /// The value of [mode][crate::model::FixedOrPercent::mode]
9135 /// if it holds a `Percent`, `None` if the field is not set or
9136 /// holds a different branch.
9137 pub fn percent(&self) -> std::option::Option<&i32> {
9138 #[allow(unreachable_patterns)]
9139 self.mode.as_ref().and_then(|v| match v {
9140 crate::model::fixed_or_percent::Mode::Percent(v) => std::option::Option::Some(v),
9141 _ => std::option::Option::None,
9142 })
9143 }
9144
9145 /// Sets the value of [mode][crate::model::FixedOrPercent::mode]
9146 /// to hold a `Percent`.
9147 ///
9148 /// Note that all the setters affecting `mode` are
9149 /// mutually exclusive.
9150 ///
9151 /// # Example
9152 /// ```ignore,no_run
9153 /// # use google_cloud_osconfig_v1::model::FixedOrPercent;
9154 /// let x = FixedOrPercent::new().set_percent(42);
9155 /// assert!(x.percent().is_some());
9156 /// assert!(x.fixed().is_none());
9157 /// ```
9158 pub fn set_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9159 self.mode =
9160 std::option::Option::Some(crate::model::fixed_or_percent::Mode::Percent(v.into()));
9161 self
9162 }
9163}
9164
9165impl wkt::message::Message for FixedOrPercent {
9166 fn typename() -> &'static str {
9167 "type.googleapis.com/google.cloud.osconfig.v1.FixedOrPercent"
9168 }
9169}
9170
9171/// Defines additional types related to [FixedOrPercent].
9172pub mod fixed_or_percent {
9173 #[allow(unused_imports)]
9174 use super::*;
9175
9176 /// Type of the value.
9177 #[derive(Clone, Debug, PartialEq)]
9178 #[non_exhaustive]
9179 pub enum Mode {
9180 /// Specifies a fixed value.
9181 Fixed(i32),
9182 /// Specifies the relative value defined as a percentage, which will be
9183 /// multiplied by a reference value.
9184 Percent(i32),
9185 }
9186}
9187
9188/// Patch deployments are configurations that individual patch jobs use to
9189/// complete a patch. These configurations include instance filter, package
9190/// repository settings, and a schedule. For more information about creating and
9191/// managing patch deployments, see [Scheduling patch
9192/// jobs](https://cloud.google.com/compute/docs/os-patch-management/schedule-patch-jobs).
9193#[derive(Clone, Default, PartialEq)]
9194#[non_exhaustive]
9195pub struct PatchDeployment {
9196 /// Unique name for the patch deployment resource in a project. The patch
9197 /// deployment name is in the form:
9198 /// `projects/{project_id}/patchDeployments/{patch_deployment_id}`.
9199 /// This field is ignored when you create a new patch deployment.
9200 pub name: std::string::String,
9201
9202 /// Optional. Description of the patch deployment. Length of the description is
9203 /// limited to 1024 characters.
9204 pub description: std::string::String,
9205
9206 /// Required. VM instances to patch.
9207 pub instance_filter: std::option::Option<crate::model::PatchInstanceFilter>,
9208
9209 /// Optional. Patch configuration that is applied.
9210 pub patch_config: std::option::Option<crate::model::PatchConfig>,
9211
9212 /// Optional. Duration of the patch. After the duration ends, the patch times
9213 /// out.
9214 pub duration: std::option::Option<wkt::Duration>,
9215
9216 /// Output only. Time the patch deployment was created. Timestamp is in
9217 /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
9218 pub create_time: std::option::Option<wkt::Timestamp>,
9219
9220 /// Output only. Time the patch deployment was last updated. Timestamp is in
9221 /// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
9222 pub update_time: std::option::Option<wkt::Timestamp>,
9223
9224 /// Output only. The last time a patch job was started by this deployment.
9225 /// Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text
9226 /// format.
9227 pub last_execute_time: std::option::Option<wkt::Timestamp>,
9228
9229 /// Optional. Rollout strategy of the patch job.
9230 pub rollout: std::option::Option<crate::model::PatchRollout>,
9231
9232 /// Output only. Current state of the patch deployment.
9233 pub state: crate::model::patch_deployment::State,
9234
9235 /// Schedule for the patch.
9236 pub schedule: std::option::Option<crate::model::patch_deployment::Schedule>,
9237
9238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9239}
9240
9241impl PatchDeployment {
9242 /// Creates a new default instance.
9243 pub fn new() -> Self {
9244 std::default::Default::default()
9245 }
9246
9247 /// Sets the value of [name][crate::model::PatchDeployment::name].
9248 ///
9249 /// # Example
9250 /// ```ignore,no_run
9251 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9252 /// # let project_id = "project_id";
9253 /// # let patch_deployment_id = "patch_deployment_id";
9254 /// let x = PatchDeployment::new().set_name(format!("projects/{project_id}/patchDeployments/{patch_deployment_id}"));
9255 /// ```
9256 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9257 self.name = v.into();
9258 self
9259 }
9260
9261 /// Sets the value of [description][crate::model::PatchDeployment::description].
9262 ///
9263 /// # Example
9264 /// ```ignore,no_run
9265 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9266 /// let x = PatchDeployment::new().set_description("example");
9267 /// ```
9268 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9269 self.description = v.into();
9270 self
9271 }
9272
9273 /// Sets the value of [instance_filter][crate::model::PatchDeployment::instance_filter].
9274 ///
9275 /// # Example
9276 /// ```ignore,no_run
9277 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9278 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
9279 /// let x = PatchDeployment::new().set_instance_filter(PatchInstanceFilter::default()/* use setters */);
9280 /// ```
9281 pub fn set_instance_filter<T>(mut self, v: T) -> Self
9282 where
9283 T: std::convert::Into<crate::model::PatchInstanceFilter>,
9284 {
9285 self.instance_filter = std::option::Option::Some(v.into());
9286 self
9287 }
9288
9289 /// Sets or clears the value of [instance_filter][crate::model::PatchDeployment::instance_filter].
9290 ///
9291 /// # Example
9292 /// ```ignore,no_run
9293 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9294 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
9295 /// let x = PatchDeployment::new().set_or_clear_instance_filter(Some(PatchInstanceFilter::default()/* use setters */));
9296 /// let x = PatchDeployment::new().set_or_clear_instance_filter(None::<PatchInstanceFilter>);
9297 /// ```
9298 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
9299 where
9300 T: std::convert::Into<crate::model::PatchInstanceFilter>,
9301 {
9302 self.instance_filter = v.map(|x| x.into());
9303 self
9304 }
9305
9306 /// Sets the value of [patch_config][crate::model::PatchDeployment::patch_config].
9307 ///
9308 /// # Example
9309 /// ```ignore,no_run
9310 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9311 /// use google_cloud_osconfig_v1::model::PatchConfig;
9312 /// let x = PatchDeployment::new().set_patch_config(PatchConfig::default()/* use setters */);
9313 /// ```
9314 pub fn set_patch_config<T>(mut self, v: T) -> Self
9315 where
9316 T: std::convert::Into<crate::model::PatchConfig>,
9317 {
9318 self.patch_config = std::option::Option::Some(v.into());
9319 self
9320 }
9321
9322 /// Sets or clears the value of [patch_config][crate::model::PatchDeployment::patch_config].
9323 ///
9324 /// # Example
9325 /// ```ignore,no_run
9326 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9327 /// use google_cloud_osconfig_v1::model::PatchConfig;
9328 /// let x = PatchDeployment::new().set_or_clear_patch_config(Some(PatchConfig::default()/* use setters */));
9329 /// let x = PatchDeployment::new().set_or_clear_patch_config(None::<PatchConfig>);
9330 /// ```
9331 pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
9332 where
9333 T: std::convert::Into<crate::model::PatchConfig>,
9334 {
9335 self.patch_config = v.map(|x| x.into());
9336 self
9337 }
9338
9339 /// Sets the value of [duration][crate::model::PatchDeployment::duration].
9340 ///
9341 /// # Example
9342 /// ```ignore,no_run
9343 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9344 /// use wkt::Duration;
9345 /// let x = PatchDeployment::new().set_duration(Duration::default()/* use setters */);
9346 /// ```
9347 pub fn set_duration<T>(mut self, v: T) -> Self
9348 where
9349 T: std::convert::Into<wkt::Duration>,
9350 {
9351 self.duration = std::option::Option::Some(v.into());
9352 self
9353 }
9354
9355 /// Sets or clears the value of [duration][crate::model::PatchDeployment::duration].
9356 ///
9357 /// # Example
9358 /// ```ignore,no_run
9359 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9360 /// use wkt::Duration;
9361 /// let x = PatchDeployment::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
9362 /// let x = PatchDeployment::new().set_or_clear_duration(None::<Duration>);
9363 /// ```
9364 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
9365 where
9366 T: std::convert::Into<wkt::Duration>,
9367 {
9368 self.duration = v.map(|x| x.into());
9369 self
9370 }
9371
9372 /// Sets the value of [create_time][crate::model::PatchDeployment::create_time].
9373 ///
9374 /// # Example
9375 /// ```ignore,no_run
9376 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9377 /// use wkt::Timestamp;
9378 /// let x = PatchDeployment::new().set_create_time(Timestamp::default()/* use setters */);
9379 /// ```
9380 pub fn set_create_time<T>(mut self, v: T) -> Self
9381 where
9382 T: std::convert::Into<wkt::Timestamp>,
9383 {
9384 self.create_time = std::option::Option::Some(v.into());
9385 self
9386 }
9387
9388 /// Sets or clears the value of [create_time][crate::model::PatchDeployment::create_time].
9389 ///
9390 /// # Example
9391 /// ```ignore,no_run
9392 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9393 /// use wkt::Timestamp;
9394 /// let x = PatchDeployment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9395 /// let x = PatchDeployment::new().set_or_clear_create_time(None::<Timestamp>);
9396 /// ```
9397 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9398 where
9399 T: std::convert::Into<wkt::Timestamp>,
9400 {
9401 self.create_time = v.map(|x| x.into());
9402 self
9403 }
9404
9405 /// Sets the value of [update_time][crate::model::PatchDeployment::update_time].
9406 ///
9407 /// # Example
9408 /// ```ignore,no_run
9409 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9410 /// use wkt::Timestamp;
9411 /// let x = PatchDeployment::new().set_update_time(Timestamp::default()/* use setters */);
9412 /// ```
9413 pub fn set_update_time<T>(mut self, v: T) -> Self
9414 where
9415 T: std::convert::Into<wkt::Timestamp>,
9416 {
9417 self.update_time = std::option::Option::Some(v.into());
9418 self
9419 }
9420
9421 /// Sets or clears the value of [update_time][crate::model::PatchDeployment::update_time].
9422 ///
9423 /// # Example
9424 /// ```ignore,no_run
9425 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9426 /// use wkt::Timestamp;
9427 /// let x = PatchDeployment::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
9428 /// let x = PatchDeployment::new().set_or_clear_update_time(None::<Timestamp>);
9429 /// ```
9430 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
9431 where
9432 T: std::convert::Into<wkt::Timestamp>,
9433 {
9434 self.update_time = v.map(|x| x.into());
9435 self
9436 }
9437
9438 /// Sets the value of [last_execute_time][crate::model::PatchDeployment::last_execute_time].
9439 ///
9440 /// # Example
9441 /// ```ignore,no_run
9442 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9443 /// use wkt::Timestamp;
9444 /// let x = PatchDeployment::new().set_last_execute_time(Timestamp::default()/* use setters */);
9445 /// ```
9446 pub fn set_last_execute_time<T>(mut self, v: T) -> Self
9447 where
9448 T: std::convert::Into<wkt::Timestamp>,
9449 {
9450 self.last_execute_time = std::option::Option::Some(v.into());
9451 self
9452 }
9453
9454 /// Sets or clears the value of [last_execute_time][crate::model::PatchDeployment::last_execute_time].
9455 ///
9456 /// # Example
9457 /// ```ignore,no_run
9458 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9459 /// use wkt::Timestamp;
9460 /// let x = PatchDeployment::new().set_or_clear_last_execute_time(Some(Timestamp::default()/* use setters */));
9461 /// let x = PatchDeployment::new().set_or_clear_last_execute_time(None::<Timestamp>);
9462 /// ```
9463 pub fn set_or_clear_last_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
9464 where
9465 T: std::convert::Into<wkt::Timestamp>,
9466 {
9467 self.last_execute_time = v.map(|x| x.into());
9468 self
9469 }
9470
9471 /// Sets the value of [rollout][crate::model::PatchDeployment::rollout].
9472 ///
9473 /// # Example
9474 /// ```ignore,no_run
9475 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9476 /// use google_cloud_osconfig_v1::model::PatchRollout;
9477 /// let x = PatchDeployment::new().set_rollout(PatchRollout::default()/* use setters */);
9478 /// ```
9479 pub fn set_rollout<T>(mut self, v: T) -> Self
9480 where
9481 T: std::convert::Into<crate::model::PatchRollout>,
9482 {
9483 self.rollout = std::option::Option::Some(v.into());
9484 self
9485 }
9486
9487 /// Sets or clears the value of [rollout][crate::model::PatchDeployment::rollout].
9488 ///
9489 /// # Example
9490 /// ```ignore,no_run
9491 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9492 /// use google_cloud_osconfig_v1::model::PatchRollout;
9493 /// let x = PatchDeployment::new().set_or_clear_rollout(Some(PatchRollout::default()/* use setters */));
9494 /// let x = PatchDeployment::new().set_or_clear_rollout(None::<PatchRollout>);
9495 /// ```
9496 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
9497 where
9498 T: std::convert::Into<crate::model::PatchRollout>,
9499 {
9500 self.rollout = v.map(|x| x.into());
9501 self
9502 }
9503
9504 /// Sets the value of [state][crate::model::PatchDeployment::state].
9505 ///
9506 /// # Example
9507 /// ```ignore,no_run
9508 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9509 /// use google_cloud_osconfig_v1::model::patch_deployment::State;
9510 /// let x0 = PatchDeployment::new().set_state(State::Active);
9511 /// let x1 = PatchDeployment::new().set_state(State::Paused);
9512 /// ```
9513 pub fn set_state<T: std::convert::Into<crate::model::patch_deployment::State>>(
9514 mut self,
9515 v: T,
9516 ) -> Self {
9517 self.state = v.into();
9518 self
9519 }
9520
9521 /// Sets the value of [schedule][crate::model::PatchDeployment::schedule].
9522 ///
9523 /// Note that all the setters affecting `schedule` are mutually
9524 /// exclusive.
9525 ///
9526 /// # Example
9527 /// ```ignore,no_run
9528 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9529 /// use google_cloud_osconfig_v1::model::OneTimeSchedule;
9530 /// let x = PatchDeployment::new().set_schedule(Some(
9531 /// google_cloud_osconfig_v1::model::patch_deployment::Schedule::OneTimeSchedule(OneTimeSchedule::default().into())));
9532 /// ```
9533 pub fn set_schedule<
9534 T: std::convert::Into<std::option::Option<crate::model::patch_deployment::Schedule>>,
9535 >(
9536 mut self,
9537 v: T,
9538 ) -> Self {
9539 self.schedule = v.into();
9540 self
9541 }
9542
9543 /// The value of [schedule][crate::model::PatchDeployment::schedule]
9544 /// if it holds a `OneTimeSchedule`, `None` if the field is not set or
9545 /// holds a different branch.
9546 pub fn one_time_schedule(
9547 &self,
9548 ) -> std::option::Option<&std::boxed::Box<crate::model::OneTimeSchedule>> {
9549 #[allow(unreachable_patterns)]
9550 self.schedule.as_ref().and_then(|v| match v {
9551 crate::model::patch_deployment::Schedule::OneTimeSchedule(v) => {
9552 std::option::Option::Some(v)
9553 }
9554 _ => std::option::Option::None,
9555 })
9556 }
9557
9558 /// Sets the value of [schedule][crate::model::PatchDeployment::schedule]
9559 /// to hold a `OneTimeSchedule`.
9560 ///
9561 /// Note that all the setters affecting `schedule` are
9562 /// mutually exclusive.
9563 ///
9564 /// # Example
9565 /// ```ignore,no_run
9566 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9567 /// use google_cloud_osconfig_v1::model::OneTimeSchedule;
9568 /// let x = PatchDeployment::new().set_one_time_schedule(OneTimeSchedule::default()/* use setters */);
9569 /// assert!(x.one_time_schedule().is_some());
9570 /// assert!(x.recurring_schedule().is_none());
9571 /// ```
9572 pub fn set_one_time_schedule<
9573 T: std::convert::Into<std::boxed::Box<crate::model::OneTimeSchedule>>,
9574 >(
9575 mut self,
9576 v: T,
9577 ) -> Self {
9578 self.schedule = std::option::Option::Some(
9579 crate::model::patch_deployment::Schedule::OneTimeSchedule(v.into()),
9580 );
9581 self
9582 }
9583
9584 /// The value of [schedule][crate::model::PatchDeployment::schedule]
9585 /// if it holds a `RecurringSchedule`, `None` if the field is not set or
9586 /// holds a different branch.
9587 pub fn recurring_schedule(
9588 &self,
9589 ) -> std::option::Option<&std::boxed::Box<crate::model::RecurringSchedule>> {
9590 #[allow(unreachable_patterns)]
9591 self.schedule.as_ref().and_then(|v| match v {
9592 crate::model::patch_deployment::Schedule::RecurringSchedule(v) => {
9593 std::option::Option::Some(v)
9594 }
9595 _ => std::option::Option::None,
9596 })
9597 }
9598
9599 /// Sets the value of [schedule][crate::model::PatchDeployment::schedule]
9600 /// to hold a `RecurringSchedule`.
9601 ///
9602 /// Note that all the setters affecting `schedule` are
9603 /// mutually exclusive.
9604 ///
9605 /// # Example
9606 /// ```ignore,no_run
9607 /// # use google_cloud_osconfig_v1::model::PatchDeployment;
9608 /// use google_cloud_osconfig_v1::model::RecurringSchedule;
9609 /// let x = PatchDeployment::new().set_recurring_schedule(RecurringSchedule::default()/* use setters */);
9610 /// assert!(x.recurring_schedule().is_some());
9611 /// assert!(x.one_time_schedule().is_none());
9612 /// ```
9613 pub fn set_recurring_schedule<
9614 T: std::convert::Into<std::boxed::Box<crate::model::RecurringSchedule>>,
9615 >(
9616 mut self,
9617 v: T,
9618 ) -> Self {
9619 self.schedule = std::option::Option::Some(
9620 crate::model::patch_deployment::Schedule::RecurringSchedule(v.into()),
9621 );
9622 self
9623 }
9624}
9625
9626impl wkt::message::Message for PatchDeployment {
9627 fn typename() -> &'static str {
9628 "type.googleapis.com/google.cloud.osconfig.v1.PatchDeployment"
9629 }
9630}
9631
9632/// Defines additional types related to [PatchDeployment].
9633pub mod patch_deployment {
9634 #[allow(unused_imports)]
9635 use super::*;
9636
9637 /// Represents state of patch peployment.
9638 ///
9639 /// # Working with unknown values
9640 ///
9641 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9642 /// additional enum variants at any time. Adding new variants is not considered
9643 /// a breaking change. Applications should write their code in anticipation of:
9644 ///
9645 /// - New values appearing in future releases of the client library, **and**
9646 /// - New values received dynamically, without application changes.
9647 ///
9648 /// Please consult the [Working with enums] section in the user guide for some
9649 /// guidelines.
9650 ///
9651 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9652 #[derive(Clone, Debug, PartialEq)]
9653 #[non_exhaustive]
9654 pub enum State {
9655 /// The default value. This value is used if the state is omitted.
9656 Unspecified,
9657 /// Active value means that patch deployment generates Patch Jobs.
9658 Active,
9659 /// Paused value means that patch deployment does not generate
9660 /// Patch jobs. Requires user action to move in and out from this state.
9661 Paused,
9662 /// If set, the enum was initialized with an unknown value.
9663 ///
9664 /// Applications can examine the value using [State::value] or
9665 /// [State::name].
9666 UnknownValue(state::UnknownValue),
9667 }
9668
9669 #[doc(hidden)]
9670 pub mod state {
9671 #[allow(unused_imports)]
9672 use super::*;
9673 #[derive(Clone, Debug, PartialEq)]
9674 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9675 }
9676
9677 impl State {
9678 /// Gets the enum value.
9679 ///
9680 /// Returns `None` if the enum contains an unknown value deserialized from
9681 /// the string representation of enums.
9682 pub fn value(&self) -> std::option::Option<i32> {
9683 match self {
9684 Self::Unspecified => std::option::Option::Some(0),
9685 Self::Active => std::option::Option::Some(1),
9686 Self::Paused => std::option::Option::Some(2),
9687 Self::UnknownValue(u) => u.0.value(),
9688 }
9689 }
9690
9691 /// Gets the enum value as a string.
9692 ///
9693 /// Returns `None` if the enum contains an unknown value deserialized from
9694 /// the integer representation of enums.
9695 pub fn name(&self) -> std::option::Option<&str> {
9696 match self {
9697 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9698 Self::Active => std::option::Option::Some("ACTIVE"),
9699 Self::Paused => std::option::Option::Some("PAUSED"),
9700 Self::UnknownValue(u) => u.0.name(),
9701 }
9702 }
9703 }
9704
9705 impl std::default::Default for State {
9706 fn default() -> Self {
9707 use std::convert::From;
9708 Self::from(0)
9709 }
9710 }
9711
9712 impl std::fmt::Display for State {
9713 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9714 wkt::internal::display_enum(f, self.name(), self.value())
9715 }
9716 }
9717
9718 impl std::convert::From<i32> for State {
9719 fn from(value: i32) -> Self {
9720 match value {
9721 0 => Self::Unspecified,
9722 1 => Self::Active,
9723 2 => Self::Paused,
9724 _ => Self::UnknownValue(state::UnknownValue(
9725 wkt::internal::UnknownEnumValue::Integer(value),
9726 )),
9727 }
9728 }
9729 }
9730
9731 impl std::convert::From<&str> for State {
9732 fn from(value: &str) -> Self {
9733 use std::string::ToString;
9734 match value {
9735 "STATE_UNSPECIFIED" => Self::Unspecified,
9736 "ACTIVE" => Self::Active,
9737 "PAUSED" => Self::Paused,
9738 _ => Self::UnknownValue(state::UnknownValue(
9739 wkt::internal::UnknownEnumValue::String(value.to_string()),
9740 )),
9741 }
9742 }
9743 }
9744
9745 impl serde::ser::Serialize for State {
9746 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9747 where
9748 S: serde::Serializer,
9749 {
9750 match self {
9751 Self::Unspecified => serializer.serialize_i32(0),
9752 Self::Active => serializer.serialize_i32(1),
9753 Self::Paused => serializer.serialize_i32(2),
9754 Self::UnknownValue(u) => u.0.serialize(serializer),
9755 }
9756 }
9757 }
9758
9759 impl<'de> serde::de::Deserialize<'de> for State {
9760 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9761 where
9762 D: serde::Deserializer<'de>,
9763 {
9764 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9765 ".google.cloud.osconfig.v1.PatchDeployment.State",
9766 ))
9767 }
9768 }
9769
9770 /// Schedule for the patch.
9771 #[derive(Clone, Debug, PartialEq)]
9772 #[non_exhaustive]
9773 pub enum Schedule {
9774 /// Required. Schedule a one-time execution.
9775 OneTimeSchedule(std::boxed::Box<crate::model::OneTimeSchedule>),
9776 /// Required. Schedule recurring executions.
9777 RecurringSchedule(std::boxed::Box<crate::model::RecurringSchedule>),
9778 }
9779}
9780
9781/// Sets the time for a one time patch deployment. Timestamp is in
9782/// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
9783#[derive(Clone, Default, PartialEq)]
9784#[non_exhaustive]
9785pub struct OneTimeSchedule {
9786 /// Required. The desired patch job execution time.
9787 pub execute_time: std::option::Option<wkt::Timestamp>,
9788
9789 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9790}
9791
9792impl OneTimeSchedule {
9793 /// Creates a new default instance.
9794 pub fn new() -> Self {
9795 std::default::Default::default()
9796 }
9797
9798 /// Sets the value of [execute_time][crate::model::OneTimeSchedule::execute_time].
9799 ///
9800 /// # Example
9801 /// ```ignore,no_run
9802 /// # use google_cloud_osconfig_v1::model::OneTimeSchedule;
9803 /// use wkt::Timestamp;
9804 /// let x = OneTimeSchedule::new().set_execute_time(Timestamp::default()/* use setters */);
9805 /// ```
9806 pub fn set_execute_time<T>(mut self, v: T) -> Self
9807 where
9808 T: std::convert::Into<wkt::Timestamp>,
9809 {
9810 self.execute_time = std::option::Option::Some(v.into());
9811 self
9812 }
9813
9814 /// Sets or clears the value of [execute_time][crate::model::OneTimeSchedule::execute_time].
9815 ///
9816 /// # Example
9817 /// ```ignore,no_run
9818 /// # use google_cloud_osconfig_v1::model::OneTimeSchedule;
9819 /// use wkt::Timestamp;
9820 /// let x = OneTimeSchedule::new().set_or_clear_execute_time(Some(Timestamp::default()/* use setters */));
9821 /// let x = OneTimeSchedule::new().set_or_clear_execute_time(None::<Timestamp>);
9822 /// ```
9823 pub fn set_or_clear_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
9824 where
9825 T: std::convert::Into<wkt::Timestamp>,
9826 {
9827 self.execute_time = v.map(|x| x.into());
9828 self
9829 }
9830}
9831
9832impl wkt::message::Message for OneTimeSchedule {
9833 fn typename() -> &'static str {
9834 "type.googleapis.com/google.cloud.osconfig.v1.OneTimeSchedule"
9835 }
9836}
9837
9838/// Sets the time for recurring patch deployments.
9839#[derive(Clone, Default, PartialEq)]
9840#[non_exhaustive]
9841pub struct RecurringSchedule {
9842 /// Required. Defines the time zone that `time_of_day` is relative to.
9843 /// The rules for daylight saving time are determined by the chosen time zone.
9844 pub time_zone: std::option::Option<google_cloud_type::model::TimeZone>,
9845
9846 /// Optional. The time that the recurring schedule becomes effective.
9847 /// Defaults to `create_time` of the patch deployment.
9848 pub start_time: std::option::Option<wkt::Timestamp>,
9849
9850 /// Optional. The end time at which a recurring patch deployment schedule is no
9851 /// longer active.
9852 pub end_time: std::option::Option<wkt::Timestamp>,
9853
9854 /// Required. Time of the day to run a recurring deployment.
9855 pub time_of_day: std::option::Option<google_cloud_type::model::TimeOfDay>,
9856
9857 /// Required. The frequency unit of this recurring schedule.
9858 pub frequency: crate::model::recurring_schedule::Frequency,
9859
9860 /// Output only. The time the last patch job ran successfully.
9861 pub last_execute_time: std::option::Option<wkt::Timestamp>,
9862
9863 /// Output only. The time the next patch job is scheduled to run.
9864 pub next_execute_time: std::option::Option<wkt::Timestamp>,
9865
9866 /// Configurations for this recurring schedule.
9867 /// Configurations must match frequency.
9868 pub schedule_config: std::option::Option<crate::model::recurring_schedule::ScheduleConfig>,
9869
9870 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9871}
9872
9873impl RecurringSchedule {
9874 /// Creates a new default instance.
9875 pub fn new() -> Self {
9876 std::default::Default::default()
9877 }
9878
9879 /// Sets the value of [time_zone][crate::model::RecurringSchedule::time_zone].
9880 ///
9881 /// # Example
9882 /// ```ignore,no_run
9883 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9884 /// use google_cloud_type::model::TimeZone;
9885 /// let x = RecurringSchedule::new().set_time_zone(TimeZone::default()/* use setters */);
9886 /// ```
9887 pub fn set_time_zone<T>(mut self, v: T) -> Self
9888 where
9889 T: std::convert::Into<google_cloud_type::model::TimeZone>,
9890 {
9891 self.time_zone = std::option::Option::Some(v.into());
9892 self
9893 }
9894
9895 /// Sets or clears the value of [time_zone][crate::model::RecurringSchedule::time_zone].
9896 ///
9897 /// # Example
9898 /// ```ignore,no_run
9899 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9900 /// use google_cloud_type::model::TimeZone;
9901 /// let x = RecurringSchedule::new().set_or_clear_time_zone(Some(TimeZone::default()/* use setters */));
9902 /// let x = RecurringSchedule::new().set_or_clear_time_zone(None::<TimeZone>);
9903 /// ```
9904 pub fn set_or_clear_time_zone<T>(mut self, v: std::option::Option<T>) -> Self
9905 where
9906 T: std::convert::Into<google_cloud_type::model::TimeZone>,
9907 {
9908 self.time_zone = v.map(|x| x.into());
9909 self
9910 }
9911
9912 /// Sets the value of [start_time][crate::model::RecurringSchedule::start_time].
9913 ///
9914 /// # Example
9915 /// ```ignore,no_run
9916 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9917 /// use wkt::Timestamp;
9918 /// let x = RecurringSchedule::new().set_start_time(Timestamp::default()/* use setters */);
9919 /// ```
9920 pub fn set_start_time<T>(mut self, v: T) -> Self
9921 where
9922 T: std::convert::Into<wkt::Timestamp>,
9923 {
9924 self.start_time = std::option::Option::Some(v.into());
9925 self
9926 }
9927
9928 /// Sets or clears the value of [start_time][crate::model::RecurringSchedule::start_time].
9929 ///
9930 /// # Example
9931 /// ```ignore,no_run
9932 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9933 /// use wkt::Timestamp;
9934 /// let x = RecurringSchedule::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
9935 /// let x = RecurringSchedule::new().set_or_clear_start_time(None::<Timestamp>);
9936 /// ```
9937 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
9938 where
9939 T: std::convert::Into<wkt::Timestamp>,
9940 {
9941 self.start_time = v.map(|x| x.into());
9942 self
9943 }
9944
9945 /// Sets the value of [end_time][crate::model::RecurringSchedule::end_time].
9946 ///
9947 /// # Example
9948 /// ```ignore,no_run
9949 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9950 /// use wkt::Timestamp;
9951 /// let x = RecurringSchedule::new().set_end_time(Timestamp::default()/* use setters */);
9952 /// ```
9953 pub fn set_end_time<T>(mut self, v: T) -> Self
9954 where
9955 T: std::convert::Into<wkt::Timestamp>,
9956 {
9957 self.end_time = std::option::Option::Some(v.into());
9958 self
9959 }
9960
9961 /// Sets or clears the value of [end_time][crate::model::RecurringSchedule::end_time].
9962 ///
9963 /// # Example
9964 /// ```ignore,no_run
9965 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9966 /// use wkt::Timestamp;
9967 /// let x = RecurringSchedule::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
9968 /// let x = RecurringSchedule::new().set_or_clear_end_time(None::<Timestamp>);
9969 /// ```
9970 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
9971 where
9972 T: std::convert::Into<wkt::Timestamp>,
9973 {
9974 self.end_time = v.map(|x| x.into());
9975 self
9976 }
9977
9978 /// Sets the value of [time_of_day][crate::model::RecurringSchedule::time_of_day].
9979 ///
9980 /// # Example
9981 /// ```ignore,no_run
9982 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9983 /// use google_cloud_type::model::TimeOfDay;
9984 /// let x = RecurringSchedule::new().set_time_of_day(TimeOfDay::default()/* use setters */);
9985 /// ```
9986 pub fn set_time_of_day<T>(mut self, v: T) -> Self
9987 where
9988 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
9989 {
9990 self.time_of_day = std::option::Option::Some(v.into());
9991 self
9992 }
9993
9994 /// Sets or clears the value of [time_of_day][crate::model::RecurringSchedule::time_of_day].
9995 ///
9996 /// # Example
9997 /// ```ignore,no_run
9998 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
9999 /// use google_cloud_type::model::TimeOfDay;
10000 /// let x = RecurringSchedule::new().set_or_clear_time_of_day(Some(TimeOfDay::default()/* use setters */));
10001 /// let x = RecurringSchedule::new().set_or_clear_time_of_day(None::<TimeOfDay>);
10002 /// ```
10003 pub fn set_or_clear_time_of_day<T>(mut self, v: std::option::Option<T>) -> Self
10004 where
10005 T: std::convert::Into<google_cloud_type::model::TimeOfDay>,
10006 {
10007 self.time_of_day = v.map(|x| x.into());
10008 self
10009 }
10010
10011 /// Sets the value of [frequency][crate::model::RecurringSchedule::frequency].
10012 ///
10013 /// # Example
10014 /// ```ignore,no_run
10015 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10016 /// use google_cloud_osconfig_v1::model::recurring_schedule::Frequency;
10017 /// let x0 = RecurringSchedule::new().set_frequency(Frequency::Weekly);
10018 /// let x1 = RecurringSchedule::new().set_frequency(Frequency::Monthly);
10019 /// let x2 = RecurringSchedule::new().set_frequency(Frequency::Daily);
10020 /// ```
10021 pub fn set_frequency<T: std::convert::Into<crate::model::recurring_schedule::Frequency>>(
10022 mut self,
10023 v: T,
10024 ) -> Self {
10025 self.frequency = v.into();
10026 self
10027 }
10028
10029 /// Sets the value of [last_execute_time][crate::model::RecurringSchedule::last_execute_time].
10030 ///
10031 /// # Example
10032 /// ```ignore,no_run
10033 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10034 /// use wkt::Timestamp;
10035 /// let x = RecurringSchedule::new().set_last_execute_time(Timestamp::default()/* use setters */);
10036 /// ```
10037 pub fn set_last_execute_time<T>(mut self, v: T) -> Self
10038 where
10039 T: std::convert::Into<wkt::Timestamp>,
10040 {
10041 self.last_execute_time = std::option::Option::Some(v.into());
10042 self
10043 }
10044
10045 /// Sets or clears the value of [last_execute_time][crate::model::RecurringSchedule::last_execute_time].
10046 ///
10047 /// # Example
10048 /// ```ignore,no_run
10049 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10050 /// use wkt::Timestamp;
10051 /// let x = RecurringSchedule::new().set_or_clear_last_execute_time(Some(Timestamp::default()/* use setters */));
10052 /// let x = RecurringSchedule::new().set_or_clear_last_execute_time(None::<Timestamp>);
10053 /// ```
10054 pub fn set_or_clear_last_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
10055 where
10056 T: std::convert::Into<wkt::Timestamp>,
10057 {
10058 self.last_execute_time = v.map(|x| x.into());
10059 self
10060 }
10061
10062 /// Sets the value of [next_execute_time][crate::model::RecurringSchedule::next_execute_time].
10063 ///
10064 /// # Example
10065 /// ```ignore,no_run
10066 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10067 /// use wkt::Timestamp;
10068 /// let x = RecurringSchedule::new().set_next_execute_time(Timestamp::default()/* use setters */);
10069 /// ```
10070 pub fn set_next_execute_time<T>(mut self, v: T) -> Self
10071 where
10072 T: std::convert::Into<wkt::Timestamp>,
10073 {
10074 self.next_execute_time = std::option::Option::Some(v.into());
10075 self
10076 }
10077
10078 /// Sets or clears the value of [next_execute_time][crate::model::RecurringSchedule::next_execute_time].
10079 ///
10080 /// # Example
10081 /// ```ignore,no_run
10082 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10083 /// use wkt::Timestamp;
10084 /// let x = RecurringSchedule::new().set_or_clear_next_execute_time(Some(Timestamp::default()/* use setters */));
10085 /// let x = RecurringSchedule::new().set_or_clear_next_execute_time(None::<Timestamp>);
10086 /// ```
10087 pub fn set_or_clear_next_execute_time<T>(mut self, v: std::option::Option<T>) -> Self
10088 where
10089 T: std::convert::Into<wkt::Timestamp>,
10090 {
10091 self.next_execute_time = v.map(|x| x.into());
10092 self
10093 }
10094
10095 /// Sets the value of [schedule_config][crate::model::RecurringSchedule::schedule_config].
10096 ///
10097 /// Note that all the setters affecting `schedule_config` are mutually
10098 /// exclusive.
10099 ///
10100 /// # Example
10101 /// ```ignore,no_run
10102 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10103 /// use google_cloud_osconfig_v1::model::WeeklySchedule;
10104 /// let x = RecurringSchedule::new().set_schedule_config(Some(
10105 /// google_cloud_osconfig_v1::model::recurring_schedule::ScheduleConfig::Weekly(WeeklySchedule::default().into())));
10106 /// ```
10107 pub fn set_schedule_config<
10108 T: std::convert::Into<std::option::Option<crate::model::recurring_schedule::ScheduleConfig>>,
10109 >(
10110 mut self,
10111 v: T,
10112 ) -> Self {
10113 self.schedule_config = v.into();
10114 self
10115 }
10116
10117 /// The value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10118 /// if it holds a `Weekly`, `None` if the field is not set or
10119 /// holds a different branch.
10120 pub fn weekly(&self) -> std::option::Option<&std::boxed::Box<crate::model::WeeklySchedule>> {
10121 #[allow(unreachable_patterns)]
10122 self.schedule_config.as_ref().and_then(|v| match v {
10123 crate::model::recurring_schedule::ScheduleConfig::Weekly(v) => {
10124 std::option::Option::Some(v)
10125 }
10126 _ => std::option::Option::None,
10127 })
10128 }
10129
10130 /// Sets the value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10131 /// to hold a `Weekly`.
10132 ///
10133 /// Note that all the setters affecting `schedule_config` are
10134 /// mutually exclusive.
10135 ///
10136 /// # Example
10137 /// ```ignore,no_run
10138 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10139 /// use google_cloud_osconfig_v1::model::WeeklySchedule;
10140 /// let x = RecurringSchedule::new().set_weekly(WeeklySchedule::default()/* use setters */);
10141 /// assert!(x.weekly().is_some());
10142 /// assert!(x.monthly().is_none());
10143 /// ```
10144 pub fn set_weekly<T: std::convert::Into<std::boxed::Box<crate::model::WeeklySchedule>>>(
10145 mut self,
10146 v: T,
10147 ) -> Self {
10148 self.schedule_config = std::option::Option::Some(
10149 crate::model::recurring_schedule::ScheduleConfig::Weekly(v.into()),
10150 );
10151 self
10152 }
10153
10154 /// The value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10155 /// if it holds a `Monthly`, `None` if the field is not set or
10156 /// holds a different branch.
10157 pub fn monthly(&self) -> std::option::Option<&std::boxed::Box<crate::model::MonthlySchedule>> {
10158 #[allow(unreachable_patterns)]
10159 self.schedule_config.as_ref().and_then(|v| match v {
10160 crate::model::recurring_schedule::ScheduleConfig::Monthly(v) => {
10161 std::option::Option::Some(v)
10162 }
10163 _ => std::option::Option::None,
10164 })
10165 }
10166
10167 /// Sets the value of [schedule_config][crate::model::RecurringSchedule::schedule_config]
10168 /// to hold a `Monthly`.
10169 ///
10170 /// Note that all the setters affecting `schedule_config` are
10171 /// mutually exclusive.
10172 ///
10173 /// # Example
10174 /// ```ignore,no_run
10175 /// # use google_cloud_osconfig_v1::model::RecurringSchedule;
10176 /// use google_cloud_osconfig_v1::model::MonthlySchedule;
10177 /// let x = RecurringSchedule::new().set_monthly(MonthlySchedule::default()/* use setters */);
10178 /// assert!(x.monthly().is_some());
10179 /// assert!(x.weekly().is_none());
10180 /// ```
10181 pub fn set_monthly<T: std::convert::Into<std::boxed::Box<crate::model::MonthlySchedule>>>(
10182 mut self,
10183 v: T,
10184 ) -> Self {
10185 self.schedule_config = std::option::Option::Some(
10186 crate::model::recurring_schedule::ScheduleConfig::Monthly(v.into()),
10187 );
10188 self
10189 }
10190}
10191
10192impl wkt::message::Message for RecurringSchedule {
10193 fn typename() -> &'static str {
10194 "type.googleapis.com/google.cloud.osconfig.v1.RecurringSchedule"
10195 }
10196}
10197
10198/// Defines additional types related to [RecurringSchedule].
10199pub mod recurring_schedule {
10200 #[allow(unused_imports)]
10201 use super::*;
10202
10203 /// Specifies the frequency of the recurring patch deployments.
10204 ///
10205 /// # Working with unknown values
10206 ///
10207 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10208 /// additional enum variants at any time. Adding new variants is not considered
10209 /// a breaking change. Applications should write their code in anticipation of:
10210 ///
10211 /// - New values appearing in future releases of the client library, **and**
10212 /// - New values received dynamically, without application changes.
10213 ///
10214 /// Please consult the [Working with enums] section in the user guide for some
10215 /// guidelines.
10216 ///
10217 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10218 #[derive(Clone, Debug, PartialEq)]
10219 #[non_exhaustive]
10220 pub enum Frequency {
10221 /// Invalid. A frequency must be specified.
10222 Unspecified,
10223 /// Indicates that the frequency of recurrence should be expressed in terms
10224 /// of weeks.
10225 Weekly,
10226 /// Indicates that the frequency of recurrence should be expressed in terms
10227 /// of months.
10228 Monthly,
10229 /// Indicates that the frequency of recurrence should be expressed in terms
10230 /// of days.
10231 Daily,
10232 /// If set, the enum was initialized with an unknown value.
10233 ///
10234 /// Applications can examine the value using [Frequency::value] or
10235 /// [Frequency::name].
10236 UnknownValue(frequency::UnknownValue),
10237 }
10238
10239 #[doc(hidden)]
10240 pub mod frequency {
10241 #[allow(unused_imports)]
10242 use super::*;
10243 #[derive(Clone, Debug, PartialEq)]
10244 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10245 }
10246
10247 impl Frequency {
10248 /// Gets the enum value.
10249 ///
10250 /// Returns `None` if the enum contains an unknown value deserialized from
10251 /// the string representation of enums.
10252 pub fn value(&self) -> std::option::Option<i32> {
10253 match self {
10254 Self::Unspecified => std::option::Option::Some(0),
10255 Self::Weekly => std::option::Option::Some(1),
10256 Self::Monthly => std::option::Option::Some(2),
10257 Self::Daily => std::option::Option::Some(3),
10258 Self::UnknownValue(u) => u.0.value(),
10259 }
10260 }
10261
10262 /// Gets the enum value as a string.
10263 ///
10264 /// Returns `None` if the enum contains an unknown value deserialized from
10265 /// the integer representation of enums.
10266 pub fn name(&self) -> std::option::Option<&str> {
10267 match self {
10268 Self::Unspecified => std::option::Option::Some("FREQUENCY_UNSPECIFIED"),
10269 Self::Weekly => std::option::Option::Some("WEEKLY"),
10270 Self::Monthly => std::option::Option::Some("MONTHLY"),
10271 Self::Daily => std::option::Option::Some("DAILY"),
10272 Self::UnknownValue(u) => u.0.name(),
10273 }
10274 }
10275 }
10276
10277 impl std::default::Default for Frequency {
10278 fn default() -> Self {
10279 use std::convert::From;
10280 Self::from(0)
10281 }
10282 }
10283
10284 impl std::fmt::Display for Frequency {
10285 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10286 wkt::internal::display_enum(f, self.name(), self.value())
10287 }
10288 }
10289
10290 impl std::convert::From<i32> for Frequency {
10291 fn from(value: i32) -> Self {
10292 match value {
10293 0 => Self::Unspecified,
10294 1 => Self::Weekly,
10295 2 => Self::Monthly,
10296 3 => Self::Daily,
10297 _ => Self::UnknownValue(frequency::UnknownValue(
10298 wkt::internal::UnknownEnumValue::Integer(value),
10299 )),
10300 }
10301 }
10302 }
10303
10304 impl std::convert::From<&str> for Frequency {
10305 fn from(value: &str) -> Self {
10306 use std::string::ToString;
10307 match value {
10308 "FREQUENCY_UNSPECIFIED" => Self::Unspecified,
10309 "WEEKLY" => Self::Weekly,
10310 "MONTHLY" => Self::Monthly,
10311 "DAILY" => Self::Daily,
10312 _ => Self::UnknownValue(frequency::UnknownValue(
10313 wkt::internal::UnknownEnumValue::String(value.to_string()),
10314 )),
10315 }
10316 }
10317 }
10318
10319 impl serde::ser::Serialize for Frequency {
10320 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10321 where
10322 S: serde::Serializer,
10323 {
10324 match self {
10325 Self::Unspecified => serializer.serialize_i32(0),
10326 Self::Weekly => serializer.serialize_i32(1),
10327 Self::Monthly => serializer.serialize_i32(2),
10328 Self::Daily => serializer.serialize_i32(3),
10329 Self::UnknownValue(u) => u.0.serialize(serializer),
10330 }
10331 }
10332 }
10333
10334 impl<'de> serde::de::Deserialize<'de> for Frequency {
10335 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10336 where
10337 D: serde::Deserializer<'de>,
10338 {
10339 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Frequency>::new(
10340 ".google.cloud.osconfig.v1.RecurringSchedule.Frequency",
10341 ))
10342 }
10343 }
10344
10345 /// Configurations for this recurring schedule.
10346 /// Configurations must match frequency.
10347 #[derive(Clone, Debug, PartialEq)]
10348 #[non_exhaustive]
10349 pub enum ScheduleConfig {
10350 /// Required. Schedule with weekly executions.
10351 Weekly(std::boxed::Box<crate::model::WeeklySchedule>),
10352 /// Required. Schedule with monthly executions.
10353 Monthly(std::boxed::Box<crate::model::MonthlySchedule>),
10354 }
10355}
10356
10357/// Represents a weekly schedule.
10358#[derive(Clone, Default, PartialEq)]
10359#[non_exhaustive]
10360pub struct WeeklySchedule {
10361 /// Required. Day of the week.
10362 pub day_of_week: google_cloud_type::model::DayOfWeek,
10363
10364 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10365}
10366
10367impl WeeklySchedule {
10368 /// Creates a new default instance.
10369 pub fn new() -> Self {
10370 std::default::Default::default()
10371 }
10372
10373 /// Sets the value of [day_of_week][crate::model::WeeklySchedule::day_of_week].
10374 ///
10375 /// # Example
10376 /// ```ignore,no_run
10377 /// # use google_cloud_osconfig_v1::model::WeeklySchedule;
10378 /// use google_cloud_type::model::DayOfWeek;
10379 /// let x0 = WeeklySchedule::new().set_day_of_week(DayOfWeek::Monday);
10380 /// let x1 = WeeklySchedule::new().set_day_of_week(DayOfWeek::Tuesday);
10381 /// let x2 = WeeklySchedule::new().set_day_of_week(DayOfWeek::Wednesday);
10382 /// ```
10383 pub fn set_day_of_week<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
10384 mut self,
10385 v: T,
10386 ) -> Self {
10387 self.day_of_week = v.into();
10388 self
10389 }
10390}
10391
10392impl wkt::message::Message for WeeklySchedule {
10393 fn typename() -> &'static str {
10394 "type.googleapis.com/google.cloud.osconfig.v1.WeeklySchedule"
10395 }
10396}
10397
10398/// Represents a monthly schedule. An example of a valid monthly schedule is
10399/// "on the third Tuesday of the month" or "on the 15th of the month".
10400#[derive(Clone, Default, PartialEq)]
10401#[non_exhaustive]
10402pub struct MonthlySchedule {
10403 /// One day in a month.
10404 pub day_of_month: std::option::Option<crate::model::monthly_schedule::DayOfMonth>,
10405
10406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10407}
10408
10409impl MonthlySchedule {
10410 /// Creates a new default instance.
10411 pub fn new() -> Self {
10412 std::default::Default::default()
10413 }
10414
10415 /// Sets the value of [day_of_month][crate::model::MonthlySchedule::day_of_month].
10416 ///
10417 /// Note that all the setters affecting `day_of_month` are mutually
10418 /// exclusive.
10419 ///
10420 /// # Example
10421 /// ```ignore,no_run
10422 /// # use google_cloud_osconfig_v1::model::MonthlySchedule;
10423 /// use google_cloud_osconfig_v1::model::monthly_schedule::DayOfMonth;
10424 /// let x = MonthlySchedule::new().set_day_of_month(Some(DayOfMonth::MonthDay(42)));
10425 /// ```
10426 pub fn set_day_of_month<
10427 T: std::convert::Into<std::option::Option<crate::model::monthly_schedule::DayOfMonth>>,
10428 >(
10429 mut self,
10430 v: T,
10431 ) -> Self {
10432 self.day_of_month = v.into();
10433 self
10434 }
10435
10436 /// The value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10437 /// if it holds a `WeekDayOfMonth`, `None` if the field is not set or
10438 /// holds a different branch.
10439 pub fn week_day_of_month(
10440 &self,
10441 ) -> std::option::Option<&std::boxed::Box<crate::model::WeekDayOfMonth>> {
10442 #[allow(unreachable_patterns)]
10443 self.day_of_month.as_ref().and_then(|v| match v {
10444 crate::model::monthly_schedule::DayOfMonth::WeekDayOfMonth(v) => {
10445 std::option::Option::Some(v)
10446 }
10447 _ => std::option::Option::None,
10448 })
10449 }
10450
10451 /// Sets the value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10452 /// to hold a `WeekDayOfMonth`.
10453 ///
10454 /// Note that all the setters affecting `day_of_month` are
10455 /// mutually exclusive.
10456 ///
10457 /// # Example
10458 /// ```ignore,no_run
10459 /// # use google_cloud_osconfig_v1::model::MonthlySchedule;
10460 /// use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10461 /// let x = MonthlySchedule::new().set_week_day_of_month(WeekDayOfMonth::default()/* use setters */);
10462 /// assert!(x.week_day_of_month().is_some());
10463 /// assert!(x.month_day().is_none());
10464 /// ```
10465 pub fn set_week_day_of_month<
10466 T: std::convert::Into<std::boxed::Box<crate::model::WeekDayOfMonth>>,
10467 >(
10468 mut self,
10469 v: T,
10470 ) -> Self {
10471 self.day_of_month = std::option::Option::Some(
10472 crate::model::monthly_schedule::DayOfMonth::WeekDayOfMonth(v.into()),
10473 );
10474 self
10475 }
10476
10477 /// The value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10478 /// if it holds a `MonthDay`, `None` if the field is not set or
10479 /// holds a different branch.
10480 pub fn month_day(&self) -> std::option::Option<&i32> {
10481 #[allow(unreachable_patterns)]
10482 self.day_of_month.as_ref().and_then(|v| match v {
10483 crate::model::monthly_schedule::DayOfMonth::MonthDay(v) => std::option::Option::Some(v),
10484 _ => std::option::Option::None,
10485 })
10486 }
10487
10488 /// Sets the value of [day_of_month][crate::model::MonthlySchedule::day_of_month]
10489 /// to hold a `MonthDay`.
10490 ///
10491 /// Note that all the setters affecting `day_of_month` are
10492 /// mutually exclusive.
10493 ///
10494 /// # Example
10495 /// ```ignore,no_run
10496 /// # use google_cloud_osconfig_v1::model::MonthlySchedule;
10497 /// let x = MonthlySchedule::new().set_month_day(42);
10498 /// assert!(x.month_day().is_some());
10499 /// assert!(x.week_day_of_month().is_none());
10500 /// ```
10501 pub fn set_month_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10502 self.day_of_month = std::option::Option::Some(
10503 crate::model::monthly_schedule::DayOfMonth::MonthDay(v.into()),
10504 );
10505 self
10506 }
10507}
10508
10509impl wkt::message::Message for MonthlySchedule {
10510 fn typename() -> &'static str {
10511 "type.googleapis.com/google.cloud.osconfig.v1.MonthlySchedule"
10512 }
10513}
10514
10515/// Defines additional types related to [MonthlySchedule].
10516pub mod monthly_schedule {
10517 #[allow(unused_imports)]
10518 use super::*;
10519
10520 /// One day in a month.
10521 #[derive(Clone, Debug, PartialEq)]
10522 #[non_exhaustive]
10523 pub enum DayOfMonth {
10524 /// Required. Week day in a month.
10525 WeekDayOfMonth(std::boxed::Box<crate::model::WeekDayOfMonth>),
10526 /// Required. One day of the month. 1-31 indicates the 1st to the 31st day.
10527 /// -1 indicates the last day of the month. Months without the target day
10528 /// will be skipped. For example, a schedule to run "every month on the 31st"
10529 /// will not run in February, April, June, etc.
10530 MonthDay(i32),
10531 }
10532}
10533
10534/// Represents one week day in a month. An example is "the 4th Sunday".
10535#[derive(Clone, Default, PartialEq)]
10536#[non_exhaustive]
10537pub struct WeekDayOfMonth {
10538 /// Required. Week number in a month. 1-4 indicates the 1st to 4th week of the
10539 /// month. -1 indicates the last week of the month.
10540 pub week_ordinal: i32,
10541
10542 /// Required. A day of the week.
10543 pub day_of_week: google_cloud_type::model::DayOfWeek,
10544
10545 /// Optional. Represents the number of days before or after the given week day
10546 /// of month that the patch deployment is scheduled for. For example if
10547 /// `week_ordinal` and `day_of_week` values point to the second day of the
10548 /// month and this `day_offset` value is set to `3`, the patch deployment takes
10549 /// place three days after the second Tuesday of the month. If this value is
10550 /// negative, for example -5, the patches are deployed five days before before
10551 /// the second Tuesday of the month. Allowed values are in range [-30, 30].
10552 pub day_offset: i32,
10553
10554 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10555}
10556
10557impl WeekDayOfMonth {
10558 /// Creates a new default instance.
10559 pub fn new() -> Self {
10560 std::default::Default::default()
10561 }
10562
10563 /// Sets the value of [week_ordinal][crate::model::WeekDayOfMonth::week_ordinal].
10564 ///
10565 /// # Example
10566 /// ```ignore,no_run
10567 /// # use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10568 /// let x = WeekDayOfMonth::new().set_week_ordinal(42);
10569 /// ```
10570 pub fn set_week_ordinal<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10571 self.week_ordinal = v.into();
10572 self
10573 }
10574
10575 /// Sets the value of [day_of_week][crate::model::WeekDayOfMonth::day_of_week].
10576 ///
10577 /// # Example
10578 /// ```ignore,no_run
10579 /// # use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10580 /// use google_cloud_type::model::DayOfWeek;
10581 /// let x0 = WeekDayOfMonth::new().set_day_of_week(DayOfWeek::Monday);
10582 /// let x1 = WeekDayOfMonth::new().set_day_of_week(DayOfWeek::Tuesday);
10583 /// let x2 = WeekDayOfMonth::new().set_day_of_week(DayOfWeek::Wednesday);
10584 /// ```
10585 pub fn set_day_of_week<T: std::convert::Into<google_cloud_type::model::DayOfWeek>>(
10586 mut self,
10587 v: T,
10588 ) -> Self {
10589 self.day_of_week = v.into();
10590 self
10591 }
10592
10593 /// Sets the value of [day_offset][crate::model::WeekDayOfMonth::day_offset].
10594 ///
10595 /// # Example
10596 /// ```ignore,no_run
10597 /// # use google_cloud_osconfig_v1::model::WeekDayOfMonth;
10598 /// let x = WeekDayOfMonth::new().set_day_offset(42);
10599 /// ```
10600 pub fn set_day_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10601 self.day_offset = v.into();
10602 self
10603 }
10604}
10605
10606impl wkt::message::Message for WeekDayOfMonth {
10607 fn typename() -> &'static str {
10608 "type.googleapis.com/google.cloud.osconfig.v1.WeekDayOfMonth"
10609 }
10610}
10611
10612/// A request message for creating a patch deployment.
10613#[derive(Clone, Default, PartialEq)]
10614#[non_exhaustive]
10615pub struct CreatePatchDeploymentRequest {
10616 /// Required. The project to apply this patch deployment to in the form
10617 /// `projects/*`.
10618 pub parent: std::string::String,
10619
10620 /// Required. A name for the patch deployment in the project. When creating a
10621 /// name the following rules apply:
10622 ///
10623 /// * Must contain only lowercase letters, numbers, and hyphens.
10624 /// * Must start with a letter.
10625 /// * Must be between 1-63 characters.
10626 /// * Must end with a number or a letter.
10627 /// * Must be unique within the project.
10628 pub patch_deployment_id: std::string::String,
10629
10630 /// Required. The patch deployment to create.
10631 pub patch_deployment: std::option::Option<crate::model::PatchDeployment>,
10632
10633 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10634}
10635
10636impl CreatePatchDeploymentRequest {
10637 /// Creates a new default instance.
10638 pub fn new() -> Self {
10639 std::default::Default::default()
10640 }
10641
10642 /// Sets the value of [parent][crate::model::CreatePatchDeploymentRequest::parent].
10643 ///
10644 /// # Example
10645 /// ```ignore,no_run
10646 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10647 /// let x = CreatePatchDeploymentRequest::new().set_parent("example");
10648 /// ```
10649 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10650 self.parent = v.into();
10651 self
10652 }
10653
10654 /// Sets the value of [patch_deployment_id][crate::model::CreatePatchDeploymentRequest::patch_deployment_id].
10655 ///
10656 /// # Example
10657 /// ```ignore,no_run
10658 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10659 /// let x = CreatePatchDeploymentRequest::new().set_patch_deployment_id("example");
10660 /// ```
10661 pub fn set_patch_deployment_id<T: std::convert::Into<std::string::String>>(
10662 mut self,
10663 v: T,
10664 ) -> Self {
10665 self.patch_deployment_id = v.into();
10666 self
10667 }
10668
10669 /// Sets the value of [patch_deployment][crate::model::CreatePatchDeploymentRequest::patch_deployment].
10670 ///
10671 /// # Example
10672 /// ```ignore,no_run
10673 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10674 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10675 /// let x = CreatePatchDeploymentRequest::new().set_patch_deployment(PatchDeployment::default()/* use setters */);
10676 /// ```
10677 pub fn set_patch_deployment<T>(mut self, v: T) -> Self
10678 where
10679 T: std::convert::Into<crate::model::PatchDeployment>,
10680 {
10681 self.patch_deployment = std::option::Option::Some(v.into());
10682 self
10683 }
10684
10685 /// Sets or clears the value of [patch_deployment][crate::model::CreatePatchDeploymentRequest::patch_deployment].
10686 ///
10687 /// # Example
10688 /// ```ignore,no_run
10689 /// # use google_cloud_osconfig_v1::model::CreatePatchDeploymentRequest;
10690 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10691 /// let x = CreatePatchDeploymentRequest::new().set_or_clear_patch_deployment(Some(PatchDeployment::default()/* use setters */));
10692 /// let x = CreatePatchDeploymentRequest::new().set_or_clear_patch_deployment(None::<PatchDeployment>);
10693 /// ```
10694 pub fn set_or_clear_patch_deployment<T>(mut self, v: std::option::Option<T>) -> Self
10695 where
10696 T: std::convert::Into<crate::model::PatchDeployment>,
10697 {
10698 self.patch_deployment = v.map(|x| x.into());
10699 self
10700 }
10701}
10702
10703impl wkt::message::Message for CreatePatchDeploymentRequest {
10704 fn typename() -> &'static str {
10705 "type.googleapis.com/google.cloud.osconfig.v1.CreatePatchDeploymentRequest"
10706 }
10707}
10708
10709/// A request message for retrieving a patch deployment.
10710#[derive(Clone, Default, PartialEq)]
10711#[non_exhaustive]
10712pub struct GetPatchDeploymentRequest {
10713 /// Required. The resource name of the patch deployment in the form
10714 /// `projects/*/patchDeployments/*`.
10715 pub name: std::string::String,
10716
10717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10718}
10719
10720impl GetPatchDeploymentRequest {
10721 /// Creates a new default instance.
10722 pub fn new() -> Self {
10723 std::default::Default::default()
10724 }
10725
10726 /// Sets the value of [name][crate::model::GetPatchDeploymentRequest::name].
10727 ///
10728 /// # Example
10729 /// ```ignore,no_run
10730 /// # use google_cloud_osconfig_v1::model::GetPatchDeploymentRequest;
10731 /// # let project_id = "project_id";
10732 /// # let patch_deployment_id = "patch_deployment_id";
10733 /// let x = GetPatchDeploymentRequest::new().set_name(format!("projects/{project_id}/patchDeployments/{patch_deployment_id}"));
10734 /// ```
10735 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10736 self.name = v.into();
10737 self
10738 }
10739}
10740
10741impl wkt::message::Message for GetPatchDeploymentRequest {
10742 fn typename() -> &'static str {
10743 "type.googleapis.com/google.cloud.osconfig.v1.GetPatchDeploymentRequest"
10744 }
10745}
10746
10747/// A request message for listing patch deployments.
10748#[derive(Clone, Default, PartialEq)]
10749#[non_exhaustive]
10750pub struct ListPatchDeploymentsRequest {
10751 /// Required. The resource name of the parent in the form `projects/*`.
10752 pub parent: std::string::String,
10753
10754 /// Optional. The maximum number of patch deployments to return. Default is
10755 /// 100.
10756 pub page_size: i32,
10757
10758 /// Optional. A pagination token returned from a previous call to
10759 /// ListPatchDeployments that indicates where this listing should continue
10760 /// from.
10761 pub page_token: std::string::String,
10762
10763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10764}
10765
10766impl ListPatchDeploymentsRequest {
10767 /// Creates a new default instance.
10768 pub fn new() -> Self {
10769 std::default::Default::default()
10770 }
10771
10772 /// Sets the value of [parent][crate::model::ListPatchDeploymentsRequest::parent].
10773 ///
10774 /// # Example
10775 /// ```ignore,no_run
10776 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsRequest;
10777 /// let x = ListPatchDeploymentsRequest::new().set_parent("example");
10778 /// ```
10779 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10780 self.parent = v.into();
10781 self
10782 }
10783
10784 /// Sets the value of [page_size][crate::model::ListPatchDeploymentsRequest::page_size].
10785 ///
10786 /// # Example
10787 /// ```ignore,no_run
10788 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsRequest;
10789 /// let x = ListPatchDeploymentsRequest::new().set_page_size(42);
10790 /// ```
10791 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10792 self.page_size = v.into();
10793 self
10794 }
10795
10796 /// Sets the value of [page_token][crate::model::ListPatchDeploymentsRequest::page_token].
10797 ///
10798 /// # Example
10799 /// ```ignore,no_run
10800 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsRequest;
10801 /// let x = ListPatchDeploymentsRequest::new().set_page_token("example");
10802 /// ```
10803 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10804 self.page_token = v.into();
10805 self
10806 }
10807}
10808
10809impl wkt::message::Message for ListPatchDeploymentsRequest {
10810 fn typename() -> &'static str {
10811 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchDeploymentsRequest"
10812 }
10813}
10814
10815/// A response message for listing patch deployments.
10816#[derive(Clone, Default, PartialEq)]
10817#[non_exhaustive]
10818pub struct ListPatchDeploymentsResponse {
10819 /// The list of patch deployments.
10820 pub patch_deployments: std::vec::Vec<crate::model::PatchDeployment>,
10821
10822 /// A pagination token that can be used to get the next page of patch
10823 /// deployments.
10824 pub next_page_token: std::string::String,
10825
10826 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10827}
10828
10829impl ListPatchDeploymentsResponse {
10830 /// Creates a new default instance.
10831 pub fn new() -> Self {
10832 std::default::Default::default()
10833 }
10834
10835 /// Sets the value of [patch_deployments][crate::model::ListPatchDeploymentsResponse::patch_deployments].
10836 ///
10837 /// # Example
10838 /// ```ignore,no_run
10839 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsResponse;
10840 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10841 /// let x = ListPatchDeploymentsResponse::new()
10842 /// .set_patch_deployments([
10843 /// PatchDeployment::default()/* use setters */,
10844 /// PatchDeployment::default()/* use (different) setters */,
10845 /// ]);
10846 /// ```
10847 pub fn set_patch_deployments<T, V>(mut self, v: T) -> Self
10848 where
10849 T: std::iter::IntoIterator<Item = V>,
10850 V: std::convert::Into<crate::model::PatchDeployment>,
10851 {
10852 use std::iter::Iterator;
10853 self.patch_deployments = v.into_iter().map(|i| i.into()).collect();
10854 self
10855 }
10856
10857 /// Sets the value of [next_page_token][crate::model::ListPatchDeploymentsResponse::next_page_token].
10858 ///
10859 /// # Example
10860 /// ```ignore,no_run
10861 /// # use google_cloud_osconfig_v1::model::ListPatchDeploymentsResponse;
10862 /// let x = ListPatchDeploymentsResponse::new().set_next_page_token("example");
10863 /// ```
10864 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10865 self.next_page_token = v.into();
10866 self
10867 }
10868}
10869
10870impl wkt::message::Message for ListPatchDeploymentsResponse {
10871 fn typename() -> &'static str {
10872 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchDeploymentsResponse"
10873 }
10874}
10875
10876#[doc(hidden)]
10877impl google_cloud_gax::paginator::internal::PageableResponse for ListPatchDeploymentsResponse {
10878 type PageItem = crate::model::PatchDeployment;
10879
10880 fn items(self) -> std::vec::Vec<Self::PageItem> {
10881 self.patch_deployments
10882 }
10883
10884 fn next_page_token(&self) -> std::string::String {
10885 use std::clone::Clone;
10886 self.next_page_token.clone()
10887 }
10888}
10889
10890/// A request message for deleting a patch deployment.
10891#[derive(Clone, Default, PartialEq)]
10892#[non_exhaustive]
10893pub struct DeletePatchDeploymentRequest {
10894 /// Required. The resource name of the patch deployment in the form
10895 /// `projects/*/patchDeployments/*`.
10896 pub name: std::string::String,
10897
10898 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10899}
10900
10901impl DeletePatchDeploymentRequest {
10902 /// Creates a new default instance.
10903 pub fn new() -> Self {
10904 std::default::Default::default()
10905 }
10906
10907 /// Sets the value of [name][crate::model::DeletePatchDeploymentRequest::name].
10908 ///
10909 /// # Example
10910 /// ```ignore,no_run
10911 /// # use google_cloud_osconfig_v1::model::DeletePatchDeploymentRequest;
10912 /// # let project_id = "project_id";
10913 /// # let patch_deployment_id = "patch_deployment_id";
10914 /// let x = DeletePatchDeploymentRequest::new().set_name(format!("projects/{project_id}/patchDeployments/{patch_deployment_id}"));
10915 /// ```
10916 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10917 self.name = v.into();
10918 self
10919 }
10920}
10921
10922impl wkt::message::Message for DeletePatchDeploymentRequest {
10923 fn typename() -> &'static str {
10924 "type.googleapis.com/google.cloud.osconfig.v1.DeletePatchDeploymentRequest"
10925 }
10926}
10927
10928/// A request message for updating a patch deployment.
10929#[derive(Clone, Default, PartialEq)]
10930#[non_exhaustive]
10931pub struct UpdatePatchDeploymentRequest {
10932 /// Required. The patch deployment to Update.
10933 pub patch_deployment: std::option::Option<crate::model::PatchDeployment>,
10934
10935 /// Optional. Field mask that controls which fields of the patch deployment
10936 /// should be updated.
10937 pub update_mask: std::option::Option<wkt::FieldMask>,
10938
10939 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10940}
10941
10942impl UpdatePatchDeploymentRequest {
10943 /// Creates a new default instance.
10944 pub fn new() -> Self {
10945 std::default::Default::default()
10946 }
10947
10948 /// Sets the value of [patch_deployment][crate::model::UpdatePatchDeploymentRequest::patch_deployment].
10949 ///
10950 /// # Example
10951 /// ```ignore,no_run
10952 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10953 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10954 /// let x = UpdatePatchDeploymentRequest::new().set_patch_deployment(PatchDeployment::default()/* use setters */);
10955 /// ```
10956 pub fn set_patch_deployment<T>(mut self, v: T) -> Self
10957 where
10958 T: std::convert::Into<crate::model::PatchDeployment>,
10959 {
10960 self.patch_deployment = std::option::Option::Some(v.into());
10961 self
10962 }
10963
10964 /// Sets or clears the value of [patch_deployment][crate::model::UpdatePatchDeploymentRequest::patch_deployment].
10965 ///
10966 /// # Example
10967 /// ```ignore,no_run
10968 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10969 /// use google_cloud_osconfig_v1::model::PatchDeployment;
10970 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_patch_deployment(Some(PatchDeployment::default()/* use setters */));
10971 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_patch_deployment(None::<PatchDeployment>);
10972 /// ```
10973 pub fn set_or_clear_patch_deployment<T>(mut self, v: std::option::Option<T>) -> Self
10974 where
10975 T: std::convert::Into<crate::model::PatchDeployment>,
10976 {
10977 self.patch_deployment = v.map(|x| x.into());
10978 self
10979 }
10980
10981 /// Sets the value of [update_mask][crate::model::UpdatePatchDeploymentRequest::update_mask].
10982 ///
10983 /// # Example
10984 /// ```ignore,no_run
10985 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
10986 /// use wkt::FieldMask;
10987 /// let x = UpdatePatchDeploymentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10988 /// ```
10989 pub fn set_update_mask<T>(mut self, v: T) -> Self
10990 where
10991 T: std::convert::Into<wkt::FieldMask>,
10992 {
10993 self.update_mask = std::option::Option::Some(v.into());
10994 self
10995 }
10996
10997 /// Sets or clears the value of [update_mask][crate::model::UpdatePatchDeploymentRequest::update_mask].
10998 ///
10999 /// # Example
11000 /// ```ignore,no_run
11001 /// # use google_cloud_osconfig_v1::model::UpdatePatchDeploymentRequest;
11002 /// use wkt::FieldMask;
11003 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11004 /// let x = UpdatePatchDeploymentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11005 /// ```
11006 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11007 where
11008 T: std::convert::Into<wkt::FieldMask>,
11009 {
11010 self.update_mask = v.map(|x| x.into());
11011 self
11012 }
11013}
11014
11015impl wkt::message::Message for UpdatePatchDeploymentRequest {
11016 fn typename() -> &'static str {
11017 "type.googleapis.com/google.cloud.osconfig.v1.UpdatePatchDeploymentRequest"
11018 }
11019}
11020
11021/// A request message for pausing a patch deployment.
11022#[derive(Clone, Default, PartialEq)]
11023#[non_exhaustive]
11024pub struct PausePatchDeploymentRequest {
11025 /// Required. The resource name of the patch deployment in the form
11026 /// `projects/*/patchDeployments/*`.
11027 pub name: std::string::String,
11028
11029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11030}
11031
11032impl PausePatchDeploymentRequest {
11033 /// Creates a new default instance.
11034 pub fn new() -> Self {
11035 std::default::Default::default()
11036 }
11037
11038 /// Sets the value of [name][crate::model::PausePatchDeploymentRequest::name].
11039 ///
11040 /// # Example
11041 /// ```ignore,no_run
11042 /// # use google_cloud_osconfig_v1::model::PausePatchDeploymentRequest;
11043 /// # let project_id = "project_id";
11044 /// # let patch_deployment_id = "patch_deployment_id";
11045 /// let x = PausePatchDeploymentRequest::new().set_name(format!("projects/{project_id}/patchDeployments/{patch_deployment_id}"));
11046 /// ```
11047 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11048 self.name = v.into();
11049 self
11050 }
11051}
11052
11053impl wkt::message::Message for PausePatchDeploymentRequest {
11054 fn typename() -> &'static str {
11055 "type.googleapis.com/google.cloud.osconfig.v1.PausePatchDeploymentRequest"
11056 }
11057}
11058
11059/// A request message for resuming a patch deployment.
11060#[derive(Clone, Default, PartialEq)]
11061#[non_exhaustive]
11062pub struct ResumePatchDeploymentRequest {
11063 /// Required. The resource name of the patch deployment in the form
11064 /// `projects/*/patchDeployments/*`.
11065 pub name: std::string::String,
11066
11067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11068}
11069
11070impl ResumePatchDeploymentRequest {
11071 /// Creates a new default instance.
11072 pub fn new() -> Self {
11073 std::default::Default::default()
11074 }
11075
11076 /// Sets the value of [name][crate::model::ResumePatchDeploymentRequest::name].
11077 ///
11078 /// # Example
11079 /// ```ignore,no_run
11080 /// # use google_cloud_osconfig_v1::model::ResumePatchDeploymentRequest;
11081 /// # let project_id = "project_id";
11082 /// # let patch_deployment_id = "patch_deployment_id";
11083 /// let x = ResumePatchDeploymentRequest::new().set_name(format!("projects/{project_id}/patchDeployments/{patch_deployment_id}"));
11084 /// ```
11085 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11086 self.name = v.into();
11087 self
11088 }
11089}
11090
11091impl wkt::message::Message for ResumePatchDeploymentRequest {
11092 fn typename() -> &'static str {
11093 "type.googleapis.com/google.cloud.osconfig.v1.ResumePatchDeploymentRequest"
11094 }
11095}
11096
11097/// A request message to initiate patching across Compute Engine
11098/// instances.
11099#[derive(Clone, Default, PartialEq)]
11100#[non_exhaustive]
11101pub struct ExecutePatchJobRequest {
11102 /// Required. The project in which to run this patch in the form `projects/*`
11103 pub parent: std::string::String,
11104
11105 /// Description of the patch job. Length of the description is limited
11106 /// to 1024 characters.
11107 pub description: std::string::String,
11108
11109 /// Required. Instances to patch, either explicitly or filtered by some
11110 /// criteria such as zone or labels.
11111 pub instance_filter: std::option::Option<crate::model::PatchInstanceFilter>,
11112
11113 /// Patch configuration being applied. If omitted, instances are
11114 /// patched using the default configurations.
11115 pub patch_config: std::option::Option<crate::model::PatchConfig>,
11116
11117 /// Duration of the patch job. After the duration ends, the patch job
11118 /// times out.
11119 pub duration: std::option::Option<wkt::Duration>,
11120
11121 /// If this patch is a dry-run only, instances are contacted but
11122 /// will do nothing.
11123 pub dry_run: bool,
11124
11125 /// Display name for this patch job. This does not have to be unique.
11126 pub display_name: std::string::String,
11127
11128 /// Rollout strategy of the patch job.
11129 pub rollout: std::option::Option<crate::model::PatchRollout>,
11130
11131 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11132}
11133
11134impl ExecutePatchJobRequest {
11135 /// Creates a new default instance.
11136 pub fn new() -> Self {
11137 std::default::Default::default()
11138 }
11139
11140 /// Sets the value of [parent][crate::model::ExecutePatchJobRequest::parent].
11141 ///
11142 /// # Example
11143 /// ```ignore,no_run
11144 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11145 /// let x = ExecutePatchJobRequest::new().set_parent("example");
11146 /// ```
11147 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11148 self.parent = v.into();
11149 self
11150 }
11151
11152 /// Sets the value of [description][crate::model::ExecutePatchJobRequest::description].
11153 ///
11154 /// # Example
11155 /// ```ignore,no_run
11156 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11157 /// let x = ExecutePatchJobRequest::new().set_description("example");
11158 /// ```
11159 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11160 self.description = v.into();
11161 self
11162 }
11163
11164 /// Sets the value of [instance_filter][crate::model::ExecutePatchJobRequest::instance_filter].
11165 ///
11166 /// # Example
11167 /// ```ignore,no_run
11168 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11169 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11170 /// let x = ExecutePatchJobRequest::new().set_instance_filter(PatchInstanceFilter::default()/* use setters */);
11171 /// ```
11172 pub fn set_instance_filter<T>(mut self, v: T) -> Self
11173 where
11174 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11175 {
11176 self.instance_filter = std::option::Option::Some(v.into());
11177 self
11178 }
11179
11180 /// Sets or clears the value of [instance_filter][crate::model::ExecutePatchJobRequest::instance_filter].
11181 ///
11182 /// # Example
11183 /// ```ignore,no_run
11184 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11185 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11186 /// let x = ExecutePatchJobRequest::new().set_or_clear_instance_filter(Some(PatchInstanceFilter::default()/* use setters */));
11187 /// let x = ExecutePatchJobRequest::new().set_or_clear_instance_filter(None::<PatchInstanceFilter>);
11188 /// ```
11189 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
11190 where
11191 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11192 {
11193 self.instance_filter = v.map(|x| x.into());
11194 self
11195 }
11196
11197 /// Sets the value of [patch_config][crate::model::ExecutePatchJobRequest::patch_config].
11198 ///
11199 /// # Example
11200 /// ```ignore,no_run
11201 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11202 /// use google_cloud_osconfig_v1::model::PatchConfig;
11203 /// let x = ExecutePatchJobRequest::new().set_patch_config(PatchConfig::default()/* use setters */);
11204 /// ```
11205 pub fn set_patch_config<T>(mut self, v: T) -> Self
11206 where
11207 T: std::convert::Into<crate::model::PatchConfig>,
11208 {
11209 self.patch_config = std::option::Option::Some(v.into());
11210 self
11211 }
11212
11213 /// Sets or clears the value of [patch_config][crate::model::ExecutePatchJobRequest::patch_config].
11214 ///
11215 /// # Example
11216 /// ```ignore,no_run
11217 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11218 /// use google_cloud_osconfig_v1::model::PatchConfig;
11219 /// let x = ExecutePatchJobRequest::new().set_or_clear_patch_config(Some(PatchConfig::default()/* use setters */));
11220 /// let x = ExecutePatchJobRequest::new().set_or_clear_patch_config(None::<PatchConfig>);
11221 /// ```
11222 pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
11223 where
11224 T: std::convert::Into<crate::model::PatchConfig>,
11225 {
11226 self.patch_config = v.map(|x| x.into());
11227 self
11228 }
11229
11230 /// Sets the value of [duration][crate::model::ExecutePatchJobRequest::duration].
11231 ///
11232 /// # Example
11233 /// ```ignore,no_run
11234 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11235 /// use wkt::Duration;
11236 /// let x = ExecutePatchJobRequest::new().set_duration(Duration::default()/* use setters */);
11237 /// ```
11238 pub fn set_duration<T>(mut self, v: T) -> Self
11239 where
11240 T: std::convert::Into<wkt::Duration>,
11241 {
11242 self.duration = std::option::Option::Some(v.into());
11243 self
11244 }
11245
11246 /// Sets or clears the value of [duration][crate::model::ExecutePatchJobRequest::duration].
11247 ///
11248 /// # Example
11249 /// ```ignore,no_run
11250 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11251 /// use wkt::Duration;
11252 /// let x = ExecutePatchJobRequest::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
11253 /// let x = ExecutePatchJobRequest::new().set_or_clear_duration(None::<Duration>);
11254 /// ```
11255 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
11256 where
11257 T: std::convert::Into<wkt::Duration>,
11258 {
11259 self.duration = v.map(|x| x.into());
11260 self
11261 }
11262
11263 /// Sets the value of [dry_run][crate::model::ExecutePatchJobRequest::dry_run].
11264 ///
11265 /// # Example
11266 /// ```ignore,no_run
11267 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11268 /// let x = ExecutePatchJobRequest::new().set_dry_run(true);
11269 /// ```
11270 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11271 self.dry_run = v.into();
11272 self
11273 }
11274
11275 /// Sets the value of [display_name][crate::model::ExecutePatchJobRequest::display_name].
11276 ///
11277 /// # Example
11278 /// ```ignore,no_run
11279 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11280 /// let x = ExecutePatchJobRequest::new().set_display_name("example");
11281 /// ```
11282 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11283 self.display_name = v.into();
11284 self
11285 }
11286
11287 /// Sets the value of [rollout][crate::model::ExecutePatchJobRequest::rollout].
11288 ///
11289 /// # Example
11290 /// ```ignore,no_run
11291 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11292 /// use google_cloud_osconfig_v1::model::PatchRollout;
11293 /// let x = ExecutePatchJobRequest::new().set_rollout(PatchRollout::default()/* use setters */);
11294 /// ```
11295 pub fn set_rollout<T>(mut self, v: T) -> Self
11296 where
11297 T: std::convert::Into<crate::model::PatchRollout>,
11298 {
11299 self.rollout = std::option::Option::Some(v.into());
11300 self
11301 }
11302
11303 /// Sets or clears the value of [rollout][crate::model::ExecutePatchJobRequest::rollout].
11304 ///
11305 /// # Example
11306 /// ```ignore,no_run
11307 /// # use google_cloud_osconfig_v1::model::ExecutePatchJobRequest;
11308 /// use google_cloud_osconfig_v1::model::PatchRollout;
11309 /// let x = ExecutePatchJobRequest::new().set_or_clear_rollout(Some(PatchRollout::default()/* use setters */));
11310 /// let x = ExecutePatchJobRequest::new().set_or_clear_rollout(None::<PatchRollout>);
11311 /// ```
11312 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
11313 where
11314 T: std::convert::Into<crate::model::PatchRollout>,
11315 {
11316 self.rollout = v.map(|x| x.into());
11317 self
11318 }
11319}
11320
11321impl wkt::message::Message for ExecutePatchJobRequest {
11322 fn typename() -> &'static str {
11323 "type.googleapis.com/google.cloud.osconfig.v1.ExecutePatchJobRequest"
11324 }
11325}
11326
11327/// Request to get an active or completed patch job.
11328#[derive(Clone, Default, PartialEq)]
11329#[non_exhaustive]
11330pub struct GetPatchJobRequest {
11331 /// Required. Name of the patch in the form `projects/*/patchJobs/*`
11332 pub name: std::string::String,
11333
11334 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11335}
11336
11337impl GetPatchJobRequest {
11338 /// Creates a new default instance.
11339 pub fn new() -> Self {
11340 std::default::Default::default()
11341 }
11342
11343 /// Sets the value of [name][crate::model::GetPatchJobRequest::name].
11344 ///
11345 /// # Example
11346 /// ```ignore,no_run
11347 /// # use google_cloud_osconfig_v1::model::GetPatchJobRequest;
11348 /// # let project_id = "project_id";
11349 /// # let patch_job_id = "patch_job_id";
11350 /// let x = GetPatchJobRequest::new().set_name(format!("projects/{project_id}/patchJobs/{patch_job_id}"));
11351 /// ```
11352 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11353 self.name = v.into();
11354 self
11355 }
11356}
11357
11358impl wkt::message::Message for GetPatchJobRequest {
11359 fn typename() -> &'static str {
11360 "type.googleapis.com/google.cloud.osconfig.v1.GetPatchJobRequest"
11361 }
11362}
11363
11364/// Request to list details for all instances that are part of a patch job.
11365#[derive(Clone, Default, PartialEq)]
11366#[non_exhaustive]
11367pub struct ListPatchJobInstanceDetailsRequest {
11368 /// Required. The parent for the instances are in the form of
11369 /// `projects/*/patchJobs/*`.
11370 pub parent: std::string::String,
11371
11372 /// The maximum number of instance details records to return. Default is 100.
11373 pub page_size: i32,
11374
11375 /// A pagination token returned from a previous call
11376 /// that indicates where this listing should continue from.
11377 pub page_token: std::string::String,
11378
11379 /// A filter expression that filters results listed in the response. This
11380 /// field supports filtering results by instance zone, name, state, or
11381 /// `failure_reason`.
11382 pub filter: std::string::String,
11383
11384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11385}
11386
11387impl ListPatchJobInstanceDetailsRequest {
11388 /// Creates a new default instance.
11389 pub fn new() -> Self {
11390 std::default::Default::default()
11391 }
11392
11393 /// Sets the value of [parent][crate::model::ListPatchJobInstanceDetailsRequest::parent].
11394 ///
11395 /// # Example
11396 /// ```ignore,no_run
11397 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11398 /// # let project_id = "project_id";
11399 /// # let patch_job_id = "patch_job_id";
11400 /// let x = ListPatchJobInstanceDetailsRequest::new().set_parent(format!("projects/{project_id}/patchJobs/{patch_job_id}"));
11401 /// ```
11402 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11403 self.parent = v.into();
11404 self
11405 }
11406
11407 /// Sets the value of [page_size][crate::model::ListPatchJobInstanceDetailsRequest::page_size].
11408 ///
11409 /// # Example
11410 /// ```ignore,no_run
11411 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11412 /// let x = ListPatchJobInstanceDetailsRequest::new().set_page_size(42);
11413 /// ```
11414 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11415 self.page_size = v.into();
11416 self
11417 }
11418
11419 /// Sets the value of [page_token][crate::model::ListPatchJobInstanceDetailsRequest::page_token].
11420 ///
11421 /// # Example
11422 /// ```ignore,no_run
11423 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11424 /// let x = ListPatchJobInstanceDetailsRequest::new().set_page_token("example");
11425 /// ```
11426 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11427 self.page_token = v.into();
11428 self
11429 }
11430
11431 /// Sets the value of [filter][crate::model::ListPatchJobInstanceDetailsRequest::filter].
11432 ///
11433 /// # Example
11434 /// ```ignore,no_run
11435 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsRequest;
11436 /// let x = ListPatchJobInstanceDetailsRequest::new().set_filter("example");
11437 /// ```
11438 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11439 self.filter = v.into();
11440 self
11441 }
11442}
11443
11444impl wkt::message::Message for ListPatchJobInstanceDetailsRequest {
11445 fn typename() -> &'static str {
11446 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobInstanceDetailsRequest"
11447 }
11448}
11449
11450/// A response message for listing the instances details for a patch job.
11451#[derive(Clone, Default, PartialEq)]
11452#[non_exhaustive]
11453pub struct ListPatchJobInstanceDetailsResponse {
11454 /// A list of instance status.
11455 pub patch_job_instance_details: std::vec::Vec<crate::model::PatchJobInstanceDetails>,
11456
11457 /// A pagination token that can be used to get the next page of results.
11458 pub next_page_token: std::string::String,
11459
11460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11461}
11462
11463impl ListPatchJobInstanceDetailsResponse {
11464 /// Creates a new default instance.
11465 pub fn new() -> Self {
11466 std::default::Default::default()
11467 }
11468
11469 /// Sets the value of [patch_job_instance_details][crate::model::ListPatchJobInstanceDetailsResponse::patch_job_instance_details].
11470 ///
11471 /// # Example
11472 /// ```ignore,no_run
11473 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsResponse;
11474 /// use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11475 /// let x = ListPatchJobInstanceDetailsResponse::new()
11476 /// .set_patch_job_instance_details([
11477 /// PatchJobInstanceDetails::default()/* use setters */,
11478 /// PatchJobInstanceDetails::default()/* use (different) setters */,
11479 /// ]);
11480 /// ```
11481 pub fn set_patch_job_instance_details<T, V>(mut self, v: T) -> Self
11482 where
11483 T: std::iter::IntoIterator<Item = V>,
11484 V: std::convert::Into<crate::model::PatchJobInstanceDetails>,
11485 {
11486 use std::iter::Iterator;
11487 self.patch_job_instance_details = v.into_iter().map(|i| i.into()).collect();
11488 self
11489 }
11490
11491 /// Sets the value of [next_page_token][crate::model::ListPatchJobInstanceDetailsResponse::next_page_token].
11492 ///
11493 /// # Example
11494 /// ```ignore,no_run
11495 /// # use google_cloud_osconfig_v1::model::ListPatchJobInstanceDetailsResponse;
11496 /// let x = ListPatchJobInstanceDetailsResponse::new().set_next_page_token("example");
11497 /// ```
11498 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11499 self.next_page_token = v.into();
11500 self
11501 }
11502}
11503
11504impl wkt::message::Message for ListPatchJobInstanceDetailsResponse {
11505 fn typename() -> &'static str {
11506 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobInstanceDetailsResponse"
11507 }
11508}
11509
11510#[doc(hidden)]
11511impl google_cloud_gax::paginator::internal::PageableResponse
11512 for ListPatchJobInstanceDetailsResponse
11513{
11514 type PageItem = crate::model::PatchJobInstanceDetails;
11515
11516 fn items(self) -> std::vec::Vec<Self::PageItem> {
11517 self.patch_job_instance_details
11518 }
11519
11520 fn next_page_token(&self) -> std::string::String {
11521 use std::clone::Clone;
11522 self.next_page_token.clone()
11523 }
11524}
11525
11526/// Patch details for a VM instance. For more information about reviewing VM
11527/// instance details, see
11528/// [Listing all VM instance details for a specific patch
11529/// job](https://cloud.google.com/compute/docs/os-patch-management/manage-patch-jobs#list-instance-details).
11530#[derive(Clone, Default, PartialEq)]
11531#[non_exhaustive]
11532pub struct PatchJobInstanceDetails {
11533 /// The instance name in the form `projects/*/zones/*/instances/*`
11534 pub name: std::string::String,
11535
11536 /// The unique identifier for the instance. This identifier is
11537 /// defined by the server.
11538 pub instance_system_id: std::string::String,
11539
11540 /// Current state of instance patch.
11541 pub state: crate::model::instance::PatchState,
11542
11543 /// If the patch fails, this field provides the reason.
11544 pub failure_reason: std::string::String,
11545
11546 /// The number of times the agent that the agent attempts to apply the patch.
11547 pub attempt_count: i64,
11548
11549 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11550}
11551
11552impl PatchJobInstanceDetails {
11553 /// Creates a new default instance.
11554 pub fn new() -> Self {
11555 std::default::Default::default()
11556 }
11557
11558 /// Sets the value of [name][crate::model::PatchJobInstanceDetails::name].
11559 ///
11560 /// # Example
11561 /// ```ignore,no_run
11562 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11563 /// let x = PatchJobInstanceDetails::new().set_name("example");
11564 /// ```
11565 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11566 self.name = v.into();
11567 self
11568 }
11569
11570 /// Sets the value of [instance_system_id][crate::model::PatchJobInstanceDetails::instance_system_id].
11571 ///
11572 /// # Example
11573 /// ```ignore,no_run
11574 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11575 /// let x = PatchJobInstanceDetails::new().set_instance_system_id("example");
11576 /// ```
11577 pub fn set_instance_system_id<T: std::convert::Into<std::string::String>>(
11578 mut self,
11579 v: T,
11580 ) -> Self {
11581 self.instance_system_id = v.into();
11582 self
11583 }
11584
11585 /// Sets the value of [state][crate::model::PatchJobInstanceDetails::state].
11586 ///
11587 /// # Example
11588 /// ```ignore,no_run
11589 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11590 /// use google_cloud_osconfig_v1::model::instance::PatchState;
11591 /// let x0 = PatchJobInstanceDetails::new().set_state(PatchState::Pending);
11592 /// let x1 = PatchJobInstanceDetails::new().set_state(PatchState::Inactive);
11593 /// let x2 = PatchJobInstanceDetails::new().set_state(PatchState::Notified);
11594 /// ```
11595 pub fn set_state<T: std::convert::Into<crate::model::instance::PatchState>>(
11596 mut self,
11597 v: T,
11598 ) -> Self {
11599 self.state = v.into();
11600 self
11601 }
11602
11603 /// Sets the value of [failure_reason][crate::model::PatchJobInstanceDetails::failure_reason].
11604 ///
11605 /// # Example
11606 /// ```ignore,no_run
11607 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11608 /// let x = PatchJobInstanceDetails::new().set_failure_reason("example");
11609 /// ```
11610 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11611 self.failure_reason = v.into();
11612 self
11613 }
11614
11615 /// Sets the value of [attempt_count][crate::model::PatchJobInstanceDetails::attempt_count].
11616 ///
11617 /// # Example
11618 /// ```ignore,no_run
11619 /// # use google_cloud_osconfig_v1::model::PatchJobInstanceDetails;
11620 /// let x = PatchJobInstanceDetails::new().set_attempt_count(42);
11621 /// ```
11622 pub fn set_attempt_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11623 self.attempt_count = v.into();
11624 self
11625 }
11626}
11627
11628impl wkt::message::Message for PatchJobInstanceDetails {
11629 fn typename() -> &'static str {
11630 "type.googleapis.com/google.cloud.osconfig.v1.PatchJobInstanceDetails"
11631 }
11632}
11633
11634/// A request message for listing patch jobs.
11635#[derive(Clone, Default, PartialEq)]
11636#[non_exhaustive]
11637pub struct ListPatchJobsRequest {
11638 /// Required. In the form of `projects/*`
11639 pub parent: std::string::String,
11640
11641 /// The maximum number of instance status to return.
11642 pub page_size: i32,
11643
11644 /// A pagination token returned from a previous call
11645 /// that indicates where this listing should continue from.
11646 pub page_token: std::string::String,
11647
11648 /// If provided, this field specifies the criteria that must be met by patch
11649 /// jobs to be included in the response.
11650 /// Currently, filtering is only available on the patch_deployment field.
11651 pub filter: std::string::String,
11652
11653 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11654}
11655
11656impl ListPatchJobsRequest {
11657 /// Creates a new default instance.
11658 pub fn new() -> Self {
11659 std::default::Default::default()
11660 }
11661
11662 /// Sets the value of [parent][crate::model::ListPatchJobsRequest::parent].
11663 ///
11664 /// # Example
11665 /// ```ignore,no_run
11666 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11667 /// let x = ListPatchJobsRequest::new().set_parent("example");
11668 /// ```
11669 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11670 self.parent = v.into();
11671 self
11672 }
11673
11674 /// Sets the value of [page_size][crate::model::ListPatchJobsRequest::page_size].
11675 ///
11676 /// # Example
11677 /// ```ignore,no_run
11678 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11679 /// let x = ListPatchJobsRequest::new().set_page_size(42);
11680 /// ```
11681 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11682 self.page_size = v.into();
11683 self
11684 }
11685
11686 /// Sets the value of [page_token][crate::model::ListPatchJobsRequest::page_token].
11687 ///
11688 /// # Example
11689 /// ```ignore,no_run
11690 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11691 /// let x = ListPatchJobsRequest::new().set_page_token("example");
11692 /// ```
11693 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11694 self.page_token = v.into();
11695 self
11696 }
11697
11698 /// Sets the value of [filter][crate::model::ListPatchJobsRequest::filter].
11699 ///
11700 /// # Example
11701 /// ```ignore,no_run
11702 /// # use google_cloud_osconfig_v1::model::ListPatchJobsRequest;
11703 /// let x = ListPatchJobsRequest::new().set_filter("example");
11704 /// ```
11705 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11706 self.filter = v.into();
11707 self
11708 }
11709}
11710
11711impl wkt::message::Message for ListPatchJobsRequest {
11712 fn typename() -> &'static str {
11713 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobsRequest"
11714 }
11715}
11716
11717/// A response message for listing patch jobs.
11718#[derive(Clone, Default, PartialEq)]
11719#[non_exhaustive]
11720pub struct ListPatchJobsResponse {
11721 /// The list of patch jobs.
11722 pub patch_jobs: std::vec::Vec<crate::model::PatchJob>,
11723
11724 /// A pagination token that can be used to get the next page of results.
11725 pub next_page_token: std::string::String,
11726
11727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11728}
11729
11730impl ListPatchJobsResponse {
11731 /// Creates a new default instance.
11732 pub fn new() -> Self {
11733 std::default::Default::default()
11734 }
11735
11736 /// Sets the value of [patch_jobs][crate::model::ListPatchJobsResponse::patch_jobs].
11737 ///
11738 /// # Example
11739 /// ```ignore,no_run
11740 /// # use google_cloud_osconfig_v1::model::ListPatchJobsResponse;
11741 /// use google_cloud_osconfig_v1::model::PatchJob;
11742 /// let x = ListPatchJobsResponse::new()
11743 /// .set_patch_jobs([
11744 /// PatchJob::default()/* use setters */,
11745 /// PatchJob::default()/* use (different) setters */,
11746 /// ]);
11747 /// ```
11748 pub fn set_patch_jobs<T, V>(mut self, v: T) -> Self
11749 where
11750 T: std::iter::IntoIterator<Item = V>,
11751 V: std::convert::Into<crate::model::PatchJob>,
11752 {
11753 use std::iter::Iterator;
11754 self.patch_jobs = v.into_iter().map(|i| i.into()).collect();
11755 self
11756 }
11757
11758 /// Sets the value of [next_page_token][crate::model::ListPatchJobsResponse::next_page_token].
11759 ///
11760 /// # Example
11761 /// ```ignore,no_run
11762 /// # use google_cloud_osconfig_v1::model::ListPatchJobsResponse;
11763 /// let x = ListPatchJobsResponse::new().set_next_page_token("example");
11764 /// ```
11765 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11766 self.next_page_token = v.into();
11767 self
11768 }
11769}
11770
11771impl wkt::message::Message for ListPatchJobsResponse {
11772 fn typename() -> &'static str {
11773 "type.googleapis.com/google.cloud.osconfig.v1.ListPatchJobsResponse"
11774 }
11775}
11776
11777#[doc(hidden)]
11778impl google_cloud_gax::paginator::internal::PageableResponse for ListPatchJobsResponse {
11779 type PageItem = crate::model::PatchJob;
11780
11781 fn items(self) -> std::vec::Vec<Self::PageItem> {
11782 self.patch_jobs
11783 }
11784
11785 fn next_page_token(&self) -> std::string::String {
11786 use std::clone::Clone;
11787 self.next_page_token.clone()
11788 }
11789}
11790
11791/// A high level representation of a patch job that is either in progress
11792/// or has completed.
11793///
11794/// Instance details are not included in the job. To paginate through instance
11795/// details, use ListPatchJobInstanceDetails.
11796///
11797/// For more information about patch jobs, see
11798/// [Creating patch
11799/// jobs](https://cloud.google.com/compute/docs/os-patch-management/create-patch-job).
11800#[derive(Clone, Default, PartialEq)]
11801#[non_exhaustive]
11802pub struct PatchJob {
11803 /// Unique identifier for this patch job in the form
11804 /// `projects/*/patchJobs/*`
11805 pub name: std::string::String,
11806
11807 /// Display name for this patch job. This is not a unique identifier.
11808 pub display_name: std::string::String,
11809
11810 /// Description of the patch job. Length of the description is limited
11811 /// to 1024 characters.
11812 pub description: std::string::String,
11813
11814 /// Time this patch job was created.
11815 pub create_time: std::option::Option<wkt::Timestamp>,
11816
11817 /// Last time this patch job was updated.
11818 pub update_time: std::option::Option<wkt::Timestamp>,
11819
11820 /// The current state of the PatchJob.
11821 pub state: crate::model::patch_job::State,
11822
11823 /// Instances to patch.
11824 pub instance_filter: std::option::Option<crate::model::PatchInstanceFilter>,
11825
11826 /// Patch configuration being applied.
11827 pub patch_config: std::option::Option<crate::model::PatchConfig>,
11828
11829 /// Duration of the patch job. After the duration ends, the
11830 /// patch job times out.
11831 pub duration: std::option::Option<wkt::Duration>,
11832
11833 /// Summary of instance details.
11834 pub instance_details_summary:
11835 std::option::Option<crate::model::patch_job::InstanceDetailsSummary>,
11836
11837 /// If this patch job is a dry run, the agent reports that it has
11838 /// finished without running any updates on the VM instance.
11839 pub dry_run: bool,
11840
11841 /// If this patch job failed, this message provides information about the
11842 /// failure.
11843 pub error_message: std::string::String,
11844
11845 /// Reflects the overall progress of the patch job in the range of
11846 /// 0.0 being no progress to 100.0 being complete.
11847 pub percent_complete: f64,
11848
11849 /// Output only. Name of the patch deployment that created this patch job.
11850 pub patch_deployment: std::string::String,
11851
11852 /// Rollout strategy being applied.
11853 pub rollout: std::option::Option<crate::model::PatchRollout>,
11854
11855 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11856}
11857
11858impl PatchJob {
11859 /// Creates a new default instance.
11860 pub fn new() -> Self {
11861 std::default::Default::default()
11862 }
11863
11864 /// Sets the value of [name][crate::model::PatchJob::name].
11865 ///
11866 /// # Example
11867 /// ```ignore,no_run
11868 /// # use google_cloud_osconfig_v1::model::PatchJob;
11869 /// # let project_id = "project_id";
11870 /// # let patch_job_id = "patch_job_id";
11871 /// let x = PatchJob::new().set_name(format!("projects/{project_id}/patchJobs/{patch_job_id}"));
11872 /// ```
11873 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11874 self.name = v.into();
11875 self
11876 }
11877
11878 /// Sets the value of [display_name][crate::model::PatchJob::display_name].
11879 ///
11880 /// # Example
11881 /// ```ignore,no_run
11882 /// # use google_cloud_osconfig_v1::model::PatchJob;
11883 /// let x = PatchJob::new().set_display_name("example");
11884 /// ```
11885 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11886 self.display_name = v.into();
11887 self
11888 }
11889
11890 /// Sets the value of [description][crate::model::PatchJob::description].
11891 ///
11892 /// # Example
11893 /// ```ignore,no_run
11894 /// # use google_cloud_osconfig_v1::model::PatchJob;
11895 /// let x = PatchJob::new().set_description("example");
11896 /// ```
11897 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11898 self.description = v.into();
11899 self
11900 }
11901
11902 /// Sets the value of [create_time][crate::model::PatchJob::create_time].
11903 ///
11904 /// # Example
11905 /// ```ignore,no_run
11906 /// # use google_cloud_osconfig_v1::model::PatchJob;
11907 /// use wkt::Timestamp;
11908 /// let x = PatchJob::new().set_create_time(Timestamp::default()/* use setters */);
11909 /// ```
11910 pub fn set_create_time<T>(mut self, v: T) -> Self
11911 where
11912 T: std::convert::Into<wkt::Timestamp>,
11913 {
11914 self.create_time = std::option::Option::Some(v.into());
11915 self
11916 }
11917
11918 /// Sets or clears the value of [create_time][crate::model::PatchJob::create_time].
11919 ///
11920 /// # Example
11921 /// ```ignore,no_run
11922 /// # use google_cloud_osconfig_v1::model::PatchJob;
11923 /// use wkt::Timestamp;
11924 /// let x = PatchJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11925 /// let x = PatchJob::new().set_or_clear_create_time(None::<Timestamp>);
11926 /// ```
11927 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11928 where
11929 T: std::convert::Into<wkt::Timestamp>,
11930 {
11931 self.create_time = v.map(|x| x.into());
11932 self
11933 }
11934
11935 /// Sets the value of [update_time][crate::model::PatchJob::update_time].
11936 ///
11937 /// # Example
11938 /// ```ignore,no_run
11939 /// # use google_cloud_osconfig_v1::model::PatchJob;
11940 /// use wkt::Timestamp;
11941 /// let x = PatchJob::new().set_update_time(Timestamp::default()/* use setters */);
11942 /// ```
11943 pub fn set_update_time<T>(mut self, v: T) -> Self
11944 where
11945 T: std::convert::Into<wkt::Timestamp>,
11946 {
11947 self.update_time = std::option::Option::Some(v.into());
11948 self
11949 }
11950
11951 /// Sets or clears the value of [update_time][crate::model::PatchJob::update_time].
11952 ///
11953 /// # Example
11954 /// ```ignore,no_run
11955 /// # use google_cloud_osconfig_v1::model::PatchJob;
11956 /// use wkt::Timestamp;
11957 /// let x = PatchJob::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11958 /// let x = PatchJob::new().set_or_clear_update_time(None::<Timestamp>);
11959 /// ```
11960 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11961 where
11962 T: std::convert::Into<wkt::Timestamp>,
11963 {
11964 self.update_time = v.map(|x| x.into());
11965 self
11966 }
11967
11968 /// Sets the value of [state][crate::model::PatchJob::state].
11969 ///
11970 /// # Example
11971 /// ```ignore,no_run
11972 /// # use google_cloud_osconfig_v1::model::PatchJob;
11973 /// use google_cloud_osconfig_v1::model::patch_job::State;
11974 /// let x0 = PatchJob::new().set_state(State::Started);
11975 /// let x1 = PatchJob::new().set_state(State::InstanceLookup);
11976 /// let x2 = PatchJob::new().set_state(State::Patching);
11977 /// ```
11978 pub fn set_state<T: std::convert::Into<crate::model::patch_job::State>>(
11979 mut self,
11980 v: T,
11981 ) -> Self {
11982 self.state = v.into();
11983 self
11984 }
11985
11986 /// Sets the value of [instance_filter][crate::model::PatchJob::instance_filter].
11987 ///
11988 /// # Example
11989 /// ```ignore,no_run
11990 /// # use google_cloud_osconfig_v1::model::PatchJob;
11991 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
11992 /// let x = PatchJob::new().set_instance_filter(PatchInstanceFilter::default()/* use setters */);
11993 /// ```
11994 pub fn set_instance_filter<T>(mut self, v: T) -> Self
11995 where
11996 T: std::convert::Into<crate::model::PatchInstanceFilter>,
11997 {
11998 self.instance_filter = std::option::Option::Some(v.into());
11999 self
12000 }
12001
12002 /// Sets or clears the value of [instance_filter][crate::model::PatchJob::instance_filter].
12003 ///
12004 /// # Example
12005 /// ```ignore,no_run
12006 /// # use google_cloud_osconfig_v1::model::PatchJob;
12007 /// use google_cloud_osconfig_v1::model::PatchInstanceFilter;
12008 /// let x = PatchJob::new().set_or_clear_instance_filter(Some(PatchInstanceFilter::default()/* use setters */));
12009 /// let x = PatchJob::new().set_or_clear_instance_filter(None::<PatchInstanceFilter>);
12010 /// ```
12011 pub fn set_or_clear_instance_filter<T>(mut self, v: std::option::Option<T>) -> Self
12012 where
12013 T: std::convert::Into<crate::model::PatchInstanceFilter>,
12014 {
12015 self.instance_filter = v.map(|x| x.into());
12016 self
12017 }
12018
12019 /// Sets the value of [patch_config][crate::model::PatchJob::patch_config].
12020 ///
12021 /// # Example
12022 /// ```ignore,no_run
12023 /// # use google_cloud_osconfig_v1::model::PatchJob;
12024 /// use google_cloud_osconfig_v1::model::PatchConfig;
12025 /// let x = PatchJob::new().set_patch_config(PatchConfig::default()/* use setters */);
12026 /// ```
12027 pub fn set_patch_config<T>(mut self, v: T) -> Self
12028 where
12029 T: std::convert::Into<crate::model::PatchConfig>,
12030 {
12031 self.patch_config = std::option::Option::Some(v.into());
12032 self
12033 }
12034
12035 /// Sets or clears the value of [patch_config][crate::model::PatchJob::patch_config].
12036 ///
12037 /// # Example
12038 /// ```ignore,no_run
12039 /// # use google_cloud_osconfig_v1::model::PatchJob;
12040 /// use google_cloud_osconfig_v1::model::PatchConfig;
12041 /// let x = PatchJob::new().set_or_clear_patch_config(Some(PatchConfig::default()/* use setters */));
12042 /// let x = PatchJob::new().set_or_clear_patch_config(None::<PatchConfig>);
12043 /// ```
12044 pub fn set_or_clear_patch_config<T>(mut self, v: std::option::Option<T>) -> Self
12045 where
12046 T: std::convert::Into<crate::model::PatchConfig>,
12047 {
12048 self.patch_config = v.map(|x| x.into());
12049 self
12050 }
12051
12052 /// Sets the value of [duration][crate::model::PatchJob::duration].
12053 ///
12054 /// # Example
12055 /// ```ignore,no_run
12056 /// # use google_cloud_osconfig_v1::model::PatchJob;
12057 /// use wkt::Duration;
12058 /// let x = PatchJob::new().set_duration(Duration::default()/* use setters */);
12059 /// ```
12060 pub fn set_duration<T>(mut self, v: T) -> Self
12061 where
12062 T: std::convert::Into<wkt::Duration>,
12063 {
12064 self.duration = std::option::Option::Some(v.into());
12065 self
12066 }
12067
12068 /// Sets or clears the value of [duration][crate::model::PatchJob::duration].
12069 ///
12070 /// # Example
12071 /// ```ignore,no_run
12072 /// # use google_cloud_osconfig_v1::model::PatchJob;
12073 /// use wkt::Duration;
12074 /// let x = PatchJob::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
12075 /// let x = PatchJob::new().set_or_clear_duration(None::<Duration>);
12076 /// ```
12077 pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
12078 where
12079 T: std::convert::Into<wkt::Duration>,
12080 {
12081 self.duration = v.map(|x| x.into());
12082 self
12083 }
12084
12085 /// Sets the value of [instance_details_summary][crate::model::PatchJob::instance_details_summary].
12086 ///
12087 /// # Example
12088 /// ```ignore,no_run
12089 /// # use google_cloud_osconfig_v1::model::PatchJob;
12090 /// use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12091 /// let x = PatchJob::new().set_instance_details_summary(InstanceDetailsSummary::default()/* use setters */);
12092 /// ```
12093 pub fn set_instance_details_summary<T>(mut self, v: T) -> Self
12094 where
12095 T: std::convert::Into<crate::model::patch_job::InstanceDetailsSummary>,
12096 {
12097 self.instance_details_summary = std::option::Option::Some(v.into());
12098 self
12099 }
12100
12101 /// Sets or clears the value of [instance_details_summary][crate::model::PatchJob::instance_details_summary].
12102 ///
12103 /// # Example
12104 /// ```ignore,no_run
12105 /// # use google_cloud_osconfig_v1::model::PatchJob;
12106 /// use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12107 /// let x = PatchJob::new().set_or_clear_instance_details_summary(Some(InstanceDetailsSummary::default()/* use setters */));
12108 /// let x = PatchJob::new().set_or_clear_instance_details_summary(None::<InstanceDetailsSummary>);
12109 /// ```
12110 pub fn set_or_clear_instance_details_summary<T>(mut self, v: std::option::Option<T>) -> Self
12111 where
12112 T: std::convert::Into<crate::model::patch_job::InstanceDetailsSummary>,
12113 {
12114 self.instance_details_summary = v.map(|x| x.into());
12115 self
12116 }
12117
12118 /// Sets the value of [dry_run][crate::model::PatchJob::dry_run].
12119 ///
12120 /// # Example
12121 /// ```ignore,no_run
12122 /// # use google_cloud_osconfig_v1::model::PatchJob;
12123 /// let x = PatchJob::new().set_dry_run(true);
12124 /// ```
12125 pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12126 self.dry_run = v.into();
12127 self
12128 }
12129
12130 /// Sets the value of [error_message][crate::model::PatchJob::error_message].
12131 ///
12132 /// # Example
12133 /// ```ignore,no_run
12134 /// # use google_cloud_osconfig_v1::model::PatchJob;
12135 /// let x = PatchJob::new().set_error_message("example");
12136 /// ```
12137 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12138 self.error_message = v.into();
12139 self
12140 }
12141
12142 /// Sets the value of [percent_complete][crate::model::PatchJob::percent_complete].
12143 ///
12144 /// # Example
12145 /// ```ignore,no_run
12146 /// # use google_cloud_osconfig_v1::model::PatchJob;
12147 /// let x = PatchJob::new().set_percent_complete(42.0);
12148 /// ```
12149 pub fn set_percent_complete<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
12150 self.percent_complete = v.into();
12151 self
12152 }
12153
12154 /// Sets the value of [patch_deployment][crate::model::PatchJob::patch_deployment].
12155 ///
12156 /// # Example
12157 /// ```ignore,no_run
12158 /// # use google_cloud_osconfig_v1::model::PatchJob;
12159 /// # let project_id = "project_id";
12160 /// # let patch_deployment_id = "patch_deployment_id";
12161 /// let x = PatchJob::new().set_patch_deployment(format!("projects/{project_id}/patchDeployments/{patch_deployment_id}"));
12162 /// ```
12163 pub fn set_patch_deployment<T: std::convert::Into<std::string::String>>(
12164 mut self,
12165 v: T,
12166 ) -> Self {
12167 self.patch_deployment = v.into();
12168 self
12169 }
12170
12171 /// Sets the value of [rollout][crate::model::PatchJob::rollout].
12172 ///
12173 /// # Example
12174 /// ```ignore,no_run
12175 /// # use google_cloud_osconfig_v1::model::PatchJob;
12176 /// use google_cloud_osconfig_v1::model::PatchRollout;
12177 /// let x = PatchJob::new().set_rollout(PatchRollout::default()/* use setters */);
12178 /// ```
12179 pub fn set_rollout<T>(mut self, v: T) -> Self
12180 where
12181 T: std::convert::Into<crate::model::PatchRollout>,
12182 {
12183 self.rollout = std::option::Option::Some(v.into());
12184 self
12185 }
12186
12187 /// Sets or clears the value of [rollout][crate::model::PatchJob::rollout].
12188 ///
12189 /// # Example
12190 /// ```ignore,no_run
12191 /// # use google_cloud_osconfig_v1::model::PatchJob;
12192 /// use google_cloud_osconfig_v1::model::PatchRollout;
12193 /// let x = PatchJob::new().set_or_clear_rollout(Some(PatchRollout::default()/* use setters */));
12194 /// let x = PatchJob::new().set_or_clear_rollout(None::<PatchRollout>);
12195 /// ```
12196 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
12197 where
12198 T: std::convert::Into<crate::model::PatchRollout>,
12199 {
12200 self.rollout = v.map(|x| x.into());
12201 self
12202 }
12203}
12204
12205impl wkt::message::Message for PatchJob {
12206 fn typename() -> &'static str {
12207 "type.googleapis.com/google.cloud.osconfig.v1.PatchJob"
12208 }
12209}
12210
12211/// Defines additional types related to [PatchJob].
12212pub mod patch_job {
12213 #[allow(unused_imports)]
12214 use super::*;
12215
12216 /// A summary of the current patch state across all instances that this patch
12217 /// job affects. Contains counts of instances in different states. These states
12218 /// map to `InstancePatchState`. List patch job instance details to see the
12219 /// specific states of each instance.
12220 #[derive(Clone, Default, PartialEq)]
12221 #[non_exhaustive]
12222 pub struct InstanceDetailsSummary {
12223 /// Number of instances pending patch job.
12224 pub pending_instance_count: i64,
12225
12226 /// Number of instances that are inactive.
12227 pub inactive_instance_count: i64,
12228
12229 /// Number of instances notified about patch job.
12230 pub notified_instance_count: i64,
12231
12232 /// Number of instances that have started.
12233 pub started_instance_count: i64,
12234
12235 /// Number of instances that are downloading patches.
12236 pub downloading_patches_instance_count: i64,
12237
12238 /// Number of instances that are applying patches.
12239 pub applying_patches_instance_count: i64,
12240
12241 /// Number of instances rebooting.
12242 pub rebooting_instance_count: i64,
12243
12244 /// Number of instances that have completed successfully.
12245 pub succeeded_instance_count: i64,
12246
12247 /// Number of instances that require reboot.
12248 pub succeeded_reboot_required_instance_count: i64,
12249
12250 /// Number of instances that failed.
12251 pub failed_instance_count: i64,
12252
12253 /// Number of instances that have acked and will start shortly.
12254 pub acked_instance_count: i64,
12255
12256 /// Number of instances that exceeded the time out while applying the patch.
12257 pub timed_out_instance_count: i64,
12258
12259 /// Number of instances that are running the pre-patch step.
12260 pub pre_patch_step_instance_count: i64,
12261
12262 /// Number of instances that are running the post-patch step.
12263 pub post_patch_step_instance_count: i64,
12264
12265 /// Number of instances that do not appear to be running the agent. Check to
12266 /// ensure that the agent is installed, running, and able to communicate with
12267 /// the service.
12268 pub no_agent_detected_instance_count: i64,
12269
12270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12271 }
12272
12273 impl InstanceDetailsSummary {
12274 /// Creates a new default instance.
12275 pub fn new() -> Self {
12276 std::default::Default::default()
12277 }
12278
12279 /// Sets the value of [pending_instance_count][crate::model::patch_job::InstanceDetailsSummary::pending_instance_count].
12280 ///
12281 /// # Example
12282 /// ```ignore,no_run
12283 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12284 /// let x = InstanceDetailsSummary::new().set_pending_instance_count(42);
12285 /// ```
12286 pub fn set_pending_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12287 self.pending_instance_count = v.into();
12288 self
12289 }
12290
12291 /// Sets the value of [inactive_instance_count][crate::model::patch_job::InstanceDetailsSummary::inactive_instance_count].
12292 ///
12293 /// # Example
12294 /// ```ignore,no_run
12295 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12296 /// let x = InstanceDetailsSummary::new().set_inactive_instance_count(42);
12297 /// ```
12298 pub fn set_inactive_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12299 self.inactive_instance_count = v.into();
12300 self
12301 }
12302
12303 /// Sets the value of [notified_instance_count][crate::model::patch_job::InstanceDetailsSummary::notified_instance_count].
12304 ///
12305 /// # Example
12306 /// ```ignore,no_run
12307 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12308 /// let x = InstanceDetailsSummary::new().set_notified_instance_count(42);
12309 /// ```
12310 pub fn set_notified_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12311 self.notified_instance_count = v.into();
12312 self
12313 }
12314
12315 /// Sets the value of [started_instance_count][crate::model::patch_job::InstanceDetailsSummary::started_instance_count].
12316 ///
12317 /// # Example
12318 /// ```ignore,no_run
12319 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12320 /// let x = InstanceDetailsSummary::new().set_started_instance_count(42);
12321 /// ```
12322 pub fn set_started_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12323 self.started_instance_count = v.into();
12324 self
12325 }
12326
12327 /// Sets the value of [downloading_patches_instance_count][crate::model::patch_job::InstanceDetailsSummary::downloading_patches_instance_count].
12328 ///
12329 /// # Example
12330 /// ```ignore,no_run
12331 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12332 /// let x = InstanceDetailsSummary::new().set_downloading_patches_instance_count(42);
12333 /// ```
12334 pub fn set_downloading_patches_instance_count<T: std::convert::Into<i64>>(
12335 mut self,
12336 v: T,
12337 ) -> Self {
12338 self.downloading_patches_instance_count = v.into();
12339 self
12340 }
12341
12342 /// Sets the value of [applying_patches_instance_count][crate::model::patch_job::InstanceDetailsSummary::applying_patches_instance_count].
12343 ///
12344 /// # Example
12345 /// ```ignore,no_run
12346 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12347 /// let x = InstanceDetailsSummary::new().set_applying_patches_instance_count(42);
12348 /// ```
12349 pub fn set_applying_patches_instance_count<T: std::convert::Into<i64>>(
12350 mut self,
12351 v: T,
12352 ) -> Self {
12353 self.applying_patches_instance_count = v.into();
12354 self
12355 }
12356
12357 /// Sets the value of [rebooting_instance_count][crate::model::patch_job::InstanceDetailsSummary::rebooting_instance_count].
12358 ///
12359 /// # Example
12360 /// ```ignore,no_run
12361 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12362 /// let x = InstanceDetailsSummary::new().set_rebooting_instance_count(42);
12363 /// ```
12364 pub fn set_rebooting_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12365 self.rebooting_instance_count = v.into();
12366 self
12367 }
12368
12369 /// Sets the value of [succeeded_instance_count][crate::model::patch_job::InstanceDetailsSummary::succeeded_instance_count].
12370 ///
12371 /// # Example
12372 /// ```ignore,no_run
12373 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12374 /// let x = InstanceDetailsSummary::new().set_succeeded_instance_count(42);
12375 /// ```
12376 pub fn set_succeeded_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12377 self.succeeded_instance_count = v.into();
12378 self
12379 }
12380
12381 /// Sets the value of [succeeded_reboot_required_instance_count][crate::model::patch_job::InstanceDetailsSummary::succeeded_reboot_required_instance_count].
12382 ///
12383 /// # Example
12384 /// ```ignore,no_run
12385 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12386 /// let x = InstanceDetailsSummary::new().set_succeeded_reboot_required_instance_count(42);
12387 /// ```
12388 pub fn set_succeeded_reboot_required_instance_count<T: std::convert::Into<i64>>(
12389 mut self,
12390 v: T,
12391 ) -> Self {
12392 self.succeeded_reboot_required_instance_count = v.into();
12393 self
12394 }
12395
12396 /// Sets the value of [failed_instance_count][crate::model::patch_job::InstanceDetailsSummary::failed_instance_count].
12397 ///
12398 /// # Example
12399 /// ```ignore,no_run
12400 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12401 /// let x = InstanceDetailsSummary::new().set_failed_instance_count(42);
12402 /// ```
12403 pub fn set_failed_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12404 self.failed_instance_count = v.into();
12405 self
12406 }
12407
12408 /// Sets the value of [acked_instance_count][crate::model::patch_job::InstanceDetailsSummary::acked_instance_count].
12409 ///
12410 /// # Example
12411 /// ```ignore,no_run
12412 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12413 /// let x = InstanceDetailsSummary::new().set_acked_instance_count(42);
12414 /// ```
12415 pub fn set_acked_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12416 self.acked_instance_count = v.into();
12417 self
12418 }
12419
12420 /// Sets the value of [timed_out_instance_count][crate::model::patch_job::InstanceDetailsSummary::timed_out_instance_count].
12421 ///
12422 /// # Example
12423 /// ```ignore,no_run
12424 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12425 /// let x = InstanceDetailsSummary::new().set_timed_out_instance_count(42);
12426 /// ```
12427 pub fn set_timed_out_instance_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12428 self.timed_out_instance_count = v.into();
12429 self
12430 }
12431
12432 /// Sets the value of [pre_patch_step_instance_count][crate::model::patch_job::InstanceDetailsSummary::pre_patch_step_instance_count].
12433 ///
12434 /// # Example
12435 /// ```ignore,no_run
12436 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12437 /// let x = InstanceDetailsSummary::new().set_pre_patch_step_instance_count(42);
12438 /// ```
12439 pub fn set_pre_patch_step_instance_count<T: std::convert::Into<i64>>(
12440 mut self,
12441 v: T,
12442 ) -> Self {
12443 self.pre_patch_step_instance_count = v.into();
12444 self
12445 }
12446
12447 /// Sets the value of [post_patch_step_instance_count][crate::model::patch_job::InstanceDetailsSummary::post_patch_step_instance_count].
12448 ///
12449 /// # Example
12450 /// ```ignore,no_run
12451 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12452 /// let x = InstanceDetailsSummary::new().set_post_patch_step_instance_count(42);
12453 /// ```
12454 pub fn set_post_patch_step_instance_count<T: std::convert::Into<i64>>(
12455 mut self,
12456 v: T,
12457 ) -> Self {
12458 self.post_patch_step_instance_count = v.into();
12459 self
12460 }
12461
12462 /// Sets the value of [no_agent_detected_instance_count][crate::model::patch_job::InstanceDetailsSummary::no_agent_detected_instance_count].
12463 ///
12464 /// # Example
12465 /// ```ignore,no_run
12466 /// # use google_cloud_osconfig_v1::model::patch_job::InstanceDetailsSummary;
12467 /// let x = InstanceDetailsSummary::new().set_no_agent_detected_instance_count(42);
12468 /// ```
12469 pub fn set_no_agent_detected_instance_count<T: std::convert::Into<i64>>(
12470 mut self,
12471 v: T,
12472 ) -> Self {
12473 self.no_agent_detected_instance_count = v.into();
12474 self
12475 }
12476 }
12477
12478 impl wkt::message::Message for InstanceDetailsSummary {
12479 fn typename() -> &'static str {
12480 "type.googleapis.com/google.cloud.osconfig.v1.PatchJob.InstanceDetailsSummary"
12481 }
12482 }
12483
12484 /// Enumeration of the various states a patch job passes through as it
12485 /// executes.
12486 ///
12487 /// # Working with unknown values
12488 ///
12489 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12490 /// additional enum variants at any time. Adding new variants is not considered
12491 /// a breaking change. Applications should write their code in anticipation of:
12492 ///
12493 /// - New values appearing in future releases of the client library, **and**
12494 /// - New values received dynamically, without application changes.
12495 ///
12496 /// Please consult the [Working with enums] section in the user guide for some
12497 /// guidelines.
12498 ///
12499 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12500 #[derive(Clone, Debug, PartialEq)]
12501 #[non_exhaustive]
12502 pub enum State {
12503 /// State must be specified.
12504 Unspecified,
12505 /// The patch job was successfully initiated.
12506 Started,
12507 /// The patch job is looking up instances to run the patch on.
12508 InstanceLookup,
12509 /// Instances are being patched.
12510 Patching,
12511 /// Patch job completed successfully.
12512 Succeeded,
12513 /// Patch job completed but there were errors.
12514 CompletedWithErrors,
12515 /// The patch job was canceled.
12516 Canceled,
12517 /// The patch job timed out.
12518 TimedOut,
12519 /// If set, the enum was initialized with an unknown value.
12520 ///
12521 /// Applications can examine the value using [State::value] or
12522 /// [State::name].
12523 UnknownValue(state::UnknownValue),
12524 }
12525
12526 #[doc(hidden)]
12527 pub mod state {
12528 #[allow(unused_imports)]
12529 use super::*;
12530 #[derive(Clone, Debug, PartialEq)]
12531 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12532 }
12533
12534 impl State {
12535 /// Gets the enum value.
12536 ///
12537 /// Returns `None` if the enum contains an unknown value deserialized from
12538 /// the string representation of enums.
12539 pub fn value(&self) -> std::option::Option<i32> {
12540 match self {
12541 Self::Unspecified => std::option::Option::Some(0),
12542 Self::Started => std::option::Option::Some(1),
12543 Self::InstanceLookup => std::option::Option::Some(2),
12544 Self::Patching => std::option::Option::Some(3),
12545 Self::Succeeded => std::option::Option::Some(4),
12546 Self::CompletedWithErrors => std::option::Option::Some(5),
12547 Self::Canceled => std::option::Option::Some(6),
12548 Self::TimedOut => std::option::Option::Some(7),
12549 Self::UnknownValue(u) => u.0.value(),
12550 }
12551 }
12552
12553 /// Gets the enum value as a string.
12554 ///
12555 /// Returns `None` if the enum contains an unknown value deserialized from
12556 /// the integer representation of enums.
12557 pub fn name(&self) -> std::option::Option<&str> {
12558 match self {
12559 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
12560 Self::Started => std::option::Option::Some("STARTED"),
12561 Self::InstanceLookup => std::option::Option::Some("INSTANCE_LOOKUP"),
12562 Self::Patching => std::option::Option::Some("PATCHING"),
12563 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
12564 Self::CompletedWithErrors => std::option::Option::Some("COMPLETED_WITH_ERRORS"),
12565 Self::Canceled => std::option::Option::Some("CANCELED"),
12566 Self::TimedOut => std::option::Option::Some("TIMED_OUT"),
12567 Self::UnknownValue(u) => u.0.name(),
12568 }
12569 }
12570 }
12571
12572 impl std::default::Default for State {
12573 fn default() -> Self {
12574 use std::convert::From;
12575 Self::from(0)
12576 }
12577 }
12578
12579 impl std::fmt::Display for State {
12580 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12581 wkt::internal::display_enum(f, self.name(), self.value())
12582 }
12583 }
12584
12585 impl std::convert::From<i32> for State {
12586 fn from(value: i32) -> Self {
12587 match value {
12588 0 => Self::Unspecified,
12589 1 => Self::Started,
12590 2 => Self::InstanceLookup,
12591 3 => Self::Patching,
12592 4 => Self::Succeeded,
12593 5 => Self::CompletedWithErrors,
12594 6 => Self::Canceled,
12595 7 => Self::TimedOut,
12596 _ => Self::UnknownValue(state::UnknownValue(
12597 wkt::internal::UnknownEnumValue::Integer(value),
12598 )),
12599 }
12600 }
12601 }
12602
12603 impl std::convert::From<&str> for State {
12604 fn from(value: &str) -> Self {
12605 use std::string::ToString;
12606 match value {
12607 "STATE_UNSPECIFIED" => Self::Unspecified,
12608 "STARTED" => Self::Started,
12609 "INSTANCE_LOOKUP" => Self::InstanceLookup,
12610 "PATCHING" => Self::Patching,
12611 "SUCCEEDED" => Self::Succeeded,
12612 "COMPLETED_WITH_ERRORS" => Self::CompletedWithErrors,
12613 "CANCELED" => Self::Canceled,
12614 "TIMED_OUT" => Self::TimedOut,
12615 _ => Self::UnknownValue(state::UnknownValue(
12616 wkt::internal::UnknownEnumValue::String(value.to_string()),
12617 )),
12618 }
12619 }
12620 }
12621
12622 impl serde::ser::Serialize for State {
12623 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12624 where
12625 S: serde::Serializer,
12626 {
12627 match self {
12628 Self::Unspecified => serializer.serialize_i32(0),
12629 Self::Started => serializer.serialize_i32(1),
12630 Self::InstanceLookup => serializer.serialize_i32(2),
12631 Self::Patching => serializer.serialize_i32(3),
12632 Self::Succeeded => serializer.serialize_i32(4),
12633 Self::CompletedWithErrors => serializer.serialize_i32(5),
12634 Self::Canceled => serializer.serialize_i32(6),
12635 Self::TimedOut => serializer.serialize_i32(7),
12636 Self::UnknownValue(u) => u.0.serialize(serializer),
12637 }
12638 }
12639 }
12640
12641 impl<'de> serde::de::Deserialize<'de> for State {
12642 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12643 where
12644 D: serde::Deserializer<'de>,
12645 {
12646 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12647 ".google.cloud.osconfig.v1.PatchJob.State",
12648 ))
12649 }
12650 }
12651}
12652
12653/// Patch configuration specifications. Contains details on how to apply the
12654/// patch(es) to a VM instance.
12655#[derive(Clone, Default, PartialEq)]
12656#[non_exhaustive]
12657pub struct PatchConfig {
12658 /// Post-patch reboot settings.
12659 pub reboot_config: crate::model::patch_config::RebootConfig,
12660
12661 /// Apt update settings. Use this setting to override the default `apt` patch
12662 /// rules.
12663 pub apt: std::option::Option<crate::model::AptSettings>,
12664
12665 /// Yum update settings. Use this setting to override the default `yum` patch
12666 /// rules.
12667 pub yum: std::option::Option<crate::model::YumSettings>,
12668
12669 /// Goo update settings. Use this setting to override the default `goo` patch
12670 /// rules.
12671 pub goo: std::option::Option<crate::model::GooSettings>,
12672
12673 /// Zypper update settings. Use this setting to override the default `zypper`
12674 /// patch rules.
12675 pub zypper: std::option::Option<crate::model::ZypperSettings>,
12676
12677 /// Windows update settings. Use this override the default windows patch rules.
12678 pub windows_update: std::option::Option<crate::model::WindowsUpdateSettings>,
12679
12680 /// The `ExecStep` to run before the patch update.
12681 pub pre_step: std::option::Option<crate::model::ExecStep>,
12682
12683 /// The `ExecStep` to run after the patch update.
12684 pub post_step: std::option::Option<crate::model::ExecStep>,
12685
12686 /// Allows the patch job to run on Managed instance groups (MIGs).
12687 pub mig_instances_allowed: bool,
12688
12689 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12690}
12691
12692impl PatchConfig {
12693 /// Creates a new default instance.
12694 pub fn new() -> Self {
12695 std::default::Default::default()
12696 }
12697
12698 /// Sets the value of [reboot_config][crate::model::PatchConfig::reboot_config].
12699 ///
12700 /// # Example
12701 /// ```ignore,no_run
12702 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12703 /// use google_cloud_osconfig_v1::model::patch_config::RebootConfig;
12704 /// let x0 = PatchConfig::new().set_reboot_config(RebootConfig::Default);
12705 /// let x1 = PatchConfig::new().set_reboot_config(RebootConfig::Always);
12706 /// let x2 = PatchConfig::new().set_reboot_config(RebootConfig::Never);
12707 /// ```
12708 pub fn set_reboot_config<T: std::convert::Into<crate::model::patch_config::RebootConfig>>(
12709 mut self,
12710 v: T,
12711 ) -> Self {
12712 self.reboot_config = v.into();
12713 self
12714 }
12715
12716 /// Sets the value of [apt][crate::model::PatchConfig::apt].
12717 ///
12718 /// # Example
12719 /// ```ignore,no_run
12720 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12721 /// use google_cloud_osconfig_v1::model::AptSettings;
12722 /// let x = PatchConfig::new().set_apt(AptSettings::default()/* use setters */);
12723 /// ```
12724 pub fn set_apt<T>(mut self, v: T) -> Self
12725 where
12726 T: std::convert::Into<crate::model::AptSettings>,
12727 {
12728 self.apt = std::option::Option::Some(v.into());
12729 self
12730 }
12731
12732 /// Sets or clears the value of [apt][crate::model::PatchConfig::apt].
12733 ///
12734 /// # Example
12735 /// ```ignore,no_run
12736 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12737 /// use google_cloud_osconfig_v1::model::AptSettings;
12738 /// let x = PatchConfig::new().set_or_clear_apt(Some(AptSettings::default()/* use setters */));
12739 /// let x = PatchConfig::new().set_or_clear_apt(None::<AptSettings>);
12740 /// ```
12741 pub fn set_or_clear_apt<T>(mut self, v: std::option::Option<T>) -> Self
12742 where
12743 T: std::convert::Into<crate::model::AptSettings>,
12744 {
12745 self.apt = v.map(|x| x.into());
12746 self
12747 }
12748
12749 /// Sets the value of [yum][crate::model::PatchConfig::yum].
12750 ///
12751 /// # Example
12752 /// ```ignore,no_run
12753 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12754 /// use google_cloud_osconfig_v1::model::YumSettings;
12755 /// let x = PatchConfig::new().set_yum(YumSettings::default()/* use setters */);
12756 /// ```
12757 pub fn set_yum<T>(mut self, v: T) -> Self
12758 where
12759 T: std::convert::Into<crate::model::YumSettings>,
12760 {
12761 self.yum = std::option::Option::Some(v.into());
12762 self
12763 }
12764
12765 /// Sets or clears the value of [yum][crate::model::PatchConfig::yum].
12766 ///
12767 /// # Example
12768 /// ```ignore,no_run
12769 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12770 /// use google_cloud_osconfig_v1::model::YumSettings;
12771 /// let x = PatchConfig::new().set_or_clear_yum(Some(YumSettings::default()/* use setters */));
12772 /// let x = PatchConfig::new().set_or_clear_yum(None::<YumSettings>);
12773 /// ```
12774 pub fn set_or_clear_yum<T>(mut self, v: std::option::Option<T>) -> Self
12775 where
12776 T: std::convert::Into<crate::model::YumSettings>,
12777 {
12778 self.yum = v.map(|x| x.into());
12779 self
12780 }
12781
12782 /// Sets the value of [goo][crate::model::PatchConfig::goo].
12783 ///
12784 /// # Example
12785 /// ```ignore,no_run
12786 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12787 /// use google_cloud_osconfig_v1::model::GooSettings;
12788 /// let x = PatchConfig::new().set_goo(GooSettings::default()/* use setters */);
12789 /// ```
12790 pub fn set_goo<T>(mut self, v: T) -> Self
12791 where
12792 T: std::convert::Into<crate::model::GooSettings>,
12793 {
12794 self.goo = std::option::Option::Some(v.into());
12795 self
12796 }
12797
12798 /// Sets or clears the value of [goo][crate::model::PatchConfig::goo].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12803 /// use google_cloud_osconfig_v1::model::GooSettings;
12804 /// let x = PatchConfig::new().set_or_clear_goo(Some(GooSettings::default()/* use setters */));
12805 /// let x = PatchConfig::new().set_or_clear_goo(None::<GooSettings>);
12806 /// ```
12807 pub fn set_or_clear_goo<T>(mut self, v: std::option::Option<T>) -> Self
12808 where
12809 T: std::convert::Into<crate::model::GooSettings>,
12810 {
12811 self.goo = v.map(|x| x.into());
12812 self
12813 }
12814
12815 /// Sets the value of [zypper][crate::model::PatchConfig::zypper].
12816 ///
12817 /// # Example
12818 /// ```ignore,no_run
12819 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12820 /// use google_cloud_osconfig_v1::model::ZypperSettings;
12821 /// let x = PatchConfig::new().set_zypper(ZypperSettings::default()/* use setters */);
12822 /// ```
12823 pub fn set_zypper<T>(mut self, v: T) -> Self
12824 where
12825 T: std::convert::Into<crate::model::ZypperSettings>,
12826 {
12827 self.zypper = std::option::Option::Some(v.into());
12828 self
12829 }
12830
12831 /// Sets or clears the value of [zypper][crate::model::PatchConfig::zypper].
12832 ///
12833 /// # Example
12834 /// ```ignore,no_run
12835 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12836 /// use google_cloud_osconfig_v1::model::ZypperSettings;
12837 /// let x = PatchConfig::new().set_or_clear_zypper(Some(ZypperSettings::default()/* use setters */));
12838 /// let x = PatchConfig::new().set_or_clear_zypper(None::<ZypperSettings>);
12839 /// ```
12840 pub fn set_or_clear_zypper<T>(mut self, v: std::option::Option<T>) -> Self
12841 where
12842 T: std::convert::Into<crate::model::ZypperSettings>,
12843 {
12844 self.zypper = v.map(|x| x.into());
12845 self
12846 }
12847
12848 /// Sets the value of [windows_update][crate::model::PatchConfig::windows_update].
12849 ///
12850 /// # Example
12851 /// ```ignore,no_run
12852 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12853 /// use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
12854 /// let x = PatchConfig::new().set_windows_update(WindowsUpdateSettings::default()/* use setters */);
12855 /// ```
12856 pub fn set_windows_update<T>(mut self, v: T) -> Self
12857 where
12858 T: std::convert::Into<crate::model::WindowsUpdateSettings>,
12859 {
12860 self.windows_update = std::option::Option::Some(v.into());
12861 self
12862 }
12863
12864 /// Sets or clears the value of [windows_update][crate::model::PatchConfig::windows_update].
12865 ///
12866 /// # Example
12867 /// ```ignore,no_run
12868 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12869 /// use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
12870 /// let x = PatchConfig::new().set_or_clear_windows_update(Some(WindowsUpdateSettings::default()/* use setters */));
12871 /// let x = PatchConfig::new().set_or_clear_windows_update(None::<WindowsUpdateSettings>);
12872 /// ```
12873 pub fn set_or_clear_windows_update<T>(mut self, v: std::option::Option<T>) -> Self
12874 where
12875 T: std::convert::Into<crate::model::WindowsUpdateSettings>,
12876 {
12877 self.windows_update = v.map(|x| x.into());
12878 self
12879 }
12880
12881 /// Sets the value of [pre_step][crate::model::PatchConfig::pre_step].
12882 ///
12883 /// # Example
12884 /// ```ignore,no_run
12885 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12886 /// use google_cloud_osconfig_v1::model::ExecStep;
12887 /// let x = PatchConfig::new().set_pre_step(ExecStep::default()/* use setters */);
12888 /// ```
12889 pub fn set_pre_step<T>(mut self, v: T) -> Self
12890 where
12891 T: std::convert::Into<crate::model::ExecStep>,
12892 {
12893 self.pre_step = std::option::Option::Some(v.into());
12894 self
12895 }
12896
12897 /// Sets or clears the value of [pre_step][crate::model::PatchConfig::pre_step].
12898 ///
12899 /// # Example
12900 /// ```ignore,no_run
12901 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12902 /// use google_cloud_osconfig_v1::model::ExecStep;
12903 /// let x = PatchConfig::new().set_or_clear_pre_step(Some(ExecStep::default()/* use setters */));
12904 /// let x = PatchConfig::new().set_or_clear_pre_step(None::<ExecStep>);
12905 /// ```
12906 pub fn set_or_clear_pre_step<T>(mut self, v: std::option::Option<T>) -> Self
12907 where
12908 T: std::convert::Into<crate::model::ExecStep>,
12909 {
12910 self.pre_step = v.map(|x| x.into());
12911 self
12912 }
12913
12914 /// Sets the value of [post_step][crate::model::PatchConfig::post_step].
12915 ///
12916 /// # Example
12917 /// ```ignore,no_run
12918 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12919 /// use google_cloud_osconfig_v1::model::ExecStep;
12920 /// let x = PatchConfig::new().set_post_step(ExecStep::default()/* use setters */);
12921 /// ```
12922 pub fn set_post_step<T>(mut self, v: T) -> Self
12923 where
12924 T: std::convert::Into<crate::model::ExecStep>,
12925 {
12926 self.post_step = std::option::Option::Some(v.into());
12927 self
12928 }
12929
12930 /// Sets or clears the value of [post_step][crate::model::PatchConfig::post_step].
12931 ///
12932 /// # Example
12933 /// ```ignore,no_run
12934 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12935 /// use google_cloud_osconfig_v1::model::ExecStep;
12936 /// let x = PatchConfig::new().set_or_clear_post_step(Some(ExecStep::default()/* use setters */));
12937 /// let x = PatchConfig::new().set_or_clear_post_step(None::<ExecStep>);
12938 /// ```
12939 pub fn set_or_clear_post_step<T>(mut self, v: std::option::Option<T>) -> Self
12940 where
12941 T: std::convert::Into<crate::model::ExecStep>,
12942 {
12943 self.post_step = v.map(|x| x.into());
12944 self
12945 }
12946
12947 /// Sets the value of [mig_instances_allowed][crate::model::PatchConfig::mig_instances_allowed].
12948 ///
12949 /// # Example
12950 /// ```ignore,no_run
12951 /// # use google_cloud_osconfig_v1::model::PatchConfig;
12952 /// let x = PatchConfig::new().set_mig_instances_allowed(true);
12953 /// ```
12954 pub fn set_mig_instances_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12955 self.mig_instances_allowed = v.into();
12956 self
12957 }
12958}
12959
12960impl wkt::message::Message for PatchConfig {
12961 fn typename() -> &'static str {
12962 "type.googleapis.com/google.cloud.osconfig.v1.PatchConfig"
12963 }
12964}
12965
12966/// Defines additional types related to [PatchConfig].
12967pub mod patch_config {
12968 #[allow(unused_imports)]
12969 use super::*;
12970
12971 /// Post-patch reboot settings.
12972 ///
12973 /// # Working with unknown values
12974 ///
12975 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12976 /// additional enum variants at any time. Adding new variants is not considered
12977 /// a breaking change. Applications should write their code in anticipation of:
12978 ///
12979 /// - New values appearing in future releases of the client library, **and**
12980 /// - New values received dynamically, without application changes.
12981 ///
12982 /// Please consult the [Working with enums] section in the user guide for some
12983 /// guidelines.
12984 ///
12985 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
12986 #[derive(Clone, Debug, PartialEq)]
12987 #[non_exhaustive]
12988 pub enum RebootConfig {
12989 /// The default behavior is DEFAULT.
12990 Unspecified,
12991 /// The agent decides if a reboot is necessary by checking signals such as
12992 /// registry keys on Windows or `/var/run/reboot-required` on APT based
12993 /// systems. On RPM based systems, a set of core system package install times
12994 /// are compared with system boot time.
12995 Default,
12996 /// Always reboot the machine after the update completes.
12997 Always,
12998 /// Never reboot the machine after the update completes.
12999 Never,
13000 /// If set, the enum was initialized with an unknown value.
13001 ///
13002 /// Applications can examine the value using [RebootConfig::value] or
13003 /// [RebootConfig::name].
13004 UnknownValue(reboot_config::UnknownValue),
13005 }
13006
13007 #[doc(hidden)]
13008 pub mod reboot_config {
13009 #[allow(unused_imports)]
13010 use super::*;
13011 #[derive(Clone, Debug, PartialEq)]
13012 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13013 }
13014
13015 impl RebootConfig {
13016 /// Gets the enum value.
13017 ///
13018 /// Returns `None` if the enum contains an unknown value deserialized from
13019 /// the string representation of enums.
13020 pub fn value(&self) -> std::option::Option<i32> {
13021 match self {
13022 Self::Unspecified => std::option::Option::Some(0),
13023 Self::Default => std::option::Option::Some(1),
13024 Self::Always => std::option::Option::Some(2),
13025 Self::Never => std::option::Option::Some(3),
13026 Self::UnknownValue(u) => u.0.value(),
13027 }
13028 }
13029
13030 /// Gets the enum value as a string.
13031 ///
13032 /// Returns `None` if the enum contains an unknown value deserialized from
13033 /// the integer representation of enums.
13034 pub fn name(&self) -> std::option::Option<&str> {
13035 match self {
13036 Self::Unspecified => std::option::Option::Some("REBOOT_CONFIG_UNSPECIFIED"),
13037 Self::Default => std::option::Option::Some("DEFAULT"),
13038 Self::Always => std::option::Option::Some("ALWAYS"),
13039 Self::Never => std::option::Option::Some("NEVER"),
13040 Self::UnknownValue(u) => u.0.name(),
13041 }
13042 }
13043 }
13044
13045 impl std::default::Default for RebootConfig {
13046 fn default() -> Self {
13047 use std::convert::From;
13048 Self::from(0)
13049 }
13050 }
13051
13052 impl std::fmt::Display for RebootConfig {
13053 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13054 wkt::internal::display_enum(f, self.name(), self.value())
13055 }
13056 }
13057
13058 impl std::convert::From<i32> for RebootConfig {
13059 fn from(value: i32) -> Self {
13060 match value {
13061 0 => Self::Unspecified,
13062 1 => Self::Default,
13063 2 => Self::Always,
13064 3 => Self::Never,
13065 _ => Self::UnknownValue(reboot_config::UnknownValue(
13066 wkt::internal::UnknownEnumValue::Integer(value),
13067 )),
13068 }
13069 }
13070 }
13071
13072 impl std::convert::From<&str> for RebootConfig {
13073 fn from(value: &str) -> Self {
13074 use std::string::ToString;
13075 match value {
13076 "REBOOT_CONFIG_UNSPECIFIED" => Self::Unspecified,
13077 "DEFAULT" => Self::Default,
13078 "ALWAYS" => Self::Always,
13079 "NEVER" => Self::Never,
13080 _ => Self::UnknownValue(reboot_config::UnknownValue(
13081 wkt::internal::UnknownEnumValue::String(value.to_string()),
13082 )),
13083 }
13084 }
13085 }
13086
13087 impl serde::ser::Serialize for RebootConfig {
13088 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13089 where
13090 S: serde::Serializer,
13091 {
13092 match self {
13093 Self::Unspecified => serializer.serialize_i32(0),
13094 Self::Default => serializer.serialize_i32(1),
13095 Self::Always => serializer.serialize_i32(2),
13096 Self::Never => serializer.serialize_i32(3),
13097 Self::UnknownValue(u) => u.0.serialize(serializer),
13098 }
13099 }
13100 }
13101
13102 impl<'de> serde::de::Deserialize<'de> for RebootConfig {
13103 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13104 where
13105 D: serde::Deserializer<'de>,
13106 {
13107 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RebootConfig>::new(
13108 ".google.cloud.osconfig.v1.PatchConfig.RebootConfig",
13109 ))
13110 }
13111 }
13112}
13113
13114/// Namespace for instance state enums.
13115#[derive(Clone, Default, PartialEq)]
13116#[non_exhaustive]
13117pub struct Instance {
13118 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13119}
13120
13121impl Instance {
13122 /// Creates a new default instance.
13123 pub fn new() -> Self {
13124 std::default::Default::default()
13125 }
13126}
13127
13128impl wkt::message::Message for Instance {
13129 fn typename() -> &'static str {
13130 "type.googleapis.com/google.cloud.osconfig.v1.Instance"
13131 }
13132}
13133
13134/// Defines additional types related to [Instance].
13135pub mod instance {
13136 #[allow(unused_imports)]
13137 use super::*;
13138
13139 /// Patch state of an instance.
13140 ///
13141 /// # Working with unknown values
13142 ///
13143 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13144 /// additional enum variants at any time. Adding new variants is not considered
13145 /// a breaking change. Applications should write their code in anticipation of:
13146 ///
13147 /// - New values appearing in future releases of the client library, **and**
13148 /// - New values received dynamically, without application changes.
13149 ///
13150 /// Please consult the [Working with enums] section in the user guide for some
13151 /// guidelines.
13152 ///
13153 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13154 #[derive(Clone, Debug, PartialEq)]
13155 #[non_exhaustive]
13156 pub enum PatchState {
13157 /// Unspecified.
13158 Unspecified,
13159 /// The instance is not yet notified.
13160 Pending,
13161 /// Instance is inactive and cannot be patched.
13162 Inactive,
13163 /// The instance is notified that it should be patched.
13164 Notified,
13165 /// The instance has started the patching process.
13166 Started,
13167 /// The instance is downloading patches.
13168 DownloadingPatches,
13169 /// The instance is applying patches.
13170 ApplyingPatches,
13171 /// The instance is rebooting.
13172 Rebooting,
13173 /// The instance has completed applying patches.
13174 Succeeded,
13175 /// The instance has completed applying patches but a reboot is required.
13176 SucceededRebootRequired,
13177 /// The instance has failed to apply the patch.
13178 Failed,
13179 /// The instance acked the notification and will start shortly.
13180 Acked,
13181 /// The instance exceeded the time out while applying the patch.
13182 TimedOut,
13183 /// The instance is running the pre-patch step.
13184 RunningPrePatchStep,
13185 /// The instance is running the post-patch step.
13186 RunningPostPatchStep,
13187 /// The service could not detect the presence of the agent. Check to ensure
13188 /// that the agent is installed, running, and able to communicate with the
13189 /// service.
13190 NoAgentDetected,
13191 /// If set, the enum was initialized with an unknown value.
13192 ///
13193 /// Applications can examine the value using [PatchState::value] or
13194 /// [PatchState::name].
13195 UnknownValue(patch_state::UnknownValue),
13196 }
13197
13198 #[doc(hidden)]
13199 pub mod patch_state {
13200 #[allow(unused_imports)]
13201 use super::*;
13202 #[derive(Clone, Debug, PartialEq)]
13203 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13204 }
13205
13206 impl PatchState {
13207 /// Gets the enum value.
13208 ///
13209 /// Returns `None` if the enum contains an unknown value deserialized from
13210 /// the string representation of enums.
13211 pub fn value(&self) -> std::option::Option<i32> {
13212 match self {
13213 Self::Unspecified => std::option::Option::Some(0),
13214 Self::Pending => std::option::Option::Some(1),
13215 Self::Inactive => std::option::Option::Some(2),
13216 Self::Notified => std::option::Option::Some(3),
13217 Self::Started => std::option::Option::Some(4),
13218 Self::DownloadingPatches => std::option::Option::Some(5),
13219 Self::ApplyingPatches => std::option::Option::Some(6),
13220 Self::Rebooting => std::option::Option::Some(7),
13221 Self::Succeeded => std::option::Option::Some(8),
13222 Self::SucceededRebootRequired => std::option::Option::Some(9),
13223 Self::Failed => std::option::Option::Some(10),
13224 Self::Acked => std::option::Option::Some(11),
13225 Self::TimedOut => std::option::Option::Some(12),
13226 Self::RunningPrePatchStep => std::option::Option::Some(13),
13227 Self::RunningPostPatchStep => std::option::Option::Some(14),
13228 Self::NoAgentDetected => std::option::Option::Some(15),
13229 Self::UnknownValue(u) => u.0.value(),
13230 }
13231 }
13232
13233 /// Gets the enum value as a string.
13234 ///
13235 /// Returns `None` if the enum contains an unknown value deserialized from
13236 /// the integer representation of enums.
13237 pub fn name(&self) -> std::option::Option<&str> {
13238 match self {
13239 Self::Unspecified => std::option::Option::Some("PATCH_STATE_UNSPECIFIED"),
13240 Self::Pending => std::option::Option::Some("PENDING"),
13241 Self::Inactive => std::option::Option::Some("INACTIVE"),
13242 Self::Notified => std::option::Option::Some("NOTIFIED"),
13243 Self::Started => std::option::Option::Some("STARTED"),
13244 Self::DownloadingPatches => std::option::Option::Some("DOWNLOADING_PATCHES"),
13245 Self::ApplyingPatches => std::option::Option::Some("APPLYING_PATCHES"),
13246 Self::Rebooting => std::option::Option::Some("REBOOTING"),
13247 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
13248 Self::SucceededRebootRequired => {
13249 std::option::Option::Some("SUCCEEDED_REBOOT_REQUIRED")
13250 }
13251 Self::Failed => std::option::Option::Some("FAILED"),
13252 Self::Acked => std::option::Option::Some("ACKED"),
13253 Self::TimedOut => std::option::Option::Some("TIMED_OUT"),
13254 Self::RunningPrePatchStep => std::option::Option::Some("RUNNING_PRE_PATCH_STEP"),
13255 Self::RunningPostPatchStep => std::option::Option::Some("RUNNING_POST_PATCH_STEP"),
13256 Self::NoAgentDetected => std::option::Option::Some("NO_AGENT_DETECTED"),
13257 Self::UnknownValue(u) => u.0.name(),
13258 }
13259 }
13260 }
13261
13262 impl std::default::Default for PatchState {
13263 fn default() -> Self {
13264 use std::convert::From;
13265 Self::from(0)
13266 }
13267 }
13268
13269 impl std::fmt::Display for PatchState {
13270 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13271 wkt::internal::display_enum(f, self.name(), self.value())
13272 }
13273 }
13274
13275 impl std::convert::From<i32> for PatchState {
13276 fn from(value: i32) -> Self {
13277 match value {
13278 0 => Self::Unspecified,
13279 1 => Self::Pending,
13280 2 => Self::Inactive,
13281 3 => Self::Notified,
13282 4 => Self::Started,
13283 5 => Self::DownloadingPatches,
13284 6 => Self::ApplyingPatches,
13285 7 => Self::Rebooting,
13286 8 => Self::Succeeded,
13287 9 => Self::SucceededRebootRequired,
13288 10 => Self::Failed,
13289 11 => Self::Acked,
13290 12 => Self::TimedOut,
13291 13 => Self::RunningPrePatchStep,
13292 14 => Self::RunningPostPatchStep,
13293 15 => Self::NoAgentDetected,
13294 _ => Self::UnknownValue(patch_state::UnknownValue(
13295 wkt::internal::UnknownEnumValue::Integer(value),
13296 )),
13297 }
13298 }
13299 }
13300
13301 impl std::convert::From<&str> for PatchState {
13302 fn from(value: &str) -> Self {
13303 use std::string::ToString;
13304 match value {
13305 "PATCH_STATE_UNSPECIFIED" => Self::Unspecified,
13306 "PENDING" => Self::Pending,
13307 "INACTIVE" => Self::Inactive,
13308 "NOTIFIED" => Self::Notified,
13309 "STARTED" => Self::Started,
13310 "DOWNLOADING_PATCHES" => Self::DownloadingPatches,
13311 "APPLYING_PATCHES" => Self::ApplyingPatches,
13312 "REBOOTING" => Self::Rebooting,
13313 "SUCCEEDED" => Self::Succeeded,
13314 "SUCCEEDED_REBOOT_REQUIRED" => Self::SucceededRebootRequired,
13315 "FAILED" => Self::Failed,
13316 "ACKED" => Self::Acked,
13317 "TIMED_OUT" => Self::TimedOut,
13318 "RUNNING_PRE_PATCH_STEP" => Self::RunningPrePatchStep,
13319 "RUNNING_POST_PATCH_STEP" => Self::RunningPostPatchStep,
13320 "NO_AGENT_DETECTED" => Self::NoAgentDetected,
13321 _ => Self::UnknownValue(patch_state::UnknownValue(
13322 wkt::internal::UnknownEnumValue::String(value.to_string()),
13323 )),
13324 }
13325 }
13326 }
13327
13328 impl serde::ser::Serialize for PatchState {
13329 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13330 where
13331 S: serde::Serializer,
13332 {
13333 match self {
13334 Self::Unspecified => serializer.serialize_i32(0),
13335 Self::Pending => serializer.serialize_i32(1),
13336 Self::Inactive => serializer.serialize_i32(2),
13337 Self::Notified => serializer.serialize_i32(3),
13338 Self::Started => serializer.serialize_i32(4),
13339 Self::DownloadingPatches => serializer.serialize_i32(5),
13340 Self::ApplyingPatches => serializer.serialize_i32(6),
13341 Self::Rebooting => serializer.serialize_i32(7),
13342 Self::Succeeded => serializer.serialize_i32(8),
13343 Self::SucceededRebootRequired => serializer.serialize_i32(9),
13344 Self::Failed => serializer.serialize_i32(10),
13345 Self::Acked => serializer.serialize_i32(11),
13346 Self::TimedOut => serializer.serialize_i32(12),
13347 Self::RunningPrePatchStep => serializer.serialize_i32(13),
13348 Self::RunningPostPatchStep => serializer.serialize_i32(14),
13349 Self::NoAgentDetected => serializer.serialize_i32(15),
13350 Self::UnknownValue(u) => u.0.serialize(serializer),
13351 }
13352 }
13353 }
13354
13355 impl<'de> serde::de::Deserialize<'de> for PatchState {
13356 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13357 where
13358 D: serde::Deserializer<'de>,
13359 {
13360 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PatchState>::new(
13361 ".google.cloud.osconfig.v1.Instance.PatchState",
13362 ))
13363 }
13364 }
13365}
13366
13367/// Message for canceling a patch job.
13368#[derive(Clone, Default, PartialEq)]
13369#[non_exhaustive]
13370pub struct CancelPatchJobRequest {
13371 /// Required. Name of the patch in the form `projects/*/patchJobs/*`
13372 pub name: std::string::String,
13373
13374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13375}
13376
13377impl CancelPatchJobRequest {
13378 /// Creates a new default instance.
13379 pub fn new() -> Self {
13380 std::default::Default::default()
13381 }
13382
13383 /// Sets the value of [name][crate::model::CancelPatchJobRequest::name].
13384 ///
13385 /// # Example
13386 /// ```ignore,no_run
13387 /// # use google_cloud_osconfig_v1::model::CancelPatchJobRequest;
13388 /// # let project_id = "project_id";
13389 /// # let patch_job_id = "patch_job_id";
13390 /// let x = CancelPatchJobRequest::new().set_name(format!("projects/{project_id}/patchJobs/{patch_job_id}"));
13391 /// ```
13392 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13393 self.name = v.into();
13394 self
13395 }
13396}
13397
13398impl wkt::message::Message for CancelPatchJobRequest {
13399 fn typename() -> &'static str {
13400 "type.googleapis.com/google.cloud.osconfig.v1.CancelPatchJobRequest"
13401 }
13402}
13403
13404/// Apt patching is completed by executing `apt-get update && apt-get
13405/// upgrade`. Additional options can be set to control how this is executed.
13406#[derive(Clone, Default, PartialEq)]
13407#[non_exhaustive]
13408pub struct AptSettings {
13409 /// By changing the type to DIST, the patching is performed
13410 /// using `apt-get dist-upgrade` instead.
13411 pub r#type: crate::model::apt_settings::Type,
13412
13413 /// List of packages to exclude from update. These packages will be excluded
13414 pub excludes: std::vec::Vec<std::string::String>,
13415
13416 /// An exclusive list of packages to be updated. These are the only packages
13417 /// that will be updated. If these packages are not installed, they will be
13418 /// ignored. This field cannot be specified with any other patch configuration
13419 /// fields.
13420 pub exclusive_packages: std::vec::Vec<std::string::String>,
13421
13422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13423}
13424
13425impl AptSettings {
13426 /// Creates a new default instance.
13427 pub fn new() -> Self {
13428 std::default::Default::default()
13429 }
13430
13431 /// Sets the value of [r#type][crate::model::AptSettings::type].
13432 ///
13433 /// # Example
13434 /// ```ignore,no_run
13435 /// # use google_cloud_osconfig_v1::model::AptSettings;
13436 /// use google_cloud_osconfig_v1::model::apt_settings::Type;
13437 /// let x0 = AptSettings::new().set_type(Type::Dist);
13438 /// let x1 = AptSettings::new().set_type(Type::Upgrade);
13439 /// ```
13440 pub fn set_type<T: std::convert::Into<crate::model::apt_settings::Type>>(
13441 mut self,
13442 v: T,
13443 ) -> Self {
13444 self.r#type = v.into();
13445 self
13446 }
13447
13448 /// Sets the value of [excludes][crate::model::AptSettings::excludes].
13449 ///
13450 /// # Example
13451 /// ```ignore,no_run
13452 /// # use google_cloud_osconfig_v1::model::AptSettings;
13453 /// let x = AptSettings::new().set_excludes(["a", "b", "c"]);
13454 /// ```
13455 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13456 where
13457 T: std::iter::IntoIterator<Item = V>,
13458 V: std::convert::Into<std::string::String>,
13459 {
13460 use std::iter::Iterator;
13461 self.excludes = v.into_iter().map(|i| i.into()).collect();
13462 self
13463 }
13464
13465 /// Sets the value of [exclusive_packages][crate::model::AptSettings::exclusive_packages].
13466 ///
13467 /// # Example
13468 /// ```ignore,no_run
13469 /// # use google_cloud_osconfig_v1::model::AptSettings;
13470 /// let x = AptSettings::new().set_exclusive_packages(["a", "b", "c"]);
13471 /// ```
13472 pub fn set_exclusive_packages<T, V>(mut self, v: T) -> Self
13473 where
13474 T: std::iter::IntoIterator<Item = V>,
13475 V: std::convert::Into<std::string::String>,
13476 {
13477 use std::iter::Iterator;
13478 self.exclusive_packages = v.into_iter().map(|i| i.into()).collect();
13479 self
13480 }
13481}
13482
13483impl wkt::message::Message for AptSettings {
13484 fn typename() -> &'static str {
13485 "type.googleapis.com/google.cloud.osconfig.v1.AptSettings"
13486 }
13487}
13488
13489/// Defines additional types related to [AptSettings].
13490pub mod apt_settings {
13491 #[allow(unused_imports)]
13492 use super::*;
13493
13494 /// Apt patch type.
13495 ///
13496 /// # Working with unknown values
13497 ///
13498 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13499 /// additional enum variants at any time. Adding new variants is not considered
13500 /// a breaking change. Applications should write their code in anticipation of:
13501 ///
13502 /// - New values appearing in future releases of the client library, **and**
13503 /// - New values received dynamically, without application changes.
13504 ///
13505 /// Please consult the [Working with enums] section in the user guide for some
13506 /// guidelines.
13507 ///
13508 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13509 #[derive(Clone, Debug, PartialEq)]
13510 #[non_exhaustive]
13511 pub enum Type {
13512 /// By default, upgrade will be performed.
13513 Unspecified,
13514 /// Runs `apt-get dist-upgrade`.
13515 Dist,
13516 /// Runs `apt-get upgrade`.
13517 Upgrade,
13518 /// If set, the enum was initialized with an unknown value.
13519 ///
13520 /// Applications can examine the value using [Type::value] or
13521 /// [Type::name].
13522 UnknownValue(r#type::UnknownValue),
13523 }
13524
13525 #[doc(hidden)]
13526 pub mod r#type {
13527 #[allow(unused_imports)]
13528 use super::*;
13529 #[derive(Clone, Debug, PartialEq)]
13530 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13531 }
13532
13533 impl Type {
13534 /// Gets the enum value.
13535 ///
13536 /// Returns `None` if the enum contains an unknown value deserialized from
13537 /// the string representation of enums.
13538 pub fn value(&self) -> std::option::Option<i32> {
13539 match self {
13540 Self::Unspecified => std::option::Option::Some(0),
13541 Self::Dist => std::option::Option::Some(1),
13542 Self::Upgrade => std::option::Option::Some(2),
13543 Self::UnknownValue(u) => u.0.value(),
13544 }
13545 }
13546
13547 /// Gets the enum value as a string.
13548 ///
13549 /// Returns `None` if the enum contains an unknown value deserialized from
13550 /// the integer representation of enums.
13551 pub fn name(&self) -> std::option::Option<&str> {
13552 match self {
13553 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
13554 Self::Dist => std::option::Option::Some("DIST"),
13555 Self::Upgrade => std::option::Option::Some("UPGRADE"),
13556 Self::UnknownValue(u) => u.0.name(),
13557 }
13558 }
13559 }
13560
13561 impl std::default::Default for Type {
13562 fn default() -> Self {
13563 use std::convert::From;
13564 Self::from(0)
13565 }
13566 }
13567
13568 impl std::fmt::Display for Type {
13569 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13570 wkt::internal::display_enum(f, self.name(), self.value())
13571 }
13572 }
13573
13574 impl std::convert::From<i32> for Type {
13575 fn from(value: i32) -> Self {
13576 match value {
13577 0 => Self::Unspecified,
13578 1 => Self::Dist,
13579 2 => Self::Upgrade,
13580 _ => Self::UnknownValue(r#type::UnknownValue(
13581 wkt::internal::UnknownEnumValue::Integer(value),
13582 )),
13583 }
13584 }
13585 }
13586
13587 impl std::convert::From<&str> for Type {
13588 fn from(value: &str) -> Self {
13589 use std::string::ToString;
13590 match value {
13591 "TYPE_UNSPECIFIED" => Self::Unspecified,
13592 "DIST" => Self::Dist,
13593 "UPGRADE" => Self::Upgrade,
13594 _ => Self::UnknownValue(r#type::UnknownValue(
13595 wkt::internal::UnknownEnumValue::String(value.to_string()),
13596 )),
13597 }
13598 }
13599 }
13600
13601 impl serde::ser::Serialize for Type {
13602 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13603 where
13604 S: serde::Serializer,
13605 {
13606 match self {
13607 Self::Unspecified => serializer.serialize_i32(0),
13608 Self::Dist => serializer.serialize_i32(1),
13609 Self::Upgrade => serializer.serialize_i32(2),
13610 Self::UnknownValue(u) => u.0.serialize(serializer),
13611 }
13612 }
13613 }
13614
13615 impl<'de> serde::de::Deserialize<'de> for Type {
13616 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13617 where
13618 D: serde::Deserializer<'de>,
13619 {
13620 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
13621 ".google.cloud.osconfig.v1.AptSettings.Type",
13622 ))
13623 }
13624 }
13625}
13626
13627/// Yum patching is performed by executing `yum update`. Additional options
13628/// can be set to control how this is executed.
13629///
13630/// Note that not all settings are supported on all platforms.
13631#[derive(Clone, Default, PartialEq)]
13632#[non_exhaustive]
13633pub struct YumSettings {
13634 /// Adds the `--security` flag to `yum update`. Not supported on
13635 /// all platforms.
13636 pub security: bool,
13637
13638 /// Will cause patch to run `yum update-minimal` instead.
13639 pub minimal: bool,
13640
13641 /// List of packages to exclude from update. These packages are excluded by
13642 /// using the yum `--exclude` flag.
13643 pub excludes: std::vec::Vec<std::string::String>,
13644
13645 /// An exclusive list of packages to be updated. These are the only packages
13646 /// that will be updated. If these packages are not installed, they will be
13647 /// ignored. This field must not be specified with any other patch
13648 /// configuration fields.
13649 pub exclusive_packages: std::vec::Vec<std::string::String>,
13650
13651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13652}
13653
13654impl YumSettings {
13655 /// Creates a new default instance.
13656 pub fn new() -> Self {
13657 std::default::Default::default()
13658 }
13659
13660 /// Sets the value of [security][crate::model::YumSettings::security].
13661 ///
13662 /// # Example
13663 /// ```ignore,no_run
13664 /// # use google_cloud_osconfig_v1::model::YumSettings;
13665 /// let x = YumSettings::new().set_security(true);
13666 /// ```
13667 pub fn set_security<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13668 self.security = v.into();
13669 self
13670 }
13671
13672 /// Sets the value of [minimal][crate::model::YumSettings::minimal].
13673 ///
13674 /// # Example
13675 /// ```ignore,no_run
13676 /// # use google_cloud_osconfig_v1::model::YumSettings;
13677 /// let x = YumSettings::new().set_minimal(true);
13678 /// ```
13679 pub fn set_minimal<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13680 self.minimal = v.into();
13681 self
13682 }
13683
13684 /// Sets the value of [excludes][crate::model::YumSettings::excludes].
13685 ///
13686 /// # Example
13687 /// ```ignore,no_run
13688 /// # use google_cloud_osconfig_v1::model::YumSettings;
13689 /// let x = YumSettings::new().set_excludes(["a", "b", "c"]);
13690 /// ```
13691 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13692 where
13693 T: std::iter::IntoIterator<Item = V>,
13694 V: std::convert::Into<std::string::String>,
13695 {
13696 use std::iter::Iterator;
13697 self.excludes = v.into_iter().map(|i| i.into()).collect();
13698 self
13699 }
13700
13701 /// Sets the value of [exclusive_packages][crate::model::YumSettings::exclusive_packages].
13702 ///
13703 /// # Example
13704 /// ```ignore,no_run
13705 /// # use google_cloud_osconfig_v1::model::YumSettings;
13706 /// let x = YumSettings::new().set_exclusive_packages(["a", "b", "c"]);
13707 /// ```
13708 pub fn set_exclusive_packages<T, V>(mut self, v: T) -> Self
13709 where
13710 T: std::iter::IntoIterator<Item = V>,
13711 V: std::convert::Into<std::string::String>,
13712 {
13713 use std::iter::Iterator;
13714 self.exclusive_packages = v.into_iter().map(|i| i.into()).collect();
13715 self
13716 }
13717}
13718
13719impl wkt::message::Message for YumSettings {
13720 fn typename() -> &'static str {
13721 "type.googleapis.com/google.cloud.osconfig.v1.YumSettings"
13722 }
13723}
13724
13725/// Googet patching is performed by running `googet update`.
13726#[derive(Clone, Default, PartialEq)]
13727#[non_exhaustive]
13728pub struct GooSettings {
13729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13730}
13731
13732impl GooSettings {
13733 /// Creates a new default instance.
13734 pub fn new() -> Self {
13735 std::default::Default::default()
13736 }
13737}
13738
13739impl wkt::message::Message for GooSettings {
13740 fn typename() -> &'static str {
13741 "type.googleapis.com/google.cloud.osconfig.v1.GooSettings"
13742 }
13743}
13744
13745/// Zypper patching is performed by running `zypper patch`.
13746/// See also <https://en.opensuse.org/SDB:Zypper_manual>.
13747#[derive(Clone, Default, PartialEq)]
13748#[non_exhaustive]
13749pub struct ZypperSettings {
13750 /// Adds the `--with-optional` flag to `zypper patch`.
13751 pub with_optional: bool,
13752
13753 /// Adds the `--with-update` flag, to `zypper patch`.
13754 pub with_update: bool,
13755
13756 /// Install only patches with these categories.
13757 /// Common categories include security, recommended, and feature.
13758 pub categories: std::vec::Vec<std::string::String>,
13759
13760 /// Install only patches with these severities.
13761 /// Common severities include critical, important, moderate, and low.
13762 pub severities: std::vec::Vec<std::string::String>,
13763
13764 /// List of patches to exclude from update.
13765 pub excludes: std::vec::Vec<std::string::String>,
13766
13767 /// An exclusive list of patches to be updated. These are the only patches
13768 /// that will be installed using 'zypper patch patch:<patch_name>' command.
13769 /// This field must not be used with any other patch configuration fields.
13770 pub exclusive_patches: std::vec::Vec<std::string::String>,
13771
13772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13773}
13774
13775impl ZypperSettings {
13776 /// Creates a new default instance.
13777 pub fn new() -> Self {
13778 std::default::Default::default()
13779 }
13780
13781 /// Sets the value of [with_optional][crate::model::ZypperSettings::with_optional].
13782 ///
13783 /// # Example
13784 /// ```ignore,no_run
13785 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13786 /// let x = ZypperSettings::new().set_with_optional(true);
13787 /// ```
13788 pub fn set_with_optional<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13789 self.with_optional = v.into();
13790 self
13791 }
13792
13793 /// Sets the value of [with_update][crate::model::ZypperSettings::with_update].
13794 ///
13795 /// # Example
13796 /// ```ignore,no_run
13797 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13798 /// let x = ZypperSettings::new().set_with_update(true);
13799 /// ```
13800 pub fn set_with_update<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13801 self.with_update = v.into();
13802 self
13803 }
13804
13805 /// Sets the value of [categories][crate::model::ZypperSettings::categories].
13806 ///
13807 /// # Example
13808 /// ```ignore,no_run
13809 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13810 /// let x = ZypperSettings::new().set_categories(["a", "b", "c"]);
13811 /// ```
13812 pub fn set_categories<T, V>(mut self, v: T) -> Self
13813 where
13814 T: std::iter::IntoIterator<Item = V>,
13815 V: std::convert::Into<std::string::String>,
13816 {
13817 use std::iter::Iterator;
13818 self.categories = v.into_iter().map(|i| i.into()).collect();
13819 self
13820 }
13821
13822 /// Sets the value of [severities][crate::model::ZypperSettings::severities].
13823 ///
13824 /// # Example
13825 /// ```ignore,no_run
13826 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13827 /// let x = ZypperSettings::new().set_severities(["a", "b", "c"]);
13828 /// ```
13829 pub fn set_severities<T, V>(mut self, v: T) -> Self
13830 where
13831 T: std::iter::IntoIterator<Item = V>,
13832 V: std::convert::Into<std::string::String>,
13833 {
13834 use std::iter::Iterator;
13835 self.severities = v.into_iter().map(|i| i.into()).collect();
13836 self
13837 }
13838
13839 /// Sets the value of [excludes][crate::model::ZypperSettings::excludes].
13840 ///
13841 /// # Example
13842 /// ```ignore,no_run
13843 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13844 /// let x = ZypperSettings::new().set_excludes(["a", "b", "c"]);
13845 /// ```
13846 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13847 where
13848 T: std::iter::IntoIterator<Item = V>,
13849 V: std::convert::Into<std::string::String>,
13850 {
13851 use std::iter::Iterator;
13852 self.excludes = v.into_iter().map(|i| i.into()).collect();
13853 self
13854 }
13855
13856 /// Sets the value of [exclusive_patches][crate::model::ZypperSettings::exclusive_patches].
13857 ///
13858 /// # Example
13859 /// ```ignore,no_run
13860 /// # use google_cloud_osconfig_v1::model::ZypperSettings;
13861 /// let x = ZypperSettings::new().set_exclusive_patches(["a", "b", "c"]);
13862 /// ```
13863 pub fn set_exclusive_patches<T, V>(mut self, v: T) -> Self
13864 where
13865 T: std::iter::IntoIterator<Item = V>,
13866 V: std::convert::Into<std::string::String>,
13867 {
13868 use std::iter::Iterator;
13869 self.exclusive_patches = v.into_iter().map(|i| i.into()).collect();
13870 self
13871 }
13872}
13873
13874impl wkt::message::Message for ZypperSettings {
13875 fn typename() -> &'static str {
13876 "type.googleapis.com/google.cloud.osconfig.v1.ZypperSettings"
13877 }
13878}
13879
13880/// Windows patching is performed using the Windows Update Agent.
13881#[derive(Clone, Default, PartialEq)]
13882#[non_exhaustive]
13883pub struct WindowsUpdateSettings {
13884 /// Only apply updates of these windows update classifications. If empty, all
13885 /// updates are applied.
13886 pub classifications: std::vec::Vec<crate::model::windows_update_settings::Classification>,
13887
13888 /// List of KBs to exclude from update.
13889 pub excludes: std::vec::Vec<std::string::String>,
13890
13891 /// An exclusive list of kbs to be updated. These are the only patches
13892 /// that will be updated. This field must not be used with other
13893 /// patch configurations.
13894 pub exclusive_patches: std::vec::Vec<std::string::String>,
13895
13896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13897}
13898
13899impl WindowsUpdateSettings {
13900 /// Creates a new default instance.
13901 pub fn new() -> Self {
13902 std::default::Default::default()
13903 }
13904
13905 /// Sets the value of [classifications][crate::model::WindowsUpdateSettings::classifications].
13906 ///
13907 /// # Example
13908 /// ```ignore,no_run
13909 /// # use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
13910 /// use google_cloud_osconfig_v1::model::windows_update_settings::Classification;
13911 /// let x = WindowsUpdateSettings::new().set_classifications([
13912 /// Classification::Critical,
13913 /// Classification::Security,
13914 /// Classification::Definition,
13915 /// ]);
13916 /// ```
13917 pub fn set_classifications<T, V>(mut self, v: T) -> Self
13918 where
13919 T: std::iter::IntoIterator<Item = V>,
13920 V: std::convert::Into<crate::model::windows_update_settings::Classification>,
13921 {
13922 use std::iter::Iterator;
13923 self.classifications = v.into_iter().map(|i| i.into()).collect();
13924 self
13925 }
13926
13927 /// Sets the value of [excludes][crate::model::WindowsUpdateSettings::excludes].
13928 ///
13929 /// # Example
13930 /// ```ignore,no_run
13931 /// # use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
13932 /// let x = WindowsUpdateSettings::new().set_excludes(["a", "b", "c"]);
13933 /// ```
13934 pub fn set_excludes<T, V>(mut self, v: T) -> Self
13935 where
13936 T: std::iter::IntoIterator<Item = V>,
13937 V: std::convert::Into<std::string::String>,
13938 {
13939 use std::iter::Iterator;
13940 self.excludes = v.into_iter().map(|i| i.into()).collect();
13941 self
13942 }
13943
13944 /// Sets the value of [exclusive_patches][crate::model::WindowsUpdateSettings::exclusive_patches].
13945 ///
13946 /// # Example
13947 /// ```ignore,no_run
13948 /// # use google_cloud_osconfig_v1::model::WindowsUpdateSettings;
13949 /// let x = WindowsUpdateSettings::new().set_exclusive_patches(["a", "b", "c"]);
13950 /// ```
13951 pub fn set_exclusive_patches<T, V>(mut self, v: T) -> Self
13952 where
13953 T: std::iter::IntoIterator<Item = V>,
13954 V: std::convert::Into<std::string::String>,
13955 {
13956 use std::iter::Iterator;
13957 self.exclusive_patches = v.into_iter().map(|i| i.into()).collect();
13958 self
13959 }
13960}
13961
13962impl wkt::message::Message for WindowsUpdateSettings {
13963 fn typename() -> &'static str {
13964 "type.googleapis.com/google.cloud.osconfig.v1.WindowsUpdateSettings"
13965 }
13966}
13967
13968/// Defines additional types related to [WindowsUpdateSettings].
13969pub mod windows_update_settings {
13970 #[allow(unused_imports)]
13971 use super::*;
13972
13973 /// Microsoft Windows update classifications as defined in
13974 /// [1]
13975 /// <https://support.microsoft.com/en-us/help/824684/description-of-the-standard-terminology-that-is-used-to-describe-micro>
13976 ///
13977 /// # Working with unknown values
13978 ///
13979 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13980 /// additional enum variants at any time. Adding new variants is not considered
13981 /// a breaking change. Applications should write their code in anticipation of:
13982 ///
13983 /// - New values appearing in future releases of the client library, **and**
13984 /// - New values received dynamically, without application changes.
13985 ///
13986 /// Please consult the [Working with enums] section in the user guide for some
13987 /// guidelines.
13988 ///
13989 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13990 #[derive(Clone, Debug, PartialEq)]
13991 #[non_exhaustive]
13992 pub enum Classification {
13993 /// Invalid. If classifications are included, they must be specified.
13994 Unspecified,
13995 /// "A widely released fix for a specific problem that addresses a critical,
13996 /// non-security-related bug." [1]
13997 Critical,
13998 /// "A widely released fix for a product-specific, security-related
13999 /// vulnerability. Security vulnerabilities are rated by their severity. The
14000 /// severity rating is indicated in the Microsoft security bulletin as
14001 /// critical, important, moderate, or low." [1]
14002 Security,
14003 /// "A widely released and frequent software update that contains additions
14004 /// to a product's definition database. Definition databases are often used
14005 /// to detect objects that have specific attributes, such as malicious code,
14006 /// phishing websites, or junk mail." [1]
14007 Definition,
14008 /// "Software that controls the input and output of a device." [1]
14009 Driver,
14010 /// "New product functionality that is first distributed outside the context
14011 /// of a product release and that is typically included in the next full
14012 /// product release." [1]
14013 FeaturePack,
14014 /// "A tested, cumulative set of all hotfixes, security updates, critical
14015 /// updates, and updates. Additionally, service packs may contain additional
14016 /// fixes for problems that are found internally since the release of the
14017 /// product. Service packs my also contain a limited number of
14018 /// customer-requested design changes or features." [1]
14019 ServicePack,
14020 /// "A utility or feature that helps complete a task or set of tasks." [1]
14021 Tool,
14022 /// "A tested, cumulative set of hotfixes, security updates, critical
14023 /// updates, and updates that are packaged together for easy deployment. A
14024 /// rollup generally targets a specific area, such as security, or a
14025 /// component of a product, such as Internet Information Services (IIS)." [1]
14026 UpdateRollup,
14027 /// "A widely released fix for a specific problem. An update addresses a
14028 /// noncritical, non-security-related bug." [1]
14029 Update,
14030 /// If set, the enum was initialized with an unknown value.
14031 ///
14032 /// Applications can examine the value using [Classification::value] or
14033 /// [Classification::name].
14034 UnknownValue(classification::UnknownValue),
14035 }
14036
14037 #[doc(hidden)]
14038 pub mod classification {
14039 #[allow(unused_imports)]
14040 use super::*;
14041 #[derive(Clone, Debug, PartialEq)]
14042 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14043 }
14044
14045 impl Classification {
14046 /// Gets the enum value.
14047 ///
14048 /// Returns `None` if the enum contains an unknown value deserialized from
14049 /// the string representation of enums.
14050 pub fn value(&self) -> std::option::Option<i32> {
14051 match self {
14052 Self::Unspecified => std::option::Option::Some(0),
14053 Self::Critical => std::option::Option::Some(1),
14054 Self::Security => std::option::Option::Some(2),
14055 Self::Definition => std::option::Option::Some(3),
14056 Self::Driver => std::option::Option::Some(4),
14057 Self::FeaturePack => std::option::Option::Some(5),
14058 Self::ServicePack => std::option::Option::Some(6),
14059 Self::Tool => std::option::Option::Some(7),
14060 Self::UpdateRollup => std::option::Option::Some(8),
14061 Self::Update => std::option::Option::Some(9),
14062 Self::UnknownValue(u) => u.0.value(),
14063 }
14064 }
14065
14066 /// Gets the enum value as a string.
14067 ///
14068 /// Returns `None` if the enum contains an unknown value deserialized from
14069 /// the integer representation of enums.
14070 pub fn name(&self) -> std::option::Option<&str> {
14071 match self {
14072 Self::Unspecified => std::option::Option::Some("CLASSIFICATION_UNSPECIFIED"),
14073 Self::Critical => std::option::Option::Some("CRITICAL"),
14074 Self::Security => std::option::Option::Some("SECURITY"),
14075 Self::Definition => std::option::Option::Some("DEFINITION"),
14076 Self::Driver => std::option::Option::Some("DRIVER"),
14077 Self::FeaturePack => std::option::Option::Some("FEATURE_PACK"),
14078 Self::ServicePack => std::option::Option::Some("SERVICE_PACK"),
14079 Self::Tool => std::option::Option::Some("TOOL"),
14080 Self::UpdateRollup => std::option::Option::Some("UPDATE_ROLLUP"),
14081 Self::Update => std::option::Option::Some("UPDATE"),
14082 Self::UnknownValue(u) => u.0.name(),
14083 }
14084 }
14085 }
14086
14087 impl std::default::Default for Classification {
14088 fn default() -> Self {
14089 use std::convert::From;
14090 Self::from(0)
14091 }
14092 }
14093
14094 impl std::fmt::Display for Classification {
14095 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14096 wkt::internal::display_enum(f, self.name(), self.value())
14097 }
14098 }
14099
14100 impl std::convert::From<i32> for Classification {
14101 fn from(value: i32) -> Self {
14102 match value {
14103 0 => Self::Unspecified,
14104 1 => Self::Critical,
14105 2 => Self::Security,
14106 3 => Self::Definition,
14107 4 => Self::Driver,
14108 5 => Self::FeaturePack,
14109 6 => Self::ServicePack,
14110 7 => Self::Tool,
14111 8 => Self::UpdateRollup,
14112 9 => Self::Update,
14113 _ => Self::UnknownValue(classification::UnknownValue(
14114 wkt::internal::UnknownEnumValue::Integer(value),
14115 )),
14116 }
14117 }
14118 }
14119
14120 impl std::convert::From<&str> for Classification {
14121 fn from(value: &str) -> Self {
14122 use std::string::ToString;
14123 match value {
14124 "CLASSIFICATION_UNSPECIFIED" => Self::Unspecified,
14125 "CRITICAL" => Self::Critical,
14126 "SECURITY" => Self::Security,
14127 "DEFINITION" => Self::Definition,
14128 "DRIVER" => Self::Driver,
14129 "FEATURE_PACK" => Self::FeaturePack,
14130 "SERVICE_PACK" => Self::ServicePack,
14131 "TOOL" => Self::Tool,
14132 "UPDATE_ROLLUP" => Self::UpdateRollup,
14133 "UPDATE" => Self::Update,
14134 _ => Self::UnknownValue(classification::UnknownValue(
14135 wkt::internal::UnknownEnumValue::String(value.to_string()),
14136 )),
14137 }
14138 }
14139 }
14140
14141 impl serde::ser::Serialize for Classification {
14142 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14143 where
14144 S: serde::Serializer,
14145 {
14146 match self {
14147 Self::Unspecified => serializer.serialize_i32(0),
14148 Self::Critical => serializer.serialize_i32(1),
14149 Self::Security => serializer.serialize_i32(2),
14150 Self::Definition => serializer.serialize_i32(3),
14151 Self::Driver => serializer.serialize_i32(4),
14152 Self::FeaturePack => serializer.serialize_i32(5),
14153 Self::ServicePack => serializer.serialize_i32(6),
14154 Self::Tool => serializer.serialize_i32(7),
14155 Self::UpdateRollup => serializer.serialize_i32(8),
14156 Self::Update => serializer.serialize_i32(9),
14157 Self::UnknownValue(u) => u.0.serialize(serializer),
14158 }
14159 }
14160 }
14161
14162 impl<'de> serde::de::Deserialize<'de> for Classification {
14163 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14164 where
14165 D: serde::Deserializer<'de>,
14166 {
14167 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Classification>::new(
14168 ".google.cloud.osconfig.v1.WindowsUpdateSettings.Classification",
14169 ))
14170 }
14171 }
14172}
14173
14174/// A step that runs an executable for a PatchJob.
14175#[derive(Clone, Default, PartialEq)]
14176#[non_exhaustive]
14177pub struct ExecStep {
14178 /// The ExecStepConfig for all Linux VMs targeted by the PatchJob.
14179 pub linux_exec_step_config: std::option::Option<crate::model::ExecStepConfig>,
14180
14181 /// The ExecStepConfig for all Windows VMs targeted by the PatchJob.
14182 pub windows_exec_step_config: std::option::Option<crate::model::ExecStepConfig>,
14183
14184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14185}
14186
14187impl ExecStep {
14188 /// Creates a new default instance.
14189 pub fn new() -> Self {
14190 std::default::Default::default()
14191 }
14192
14193 /// Sets the value of [linux_exec_step_config][crate::model::ExecStep::linux_exec_step_config].
14194 ///
14195 /// # Example
14196 /// ```ignore,no_run
14197 /// # use google_cloud_osconfig_v1::model::ExecStep;
14198 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14199 /// let x = ExecStep::new().set_linux_exec_step_config(ExecStepConfig::default()/* use setters */);
14200 /// ```
14201 pub fn set_linux_exec_step_config<T>(mut self, v: T) -> Self
14202 where
14203 T: std::convert::Into<crate::model::ExecStepConfig>,
14204 {
14205 self.linux_exec_step_config = std::option::Option::Some(v.into());
14206 self
14207 }
14208
14209 /// Sets or clears the value of [linux_exec_step_config][crate::model::ExecStep::linux_exec_step_config].
14210 ///
14211 /// # Example
14212 /// ```ignore,no_run
14213 /// # use google_cloud_osconfig_v1::model::ExecStep;
14214 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14215 /// let x = ExecStep::new().set_or_clear_linux_exec_step_config(Some(ExecStepConfig::default()/* use setters */));
14216 /// let x = ExecStep::new().set_or_clear_linux_exec_step_config(None::<ExecStepConfig>);
14217 /// ```
14218 pub fn set_or_clear_linux_exec_step_config<T>(mut self, v: std::option::Option<T>) -> Self
14219 where
14220 T: std::convert::Into<crate::model::ExecStepConfig>,
14221 {
14222 self.linux_exec_step_config = v.map(|x| x.into());
14223 self
14224 }
14225
14226 /// Sets the value of [windows_exec_step_config][crate::model::ExecStep::windows_exec_step_config].
14227 ///
14228 /// # Example
14229 /// ```ignore,no_run
14230 /// # use google_cloud_osconfig_v1::model::ExecStep;
14231 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14232 /// let x = ExecStep::new().set_windows_exec_step_config(ExecStepConfig::default()/* use setters */);
14233 /// ```
14234 pub fn set_windows_exec_step_config<T>(mut self, v: T) -> Self
14235 where
14236 T: std::convert::Into<crate::model::ExecStepConfig>,
14237 {
14238 self.windows_exec_step_config = std::option::Option::Some(v.into());
14239 self
14240 }
14241
14242 /// Sets or clears the value of [windows_exec_step_config][crate::model::ExecStep::windows_exec_step_config].
14243 ///
14244 /// # Example
14245 /// ```ignore,no_run
14246 /// # use google_cloud_osconfig_v1::model::ExecStep;
14247 /// use google_cloud_osconfig_v1::model::ExecStepConfig;
14248 /// let x = ExecStep::new().set_or_clear_windows_exec_step_config(Some(ExecStepConfig::default()/* use setters */));
14249 /// let x = ExecStep::new().set_or_clear_windows_exec_step_config(None::<ExecStepConfig>);
14250 /// ```
14251 pub fn set_or_clear_windows_exec_step_config<T>(mut self, v: std::option::Option<T>) -> Self
14252 where
14253 T: std::convert::Into<crate::model::ExecStepConfig>,
14254 {
14255 self.windows_exec_step_config = v.map(|x| x.into());
14256 self
14257 }
14258}
14259
14260impl wkt::message::Message for ExecStep {
14261 fn typename() -> &'static str {
14262 "type.googleapis.com/google.cloud.osconfig.v1.ExecStep"
14263 }
14264}
14265
14266/// Common configurations for an ExecStep.
14267#[derive(Clone, Default, PartialEq)]
14268#[non_exhaustive]
14269pub struct ExecStepConfig {
14270 /// Defaults to [0]. A list of possible return values that the
14271 /// execution can return to indicate a success.
14272 pub allowed_success_codes: std::vec::Vec<i32>,
14273
14274 /// The script interpreter to use to run the script. If no interpreter is
14275 /// specified the script will be executed directly, which will likely
14276 /// only succeed for scripts with [shebang lines]
14277 /// (<https://en.wikipedia.org/wiki/Shebang_>\(Unix\)).
14278 pub interpreter: crate::model::exec_step_config::Interpreter,
14279
14280 /// Location of the executable.
14281 pub executable: std::option::Option<crate::model::exec_step_config::Executable>,
14282
14283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14284}
14285
14286impl ExecStepConfig {
14287 /// Creates a new default instance.
14288 pub fn new() -> Self {
14289 std::default::Default::default()
14290 }
14291
14292 /// Sets the value of [allowed_success_codes][crate::model::ExecStepConfig::allowed_success_codes].
14293 ///
14294 /// # Example
14295 /// ```ignore,no_run
14296 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14297 /// let x = ExecStepConfig::new().set_allowed_success_codes([1, 2, 3]);
14298 /// ```
14299 pub fn set_allowed_success_codes<T, V>(mut self, v: T) -> Self
14300 where
14301 T: std::iter::IntoIterator<Item = V>,
14302 V: std::convert::Into<i32>,
14303 {
14304 use std::iter::Iterator;
14305 self.allowed_success_codes = v.into_iter().map(|i| i.into()).collect();
14306 self
14307 }
14308
14309 /// Sets the value of [interpreter][crate::model::ExecStepConfig::interpreter].
14310 ///
14311 /// # Example
14312 /// ```ignore,no_run
14313 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14314 /// use google_cloud_osconfig_v1::model::exec_step_config::Interpreter;
14315 /// let x0 = ExecStepConfig::new().set_interpreter(Interpreter::Shell);
14316 /// let x1 = ExecStepConfig::new().set_interpreter(Interpreter::Powershell);
14317 /// ```
14318 pub fn set_interpreter<T: std::convert::Into<crate::model::exec_step_config::Interpreter>>(
14319 mut self,
14320 v: T,
14321 ) -> Self {
14322 self.interpreter = v.into();
14323 self
14324 }
14325
14326 /// Sets the value of [executable][crate::model::ExecStepConfig::executable].
14327 ///
14328 /// Note that all the setters affecting `executable` are mutually
14329 /// exclusive.
14330 ///
14331 /// # Example
14332 /// ```ignore,no_run
14333 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14334 /// use google_cloud_osconfig_v1::model::exec_step_config::Executable;
14335 /// let x = ExecStepConfig::new().set_executable(Some(Executable::LocalPath("example".to_string())));
14336 /// ```
14337 pub fn set_executable<
14338 T: std::convert::Into<std::option::Option<crate::model::exec_step_config::Executable>>,
14339 >(
14340 mut self,
14341 v: T,
14342 ) -> Self {
14343 self.executable = v.into();
14344 self
14345 }
14346
14347 /// The value of [executable][crate::model::ExecStepConfig::executable]
14348 /// if it holds a `LocalPath`, `None` if the field is not set or
14349 /// holds a different branch.
14350 pub fn local_path(&self) -> std::option::Option<&std::string::String> {
14351 #[allow(unreachable_patterns)]
14352 self.executable.as_ref().and_then(|v| match v {
14353 crate::model::exec_step_config::Executable::LocalPath(v) => {
14354 std::option::Option::Some(v)
14355 }
14356 _ => std::option::Option::None,
14357 })
14358 }
14359
14360 /// Sets the value of [executable][crate::model::ExecStepConfig::executable]
14361 /// to hold a `LocalPath`.
14362 ///
14363 /// Note that all the setters affecting `executable` are
14364 /// mutually exclusive.
14365 ///
14366 /// # Example
14367 /// ```ignore,no_run
14368 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14369 /// let x = ExecStepConfig::new().set_local_path("example");
14370 /// assert!(x.local_path().is_some());
14371 /// assert!(x.gcs_object().is_none());
14372 /// ```
14373 pub fn set_local_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14374 self.executable = std::option::Option::Some(
14375 crate::model::exec_step_config::Executable::LocalPath(v.into()),
14376 );
14377 self
14378 }
14379
14380 /// The value of [executable][crate::model::ExecStepConfig::executable]
14381 /// if it holds a `GcsObject`, `None` if the field is not set or
14382 /// holds a different branch.
14383 pub fn gcs_object(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsObject>> {
14384 #[allow(unreachable_patterns)]
14385 self.executable.as_ref().and_then(|v| match v {
14386 crate::model::exec_step_config::Executable::GcsObject(v) => {
14387 std::option::Option::Some(v)
14388 }
14389 _ => std::option::Option::None,
14390 })
14391 }
14392
14393 /// Sets the value of [executable][crate::model::ExecStepConfig::executable]
14394 /// to hold a `GcsObject`.
14395 ///
14396 /// Note that all the setters affecting `executable` are
14397 /// mutually exclusive.
14398 ///
14399 /// # Example
14400 /// ```ignore,no_run
14401 /// # use google_cloud_osconfig_v1::model::ExecStepConfig;
14402 /// use google_cloud_osconfig_v1::model::GcsObject;
14403 /// let x = ExecStepConfig::new().set_gcs_object(GcsObject::default()/* use setters */);
14404 /// assert!(x.gcs_object().is_some());
14405 /// assert!(x.local_path().is_none());
14406 /// ```
14407 pub fn set_gcs_object<T: std::convert::Into<std::boxed::Box<crate::model::GcsObject>>>(
14408 mut self,
14409 v: T,
14410 ) -> Self {
14411 self.executable = std::option::Option::Some(
14412 crate::model::exec_step_config::Executable::GcsObject(v.into()),
14413 );
14414 self
14415 }
14416}
14417
14418impl wkt::message::Message for ExecStepConfig {
14419 fn typename() -> &'static str {
14420 "type.googleapis.com/google.cloud.osconfig.v1.ExecStepConfig"
14421 }
14422}
14423
14424/// Defines additional types related to [ExecStepConfig].
14425pub mod exec_step_config {
14426 #[allow(unused_imports)]
14427 use super::*;
14428
14429 /// The interpreter used to execute the a file.
14430 ///
14431 /// # Working with unknown values
14432 ///
14433 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14434 /// additional enum variants at any time. Adding new variants is not considered
14435 /// a breaking change. Applications should write their code in anticipation of:
14436 ///
14437 /// - New values appearing in future releases of the client library, **and**
14438 /// - New values received dynamically, without application changes.
14439 ///
14440 /// Please consult the [Working with enums] section in the user guide for some
14441 /// guidelines.
14442 ///
14443 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14444 #[derive(Clone, Debug, PartialEq)]
14445 #[non_exhaustive]
14446 pub enum Interpreter {
14447 /// Invalid for a Windows ExecStepConfig. For a Linux ExecStepConfig, the
14448 /// interpreter will be parsed from the shebang line of the script if
14449 /// unspecified.
14450 Unspecified,
14451 /// Indicates that the script is run with `/bin/sh` on Linux and `cmd`
14452 /// on Windows.
14453 Shell,
14454 /// Indicates that the file is run with PowerShell flags
14455 /// `-NonInteractive`, `-NoProfile`, and `-ExecutionPolicy Bypass`.
14456 Powershell,
14457 /// If set, the enum was initialized with an unknown value.
14458 ///
14459 /// Applications can examine the value using [Interpreter::value] or
14460 /// [Interpreter::name].
14461 UnknownValue(interpreter::UnknownValue),
14462 }
14463
14464 #[doc(hidden)]
14465 pub mod interpreter {
14466 #[allow(unused_imports)]
14467 use super::*;
14468 #[derive(Clone, Debug, PartialEq)]
14469 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14470 }
14471
14472 impl Interpreter {
14473 /// Gets the enum value.
14474 ///
14475 /// Returns `None` if the enum contains an unknown value deserialized from
14476 /// the string representation of enums.
14477 pub fn value(&self) -> std::option::Option<i32> {
14478 match self {
14479 Self::Unspecified => std::option::Option::Some(0),
14480 Self::Shell => std::option::Option::Some(1),
14481 Self::Powershell => std::option::Option::Some(2),
14482 Self::UnknownValue(u) => u.0.value(),
14483 }
14484 }
14485
14486 /// Gets the enum value as a string.
14487 ///
14488 /// Returns `None` if the enum contains an unknown value deserialized from
14489 /// the integer representation of enums.
14490 pub fn name(&self) -> std::option::Option<&str> {
14491 match self {
14492 Self::Unspecified => std::option::Option::Some("INTERPRETER_UNSPECIFIED"),
14493 Self::Shell => std::option::Option::Some("SHELL"),
14494 Self::Powershell => std::option::Option::Some("POWERSHELL"),
14495 Self::UnknownValue(u) => u.0.name(),
14496 }
14497 }
14498 }
14499
14500 impl std::default::Default for Interpreter {
14501 fn default() -> Self {
14502 use std::convert::From;
14503 Self::from(0)
14504 }
14505 }
14506
14507 impl std::fmt::Display for Interpreter {
14508 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14509 wkt::internal::display_enum(f, self.name(), self.value())
14510 }
14511 }
14512
14513 impl std::convert::From<i32> for Interpreter {
14514 fn from(value: i32) -> Self {
14515 match value {
14516 0 => Self::Unspecified,
14517 1 => Self::Shell,
14518 2 => Self::Powershell,
14519 _ => Self::UnknownValue(interpreter::UnknownValue(
14520 wkt::internal::UnknownEnumValue::Integer(value),
14521 )),
14522 }
14523 }
14524 }
14525
14526 impl std::convert::From<&str> for Interpreter {
14527 fn from(value: &str) -> Self {
14528 use std::string::ToString;
14529 match value {
14530 "INTERPRETER_UNSPECIFIED" => Self::Unspecified,
14531 "SHELL" => Self::Shell,
14532 "POWERSHELL" => Self::Powershell,
14533 _ => Self::UnknownValue(interpreter::UnknownValue(
14534 wkt::internal::UnknownEnumValue::String(value.to_string()),
14535 )),
14536 }
14537 }
14538 }
14539
14540 impl serde::ser::Serialize for Interpreter {
14541 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14542 where
14543 S: serde::Serializer,
14544 {
14545 match self {
14546 Self::Unspecified => serializer.serialize_i32(0),
14547 Self::Shell => serializer.serialize_i32(1),
14548 Self::Powershell => serializer.serialize_i32(2),
14549 Self::UnknownValue(u) => u.0.serialize(serializer),
14550 }
14551 }
14552 }
14553
14554 impl<'de> serde::de::Deserialize<'de> for Interpreter {
14555 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14556 where
14557 D: serde::Deserializer<'de>,
14558 {
14559 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Interpreter>::new(
14560 ".google.cloud.osconfig.v1.ExecStepConfig.Interpreter",
14561 ))
14562 }
14563 }
14564
14565 /// Location of the executable.
14566 #[derive(Clone, Debug, PartialEq)]
14567 #[non_exhaustive]
14568 pub enum Executable {
14569 /// An absolute path to the executable on the VM.
14570 LocalPath(std::string::String),
14571 /// A Cloud Storage object containing the executable.
14572 GcsObject(std::boxed::Box<crate::model::GcsObject>),
14573 }
14574}
14575
14576/// Cloud Storage object representation.
14577#[derive(Clone, Default, PartialEq)]
14578#[non_exhaustive]
14579pub struct GcsObject {
14580 /// Required. Bucket of the Cloud Storage object.
14581 pub bucket: std::string::String,
14582
14583 /// Required. Name of the Cloud Storage object.
14584 pub object: std::string::String,
14585
14586 /// Required. Generation number of the Cloud Storage object. This is used to
14587 /// ensure that the ExecStep specified by this PatchJob does not change.
14588 pub generation_number: i64,
14589
14590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14591}
14592
14593impl GcsObject {
14594 /// Creates a new default instance.
14595 pub fn new() -> Self {
14596 std::default::Default::default()
14597 }
14598
14599 /// Sets the value of [bucket][crate::model::GcsObject::bucket].
14600 ///
14601 /// # Example
14602 /// ```ignore,no_run
14603 /// # use google_cloud_osconfig_v1::model::GcsObject;
14604 /// let x = GcsObject::new().set_bucket("example");
14605 /// ```
14606 pub fn set_bucket<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14607 self.bucket = v.into();
14608 self
14609 }
14610
14611 /// Sets the value of [object][crate::model::GcsObject::object].
14612 ///
14613 /// # Example
14614 /// ```ignore,no_run
14615 /// # use google_cloud_osconfig_v1::model::GcsObject;
14616 /// let x = GcsObject::new().set_object("example");
14617 /// ```
14618 pub fn set_object<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14619 self.object = v.into();
14620 self
14621 }
14622
14623 /// Sets the value of [generation_number][crate::model::GcsObject::generation_number].
14624 ///
14625 /// # Example
14626 /// ```ignore,no_run
14627 /// # use google_cloud_osconfig_v1::model::GcsObject;
14628 /// let x = GcsObject::new().set_generation_number(42);
14629 /// ```
14630 pub fn set_generation_number<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
14631 self.generation_number = v.into();
14632 self
14633 }
14634}
14635
14636impl wkt::message::Message for GcsObject {
14637 fn typename() -> &'static str {
14638 "type.googleapis.com/google.cloud.osconfig.v1.GcsObject"
14639 }
14640}
14641
14642/// A filter to target VM instances for patching. The targeted
14643/// VMs must meet all criteria specified. So if both labels and zones are
14644/// specified, the patch job targets only VMs with those labels and in those
14645/// zones.
14646#[derive(Clone, Default, PartialEq)]
14647#[non_exhaustive]
14648pub struct PatchInstanceFilter {
14649 /// Target all VM instances in the project. If true, no other criteria is
14650 /// permitted.
14651 pub all: bool,
14652
14653 /// Targets VM instances matching ANY of these GroupLabels. This allows
14654 /// targeting of disparate groups of VM instances.
14655 pub group_labels: std::vec::Vec<crate::model::patch_instance_filter::GroupLabel>,
14656
14657 /// Targets VM instances in ANY of these zones. Leave empty to target VM
14658 /// instances in any zone.
14659 pub zones: std::vec::Vec<std::string::String>,
14660
14661 /// Targets any of the VM instances specified. Instances are specified by their
14662 /// URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`,
14663 /// `projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or
14664 /// `<https://www.googleapis.com/compute/v1/projects/>[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`
14665 pub instances: std::vec::Vec<std::string::String>,
14666
14667 /// Targets VMs whose name starts with one of these prefixes. Similar to
14668 /// labels, this is another way to group VMs when targeting configs, for
14669 /// example prefix="prod-".
14670 pub instance_name_prefixes: std::vec::Vec<std::string::String>,
14671
14672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14673}
14674
14675impl PatchInstanceFilter {
14676 /// Creates a new default instance.
14677 pub fn new() -> Self {
14678 std::default::Default::default()
14679 }
14680
14681 /// Sets the value of [all][crate::model::PatchInstanceFilter::all].
14682 ///
14683 /// # Example
14684 /// ```ignore,no_run
14685 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14686 /// let x = PatchInstanceFilter::new().set_all(true);
14687 /// ```
14688 pub fn set_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14689 self.all = v.into();
14690 self
14691 }
14692
14693 /// Sets the value of [group_labels][crate::model::PatchInstanceFilter::group_labels].
14694 ///
14695 /// # Example
14696 /// ```ignore,no_run
14697 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14698 /// use google_cloud_osconfig_v1::model::patch_instance_filter::GroupLabel;
14699 /// let x = PatchInstanceFilter::new()
14700 /// .set_group_labels([
14701 /// GroupLabel::default()/* use setters */,
14702 /// GroupLabel::default()/* use (different) setters */,
14703 /// ]);
14704 /// ```
14705 pub fn set_group_labels<T, V>(mut self, v: T) -> Self
14706 where
14707 T: std::iter::IntoIterator<Item = V>,
14708 V: std::convert::Into<crate::model::patch_instance_filter::GroupLabel>,
14709 {
14710 use std::iter::Iterator;
14711 self.group_labels = v.into_iter().map(|i| i.into()).collect();
14712 self
14713 }
14714
14715 /// Sets the value of [zones][crate::model::PatchInstanceFilter::zones].
14716 ///
14717 /// # Example
14718 /// ```ignore,no_run
14719 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14720 /// let x = PatchInstanceFilter::new().set_zones(["a", "b", "c"]);
14721 /// ```
14722 pub fn set_zones<T, V>(mut self, v: T) -> Self
14723 where
14724 T: std::iter::IntoIterator<Item = V>,
14725 V: std::convert::Into<std::string::String>,
14726 {
14727 use std::iter::Iterator;
14728 self.zones = v.into_iter().map(|i| i.into()).collect();
14729 self
14730 }
14731
14732 /// Sets the value of [instances][crate::model::PatchInstanceFilter::instances].
14733 ///
14734 /// # Example
14735 /// ```ignore,no_run
14736 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14737 /// let x = PatchInstanceFilter::new().set_instances(["a", "b", "c"]);
14738 /// ```
14739 pub fn set_instances<T, V>(mut self, v: T) -> Self
14740 where
14741 T: std::iter::IntoIterator<Item = V>,
14742 V: std::convert::Into<std::string::String>,
14743 {
14744 use std::iter::Iterator;
14745 self.instances = v.into_iter().map(|i| i.into()).collect();
14746 self
14747 }
14748
14749 /// Sets the value of [instance_name_prefixes][crate::model::PatchInstanceFilter::instance_name_prefixes].
14750 ///
14751 /// # Example
14752 /// ```ignore,no_run
14753 /// # use google_cloud_osconfig_v1::model::PatchInstanceFilter;
14754 /// let x = PatchInstanceFilter::new().set_instance_name_prefixes(["a", "b", "c"]);
14755 /// ```
14756 pub fn set_instance_name_prefixes<T, V>(mut self, v: T) -> Self
14757 where
14758 T: std::iter::IntoIterator<Item = V>,
14759 V: std::convert::Into<std::string::String>,
14760 {
14761 use std::iter::Iterator;
14762 self.instance_name_prefixes = v.into_iter().map(|i| i.into()).collect();
14763 self
14764 }
14765}
14766
14767impl wkt::message::Message for PatchInstanceFilter {
14768 fn typename() -> &'static str {
14769 "type.googleapis.com/google.cloud.osconfig.v1.PatchInstanceFilter"
14770 }
14771}
14772
14773/// Defines additional types related to [PatchInstanceFilter].
14774pub mod patch_instance_filter {
14775 #[allow(unused_imports)]
14776 use super::*;
14777
14778 /// Targets a group of VM instances by using their [assigned
14779 /// labels](https://cloud.google.com/compute/docs/labeling-resources). Labels
14780 /// are key-value pairs. A `GroupLabel` is a combination of labels
14781 /// that is used to target VMs for a patch job.
14782 ///
14783 /// For example, a patch job can target VMs that have the following
14784 /// `GroupLabel`: `{"env":"test", "app":"web"}`. This means that the patch job
14785 /// is applied to VMs that have both the labels `env=test` and `app=web`.
14786 #[derive(Clone, Default, PartialEq)]
14787 #[non_exhaustive]
14788 pub struct GroupLabel {
14789 /// Compute Engine instance labels that must be present for a VM
14790 /// instance to be targeted by this filter.
14791 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
14792
14793 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14794 }
14795
14796 impl GroupLabel {
14797 /// Creates a new default instance.
14798 pub fn new() -> Self {
14799 std::default::Default::default()
14800 }
14801
14802 /// Sets the value of [labels][crate::model::patch_instance_filter::GroupLabel::labels].
14803 ///
14804 /// # Example
14805 /// ```ignore,no_run
14806 /// # use google_cloud_osconfig_v1::model::patch_instance_filter::GroupLabel;
14807 /// let x = GroupLabel::new().set_labels([
14808 /// ("key0", "abc"),
14809 /// ("key1", "xyz"),
14810 /// ]);
14811 /// ```
14812 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
14813 where
14814 T: std::iter::IntoIterator<Item = (K, V)>,
14815 K: std::convert::Into<std::string::String>,
14816 V: std::convert::Into<std::string::String>,
14817 {
14818 use std::iter::Iterator;
14819 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
14820 self
14821 }
14822 }
14823
14824 impl wkt::message::Message for GroupLabel {
14825 fn typename() -> &'static str {
14826 "type.googleapis.com/google.cloud.osconfig.v1.PatchInstanceFilter.GroupLabel"
14827 }
14828 }
14829}
14830
14831/// Patch rollout configuration specifications. Contains details on the
14832/// concurrency control when applying patch(es) to all targeted VMs.
14833#[derive(Clone, Default, PartialEq)]
14834#[non_exhaustive]
14835pub struct PatchRollout {
14836 /// Mode of the patch rollout.
14837 pub mode: crate::model::patch_rollout::Mode,
14838
14839 /// The maximum number (or percentage) of VMs per zone to disrupt at any given
14840 /// moment. The number of VMs calculated from multiplying the percentage by the
14841 /// total number of VMs in a zone is rounded up.
14842 ///
14843 /// During patching, a VM is considered disrupted from the time the agent is
14844 /// notified to begin until patching has completed. This disruption time
14845 /// includes the time to complete reboot and any post-patch steps.
14846 ///
14847 /// A VM contributes to the disruption budget if its patching operation fails
14848 /// either when applying the patches, running pre or post patch steps, or if it
14849 /// fails to respond with a success notification before timing out. VMs that
14850 /// are not running or do not have an active agent do not count toward this
14851 /// disruption budget.
14852 ///
14853 /// For zone-by-zone rollouts, if the disruption budget in a zone is exceeded,
14854 /// the patch job stops, because continuing to the next zone requires
14855 /// completion of the patch process in the previous zone.
14856 ///
14857 /// For example, if the disruption budget has a fixed value of `10`, and 8 VMs
14858 /// fail to patch in the current zone, the patch job continues to patch 2 VMs
14859 /// at a time until the zone is completed. When that zone is completed
14860 /// successfully, patching begins with 10 VMs at a time in the next zone. If 10
14861 /// VMs in the next zone fail to patch, the patch job stops.
14862 pub disruption_budget: std::option::Option<crate::model::FixedOrPercent>,
14863
14864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14865}
14866
14867impl PatchRollout {
14868 /// Creates a new default instance.
14869 pub fn new() -> Self {
14870 std::default::Default::default()
14871 }
14872
14873 /// Sets the value of [mode][crate::model::PatchRollout::mode].
14874 ///
14875 /// # Example
14876 /// ```ignore,no_run
14877 /// # use google_cloud_osconfig_v1::model::PatchRollout;
14878 /// use google_cloud_osconfig_v1::model::patch_rollout::Mode;
14879 /// let x0 = PatchRollout::new().set_mode(Mode::ZoneByZone);
14880 /// let x1 = PatchRollout::new().set_mode(Mode::ConcurrentZones);
14881 /// ```
14882 pub fn set_mode<T: std::convert::Into<crate::model::patch_rollout::Mode>>(
14883 mut self,
14884 v: T,
14885 ) -> Self {
14886 self.mode = v.into();
14887 self
14888 }
14889
14890 /// Sets the value of [disruption_budget][crate::model::PatchRollout::disruption_budget].
14891 ///
14892 /// # Example
14893 /// ```ignore,no_run
14894 /// # use google_cloud_osconfig_v1::model::PatchRollout;
14895 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
14896 /// let x = PatchRollout::new().set_disruption_budget(FixedOrPercent::default()/* use setters */);
14897 /// ```
14898 pub fn set_disruption_budget<T>(mut self, v: T) -> Self
14899 where
14900 T: std::convert::Into<crate::model::FixedOrPercent>,
14901 {
14902 self.disruption_budget = std::option::Option::Some(v.into());
14903 self
14904 }
14905
14906 /// Sets or clears the value of [disruption_budget][crate::model::PatchRollout::disruption_budget].
14907 ///
14908 /// # Example
14909 /// ```ignore,no_run
14910 /// # use google_cloud_osconfig_v1::model::PatchRollout;
14911 /// use google_cloud_osconfig_v1::model::FixedOrPercent;
14912 /// let x = PatchRollout::new().set_or_clear_disruption_budget(Some(FixedOrPercent::default()/* use setters */));
14913 /// let x = PatchRollout::new().set_or_clear_disruption_budget(None::<FixedOrPercent>);
14914 /// ```
14915 pub fn set_or_clear_disruption_budget<T>(mut self, v: std::option::Option<T>) -> Self
14916 where
14917 T: std::convert::Into<crate::model::FixedOrPercent>,
14918 {
14919 self.disruption_budget = v.map(|x| x.into());
14920 self
14921 }
14922}
14923
14924impl wkt::message::Message for PatchRollout {
14925 fn typename() -> &'static str {
14926 "type.googleapis.com/google.cloud.osconfig.v1.PatchRollout"
14927 }
14928}
14929
14930/// Defines additional types related to [PatchRollout].
14931pub mod patch_rollout {
14932 #[allow(unused_imports)]
14933 use super::*;
14934
14935 /// Type of the rollout.
14936 ///
14937 /// # Working with unknown values
14938 ///
14939 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14940 /// additional enum variants at any time. Adding new variants is not considered
14941 /// a breaking change. Applications should write their code in anticipation of:
14942 ///
14943 /// - New values appearing in future releases of the client library, **and**
14944 /// - New values received dynamically, without application changes.
14945 ///
14946 /// Please consult the [Working with enums] section in the user guide for some
14947 /// guidelines.
14948 ///
14949 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14950 #[derive(Clone, Debug, PartialEq)]
14951 #[non_exhaustive]
14952 pub enum Mode {
14953 /// Mode must be specified.
14954 Unspecified,
14955 /// Patches are applied one zone at a time. The patch job begins in the
14956 /// region with the lowest number of targeted VMs. Within the region,
14957 /// patching begins in the zone with the lowest number of targeted VMs. If
14958 /// multiple regions (or zones within a region) have the same number of
14959 /// targeted VMs, a tie-breaker is achieved by sorting the regions or zones
14960 /// in alphabetical order.
14961 ZoneByZone,
14962 /// Patches are applied to VMs in all zones at the same time.
14963 ConcurrentZones,
14964 /// If set, the enum was initialized with an unknown value.
14965 ///
14966 /// Applications can examine the value using [Mode::value] or
14967 /// [Mode::name].
14968 UnknownValue(mode::UnknownValue),
14969 }
14970
14971 #[doc(hidden)]
14972 pub mod mode {
14973 #[allow(unused_imports)]
14974 use super::*;
14975 #[derive(Clone, Debug, PartialEq)]
14976 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14977 }
14978
14979 impl Mode {
14980 /// Gets the enum value.
14981 ///
14982 /// Returns `None` if the enum contains an unknown value deserialized from
14983 /// the string representation of enums.
14984 pub fn value(&self) -> std::option::Option<i32> {
14985 match self {
14986 Self::Unspecified => std::option::Option::Some(0),
14987 Self::ZoneByZone => std::option::Option::Some(1),
14988 Self::ConcurrentZones => std::option::Option::Some(2),
14989 Self::UnknownValue(u) => u.0.value(),
14990 }
14991 }
14992
14993 /// Gets the enum value as a string.
14994 ///
14995 /// Returns `None` if the enum contains an unknown value deserialized from
14996 /// the integer representation of enums.
14997 pub fn name(&self) -> std::option::Option<&str> {
14998 match self {
14999 Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
15000 Self::ZoneByZone => std::option::Option::Some("ZONE_BY_ZONE"),
15001 Self::ConcurrentZones => std::option::Option::Some("CONCURRENT_ZONES"),
15002 Self::UnknownValue(u) => u.0.name(),
15003 }
15004 }
15005 }
15006
15007 impl std::default::Default for Mode {
15008 fn default() -> Self {
15009 use std::convert::From;
15010 Self::from(0)
15011 }
15012 }
15013
15014 impl std::fmt::Display for Mode {
15015 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15016 wkt::internal::display_enum(f, self.name(), self.value())
15017 }
15018 }
15019
15020 impl std::convert::From<i32> for Mode {
15021 fn from(value: i32) -> Self {
15022 match value {
15023 0 => Self::Unspecified,
15024 1 => Self::ZoneByZone,
15025 2 => Self::ConcurrentZones,
15026 _ => Self::UnknownValue(mode::UnknownValue(
15027 wkt::internal::UnknownEnumValue::Integer(value),
15028 )),
15029 }
15030 }
15031 }
15032
15033 impl std::convert::From<&str> for Mode {
15034 fn from(value: &str) -> Self {
15035 use std::string::ToString;
15036 match value {
15037 "MODE_UNSPECIFIED" => Self::Unspecified,
15038 "ZONE_BY_ZONE" => Self::ZoneByZone,
15039 "CONCURRENT_ZONES" => Self::ConcurrentZones,
15040 _ => Self::UnknownValue(mode::UnknownValue(
15041 wkt::internal::UnknownEnumValue::String(value.to_string()),
15042 )),
15043 }
15044 }
15045 }
15046
15047 impl serde::ser::Serialize for Mode {
15048 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15049 where
15050 S: serde::Serializer,
15051 {
15052 match self {
15053 Self::Unspecified => serializer.serialize_i32(0),
15054 Self::ZoneByZone => serializer.serialize_i32(1),
15055 Self::ConcurrentZones => serializer.serialize_i32(2),
15056 Self::UnknownValue(u) => u.0.serialize(serializer),
15057 }
15058 }
15059 }
15060
15061 impl<'de> serde::de::Deserialize<'de> for Mode {
15062 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15063 where
15064 D: serde::Deserializer<'de>,
15065 {
15066 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
15067 ".google.cloud.osconfig.v1.PatchRollout.Mode",
15068 ))
15069 }
15070 }
15071}
15072
15073/// This API resource represents the vulnerability report for a specified
15074/// Compute Engine virtual machine (VM) instance at a given point in time.
15075///
15076/// For more information, see [Vulnerability
15077/// reports](https://cloud.google.com/compute/docs/instances/os-inventory-management#vulnerability-reports).
15078#[derive(Clone, Default, PartialEq)]
15079#[non_exhaustive]
15080pub struct VulnerabilityReport {
15081 /// Output only. The `vulnerabilityReport` API resource name.
15082 ///
15083 /// Format:
15084 /// `projects/{project_number}/locations/{location}/instances/{instance_id}/vulnerabilityReport`
15085 pub name: std::string::String,
15086
15087 /// Output only. List of vulnerabilities affecting the VM.
15088 pub vulnerabilities: std::vec::Vec<crate::model::vulnerability_report::Vulnerability>,
15089
15090 /// Output only. The timestamp for when the last vulnerability report was
15091 /// generated for the VM.
15092 pub update_time: std::option::Option<wkt::Timestamp>,
15093
15094 /// Output only. Highest level of severity among all the upgradable
15095 /// vulnerabilities with CVEs attached.
15096 pub highest_upgradable_cve_severity:
15097 crate::model::vulnerability_report::VulnerabilitySeverityLevel,
15098
15099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15100}
15101
15102impl VulnerabilityReport {
15103 /// Creates a new default instance.
15104 pub fn new() -> Self {
15105 std::default::Default::default()
15106 }
15107
15108 /// Sets the value of [name][crate::model::VulnerabilityReport::name].
15109 ///
15110 /// # Example
15111 /// ```ignore,no_run
15112 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15113 /// # let project_id = "project_id";
15114 /// # let location_id = "location_id";
15115 /// # let instance_id = "instance_id";
15116 /// let x = VulnerabilityReport::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/vulnerabilityReport"));
15117 /// ```
15118 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15119 self.name = v.into();
15120 self
15121 }
15122
15123 /// Sets the value of [vulnerabilities][crate::model::VulnerabilityReport::vulnerabilities].
15124 ///
15125 /// # Example
15126 /// ```ignore,no_run
15127 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15128 /// use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15129 /// let x = VulnerabilityReport::new()
15130 /// .set_vulnerabilities([
15131 /// Vulnerability::default()/* use setters */,
15132 /// Vulnerability::default()/* use (different) setters */,
15133 /// ]);
15134 /// ```
15135 pub fn set_vulnerabilities<T, V>(mut self, v: T) -> Self
15136 where
15137 T: std::iter::IntoIterator<Item = V>,
15138 V: std::convert::Into<crate::model::vulnerability_report::Vulnerability>,
15139 {
15140 use std::iter::Iterator;
15141 self.vulnerabilities = v.into_iter().map(|i| i.into()).collect();
15142 self
15143 }
15144
15145 /// Sets the value of [update_time][crate::model::VulnerabilityReport::update_time].
15146 ///
15147 /// # Example
15148 /// ```ignore,no_run
15149 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15150 /// use wkt::Timestamp;
15151 /// let x = VulnerabilityReport::new().set_update_time(Timestamp::default()/* use setters */);
15152 /// ```
15153 pub fn set_update_time<T>(mut self, v: T) -> Self
15154 where
15155 T: std::convert::Into<wkt::Timestamp>,
15156 {
15157 self.update_time = std::option::Option::Some(v.into());
15158 self
15159 }
15160
15161 /// Sets or clears the value of [update_time][crate::model::VulnerabilityReport::update_time].
15162 ///
15163 /// # Example
15164 /// ```ignore,no_run
15165 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15166 /// use wkt::Timestamp;
15167 /// let x = VulnerabilityReport::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15168 /// let x = VulnerabilityReport::new().set_or_clear_update_time(None::<Timestamp>);
15169 /// ```
15170 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15171 where
15172 T: std::convert::Into<wkt::Timestamp>,
15173 {
15174 self.update_time = v.map(|x| x.into());
15175 self
15176 }
15177
15178 /// Sets the value of [highest_upgradable_cve_severity][crate::model::VulnerabilityReport::highest_upgradable_cve_severity].
15179 ///
15180 /// # Example
15181 /// ```ignore,no_run
15182 /// # use google_cloud_osconfig_v1::model::VulnerabilityReport;
15183 /// use google_cloud_osconfig_v1::model::vulnerability_report::VulnerabilitySeverityLevel;
15184 /// let x0 = VulnerabilityReport::new().set_highest_upgradable_cve_severity(VulnerabilitySeverityLevel::None);
15185 /// let x1 = VulnerabilityReport::new().set_highest_upgradable_cve_severity(VulnerabilitySeverityLevel::Minimal);
15186 /// let x2 = VulnerabilityReport::new().set_highest_upgradable_cve_severity(VulnerabilitySeverityLevel::Low);
15187 /// ```
15188 pub fn set_highest_upgradable_cve_severity<
15189 T: std::convert::Into<crate::model::vulnerability_report::VulnerabilitySeverityLevel>,
15190 >(
15191 mut self,
15192 v: T,
15193 ) -> Self {
15194 self.highest_upgradable_cve_severity = v.into();
15195 self
15196 }
15197}
15198
15199impl wkt::message::Message for VulnerabilityReport {
15200 fn typename() -> &'static str {
15201 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport"
15202 }
15203}
15204
15205/// Defines additional types related to [VulnerabilityReport].
15206pub mod vulnerability_report {
15207 #[allow(unused_imports)]
15208 use super::*;
15209
15210 /// A vulnerability affecting the VM instance.
15211 #[derive(Clone, Default, PartialEq)]
15212 #[non_exhaustive]
15213 pub struct Vulnerability {
15214 /// Contains metadata as per the upstream feed of the operating system and
15215 /// NVD.
15216 pub details:
15217 std::option::Option<crate::model::vulnerability_report::vulnerability::Details>,
15218
15219 /// Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM.
15220 /// This field displays the inventory items affected by this vulnerability.
15221 /// If the vulnerability report was not updated after the VM inventory
15222 /// update, these values might not display in VM inventory. For some distros,
15223 /// this field may be empty.
15224 #[deprecated]
15225 pub installed_inventory_item_ids: std::vec::Vec<std::string::String>,
15226
15227 /// Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM.
15228 /// If the vulnerability report was not updated after the VM inventory
15229 /// update, these values might not display in VM inventory. If there is no
15230 /// available fix, the field is empty. The `inventory_item` value specifies
15231 /// the latest `SoftwarePackage` available to the VM that fixes the
15232 /// vulnerability.
15233 #[deprecated]
15234 pub available_inventory_item_ids: std::vec::Vec<std::string::String>,
15235
15236 /// The timestamp for when the vulnerability was first detected.
15237 pub create_time: std::option::Option<wkt::Timestamp>,
15238
15239 /// The timestamp for when the vulnerability was last modified.
15240 pub update_time: std::option::Option<wkt::Timestamp>,
15241
15242 /// List of items affected by the vulnerability.
15243 pub items: std::vec::Vec<crate::model::vulnerability_report::vulnerability::Item>,
15244
15245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15246 }
15247
15248 impl Vulnerability {
15249 /// Creates a new default instance.
15250 pub fn new() -> Self {
15251 std::default::Default::default()
15252 }
15253
15254 /// Sets the value of [details][crate::model::vulnerability_report::Vulnerability::details].
15255 ///
15256 /// # Example
15257 /// ```ignore,no_run
15258 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15259 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15260 /// let x = Vulnerability::new().set_details(Details::default()/* use setters */);
15261 /// ```
15262 pub fn set_details<T>(mut self, v: T) -> Self
15263 where
15264 T: std::convert::Into<crate::model::vulnerability_report::vulnerability::Details>,
15265 {
15266 self.details = std::option::Option::Some(v.into());
15267 self
15268 }
15269
15270 /// Sets or clears the value of [details][crate::model::vulnerability_report::Vulnerability::details].
15271 ///
15272 /// # Example
15273 /// ```ignore,no_run
15274 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15275 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15276 /// let x = Vulnerability::new().set_or_clear_details(Some(Details::default()/* use setters */));
15277 /// let x = Vulnerability::new().set_or_clear_details(None::<Details>);
15278 /// ```
15279 pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
15280 where
15281 T: std::convert::Into<crate::model::vulnerability_report::vulnerability::Details>,
15282 {
15283 self.details = v.map(|x| x.into());
15284 self
15285 }
15286
15287 /// Sets the value of [installed_inventory_item_ids][crate::model::vulnerability_report::Vulnerability::installed_inventory_item_ids].
15288 ///
15289 /// # Example
15290 /// ```ignore,no_run
15291 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15292 /// let x = Vulnerability::new().set_installed_inventory_item_ids(["a", "b", "c"]);
15293 /// ```
15294 #[deprecated]
15295 pub fn set_installed_inventory_item_ids<T, V>(mut self, v: T) -> Self
15296 where
15297 T: std::iter::IntoIterator<Item = V>,
15298 V: std::convert::Into<std::string::String>,
15299 {
15300 use std::iter::Iterator;
15301 self.installed_inventory_item_ids = v.into_iter().map(|i| i.into()).collect();
15302 self
15303 }
15304
15305 /// Sets the value of [available_inventory_item_ids][crate::model::vulnerability_report::Vulnerability::available_inventory_item_ids].
15306 ///
15307 /// # Example
15308 /// ```ignore,no_run
15309 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15310 /// let x = Vulnerability::new().set_available_inventory_item_ids(["a", "b", "c"]);
15311 /// ```
15312 #[deprecated]
15313 pub fn set_available_inventory_item_ids<T, V>(mut self, v: T) -> Self
15314 where
15315 T: std::iter::IntoIterator<Item = V>,
15316 V: std::convert::Into<std::string::String>,
15317 {
15318 use std::iter::Iterator;
15319 self.available_inventory_item_ids = v.into_iter().map(|i| i.into()).collect();
15320 self
15321 }
15322
15323 /// Sets the value of [create_time][crate::model::vulnerability_report::Vulnerability::create_time].
15324 ///
15325 /// # Example
15326 /// ```ignore,no_run
15327 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15328 /// use wkt::Timestamp;
15329 /// let x = Vulnerability::new().set_create_time(Timestamp::default()/* use setters */);
15330 /// ```
15331 pub fn set_create_time<T>(mut self, v: T) -> Self
15332 where
15333 T: std::convert::Into<wkt::Timestamp>,
15334 {
15335 self.create_time = std::option::Option::Some(v.into());
15336 self
15337 }
15338
15339 /// Sets or clears the value of [create_time][crate::model::vulnerability_report::Vulnerability::create_time].
15340 ///
15341 /// # Example
15342 /// ```ignore,no_run
15343 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15344 /// use wkt::Timestamp;
15345 /// let x = Vulnerability::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15346 /// let x = Vulnerability::new().set_or_clear_create_time(None::<Timestamp>);
15347 /// ```
15348 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15349 where
15350 T: std::convert::Into<wkt::Timestamp>,
15351 {
15352 self.create_time = v.map(|x| x.into());
15353 self
15354 }
15355
15356 /// Sets the value of [update_time][crate::model::vulnerability_report::Vulnerability::update_time].
15357 ///
15358 /// # Example
15359 /// ```ignore,no_run
15360 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15361 /// use wkt::Timestamp;
15362 /// let x = Vulnerability::new().set_update_time(Timestamp::default()/* use setters */);
15363 /// ```
15364 pub fn set_update_time<T>(mut self, v: T) -> Self
15365 where
15366 T: std::convert::Into<wkt::Timestamp>,
15367 {
15368 self.update_time = std::option::Option::Some(v.into());
15369 self
15370 }
15371
15372 /// Sets or clears the value of [update_time][crate::model::vulnerability_report::Vulnerability::update_time].
15373 ///
15374 /// # Example
15375 /// ```ignore,no_run
15376 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15377 /// use wkt::Timestamp;
15378 /// let x = Vulnerability::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
15379 /// let x = Vulnerability::new().set_or_clear_update_time(None::<Timestamp>);
15380 /// ```
15381 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
15382 where
15383 T: std::convert::Into<wkt::Timestamp>,
15384 {
15385 self.update_time = v.map(|x| x.into());
15386 self
15387 }
15388
15389 /// Sets the value of [items][crate::model::vulnerability_report::Vulnerability::items].
15390 ///
15391 /// # Example
15392 /// ```ignore,no_run
15393 /// # use google_cloud_osconfig_v1::model::vulnerability_report::Vulnerability;
15394 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15395 /// let x = Vulnerability::new()
15396 /// .set_items([
15397 /// Item::default()/* use setters */,
15398 /// Item::default()/* use (different) setters */,
15399 /// ]);
15400 /// ```
15401 pub fn set_items<T, V>(mut self, v: T) -> Self
15402 where
15403 T: std::iter::IntoIterator<Item = V>,
15404 V: std::convert::Into<crate::model::vulnerability_report::vulnerability::Item>,
15405 {
15406 use std::iter::Iterator;
15407 self.items = v.into_iter().map(|i| i.into()).collect();
15408 self
15409 }
15410 }
15411
15412 impl wkt::message::Message for Vulnerability {
15413 fn typename() -> &'static str {
15414 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability"
15415 }
15416 }
15417
15418 /// Defines additional types related to [Vulnerability].
15419 pub mod vulnerability {
15420 #[allow(unused_imports)]
15421 use super::*;
15422
15423 /// Contains metadata information for the vulnerability. This information is
15424 /// collected from the upstream feed of the operating system.
15425 #[derive(Clone, Default, PartialEq)]
15426 #[non_exhaustive]
15427 pub struct Details {
15428 /// The CVE of the vulnerability. CVE cannot be
15429 /// empty and the combination of <cve, classification> should be unique
15430 /// across vulnerabilities for a VM.
15431 pub cve: std::string::String,
15432
15433 /// The CVSS V2 score of this vulnerability. CVSS V2 score is on a scale of
15434 /// 0 - 10 where 0 indicates low severity and 10 indicates high severity.
15435 pub cvss_v2_score: f32,
15436
15437 /// The full description of the CVSSv3 for this vulnerability from NVD.
15438 pub cvss_v3: std::option::Option<crate::model::CVSSv3>,
15439
15440 /// Assigned severity/impact ranking from the distro.
15441 pub severity: std::string::String,
15442
15443 /// The note or description describing the vulnerability from the distro.
15444 pub description: std::string::String,
15445
15446 /// Corresponds to the references attached to the `VulnerabilityDetails`.
15447 pub references: std::vec::Vec<
15448 crate::model::vulnerability_report::vulnerability::details::Reference,
15449 >,
15450
15451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15452 }
15453
15454 impl Details {
15455 /// Creates a new default instance.
15456 pub fn new() -> Self {
15457 std::default::Default::default()
15458 }
15459
15460 /// Sets the value of [cve][crate::model::vulnerability_report::vulnerability::Details::cve].
15461 ///
15462 /// # Example
15463 /// ```ignore,no_run
15464 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15465 /// let x = Details::new().set_cve("example");
15466 /// ```
15467 pub fn set_cve<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15468 self.cve = v.into();
15469 self
15470 }
15471
15472 /// Sets the value of [cvss_v2_score][crate::model::vulnerability_report::vulnerability::Details::cvss_v2_score].
15473 ///
15474 /// # Example
15475 /// ```ignore,no_run
15476 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15477 /// let x = Details::new().set_cvss_v2_score(42.0);
15478 /// ```
15479 pub fn set_cvss_v2_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15480 self.cvss_v2_score = v.into();
15481 self
15482 }
15483
15484 /// Sets the value of [cvss_v3][crate::model::vulnerability_report::vulnerability::Details::cvss_v3].
15485 ///
15486 /// # Example
15487 /// ```ignore,no_run
15488 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15489 /// use google_cloud_osconfig_v1::model::CVSSv3;
15490 /// let x = Details::new().set_cvss_v3(CVSSv3::default()/* use setters */);
15491 /// ```
15492 pub fn set_cvss_v3<T>(mut self, v: T) -> Self
15493 where
15494 T: std::convert::Into<crate::model::CVSSv3>,
15495 {
15496 self.cvss_v3 = std::option::Option::Some(v.into());
15497 self
15498 }
15499
15500 /// Sets or clears the value of [cvss_v3][crate::model::vulnerability_report::vulnerability::Details::cvss_v3].
15501 ///
15502 /// # Example
15503 /// ```ignore,no_run
15504 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15505 /// use google_cloud_osconfig_v1::model::CVSSv3;
15506 /// let x = Details::new().set_or_clear_cvss_v3(Some(CVSSv3::default()/* use setters */));
15507 /// let x = Details::new().set_or_clear_cvss_v3(None::<CVSSv3>);
15508 /// ```
15509 pub fn set_or_clear_cvss_v3<T>(mut self, v: std::option::Option<T>) -> Self
15510 where
15511 T: std::convert::Into<crate::model::CVSSv3>,
15512 {
15513 self.cvss_v3 = v.map(|x| x.into());
15514 self
15515 }
15516
15517 /// Sets the value of [severity][crate::model::vulnerability_report::vulnerability::Details::severity].
15518 ///
15519 /// # Example
15520 /// ```ignore,no_run
15521 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15522 /// let x = Details::new().set_severity("example");
15523 /// ```
15524 pub fn set_severity<T: std::convert::Into<std::string::String>>(
15525 mut self,
15526 v: T,
15527 ) -> Self {
15528 self.severity = v.into();
15529 self
15530 }
15531
15532 /// Sets the value of [description][crate::model::vulnerability_report::vulnerability::Details::description].
15533 ///
15534 /// # Example
15535 /// ```ignore,no_run
15536 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15537 /// let x = Details::new().set_description("example");
15538 /// ```
15539 pub fn set_description<T: std::convert::Into<std::string::String>>(
15540 mut self,
15541 v: T,
15542 ) -> Self {
15543 self.description = v.into();
15544 self
15545 }
15546
15547 /// Sets the value of [references][crate::model::vulnerability_report::vulnerability::Details::references].
15548 ///
15549 /// # Example
15550 /// ```ignore,no_run
15551 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Details;
15552 /// use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::details::Reference;
15553 /// let x = Details::new()
15554 /// .set_references([
15555 /// Reference::default()/* use setters */,
15556 /// Reference::default()/* use (different) setters */,
15557 /// ]);
15558 /// ```
15559 pub fn set_references<T, V>(mut self, v: T) -> Self
15560 where
15561 T: std::iter::IntoIterator<Item = V>,
15562 V: std::convert::Into<
15563 crate::model::vulnerability_report::vulnerability::details::Reference,
15564 >,
15565 {
15566 use std::iter::Iterator;
15567 self.references = v.into_iter().map(|i| i.into()).collect();
15568 self
15569 }
15570 }
15571
15572 impl wkt::message::Message for Details {
15573 fn typename() -> &'static str {
15574 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability.Details"
15575 }
15576 }
15577
15578 /// Defines additional types related to [Details].
15579 pub mod details {
15580 #[allow(unused_imports)]
15581 use super::*;
15582
15583 /// A reference for this vulnerability.
15584 #[derive(Clone, Default, PartialEq)]
15585 #[non_exhaustive]
15586 pub struct Reference {
15587 /// The url of the reference.
15588 pub url: std::string::String,
15589
15590 /// The source of the reference e.g. NVD.
15591 pub source: std::string::String,
15592
15593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15594 }
15595
15596 impl Reference {
15597 /// Creates a new default instance.
15598 pub fn new() -> Self {
15599 std::default::Default::default()
15600 }
15601
15602 /// Sets the value of [url][crate::model::vulnerability_report::vulnerability::details::Reference::url].
15603 ///
15604 /// # Example
15605 /// ```ignore,no_run
15606 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::details::Reference;
15607 /// let x = Reference::new().set_url("example");
15608 /// ```
15609 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15610 self.url = v.into();
15611 self
15612 }
15613
15614 /// Sets the value of [source][crate::model::vulnerability_report::vulnerability::details::Reference::source].
15615 ///
15616 /// # Example
15617 /// ```ignore,no_run
15618 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::details::Reference;
15619 /// let x = Reference::new().set_source("example");
15620 /// ```
15621 pub fn set_source<T: std::convert::Into<std::string::String>>(
15622 mut self,
15623 v: T,
15624 ) -> Self {
15625 self.source = v.into();
15626 self
15627 }
15628 }
15629
15630 impl wkt::message::Message for Reference {
15631 fn typename() -> &'static str {
15632 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability.Details.Reference"
15633 }
15634 }
15635 }
15636
15637 /// OS inventory item that is affected by a vulnerability or fixed as a
15638 /// result of a vulnerability.
15639 #[derive(Clone, Default, PartialEq)]
15640 #[non_exhaustive]
15641 pub struct Item {
15642 /// Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM.
15643 /// This field displays the inventory items affected by this vulnerability.
15644 /// If the vulnerability report was not updated after the VM inventory
15645 /// update, these values might not display in VM inventory. For some
15646 /// operating systems, this field might be empty.
15647 pub installed_inventory_item_id: std::string::String,
15648
15649 /// Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM.
15650 /// If the vulnerability report was not updated after the VM inventory
15651 /// update, these values might not display in VM inventory. If there is no
15652 /// available fix, the field is empty. The `inventory_item` value specifies
15653 /// the latest `SoftwarePackage` available to the VM that fixes the
15654 /// vulnerability.
15655 pub available_inventory_item_id: std::string::String,
15656
15657 /// The recommended [CPE URI](https://cpe.mitre.org/specification/) update
15658 /// that contains a fix for this vulnerability.
15659 pub fixed_cpe_uri: std::string::String,
15660
15661 /// The upstream OS patch, packages or KB that fixes the vulnerability.
15662 pub upstream_fix: std::string::String,
15663
15664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15665 }
15666
15667 impl Item {
15668 /// Creates a new default instance.
15669 pub fn new() -> Self {
15670 std::default::Default::default()
15671 }
15672
15673 /// Sets the value of [installed_inventory_item_id][crate::model::vulnerability_report::vulnerability::Item::installed_inventory_item_id].
15674 ///
15675 /// # Example
15676 /// ```ignore,no_run
15677 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15678 /// let x = Item::new().set_installed_inventory_item_id("example");
15679 /// ```
15680 pub fn set_installed_inventory_item_id<T: std::convert::Into<std::string::String>>(
15681 mut self,
15682 v: T,
15683 ) -> Self {
15684 self.installed_inventory_item_id = v.into();
15685 self
15686 }
15687
15688 /// Sets the value of [available_inventory_item_id][crate::model::vulnerability_report::vulnerability::Item::available_inventory_item_id].
15689 ///
15690 /// # Example
15691 /// ```ignore,no_run
15692 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15693 /// let x = Item::new().set_available_inventory_item_id("example");
15694 /// ```
15695 pub fn set_available_inventory_item_id<T: std::convert::Into<std::string::String>>(
15696 mut self,
15697 v: T,
15698 ) -> Self {
15699 self.available_inventory_item_id = v.into();
15700 self
15701 }
15702
15703 /// Sets the value of [fixed_cpe_uri][crate::model::vulnerability_report::vulnerability::Item::fixed_cpe_uri].
15704 ///
15705 /// # Example
15706 /// ```ignore,no_run
15707 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15708 /// let x = Item::new().set_fixed_cpe_uri("example");
15709 /// ```
15710 pub fn set_fixed_cpe_uri<T: std::convert::Into<std::string::String>>(
15711 mut self,
15712 v: T,
15713 ) -> Self {
15714 self.fixed_cpe_uri = v.into();
15715 self
15716 }
15717
15718 /// Sets the value of [upstream_fix][crate::model::vulnerability_report::vulnerability::Item::upstream_fix].
15719 ///
15720 /// # Example
15721 /// ```ignore,no_run
15722 /// # use google_cloud_osconfig_v1::model::vulnerability_report::vulnerability::Item;
15723 /// let x = Item::new().set_upstream_fix("example");
15724 /// ```
15725 pub fn set_upstream_fix<T: std::convert::Into<std::string::String>>(
15726 mut self,
15727 v: T,
15728 ) -> Self {
15729 self.upstream_fix = v.into();
15730 self
15731 }
15732 }
15733
15734 impl wkt::message::Message for Item {
15735 fn typename() -> &'static str {
15736 "type.googleapis.com/google.cloud.osconfig.v1.VulnerabilityReport.Vulnerability.Item"
15737 }
15738 }
15739 }
15740
15741 /// Severity levels for vulnerabilities.
15742 ///
15743 /// # Working with unknown values
15744 ///
15745 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15746 /// additional enum variants at any time. Adding new variants is not considered
15747 /// a breaking change. Applications should write their code in anticipation of:
15748 ///
15749 /// - New values appearing in future releases of the client library, **and**
15750 /// - New values received dynamically, without application changes.
15751 ///
15752 /// Please consult the [Working with enums] section in the user guide for some
15753 /// guidelines.
15754 ///
15755 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15756 #[derive(Clone, Debug, PartialEq)]
15757 #[non_exhaustive]
15758 pub enum VulnerabilitySeverityLevel {
15759 /// Default SeverityLevel. This value is unused.
15760 Unspecified,
15761 /// Vulnerability has no severity level.
15762 None,
15763 /// Vulnerability severity level is minimal. This is level below the low
15764 /// severity level.
15765 Minimal,
15766 /// Vulnerability severity level is low. This is level below the medium
15767 /// severity level.
15768 Low,
15769 /// Vulnerability severity level is medium. This is level below the high
15770 /// severity level.
15771 Medium,
15772 /// Vulnerability severity level is high. This is level below the critical
15773 /// severity level.
15774 High,
15775 /// Vulnerability severity level is critical. This is the highest severity
15776 /// level.
15777 Critical,
15778 /// If set, the enum was initialized with an unknown value.
15779 ///
15780 /// Applications can examine the value using [VulnerabilitySeverityLevel::value] or
15781 /// [VulnerabilitySeverityLevel::name].
15782 UnknownValue(vulnerability_severity_level::UnknownValue),
15783 }
15784
15785 #[doc(hidden)]
15786 pub mod vulnerability_severity_level {
15787 #[allow(unused_imports)]
15788 use super::*;
15789 #[derive(Clone, Debug, PartialEq)]
15790 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15791 }
15792
15793 impl VulnerabilitySeverityLevel {
15794 /// Gets the enum value.
15795 ///
15796 /// Returns `None` if the enum contains an unknown value deserialized from
15797 /// the string representation of enums.
15798 pub fn value(&self) -> std::option::Option<i32> {
15799 match self {
15800 Self::Unspecified => std::option::Option::Some(0),
15801 Self::None => std::option::Option::Some(1),
15802 Self::Minimal => std::option::Option::Some(2),
15803 Self::Low => std::option::Option::Some(3),
15804 Self::Medium => std::option::Option::Some(4),
15805 Self::High => std::option::Option::Some(5),
15806 Self::Critical => std::option::Option::Some(6),
15807 Self::UnknownValue(u) => u.0.value(),
15808 }
15809 }
15810
15811 /// Gets the enum value as a string.
15812 ///
15813 /// Returns `None` if the enum contains an unknown value deserialized from
15814 /// the integer representation of enums.
15815 pub fn name(&self) -> std::option::Option<&str> {
15816 match self {
15817 Self::Unspecified => {
15818 std::option::Option::Some("VULNERABILITY_SEVERITY_LEVEL_UNSPECIFIED")
15819 }
15820 Self::None => std::option::Option::Some("NONE"),
15821 Self::Minimal => std::option::Option::Some("MINIMAL"),
15822 Self::Low => std::option::Option::Some("LOW"),
15823 Self::Medium => std::option::Option::Some("MEDIUM"),
15824 Self::High => std::option::Option::Some("HIGH"),
15825 Self::Critical => std::option::Option::Some("CRITICAL"),
15826 Self::UnknownValue(u) => u.0.name(),
15827 }
15828 }
15829 }
15830
15831 impl std::default::Default for VulnerabilitySeverityLevel {
15832 fn default() -> Self {
15833 use std::convert::From;
15834 Self::from(0)
15835 }
15836 }
15837
15838 impl std::fmt::Display for VulnerabilitySeverityLevel {
15839 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15840 wkt::internal::display_enum(f, self.name(), self.value())
15841 }
15842 }
15843
15844 impl std::convert::From<i32> for VulnerabilitySeverityLevel {
15845 fn from(value: i32) -> Self {
15846 match value {
15847 0 => Self::Unspecified,
15848 1 => Self::None,
15849 2 => Self::Minimal,
15850 3 => Self::Low,
15851 4 => Self::Medium,
15852 5 => Self::High,
15853 6 => Self::Critical,
15854 _ => Self::UnknownValue(vulnerability_severity_level::UnknownValue(
15855 wkt::internal::UnknownEnumValue::Integer(value),
15856 )),
15857 }
15858 }
15859 }
15860
15861 impl std::convert::From<&str> for VulnerabilitySeverityLevel {
15862 fn from(value: &str) -> Self {
15863 use std::string::ToString;
15864 match value {
15865 "VULNERABILITY_SEVERITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
15866 "NONE" => Self::None,
15867 "MINIMAL" => Self::Minimal,
15868 "LOW" => Self::Low,
15869 "MEDIUM" => Self::Medium,
15870 "HIGH" => Self::High,
15871 "CRITICAL" => Self::Critical,
15872 _ => Self::UnknownValue(vulnerability_severity_level::UnknownValue(
15873 wkt::internal::UnknownEnumValue::String(value.to_string()),
15874 )),
15875 }
15876 }
15877 }
15878
15879 impl serde::ser::Serialize for VulnerabilitySeverityLevel {
15880 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15881 where
15882 S: serde::Serializer,
15883 {
15884 match self {
15885 Self::Unspecified => serializer.serialize_i32(0),
15886 Self::None => serializer.serialize_i32(1),
15887 Self::Minimal => serializer.serialize_i32(2),
15888 Self::Low => serializer.serialize_i32(3),
15889 Self::Medium => serializer.serialize_i32(4),
15890 Self::High => serializer.serialize_i32(5),
15891 Self::Critical => serializer.serialize_i32(6),
15892 Self::UnknownValue(u) => u.0.serialize(serializer),
15893 }
15894 }
15895 }
15896
15897 impl<'de> serde::de::Deserialize<'de> for VulnerabilitySeverityLevel {
15898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15899 where
15900 D: serde::Deserializer<'de>,
15901 {
15902 deserializer.deserialize_any(
15903 wkt::internal::EnumVisitor::<VulnerabilitySeverityLevel>::new(
15904 ".google.cloud.osconfig.v1.VulnerabilityReport.VulnerabilitySeverityLevel",
15905 ),
15906 )
15907 }
15908 }
15909}
15910
15911/// A request message for getting the vulnerability report for the specified VM.
15912#[derive(Clone, Default, PartialEq)]
15913#[non_exhaustive]
15914pub struct GetVulnerabilityReportRequest {
15915 /// Required. API resource name for vulnerability resource.
15916 ///
15917 /// Format:
15918 /// `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport`
15919 ///
15920 /// For `{project}`, either `project-number` or `project-id` can be provided.
15921 /// For `{instance}`, either Compute Engine `instance-id` or `instance-name`
15922 /// can be provided.
15923 pub name: std::string::String,
15924
15925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15926}
15927
15928impl GetVulnerabilityReportRequest {
15929 /// Creates a new default instance.
15930 pub fn new() -> Self {
15931 std::default::Default::default()
15932 }
15933
15934 /// Sets the value of [name][crate::model::GetVulnerabilityReportRequest::name].
15935 ///
15936 /// # Example
15937 /// ```ignore,no_run
15938 /// # use google_cloud_osconfig_v1::model::GetVulnerabilityReportRequest;
15939 /// # let project_id = "project_id";
15940 /// # let location_id = "location_id";
15941 /// # let instance_id = "instance_id";
15942 /// let x = GetVulnerabilityReportRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/instances/{instance_id}/vulnerabilityReport"));
15943 /// ```
15944 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15945 self.name = v.into();
15946 self
15947 }
15948}
15949
15950impl wkt::message::Message for GetVulnerabilityReportRequest {
15951 fn typename() -> &'static str {
15952 "type.googleapis.com/google.cloud.osconfig.v1.GetVulnerabilityReportRequest"
15953 }
15954}
15955
15956/// A request message for listing vulnerability reports for all VM instances in
15957/// the specified location.
15958#[derive(Clone, Default, PartialEq)]
15959#[non_exhaustive]
15960pub struct ListVulnerabilityReportsRequest {
15961 /// Required. The parent resource name.
15962 ///
15963 /// Format: `projects/{project}/locations/{location}/instances/-`
15964 ///
15965 /// For `{project}`, either `project-number` or `project-id` can be provided.
15966 pub parent: std::string::String,
15967
15968 /// The maximum number of results to return.
15969 pub page_size: i32,
15970
15971 /// A pagination token returned from a previous call to
15972 /// `ListVulnerabilityReports` that indicates where this listing
15973 /// should continue from.
15974 pub page_token: std::string::String,
15975
15976 /// This field supports filtering by the severity level for the vulnerability.
15977 /// For a list of severity levels, see [Severity levels for
15978 /// vulnerabilities](https://cloud.google.com/container-analysis/docs/container-scanning-overview#severity_levels_for_vulnerabilities).
15979 ///
15980 /// The filter field follows the rules described in the
15981 /// [AIP-160](https://google.aip.dev/160) guidelines as follows:
15982 ///
15983 /// + **Filter for a specific severity type**: you can list reports that
15984 /// contain
15985 /// vulnerabilities that are classified as medium by specifying
15986 /// `vulnerabilities.details.severity:MEDIUM`.
15987 ///
15988 /// + **Filter for a range of severities** : you can list reports that have
15989 /// vulnerabilities that are classified as critical or high by specifying
15990 /// `vulnerabilities.details.severity:HIGH OR
15991 /// vulnerabilities.details.severity:CRITICAL`
15992 ///
15993 pub filter: std::string::String,
15994
15995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15996}
15997
15998impl ListVulnerabilityReportsRequest {
15999 /// Creates a new default instance.
16000 pub fn new() -> Self {
16001 std::default::Default::default()
16002 }
16003
16004 /// Sets the value of [parent][crate::model::ListVulnerabilityReportsRequest::parent].
16005 ///
16006 /// # Example
16007 /// ```ignore,no_run
16008 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
16009 /// let x = ListVulnerabilityReportsRequest::new().set_parent("example");
16010 /// ```
16011 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16012 self.parent = v.into();
16013 self
16014 }
16015
16016 /// Sets the value of [page_size][crate::model::ListVulnerabilityReportsRequest::page_size].
16017 ///
16018 /// # Example
16019 /// ```ignore,no_run
16020 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
16021 /// let x = ListVulnerabilityReportsRequest::new().set_page_size(42);
16022 /// ```
16023 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16024 self.page_size = v.into();
16025 self
16026 }
16027
16028 /// Sets the value of [page_token][crate::model::ListVulnerabilityReportsRequest::page_token].
16029 ///
16030 /// # Example
16031 /// ```ignore,no_run
16032 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
16033 /// let x = ListVulnerabilityReportsRequest::new().set_page_token("example");
16034 /// ```
16035 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16036 self.page_token = v.into();
16037 self
16038 }
16039
16040 /// Sets the value of [filter][crate::model::ListVulnerabilityReportsRequest::filter].
16041 ///
16042 /// # Example
16043 /// ```ignore,no_run
16044 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsRequest;
16045 /// let x = ListVulnerabilityReportsRequest::new().set_filter("example");
16046 /// ```
16047 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16048 self.filter = v.into();
16049 self
16050 }
16051}
16052
16053impl wkt::message::Message for ListVulnerabilityReportsRequest {
16054 fn typename() -> &'static str {
16055 "type.googleapis.com/google.cloud.osconfig.v1.ListVulnerabilityReportsRequest"
16056 }
16057}
16058
16059/// A response message for listing vulnerability reports for all VM instances in
16060/// the specified location.
16061#[derive(Clone, Default, PartialEq)]
16062#[non_exhaustive]
16063pub struct ListVulnerabilityReportsResponse {
16064 /// List of vulnerabilityReport objects.
16065 pub vulnerability_reports: std::vec::Vec<crate::model::VulnerabilityReport>,
16066
16067 /// The pagination token to retrieve the next page of vulnerabilityReports
16068 /// object.
16069 pub next_page_token: std::string::String,
16070
16071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16072}
16073
16074impl ListVulnerabilityReportsResponse {
16075 /// Creates a new default instance.
16076 pub fn new() -> Self {
16077 std::default::Default::default()
16078 }
16079
16080 /// Sets the value of [vulnerability_reports][crate::model::ListVulnerabilityReportsResponse::vulnerability_reports].
16081 ///
16082 /// # Example
16083 /// ```ignore,no_run
16084 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsResponse;
16085 /// use google_cloud_osconfig_v1::model::VulnerabilityReport;
16086 /// let x = ListVulnerabilityReportsResponse::new()
16087 /// .set_vulnerability_reports([
16088 /// VulnerabilityReport::default()/* use setters */,
16089 /// VulnerabilityReport::default()/* use (different) setters */,
16090 /// ]);
16091 /// ```
16092 pub fn set_vulnerability_reports<T, V>(mut self, v: T) -> Self
16093 where
16094 T: std::iter::IntoIterator<Item = V>,
16095 V: std::convert::Into<crate::model::VulnerabilityReport>,
16096 {
16097 use std::iter::Iterator;
16098 self.vulnerability_reports = v.into_iter().map(|i| i.into()).collect();
16099 self
16100 }
16101
16102 /// Sets the value of [next_page_token][crate::model::ListVulnerabilityReportsResponse::next_page_token].
16103 ///
16104 /// # Example
16105 /// ```ignore,no_run
16106 /// # use google_cloud_osconfig_v1::model::ListVulnerabilityReportsResponse;
16107 /// let x = ListVulnerabilityReportsResponse::new().set_next_page_token("example");
16108 /// ```
16109 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16110 self.next_page_token = v.into();
16111 self
16112 }
16113}
16114
16115impl wkt::message::Message for ListVulnerabilityReportsResponse {
16116 fn typename() -> &'static str {
16117 "type.googleapis.com/google.cloud.osconfig.v1.ListVulnerabilityReportsResponse"
16118 }
16119}
16120
16121#[doc(hidden)]
16122impl google_cloud_gax::paginator::internal::PageableResponse for ListVulnerabilityReportsResponse {
16123 type PageItem = crate::model::VulnerabilityReport;
16124
16125 fn items(self) -> std::vec::Vec<Self::PageItem> {
16126 self.vulnerability_reports
16127 }
16128
16129 fn next_page_token(&self) -> std::string::String {
16130 use std::clone::Clone;
16131 self.next_page_token.clone()
16132 }
16133}
16134
16135/// Common Vulnerability Scoring System version 3.
16136/// For details, see <https://www.first.org/cvss/specification-document>
16137#[derive(Clone, Default, PartialEq)]
16138#[non_exhaustive]
16139pub struct CVSSv3 {
16140 /// The base score is a function of the base metric scores.
16141 /// <https://www.first.org/cvss/specification-document#Base-Metrics>
16142 pub base_score: f32,
16143
16144 /// The Exploitability sub-score equation is derived from the Base
16145 /// Exploitability metrics.
16146 /// <https://www.first.org/cvss/specification-document#2-1-Exploitability-Metrics>
16147 pub exploitability_score: f32,
16148
16149 /// The Impact sub-score equation is derived from the Base Impact metrics.
16150 pub impact_score: f32,
16151
16152 /// This metric reflects the context by which vulnerability exploitation is
16153 /// possible.
16154 pub attack_vector: crate::model::cvs_sv_3::AttackVector,
16155
16156 /// This metric describes the conditions beyond the attacker's control that
16157 /// must exist in order to exploit the vulnerability.
16158 pub attack_complexity: crate::model::cvs_sv_3::AttackComplexity,
16159
16160 /// This metric describes the level of privileges an attacker must possess
16161 /// before successfully exploiting the vulnerability.
16162 pub privileges_required: crate::model::cvs_sv_3::PrivilegesRequired,
16163
16164 /// This metric captures the requirement for a human user, other than the
16165 /// attacker, to participate in the successful compromise of the vulnerable
16166 /// component.
16167 pub user_interaction: crate::model::cvs_sv_3::UserInteraction,
16168
16169 /// The Scope metric captures whether a vulnerability in one vulnerable
16170 /// component impacts resources in components beyond its security scope.
16171 pub scope: crate::model::cvs_sv_3::Scope,
16172
16173 /// This metric measures the impact to the confidentiality of the information
16174 /// resources managed by a software component due to a successfully exploited
16175 /// vulnerability.
16176 pub confidentiality_impact: crate::model::cvs_sv_3::Impact,
16177
16178 /// This metric measures the impact to integrity of a successfully exploited
16179 /// vulnerability.
16180 pub integrity_impact: crate::model::cvs_sv_3::Impact,
16181
16182 /// This metric measures the impact to the availability of the impacted
16183 /// component resulting from a successfully exploited vulnerability.
16184 pub availability_impact: crate::model::cvs_sv_3::Impact,
16185
16186 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16187}
16188
16189impl CVSSv3 {
16190 /// Creates a new default instance.
16191 pub fn new() -> Self {
16192 std::default::Default::default()
16193 }
16194
16195 /// Sets the value of [base_score][crate::model::CVSSv3::base_score].
16196 ///
16197 /// # Example
16198 /// ```ignore,no_run
16199 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16200 /// let x = CVSSv3::new().set_base_score(42.0);
16201 /// ```
16202 pub fn set_base_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16203 self.base_score = v.into();
16204 self
16205 }
16206
16207 /// Sets the value of [exploitability_score][crate::model::CVSSv3::exploitability_score].
16208 ///
16209 /// # Example
16210 /// ```ignore,no_run
16211 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16212 /// let x = CVSSv3::new().set_exploitability_score(42.0);
16213 /// ```
16214 pub fn set_exploitability_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16215 self.exploitability_score = v.into();
16216 self
16217 }
16218
16219 /// Sets the value of [impact_score][crate::model::CVSSv3::impact_score].
16220 ///
16221 /// # Example
16222 /// ```ignore,no_run
16223 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16224 /// let x = CVSSv3::new().set_impact_score(42.0);
16225 /// ```
16226 pub fn set_impact_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16227 self.impact_score = v.into();
16228 self
16229 }
16230
16231 /// Sets the value of [attack_vector][crate::model::CVSSv3::attack_vector].
16232 ///
16233 /// # Example
16234 /// ```ignore,no_run
16235 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16236 /// use google_cloud_osconfig_v1::model::cvs_sv_3::AttackVector;
16237 /// let x0 = CVSSv3::new().set_attack_vector(AttackVector::Network);
16238 /// let x1 = CVSSv3::new().set_attack_vector(AttackVector::Adjacent);
16239 /// let x2 = CVSSv3::new().set_attack_vector(AttackVector::Local);
16240 /// ```
16241 pub fn set_attack_vector<T: std::convert::Into<crate::model::cvs_sv_3::AttackVector>>(
16242 mut self,
16243 v: T,
16244 ) -> Self {
16245 self.attack_vector = v.into();
16246 self
16247 }
16248
16249 /// Sets the value of [attack_complexity][crate::model::CVSSv3::attack_complexity].
16250 ///
16251 /// # Example
16252 /// ```ignore,no_run
16253 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16254 /// use google_cloud_osconfig_v1::model::cvs_sv_3::AttackComplexity;
16255 /// let x0 = CVSSv3::new().set_attack_complexity(AttackComplexity::Low);
16256 /// let x1 = CVSSv3::new().set_attack_complexity(AttackComplexity::High);
16257 /// ```
16258 pub fn set_attack_complexity<
16259 T: std::convert::Into<crate::model::cvs_sv_3::AttackComplexity>,
16260 >(
16261 mut self,
16262 v: T,
16263 ) -> Self {
16264 self.attack_complexity = v.into();
16265 self
16266 }
16267
16268 /// Sets the value of [privileges_required][crate::model::CVSSv3::privileges_required].
16269 ///
16270 /// # Example
16271 /// ```ignore,no_run
16272 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16273 /// use google_cloud_osconfig_v1::model::cvs_sv_3::PrivilegesRequired;
16274 /// let x0 = CVSSv3::new().set_privileges_required(PrivilegesRequired::None);
16275 /// let x1 = CVSSv3::new().set_privileges_required(PrivilegesRequired::Low);
16276 /// let x2 = CVSSv3::new().set_privileges_required(PrivilegesRequired::High);
16277 /// ```
16278 pub fn set_privileges_required<
16279 T: std::convert::Into<crate::model::cvs_sv_3::PrivilegesRequired>,
16280 >(
16281 mut self,
16282 v: T,
16283 ) -> Self {
16284 self.privileges_required = v.into();
16285 self
16286 }
16287
16288 /// Sets the value of [user_interaction][crate::model::CVSSv3::user_interaction].
16289 ///
16290 /// # Example
16291 /// ```ignore,no_run
16292 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16293 /// use google_cloud_osconfig_v1::model::cvs_sv_3::UserInteraction;
16294 /// let x0 = CVSSv3::new().set_user_interaction(UserInteraction::None);
16295 /// let x1 = CVSSv3::new().set_user_interaction(UserInteraction::Required);
16296 /// ```
16297 pub fn set_user_interaction<T: std::convert::Into<crate::model::cvs_sv_3::UserInteraction>>(
16298 mut self,
16299 v: T,
16300 ) -> Self {
16301 self.user_interaction = v.into();
16302 self
16303 }
16304
16305 /// Sets the value of [scope][crate::model::CVSSv3::scope].
16306 ///
16307 /// # Example
16308 /// ```ignore,no_run
16309 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16310 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Scope;
16311 /// let x0 = CVSSv3::new().set_scope(Scope::Unchanged);
16312 /// let x1 = CVSSv3::new().set_scope(Scope::Changed);
16313 /// ```
16314 pub fn set_scope<T: std::convert::Into<crate::model::cvs_sv_3::Scope>>(mut self, v: T) -> Self {
16315 self.scope = v.into();
16316 self
16317 }
16318
16319 /// Sets the value of [confidentiality_impact][crate::model::CVSSv3::confidentiality_impact].
16320 ///
16321 /// # Example
16322 /// ```ignore,no_run
16323 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16324 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Impact;
16325 /// let x0 = CVSSv3::new().set_confidentiality_impact(Impact::High);
16326 /// let x1 = CVSSv3::new().set_confidentiality_impact(Impact::Low);
16327 /// let x2 = CVSSv3::new().set_confidentiality_impact(Impact::None);
16328 /// ```
16329 pub fn set_confidentiality_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
16330 mut self,
16331 v: T,
16332 ) -> Self {
16333 self.confidentiality_impact = v.into();
16334 self
16335 }
16336
16337 /// Sets the value of [integrity_impact][crate::model::CVSSv3::integrity_impact].
16338 ///
16339 /// # Example
16340 /// ```ignore,no_run
16341 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16342 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Impact;
16343 /// let x0 = CVSSv3::new().set_integrity_impact(Impact::High);
16344 /// let x1 = CVSSv3::new().set_integrity_impact(Impact::Low);
16345 /// let x2 = CVSSv3::new().set_integrity_impact(Impact::None);
16346 /// ```
16347 pub fn set_integrity_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
16348 mut self,
16349 v: T,
16350 ) -> Self {
16351 self.integrity_impact = v.into();
16352 self
16353 }
16354
16355 /// Sets the value of [availability_impact][crate::model::CVSSv3::availability_impact].
16356 ///
16357 /// # Example
16358 /// ```ignore,no_run
16359 /// # use google_cloud_osconfig_v1::model::CVSSv3;
16360 /// use google_cloud_osconfig_v1::model::cvs_sv_3::Impact;
16361 /// let x0 = CVSSv3::new().set_availability_impact(Impact::High);
16362 /// let x1 = CVSSv3::new().set_availability_impact(Impact::Low);
16363 /// let x2 = CVSSv3::new().set_availability_impact(Impact::None);
16364 /// ```
16365 pub fn set_availability_impact<T: std::convert::Into<crate::model::cvs_sv_3::Impact>>(
16366 mut self,
16367 v: T,
16368 ) -> Self {
16369 self.availability_impact = v.into();
16370 self
16371 }
16372}
16373
16374impl wkt::message::Message for CVSSv3 {
16375 fn typename() -> &'static str {
16376 "type.googleapis.com/google.cloud.osconfig.v1.CVSSv3"
16377 }
16378}
16379
16380/// Defines additional types related to [CVSSv3].
16381pub mod cvs_sv_3 {
16382 #[allow(unused_imports)]
16383 use super::*;
16384
16385 /// This metric reflects the context by which vulnerability exploitation is
16386 /// possible.
16387 ///
16388 /// # Working with unknown values
16389 ///
16390 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16391 /// additional enum variants at any time. Adding new variants is not considered
16392 /// a breaking change. Applications should write their code in anticipation of:
16393 ///
16394 /// - New values appearing in future releases of the client library, **and**
16395 /// - New values received dynamically, without application changes.
16396 ///
16397 /// Please consult the [Working with enums] section in the user guide for some
16398 /// guidelines.
16399 ///
16400 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16401 #[derive(Clone, Debug, PartialEq)]
16402 #[non_exhaustive]
16403 pub enum AttackVector {
16404 /// Invalid value.
16405 Unspecified,
16406 /// The vulnerable component is bound to the network stack and the set of
16407 /// possible attackers extends beyond the other options listed below, up to
16408 /// and including the entire Internet.
16409 Network,
16410 /// The vulnerable component is bound to the network stack, but the attack is
16411 /// limited at the protocol level to a logically adjacent topology.
16412 Adjacent,
16413 /// The vulnerable component is not bound to the network stack and the
16414 /// attacker's path is via read/write/execute capabilities.
16415 Local,
16416 /// The attack requires the attacker to physically touch or manipulate the
16417 /// vulnerable component.
16418 Physical,
16419 /// If set, the enum was initialized with an unknown value.
16420 ///
16421 /// Applications can examine the value using [AttackVector::value] or
16422 /// [AttackVector::name].
16423 UnknownValue(attack_vector::UnknownValue),
16424 }
16425
16426 #[doc(hidden)]
16427 pub mod attack_vector {
16428 #[allow(unused_imports)]
16429 use super::*;
16430 #[derive(Clone, Debug, PartialEq)]
16431 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16432 }
16433
16434 impl AttackVector {
16435 /// Gets the enum value.
16436 ///
16437 /// Returns `None` if the enum contains an unknown value deserialized from
16438 /// the string representation of enums.
16439 pub fn value(&self) -> std::option::Option<i32> {
16440 match self {
16441 Self::Unspecified => std::option::Option::Some(0),
16442 Self::Network => std::option::Option::Some(1),
16443 Self::Adjacent => std::option::Option::Some(2),
16444 Self::Local => std::option::Option::Some(3),
16445 Self::Physical => std::option::Option::Some(4),
16446 Self::UnknownValue(u) => u.0.value(),
16447 }
16448 }
16449
16450 /// Gets the enum value as a string.
16451 ///
16452 /// Returns `None` if the enum contains an unknown value deserialized from
16453 /// the integer representation of enums.
16454 pub fn name(&self) -> std::option::Option<&str> {
16455 match self {
16456 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
16457 Self::Network => std::option::Option::Some("ATTACK_VECTOR_NETWORK"),
16458 Self::Adjacent => std::option::Option::Some("ATTACK_VECTOR_ADJACENT"),
16459 Self::Local => std::option::Option::Some("ATTACK_VECTOR_LOCAL"),
16460 Self::Physical => std::option::Option::Some("ATTACK_VECTOR_PHYSICAL"),
16461 Self::UnknownValue(u) => u.0.name(),
16462 }
16463 }
16464 }
16465
16466 impl std::default::Default for AttackVector {
16467 fn default() -> Self {
16468 use std::convert::From;
16469 Self::from(0)
16470 }
16471 }
16472
16473 impl std::fmt::Display for AttackVector {
16474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16475 wkt::internal::display_enum(f, self.name(), self.value())
16476 }
16477 }
16478
16479 impl std::convert::From<i32> for AttackVector {
16480 fn from(value: i32) -> Self {
16481 match value {
16482 0 => Self::Unspecified,
16483 1 => Self::Network,
16484 2 => Self::Adjacent,
16485 3 => Self::Local,
16486 4 => Self::Physical,
16487 _ => Self::UnknownValue(attack_vector::UnknownValue(
16488 wkt::internal::UnknownEnumValue::Integer(value),
16489 )),
16490 }
16491 }
16492 }
16493
16494 impl std::convert::From<&str> for AttackVector {
16495 fn from(value: &str) -> Self {
16496 use std::string::ToString;
16497 match value {
16498 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
16499 "ATTACK_VECTOR_NETWORK" => Self::Network,
16500 "ATTACK_VECTOR_ADJACENT" => Self::Adjacent,
16501 "ATTACK_VECTOR_LOCAL" => Self::Local,
16502 "ATTACK_VECTOR_PHYSICAL" => Self::Physical,
16503 _ => Self::UnknownValue(attack_vector::UnknownValue(
16504 wkt::internal::UnknownEnumValue::String(value.to_string()),
16505 )),
16506 }
16507 }
16508 }
16509
16510 impl serde::ser::Serialize for AttackVector {
16511 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16512 where
16513 S: serde::Serializer,
16514 {
16515 match self {
16516 Self::Unspecified => serializer.serialize_i32(0),
16517 Self::Network => serializer.serialize_i32(1),
16518 Self::Adjacent => serializer.serialize_i32(2),
16519 Self::Local => serializer.serialize_i32(3),
16520 Self::Physical => serializer.serialize_i32(4),
16521 Self::UnknownValue(u) => u.0.serialize(serializer),
16522 }
16523 }
16524 }
16525
16526 impl<'de> serde::de::Deserialize<'de> for AttackVector {
16527 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16528 where
16529 D: serde::Deserializer<'de>,
16530 {
16531 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
16532 ".google.cloud.osconfig.v1.CVSSv3.AttackVector",
16533 ))
16534 }
16535 }
16536
16537 /// This metric describes the conditions beyond the attacker's control that
16538 /// must exist in order to exploit the vulnerability.
16539 ///
16540 /// # Working with unknown values
16541 ///
16542 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16543 /// additional enum variants at any time. Adding new variants is not considered
16544 /// a breaking change. Applications should write their code in anticipation of:
16545 ///
16546 /// - New values appearing in future releases of the client library, **and**
16547 /// - New values received dynamically, without application changes.
16548 ///
16549 /// Please consult the [Working with enums] section in the user guide for some
16550 /// guidelines.
16551 ///
16552 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16553 #[derive(Clone, Debug, PartialEq)]
16554 #[non_exhaustive]
16555 pub enum AttackComplexity {
16556 /// Invalid value.
16557 Unspecified,
16558 /// Specialized access conditions or extenuating circumstances do not exist.
16559 /// An attacker can expect repeatable success when attacking the vulnerable
16560 /// component.
16561 Low,
16562 /// A successful attack depends on conditions beyond the attacker's control.
16563 /// That is, a successful attack cannot be accomplished at will, but requires
16564 /// the attacker to invest in some measurable amount of effort in preparation
16565 /// or execution against the vulnerable component before a successful attack
16566 /// can be expected.
16567 High,
16568 /// If set, the enum was initialized with an unknown value.
16569 ///
16570 /// Applications can examine the value using [AttackComplexity::value] or
16571 /// [AttackComplexity::name].
16572 UnknownValue(attack_complexity::UnknownValue),
16573 }
16574
16575 #[doc(hidden)]
16576 pub mod attack_complexity {
16577 #[allow(unused_imports)]
16578 use super::*;
16579 #[derive(Clone, Debug, PartialEq)]
16580 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16581 }
16582
16583 impl AttackComplexity {
16584 /// Gets the enum value.
16585 ///
16586 /// Returns `None` if the enum contains an unknown value deserialized from
16587 /// the string representation of enums.
16588 pub fn value(&self) -> std::option::Option<i32> {
16589 match self {
16590 Self::Unspecified => std::option::Option::Some(0),
16591 Self::Low => std::option::Option::Some(1),
16592 Self::High => std::option::Option::Some(2),
16593 Self::UnknownValue(u) => u.0.value(),
16594 }
16595 }
16596
16597 /// Gets the enum value as a string.
16598 ///
16599 /// Returns `None` if the enum contains an unknown value deserialized from
16600 /// the integer representation of enums.
16601 pub fn name(&self) -> std::option::Option<&str> {
16602 match self {
16603 Self::Unspecified => std::option::Option::Some("ATTACK_COMPLEXITY_UNSPECIFIED"),
16604 Self::Low => std::option::Option::Some("ATTACK_COMPLEXITY_LOW"),
16605 Self::High => std::option::Option::Some("ATTACK_COMPLEXITY_HIGH"),
16606 Self::UnknownValue(u) => u.0.name(),
16607 }
16608 }
16609 }
16610
16611 impl std::default::Default for AttackComplexity {
16612 fn default() -> Self {
16613 use std::convert::From;
16614 Self::from(0)
16615 }
16616 }
16617
16618 impl std::fmt::Display for AttackComplexity {
16619 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16620 wkt::internal::display_enum(f, self.name(), self.value())
16621 }
16622 }
16623
16624 impl std::convert::From<i32> for AttackComplexity {
16625 fn from(value: i32) -> Self {
16626 match value {
16627 0 => Self::Unspecified,
16628 1 => Self::Low,
16629 2 => Self::High,
16630 _ => Self::UnknownValue(attack_complexity::UnknownValue(
16631 wkt::internal::UnknownEnumValue::Integer(value),
16632 )),
16633 }
16634 }
16635 }
16636
16637 impl std::convert::From<&str> for AttackComplexity {
16638 fn from(value: &str) -> Self {
16639 use std::string::ToString;
16640 match value {
16641 "ATTACK_COMPLEXITY_UNSPECIFIED" => Self::Unspecified,
16642 "ATTACK_COMPLEXITY_LOW" => Self::Low,
16643 "ATTACK_COMPLEXITY_HIGH" => Self::High,
16644 _ => Self::UnknownValue(attack_complexity::UnknownValue(
16645 wkt::internal::UnknownEnumValue::String(value.to_string()),
16646 )),
16647 }
16648 }
16649 }
16650
16651 impl serde::ser::Serialize for AttackComplexity {
16652 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16653 where
16654 S: serde::Serializer,
16655 {
16656 match self {
16657 Self::Unspecified => serializer.serialize_i32(0),
16658 Self::Low => serializer.serialize_i32(1),
16659 Self::High => serializer.serialize_i32(2),
16660 Self::UnknownValue(u) => u.0.serialize(serializer),
16661 }
16662 }
16663 }
16664
16665 impl<'de> serde::de::Deserialize<'de> for AttackComplexity {
16666 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16667 where
16668 D: serde::Deserializer<'de>,
16669 {
16670 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackComplexity>::new(
16671 ".google.cloud.osconfig.v1.CVSSv3.AttackComplexity",
16672 ))
16673 }
16674 }
16675
16676 /// This metric describes the level of privileges an attacker must possess
16677 /// before successfully exploiting the vulnerability.
16678 ///
16679 /// # Working with unknown values
16680 ///
16681 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16682 /// additional enum variants at any time. Adding new variants is not considered
16683 /// a breaking change. Applications should write their code in anticipation of:
16684 ///
16685 /// - New values appearing in future releases of the client library, **and**
16686 /// - New values received dynamically, without application changes.
16687 ///
16688 /// Please consult the [Working with enums] section in the user guide for some
16689 /// guidelines.
16690 ///
16691 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16692 #[derive(Clone, Debug, PartialEq)]
16693 #[non_exhaustive]
16694 pub enum PrivilegesRequired {
16695 /// Invalid value.
16696 Unspecified,
16697 /// The attacker is unauthorized prior to attack, and therefore does not
16698 /// require any access to settings or files of the vulnerable system to
16699 /// carry out an attack.
16700 None,
16701 /// The attacker requires privileges that provide basic user capabilities
16702 /// that could normally affect only settings and files owned by a user.
16703 /// Alternatively, an attacker with Low privileges has the ability to access
16704 /// only non-sensitive resources.
16705 Low,
16706 /// The attacker requires privileges that provide significant (e.g.,
16707 /// administrative) control over the vulnerable component allowing access to
16708 /// component-wide settings and files.
16709 High,
16710 /// If set, the enum was initialized with an unknown value.
16711 ///
16712 /// Applications can examine the value using [PrivilegesRequired::value] or
16713 /// [PrivilegesRequired::name].
16714 UnknownValue(privileges_required::UnknownValue),
16715 }
16716
16717 #[doc(hidden)]
16718 pub mod privileges_required {
16719 #[allow(unused_imports)]
16720 use super::*;
16721 #[derive(Clone, Debug, PartialEq)]
16722 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16723 }
16724
16725 impl PrivilegesRequired {
16726 /// Gets the enum value.
16727 ///
16728 /// Returns `None` if the enum contains an unknown value deserialized from
16729 /// the string representation of enums.
16730 pub fn value(&self) -> std::option::Option<i32> {
16731 match self {
16732 Self::Unspecified => std::option::Option::Some(0),
16733 Self::None => std::option::Option::Some(1),
16734 Self::Low => std::option::Option::Some(2),
16735 Self::High => std::option::Option::Some(3),
16736 Self::UnknownValue(u) => u.0.value(),
16737 }
16738 }
16739
16740 /// Gets the enum value as a string.
16741 ///
16742 /// Returns `None` if the enum contains an unknown value deserialized from
16743 /// the integer representation of enums.
16744 pub fn name(&self) -> std::option::Option<&str> {
16745 match self {
16746 Self::Unspecified => std::option::Option::Some("PRIVILEGES_REQUIRED_UNSPECIFIED"),
16747 Self::None => std::option::Option::Some("PRIVILEGES_REQUIRED_NONE"),
16748 Self::Low => std::option::Option::Some("PRIVILEGES_REQUIRED_LOW"),
16749 Self::High => std::option::Option::Some("PRIVILEGES_REQUIRED_HIGH"),
16750 Self::UnknownValue(u) => u.0.name(),
16751 }
16752 }
16753 }
16754
16755 impl std::default::Default for PrivilegesRequired {
16756 fn default() -> Self {
16757 use std::convert::From;
16758 Self::from(0)
16759 }
16760 }
16761
16762 impl std::fmt::Display for PrivilegesRequired {
16763 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16764 wkt::internal::display_enum(f, self.name(), self.value())
16765 }
16766 }
16767
16768 impl std::convert::From<i32> for PrivilegesRequired {
16769 fn from(value: i32) -> Self {
16770 match value {
16771 0 => Self::Unspecified,
16772 1 => Self::None,
16773 2 => Self::Low,
16774 3 => Self::High,
16775 _ => Self::UnknownValue(privileges_required::UnknownValue(
16776 wkt::internal::UnknownEnumValue::Integer(value),
16777 )),
16778 }
16779 }
16780 }
16781
16782 impl std::convert::From<&str> for PrivilegesRequired {
16783 fn from(value: &str) -> Self {
16784 use std::string::ToString;
16785 match value {
16786 "PRIVILEGES_REQUIRED_UNSPECIFIED" => Self::Unspecified,
16787 "PRIVILEGES_REQUIRED_NONE" => Self::None,
16788 "PRIVILEGES_REQUIRED_LOW" => Self::Low,
16789 "PRIVILEGES_REQUIRED_HIGH" => Self::High,
16790 _ => Self::UnknownValue(privileges_required::UnknownValue(
16791 wkt::internal::UnknownEnumValue::String(value.to_string()),
16792 )),
16793 }
16794 }
16795 }
16796
16797 impl serde::ser::Serialize for PrivilegesRequired {
16798 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16799 where
16800 S: serde::Serializer,
16801 {
16802 match self {
16803 Self::Unspecified => serializer.serialize_i32(0),
16804 Self::None => serializer.serialize_i32(1),
16805 Self::Low => serializer.serialize_i32(2),
16806 Self::High => serializer.serialize_i32(3),
16807 Self::UnknownValue(u) => u.0.serialize(serializer),
16808 }
16809 }
16810 }
16811
16812 impl<'de> serde::de::Deserialize<'de> for PrivilegesRequired {
16813 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16814 where
16815 D: serde::Deserializer<'de>,
16816 {
16817 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PrivilegesRequired>::new(
16818 ".google.cloud.osconfig.v1.CVSSv3.PrivilegesRequired",
16819 ))
16820 }
16821 }
16822
16823 /// This metric captures the requirement for a human user, other than the
16824 /// attacker, to participate in the successful compromise of the vulnerable
16825 /// component.
16826 ///
16827 /// # Working with unknown values
16828 ///
16829 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16830 /// additional enum variants at any time. Adding new variants is not considered
16831 /// a breaking change. Applications should write their code in anticipation of:
16832 ///
16833 /// - New values appearing in future releases of the client library, **and**
16834 /// - New values received dynamically, without application changes.
16835 ///
16836 /// Please consult the [Working with enums] section in the user guide for some
16837 /// guidelines.
16838 ///
16839 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16840 #[derive(Clone, Debug, PartialEq)]
16841 #[non_exhaustive]
16842 pub enum UserInteraction {
16843 /// Invalid value.
16844 Unspecified,
16845 /// The vulnerable system can be exploited without interaction from any user.
16846 None,
16847 /// Successful exploitation of this vulnerability requires a user to take
16848 /// some action before the vulnerability can be exploited.
16849 Required,
16850 /// If set, the enum was initialized with an unknown value.
16851 ///
16852 /// Applications can examine the value using [UserInteraction::value] or
16853 /// [UserInteraction::name].
16854 UnknownValue(user_interaction::UnknownValue),
16855 }
16856
16857 #[doc(hidden)]
16858 pub mod user_interaction {
16859 #[allow(unused_imports)]
16860 use super::*;
16861 #[derive(Clone, Debug, PartialEq)]
16862 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16863 }
16864
16865 impl UserInteraction {
16866 /// Gets the enum value.
16867 ///
16868 /// Returns `None` if the enum contains an unknown value deserialized from
16869 /// the string representation of enums.
16870 pub fn value(&self) -> std::option::Option<i32> {
16871 match self {
16872 Self::Unspecified => std::option::Option::Some(0),
16873 Self::None => std::option::Option::Some(1),
16874 Self::Required => std::option::Option::Some(2),
16875 Self::UnknownValue(u) => u.0.value(),
16876 }
16877 }
16878
16879 /// Gets the enum value as a string.
16880 ///
16881 /// Returns `None` if the enum contains an unknown value deserialized from
16882 /// the integer representation of enums.
16883 pub fn name(&self) -> std::option::Option<&str> {
16884 match self {
16885 Self::Unspecified => std::option::Option::Some("USER_INTERACTION_UNSPECIFIED"),
16886 Self::None => std::option::Option::Some("USER_INTERACTION_NONE"),
16887 Self::Required => std::option::Option::Some("USER_INTERACTION_REQUIRED"),
16888 Self::UnknownValue(u) => u.0.name(),
16889 }
16890 }
16891 }
16892
16893 impl std::default::Default for UserInteraction {
16894 fn default() -> Self {
16895 use std::convert::From;
16896 Self::from(0)
16897 }
16898 }
16899
16900 impl std::fmt::Display for UserInteraction {
16901 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16902 wkt::internal::display_enum(f, self.name(), self.value())
16903 }
16904 }
16905
16906 impl std::convert::From<i32> for UserInteraction {
16907 fn from(value: i32) -> Self {
16908 match value {
16909 0 => Self::Unspecified,
16910 1 => Self::None,
16911 2 => Self::Required,
16912 _ => Self::UnknownValue(user_interaction::UnknownValue(
16913 wkt::internal::UnknownEnumValue::Integer(value),
16914 )),
16915 }
16916 }
16917 }
16918
16919 impl std::convert::From<&str> for UserInteraction {
16920 fn from(value: &str) -> Self {
16921 use std::string::ToString;
16922 match value {
16923 "USER_INTERACTION_UNSPECIFIED" => Self::Unspecified,
16924 "USER_INTERACTION_NONE" => Self::None,
16925 "USER_INTERACTION_REQUIRED" => Self::Required,
16926 _ => Self::UnknownValue(user_interaction::UnknownValue(
16927 wkt::internal::UnknownEnumValue::String(value.to_string()),
16928 )),
16929 }
16930 }
16931 }
16932
16933 impl serde::ser::Serialize for UserInteraction {
16934 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16935 where
16936 S: serde::Serializer,
16937 {
16938 match self {
16939 Self::Unspecified => serializer.serialize_i32(0),
16940 Self::None => serializer.serialize_i32(1),
16941 Self::Required => serializer.serialize_i32(2),
16942 Self::UnknownValue(u) => u.0.serialize(serializer),
16943 }
16944 }
16945 }
16946
16947 impl<'de> serde::de::Deserialize<'de> for UserInteraction {
16948 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16949 where
16950 D: serde::Deserializer<'de>,
16951 {
16952 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserInteraction>::new(
16953 ".google.cloud.osconfig.v1.CVSSv3.UserInteraction",
16954 ))
16955 }
16956 }
16957
16958 /// The Scope metric captures whether a vulnerability in one vulnerable
16959 /// component impacts resources in components beyond its security scope.
16960 ///
16961 /// # Working with unknown values
16962 ///
16963 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16964 /// additional enum variants at any time. Adding new variants is not considered
16965 /// a breaking change. Applications should write their code in anticipation of:
16966 ///
16967 /// - New values appearing in future releases of the client library, **and**
16968 /// - New values received dynamically, without application changes.
16969 ///
16970 /// Please consult the [Working with enums] section in the user guide for some
16971 /// guidelines.
16972 ///
16973 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16974 #[derive(Clone, Debug, PartialEq)]
16975 #[non_exhaustive]
16976 pub enum Scope {
16977 /// Invalid value.
16978 Unspecified,
16979 /// An exploited vulnerability can only affect resources managed by the same
16980 /// security authority.
16981 Unchanged,
16982 /// An exploited vulnerability can affect resources beyond the security scope
16983 /// managed by the security authority of the vulnerable component.
16984 Changed,
16985 /// If set, the enum was initialized with an unknown value.
16986 ///
16987 /// Applications can examine the value using [Scope::value] or
16988 /// [Scope::name].
16989 UnknownValue(scope::UnknownValue),
16990 }
16991
16992 #[doc(hidden)]
16993 pub mod scope {
16994 #[allow(unused_imports)]
16995 use super::*;
16996 #[derive(Clone, Debug, PartialEq)]
16997 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16998 }
16999
17000 impl Scope {
17001 /// Gets the enum value.
17002 ///
17003 /// Returns `None` if the enum contains an unknown value deserialized from
17004 /// the string representation of enums.
17005 pub fn value(&self) -> std::option::Option<i32> {
17006 match self {
17007 Self::Unspecified => std::option::Option::Some(0),
17008 Self::Unchanged => std::option::Option::Some(1),
17009 Self::Changed => std::option::Option::Some(2),
17010 Self::UnknownValue(u) => u.0.value(),
17011 }
17012 }
17013
17014 /// Gets the enum value as a string.
17015 ///
17016 /// Returns `None` if the enum contains an unknown value deserialized from
17017 /// the integer representation of enums.
17018 pub fn name(&self) -> std::option::Option<&str> {
17019 match self {
17020 Self::Unspecified => std::option::Option::Some("SCOPE_UNSPECIFIED"),
17021 Self::Unchanged => std::option::Option::Some("SCOPE_UNCHANGED"),
17022 Self::Changed => std::option::Option::Some("SCOPE_CHANGED"),
17023 Self::UnknownValue(u) => u.0.name(),
17024 }
17025 }
17026 }
17027
17028 impl std::default::Default for Scope {
17029 fn default() -> Self {
17030 use std::convert::From;
17031 Self::from(0)
17032 }
17033 }
17034
17035 impl std::fmt::Display for Scope {
17036 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17037 wkt::internal::display_enum(f, self.name(), self.value())
17038 }
17039 }
17040
17041 impl std::convert::From<i32> for Scope {
17042 fn from(value: i32) -> Self {
17043 match value {
17044 0 => Self::Unspecified,
17045 1 => Self::Unchanged,
17046 2 => Self::Changed,
17047 _ => Self::UnknownValue(scope::UnknownValue(
17048 wkt::internal::UnknownEnumValue::Integer(value),
17049 )),
17050 }
17051 }
17052 }
17053
17054 impl std::convert::From<&str> for Scope {
17055 fn from(value: &str) -> Self {
17056 use std::string::ToString;
17057 match value {
17058 "SCOPE_UNSPECIFIED" => Self::Unspecified,
17059 "SCOPE_UNCHANGED" => Self::Unchanged,
17060 "SCOPE_CHANGED" => Self::Changed,
17061 _ => Self::UnknownValue(scope::UnknownValue(
17062 wkt::internal::UnknownEnumValue::String(value.to_string()),
17063 )),
17064 }
17065 }
17066 }
17067
17068 impl serde::ser::Serialize for Scope {
17069 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17070 where
17071 S: serde::Serializer,
17072 {
17073 match self {
17074 Self::Unspecified => serializer.serialize_i32(0),
17075 Self::Unchanged => serializer.serialize_i32(1),
17076 Self::Changed => serializer.serialize_i32(2),
17077 Self::UnknownValue(u) => u.0.serialize(serializer),
17078 }
17079 }
17080 }
17081
17082 impl<'de> serde::de::Deserialize<'de> for Scope {
17083 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17084 where
17085 D: serde::Deserializer<'de>,
17086 {
17087 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Scope>::new(
17088 ".google.cloud.osconfig.v1.CVSSv3.Scope",
17089 ))
17090 }
17091 }
17092
17093 /// The Impact metrics capture the effects of a successfully exploited
17094 /// vulnerability on the component that suffers the worst outcome that is most
17095 /// directly and predictably associated with the attack.
17096 ///
17097 /// # Working with unknown values
17098 ///
17099 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17100 /// additional enum variants at any time. Adding new variants is not considered
17101 /// a breaking change. Applications should write their code in anticipation of:
17102 ///
17103 /// - New values appearing in future releases of the client library, **and**
17104 /// - New values received dynamically, without application changes.
17105 ///
17106 /// Please consult the [Working with enums] section in the user guide for some
17107 /// guidelines.
17108 ///
17109 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17110 #[derive(Clone, Debug, PartialEq)]
17111 #[non_exhaustive]
17112 pub enum Impact {
17113 /// Invalid value.
17114 Unspecified,
17115 /// High impact.
17116 High,
17117 /// Low impact.
17118 Low,
17119 /// No impact.
17120 None,
17121 /// If set, the enum was initialized with an unknown value.
17122 ///
17123 /// Applications can examine the value using [Impact::value] or
17124 /// [Impact::name].
17125 UnknownValue(impact::UnknownValue),
17126 }
17127
17128 #[doc(hidden)]
17129 pub mod impact {
17130 #[allow(unused_imports)]
17131 use super::*;
17132 #[derive(Clone, Debug, PartialEq)]
17133 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17134 }
17135
17136 impl Impact {
17137 /// Gets the enum value.
17138 ///
17139 /// Returns `None` if the enum contains an unknown value deserialized from
17140 /// the string representation of enums.
17141 pub fn value(&self) -> std::option::Option<i32> {
17142 match self {
17143 Self::Unspecified => std::option::Option::Some(0),
17144 Self::High => std::option::Option::Some(1),
17145 Self::Low => std::option::Option::Some(2),
17146 Self::None => std::option::Option::Some(3),
17147 Self::UnknownValue(u) => u.0.value(),
17148 }
17149 }
17150
17151 /// Gets the enum value as a string.
17152 ///
17153 /// Returns `None` if the enum contains an unknown value deserialized from
17154 /// the integer representation of enums.
17155 pub fn name(&self) -> std::option::Option<&str> {
17156 match self {
17157 Self::Unspecified => std::option::Option::Some("IMPACT_UNSPECIFIED"),
17158 Self::High => std::option::Option::Some("IMPACT_HIGH"),
17159 Self::Low => std::option::Option::Some("IMPACT_LOW"),
17160 Self::None => std::option::Option::Some("IMPACT_NONE"),
17161 Self::UnknownValue(u) => u.0.name(),
17162 }
17163 }
17164 }
17165
17166 impl std::default::Default for Impact {
17167 fn default() -> Self {
17168 use std::convert::From;
17169 Self::from(0)
17170 }
17171 }
17172
17173 impl std::fmt::Display for Impact {
17174 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17175 wkt::internal::display_enum(f, self.name(), self.value())
17176 }
17177 }
17178
17179 impl std::convert::From<i32> for Impact {
17180 fn from(value: i32) -> Self {
17181 match value {
17182 0 => Self::Unspecified,
17183 1 => Self::High,
17184 2 => Self::Low,
17185 3 => Self::None,
17186 _ => Self::UnknownValue(impact::UnknownValue(
17187 wkt::internal::UnknownEnumValue::Integer(value),
17188 )),
17189 }
17190 }
17191 }
17192
17193 impl std::convert::From<&str> for Impact {
17194 fn from(value: &str) -> Self {
17195 use std::string::ToString;
17196 match value {
17197 "IMPACT_UNSPECIFIED" => Self::Unspecified,
17198 "IMPACT_HIGH" => Self::High,
17199 "IMPACT_LOW" => Self::Low,
17200 "IMPACT_NONE" => Self::None,
17201 _ => Self::UnknownValue(impact::UnknownValue(
17202 wkt::internal::UnknownEnumValue::String(value.to_string()),
17203 )),
17204 }
17205 }
17206 }
17207
17208 impl serde::ser::Serialize for Impact {
17209 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17210 where
17211 S: serde::Serializer,
17212 {
17213 match self {
17214 Self::Unspecified => serializer.serialize_i32(0),
17215 Self::High => serializer.serialize_i32(1),
17216 Self::Low => serializer.serialize_i32(2),
17217 Self::None => serializer.serialize_i32(3),
17218 Self::UnknownValue(u) => u.0.serialize(serializer),
17219 }
17220 }
17221 }
17222
17223 impl<'de> serde::de::Deserialize<'de> for Impact {
17224 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17225 where
17226 D: serde::Deserializer<'de>,
17227 {
17228 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Impact>::new(
17229 ".google.cloud.osconfig.v1.CVSSv3.Impact",
17230 ))
17231 }
17232 }
17233}
17234
17235/// The view for inventory objects.
17236///
17237/// # Working with unknown values
17238///
17239/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17240/// additional enum variants at any time. Adding new variants is not considered
17241/// a breaking change. Applications should write their code in anticipation of:
17242///
17243/// - New values appearing in future releases of the client library, **and**
17244/// - New values received dynamically, without application changes.
17245///
17246/// Please consult the [Working with enums] section in the user guide for some
17247/// guidelines.
17248///
17249/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17250#[derive(Clone, Debug, PartialEq)]
17251#[non_exhaustive]
17252pub enum InventoryView {
17253 /// The default value.
17254 /// The API defaults to the BASIC view.
17255 Unspecified,
17256 /// Returns the basic inventory information that includes `os_info`.
17257 Basic,
17258 /// Returns all fields.
17259 Full,
17260 /// If set, the enum was initialized with an unknown value.
17261 ///
17262 /// Applications can examine the value using [InventoryView::value] or
17263 /// [InventoryView::name].
17264 UnknownValue(inventory_view::UnknownValue),
17265}
17266
17267#[doc(hidden)]
17268pub mod inventory_view {
17269 #[allow(unused_imports)]
17270 use super::*;
17271 #[derive(Clone, Debug, PartialEq)]
17272 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17273}
17274
17275impl InventoryView {
17276 /// Gets the enum value.
17277 ///
17278 /// Returns `None` if the enum contains an unknown value deserialized from
17279 /// the string representation of enums.
17280 pub fn value(&self) -> std::option::Option<i32> {
17281 match self {
17282 Self::Unspecified => std::option::Option::Some(0),
17283 Self::Basic => std::option::Option::Some(1),
17284 Self::Full => std::option::Option::Some(2),
17285 Self::UnknownValue(u) => u.0.value(),
17286 }
17287 }
17288
17289 /// Gets the enum value as a string.
17290 ///
17291 /// Returns `None` if the enum contains an unknown value deserialized from
17292 /// the integer representation of enums.
17293 pub fn name(&self) -> std::option::Option<&str> {
17294 match self {
17295 Self::Unspecified => std::option::Option::Some("INVENTORY_VIEW_UNSPECIFIED"),
17296 Self::Basic => std::option::Option::Some("BASIC"),
17297 Self::Full => std::option::Option::Some("FULL"),
17298 Self::UnknownValue(u) => u.0.name(),
17299 }
17300 }
17301}
17302
17303impl std::default::Default for InventoryView {
17304 fn default() -> Self {
17305 use std::convert::From;
17306 Self::from(0)
17307 }
17308}
17309
17310impl std::fmt::Display for InventoryView {
17311 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17312 wkt::internal::display_enum(f, self.name(), self.value())
17313 }
17314}
17315
17316impl std::convert::From<i32> for InventoryView {
17317 fn from(value: i32) -> Self {
17318 match value {
17319 0 => Self::Unspecified,
17320 1 => Self::Basic,
17321 2 => Self::Full,
17322 _ => Self::UnknownValue(inventory_view::UnknownValue(
17323 wkt::internal::UnknownEnumValue::Integer(value),
17324 )),
17325 }
17326 }
17327}
17328
17329impl std::convert::From<&str> for InventoryView {
17330 fn from(value: &str) -> Self {
17331 use std::string::ToString;
17332 match value {
17333 "INVENTORY_VIEW_UNSPECIFIED" => Self::Unspecified,
17334 "BASIC" => Self::Basic,
17335 "FULL" => Self::Full,
17336 _ => Self::UnknownValue(inventory_view::UnknownValue(
17337 wkt::internal::UnknownEnumValue::String(value.to_string()),
17338 )),
17339 }
17340 }
17341}
17342
17343impl serde::ser::Serialize for InventoryView {
17344 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17345 where
17346 S: serde::Serializer,
17347 {
17348 match self {
17349 Self::Unspecified => serializer.serialize_i32(0),
17350 Self::Basic => serializer.serialize_i32(1),
17351 Self::Full => serializer.serialize_i32(2),
17352 Self::UnknownValue(u) => u.0.serialize(serializer),
17353 }
17354 }
17355}
17356
17357impl<'de> serde::de::Deserialize<'de> for InventoryView {
17358 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17359 where
17360 D: serde::Deserializer<'de>,
17361 {
17362 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InventoryView>::new(
17363 ".google.cloud.osconfig.v1.InventoryView",
17364 ))
17365 }
17366}