Skip to main content

google_cloud_maintenance_api_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate serde;
26extern crate serde_json;
27extern crate serde_with;
28extern crate std;
29extern crate tracing;
30extern crate wkt;
31
32mod debug;
33mod deserialize;
34mod serialize;
35
36/// Request message for SummarizeMaintenances custom method.
37#[derive(Clone, Default, PartialEq)]
38#[non_exhaustive]
39pub struct SummarizeMaintenancesRequest {
40    /// Required. The parent of the resource maintenance.
41    /// eg. `projects/123/locations/*`
42    pub parent: std::string::String,
43
44    /// The maximum number of resource maintenances to send per page. The default
45    /// page size is 20 and the maximum is 1000.
46    pub page_size: i32,
47
48    /// The page token: If the next_page_token from a previous response
49    /// is provided, this request will send the subsequent page.
50    pub page_token: std::string::String,
51
52    /// Filter the list as specified in <https://google.aip.dev/160>.
53    /// Supported fields include:
54    ///
55    /// - `maintenance.maintenanceName`
56    ///   Examples:
57    /// - `maintenance.maintenanceName="eb3b709c-9ca1-5472-9fb6-800a3849eda1"`
58    pub filter: std::string::String,
59
60    /// Order results as specified in <https://google.aip.dev/132>.
61    pub order_by: std::string::String,
62
63    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
64}
65
66impl SummarizeMaintenancesRequest {
67    /// Creates a new default instance.
68    pub fn new() -> Self {
69        std::default::Default::default()
70    }
71
72    /// Sets the value of [parent][crate::model::SummarizeMaintenancesRequest::parent].
73    ///
74    /// # Example
75    /// ```ignore,no_run
76    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesRequest;
77    /// # let project_id = "project_id";
78    /// # let location_id = "location_id";
79    /// let x = SummarizeMaintenancesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
80    /// ```
81    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82        self.parent = v.into();
83        self
84    }
85
86    /// Sets the value of [page_size][crate::model::SummarizeMaintenancesRequest::page_size].
87    ///
88    /// # Example
89    /// ```ignore,no_run
90    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesRequest;
91    /// let x = SummarizeMaintenancesRequest::new().set_page_size(42);
92    /// ```
93    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
94        self.page_size = v.into();
95        self
96    }
97
98    /// Sets the value of [page_token][crate::model::SummarizeMaintenancesRequest::page_token].
99    ///
100    /// # Example
101    /// ```ignore,no_run
102    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesRequest;
103    /// let x = SummarizeMaintenancesRequest::new().set_page_token("example");
104    /// ```
105    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
106        self.page_token = v.into();
107        self
108    }
109
110    /// Sets the value of [filter][crate::model::SummarizeMaintenancesRequest::filter].
111    ///
112    /// # Example
113    /// ```ignore,no_run
114    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesRequest;
115    /// let x = SummarizeMaintenancesRequest::new().set_filter("example");
116    /// ```
117    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
118        self.filter = v.into();
119        self
120    }
121
122    /// Sets the value of [order_by][crate::model::SummarizeMaintenancesRequest::order_by].
123    ///
124    /// # Example
125    /// ```ignore,no_run
126    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesRequest;
127    /// let x = SummarizeMaintenancesRequest::new().set_order_by("example");
128    /// ```
129    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
130        self.order_by = v.into();
131        self
132    }
133}
134
135impl wkt::message::Message for SummarizeMaintenancesRequest {
136    fn typename() -> &'static str {
137        "type.googleapis.com/google.cloud.maintenance.api.v1.SummarizeMaintenancesRequest"
138    }
139}
140
141/// Request message for SummarizeMaintenances custom method.
142#[derive(Clone, Default, PartialEq)]
143#[non_exhaustive]
144pub struct SummarizeMaintenancesResponse {
145    /// The resulting summaries.
146    pub maintenances: std::vec::Vec<crate::model::MaintenanceSummary>,
147
148    /// If present, the next page token can be provided to a subsequent
149    /// SummarizeMaintenances call to list the next page.
150    /// If empty, there are no more pages.
151    pub next_page_token: std::string::String,
152
153    /// Unordered list. Locations that could not be reached.
154    pub unreachable: std::vec::Vec<std::string::String>,
155
156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
157}
158
159impl SummarizeMaintenancesResponse {
160    /// Creates a new default instance.
161    pub fn new() -> Self {
162        std::default::Default::default()
163    }
164
165    /// Sets the value of [maintenances][crate::model::SummarizeMaintenancesResponse::maintenances].
166    ///
167    /// # Example
168    /// ```ignore,no_run
169    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesResponse;
170    /// use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
171    /// let x = SummarizeMaintenancesResponse::new()
172    ///     .set_maintenances([
173    ///         MaintenanceSummary::default()/* use setters */,
174    ///         MaintenanceSummary::default()/* use (different) setters */,
175    ///     ]);
176    /// ```
177    pub fn set_maintenances<T, V>(mut self, v: T) -> Self
178    where
179        T: std::iter::IntoIterator<Item = V>,
180        V: std::convert::Into<crate::model::MaintenanceSummary>,
181    {
182        use std::iter::Iterator;
183        self.maintenances = v.into_iter().map(|i| i.into()).collect();
184        self
185    }
186
187    /// Sets the value of [next_page_token][crate::model::SummarizeMaintenancesResponse::next_page_token].
188    ///
189    /// # Example
190    /// ```ignore,no_run
191    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesResponse;
192    /// let x = SummarizeMaintenancesResponse::new().set_next_page_token("example");
193    /// ```
194    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
195        self.next_page_token = v.into();
196        self
197    }
198
199    /// Sets the value of [unreachable][crate::model::SummarizeMaintenancesResponse::unreachable].
200    ///
201    /// # Example
202    /// ```ignore,no_run
203    /// # use google_cloud_maintenance_api_v1::model::SummarizeMaintenancesResponse;
204    /// let x = SummarizeMaintenancesResponse::new().set_unreachable(["a", "b", "c"]);
205    /// ```
206    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
207    where
208        T: std::iter::IntoIterator<Item = V>,
209        V: std::convert::Into<std::string::String>,
210    {
211        use std::iter::Iterator;
212        self.unreachable = v.into_iter().map(|i| i.into()).collect();
213        self
214    }
215}
216
217impl wkt::message::Message for SummarizeMaintenancesResponse {
218    fn typename() -> &'static str {
219        "type.googleapis.com/google.cloud.maintenance.api.v1.SummarizeMaintenancesResponse"
220    }
221}
222
223#[doc(hidden)]
224impl google_cloud_gax::paginator::internal::PageableResponse for SummarizeMaintenancesResponse {
225    type PageItem = crate::model::MaintenanceSummary;
226
227    fn items(self) -> std::vec::Vec<Self::PageItem> {
228        self.maintenances
229    }
230
231    fn next_page_token(&self) -> std::string::String {
232        use std::clone::Clone;
233        self.next_page_token.clone()
234    }
235}
236
237/// MaintenanceSummary contains maintenance statistics calculated based on
238/// ResourceMaintenances within the scope: project and location.
239#[derive(Clone, Default, PartialEq)]
240#[non_exhaustive]
241pub struct MaintenanceSummary {
242    /// Output only. The name of the maintenance.
243    pub maintenance_name: std::string::String,
244
245    /// Output only. The title of the maintenance.
246    pub title: std::string::String,
247
248    /// Output only. The description of the maintenance.
249    pub description: std::string::String,
250
251    /// Output only. The category of the maintenance event.
252    pub category: crate::model::MaintenanceCategory,
253
254    /// Output only. Scheduled start time of the maintenance. The maintenance will
255    /// start at `maintenanceScheduledStartTime` or later, with best effort to
256    /// finish before `maintenanceScheduledEndTime`.
257    pub maintenance_scheduled_start_time: std::option::Option<wkt::Timestamp>,
258
259    /// Output only. An estimated (best effort, not guaranteed) end time of the
260    /// scheduled maintenance.
261    pub maintenance_scheduled_end_time: std::option::Option<wkt::Timestamp>,
262
263    /// Output only. Actual date when the maintenance started. Field present only
264    /// after the state changed to `RUNNING`.
265    pub maintenance_start_time: std::option::Option<wkt::Timestamp>,
266
267    /// Output only. Actual date when the maintenance successfully completed. Field
268    /// present only after the state changed to `SUCCEEDED`.
269    pub maintenance_end_time: std::option::Option<wkt::Timestamp>,
270
271    /// Output only. Indicates whether the user has some control over that
272    /// maintenance, either proactively before maintenance was scheduled with
273    /// maintenance policy or with reactive controls after it was scheduled (see
274    /// controls field).
275    pub user_controllable: bool,
276
277    /// Output only. Control available for that Maintenance (might not be available
278    /// for every resource that maintenance is applied to).
279    pub controls: std::vec::Vec<crate::model::MaintenanceControl>,
280
281    /// Output only. Stats is a field of ResourceMaintenance used to aggregate the
282    /// stats.
283    pub stats: std::vec::Vec<crate::model::maintenance_summary::Stats>,
284
285    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
286}
287
288impl MaintenanceSummary {
289    /// Creates a new default instance.
290    pub fn new() -> Self {
291        std::default::Default::default()
292    }
293
294    /// Sets the value of [maintenance_name][crate::model::MaintenanceSummary::maintenance_name].
295    ///
296    /// # Example
297    /// ```ignore,no_run
298    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
299    /// let x = MaintenanceSummary::new().set_maintenance_name("example");
300    /// ```
301    pub fn set_maintenance_name<T: std::convert::Into<std::string::String>>(
302        mut self,
303        v: T,
304    ) -> Self {
305        self.maintenance_name = v.into();
306        self
307    }
308
309    /// Sets the value of [title][crate::model::MaintenanceSummary::title].
310    ///
311    /// # Example
312    /// ```ignore,no_run
313    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
314    /// let x = MaintenanceSummary::new().set_title("example");
315    /// ```
316    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
317        self.title = v.into();
318        self
319    }
320
321    /// Sets the value of [description][crate::model::MaintenanceSummary::description].
322    ///
323    /// # Example
324    /// ```ignore,no_run
325    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
326    /// let x = MaintenanceSummary::new().set_description("example");
327    /// ```
328    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
329        self.description = v.into();
330        self
331    }
332
333    /// Sets the value of [category][crate::model::MaintenanceSummary::category].
334    ///
335    /// # Example
336    /// ```ignore,no_run
337    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
338    /// use google_cloud_maintenance_api_v1::model::MaintenanceCategory;
339    /// let x0 = MaintenanceSummary::new().set_category(MaintenanceCategory::Infrastructure);
340    /// let x1 = MaintenanceSummary::new().set_category(MaintenanceCategory::ServiceUpdate);
341    /// ```
342    pub fn set_category<T: std::convert::Into<crate::model::MaintenanceCategory>>(
343        mut self,
344        v: T,
345    ) -> Self {
346        self.category = v.into();
347        self
348    }
349
350    /// Sets the value of [maintenance_scheduled_start_time][crate::model::MaintenanceSummary::maintenance_scheduled_start_time].
351    ///
352    /// # Example
353    /// ```ignore,no_run
354    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
355    /// use wkt::Timestamp;
356    /// let x = MaintenanceSummary::new().set_maintenance_scheduled_start_time(Timestamp::default()/* use setters */);
357    /// ```
358    pub fn set_maintenance_scheduled_start_time<T>(mut self, v: T) -> Self
359    where
360        T: std::convert::Into<wkt::Timestamp>,
361    {
362        self.maintenance_scheduled_start_time = std::option::Option::Some(v.into());
363        self
364    }
365
366    /// Sets or clears the value of [maintenance_scheduled_start_time][crate::model::MaintenanceSummary::maintenance_scheduled_start_time].
367    ///
368    /// # Example
369    /// ```ignore,no_run
370    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
371    /// use wkt::Timestamp;
372    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_scheduled_start_time(Some(Timestamp::default()/* use setters */));
373    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_scheduled_start_time(None::<Timestamp>);
374    /// ```
375    pub fn set_or_clear_maintenance_scheduled_start_time<T>(
376        mut self,
377        v: std::option::Option<T>,
378    ) -> Self
379    where
380        T: std::convert::Into<wkt::Timestamp>,
381    {
382        self.maintenance_scheduled_start_time = v.map(|x| x.into());
383        self
384    }
385
386    /// Sets the value of [maintenance_scheduled_end_time][crate::model::MaintenanceSummary::maintenance_scheduled_end_time].
387    ///
388    /// # Example
389    /// ```ignore,no_run
390    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
391    /// use wkt::Timestamp;
392    /// let x = MaintenanceSummary::new().set_maintenance_scheduled_end_time(Timestamp::default()/* use setters */);
393    /// ```
394    pub fn set_maintenance_scheduled_end_time<T>(mut self, v: T) -> Self
395    where
396        T: std::convert::Into<wkt::Timestamp>,
397    {
398        self.maintenance_scheduled_end_time = std::option::Option::Some(v.into());
399        self
400    }
401
402    /// Sets or clears the value of [maintenance_scheduled_end_time][crate::model::MaintenanceSummary::maintenance_scheduled_end_time].
403    ///
404    /// # Example
405    /// ```ignore,no_run
406    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
407    /// use wkt::Timestamp;
408    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_scheduled_end_time(Some(Timestamp::default()/* use setters */));
409    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_scheduled_end_time(None::<Timestamp>);
410    /// ```
411    pub fn set_or_clear_maintenance_scheduled_end_time<T>(
412        mut self,
413        v: std::option::Option<T>,
414    ) -> Self
415    where
416        T: std::convert::Into<wkt::Timestamp>,
417    {
418        self.maintenance_scheduled_end_time = v.map(|x| x.into());
419        self
420    }
421
422    /// Sets the value of [maintenance_start_time][crate::model::MaintenanceSummary::maintenance_start_time].
423    ///
424    /// # Example
425    /// ```ignore,no_run
426    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
427    /// use wkt::Timestamp;
428    /// let x = MaintenanceSummary::new().set_maintenance_start_time(Timestamp::default()/* use setters */);
429    /// ```
430    pub fn set_maintenance_start_time<T>(mut self, v: T) -> Self
431    where
432        T: std::convert::Into<wkt::Timestamp>,
433    {
434        self.maintenance_start_time = std::option::Option::Some(v.into());
435        self
436    }
437
438    /// Sets or clears the value of [maintenance_start_time][crate::model::MaintenanceSummary::maintenance_start_time].
439    ///
440    /// # Example
441    /// ```ignore,no_run
442    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
443    /// use wkt::Timestamp;
444    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_start_time(Some(Timestamp::default()/* use setters */));
445    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_start_time(None::<Timestamp>);
446    /// ```
447    pub fn set_or_clear_maintenance_start_time<T>(mut self, v: std::option::Option<T>) -> Self
448    where
449        T: std::convert::Into<wkt::Timestamp>,
450    {
451        self.maintenance_start_time = v.map(|x| x.into());
452        self
453    }
454
455    /// Sets the value of [maintenance_end_time][crate::model::MaintenanceSummary::maintenance_end_time].
456    ///
457    /// # Example
458    /// ```ignore,no_run
459    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
460    /// use wkt::Timestamp;
461    /// let x = MaintenanceSummary::new().set_maintenance_end_time(Timestamp::default()/* use setters */);
462    /// ```
463    pub fn set_maintenance_end_time<T>(mut self, v: T) -> Self
464    where
465        T: std::convert::Into<wkt::Timestamp>,
466    {
467        self.maintenance_end_time = std::option::Option::Some(v.into());
468        self
469    }
470
471    /// Sets or clears the value of [maintenance_end_time][crate::model::MaintenanceSummary::maintenance_end_time].
472    ///
473    /// # Example
474    /// ```ignore,no_run
475    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
476    /// use wkt::Timestamp;
477    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_end_time(Some(Timestamp::default()/* use setters */));
478    /// let x = MaintenanceSummary::new().set_or_clear_maintenance_end_time(None::<Timestamp>);
479    /// ```
480    pub fn set_or_clear_maintenance_end_time<T>(mut self, v: std::option::Option<T>) -> Self
481    where
482        T: std::convert::Into<wkt::Timestamp>,
483    {
484        self.maintenance_end_time = v.map(|x| x.into());
485        self
486    }
487
488    /// Sets the value of [user_controllable][crate::model::MaintenanceSummary::user_controllable].
489    ///
490    /// # Example
491    /// ```ignore,no_run
492    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
493    /// let x = MaintenanceSummary::new().set_user_controllable(true);
494    /// ```
495    pub fn set_user_controllable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
496        self.user_controllable = v.into();
497        self
498    }
499
500    /// Sets the value of [controls][crate::model::MaintenanceSummary::controls].
501    ///
502    /// # Example
503    /// ```ignore,no_run
504    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
505    /// use google_cloud_maintenance_api_v1::model::MaintenanceControl;
506    /// let x = MaintenanceSummary::new()
507    ///     .set_controls([
508    ///         MaintenanceControl::default()/* use setters */,
509    ///         MaintenanceControl::default()/* use (different) setters */,
510    ///     ]);
511    /// ```
512    pub fn set_controls<T, V>(mut self, v: T) -> Self
513    where
514        T: std::iter::IntoIterator<Item = V>,
515        V: std::convert::Into<crate::model::MaintenanceControl>,
516    {
517        use std::iter::Iterator;
518        self.controls = v.into_iter().map(|i| i.into()).collect();
519        self
520    }
521
522    /// Sets the value of [stats][crate::model::MaintenanceSummary::stats].
523    ///
524    /// # Example
525    /// ```ignore,no_run
526    /// # use google_cloud_maintenance_api_v1::model::MaintenanceSummary;
527    /// use google_cloud_maintenance_api_v1::model::maintenance_summary::Stats;
528    /// let x = MaintenanceSummary::new()
529    ///     .set_stats([
530    ///         Stats::default()/* use setters */,
531    ///         Stats::default()/* use (different) setters */,
532    ///     ]);
533    /// ```
534    pub fn set_stats<T, V>(mut self, v: T) -> Self
535    where
536        T: std::iter::IntoIterator<Item = V>,
537        V: std::convert::Into<crate::model::maintenance_summary::Stats>,
538    {
539        use std::iter::Iterator;
540        self.stats = v.into_iter().map(|i| i.into()).collect();
541        self
542    }
543}
544
545impl wkt::message::Message for MaintenanceSummary {
546    fn typename() -> &'static str {
547        "type.googleapis.com/google.cloud.maintenance.api.v1.MaintenanceSummary"
548    }
549}
550
551/// Defines additional types related to [MaintenanceSummary].
552pub mod maintenance_summary {
553    #[allow(unused_imports)]
554    use super::*;
555
556    /// Stats indicates the type of aggregate and the corresponding aggregates.
557    #[derive(Clone, Default, PartialEq)]
558    #[non_exhaustive]
559    pub struct Stats {
560        /// groupBy specifies the type of aggregate.
561        /// For example a group_by might be `"state"`
562        pub group_by: std::string::String,
563
564        /// Aggregates is a list <group, count> pairs. For example, if the
565        /// group_by is `"state"` a possible tuple in the aggregates list could be
566        /// "SCHEDULED" : `11`,
567        pub aggregates: std::vec::Vec<crate::model::maintenance_summary::Aggregate>,
568
569        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
570    }
571
572    impl Stats {
573        /// Creates a new default instance.
574        pub fn new() -> Self {
575            std::default::Default::default()
576        }
577
578        /// Sets the value of [group_by][crate::model::maintenance_summary::Stats::group_by].
579        ///
580        /// # Example
581        /// ```ignore,no_run
582        /// # use google_cloud_maintenance_api_v1::model::maintenance_summary::Stats;
583        /// let x = Stats::new().set_group_by("example");
584        /// ```
585        pub fn set_group_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
586            self.group_by = v.into();
587            self
588        }
589
590        /// Sets the value of [aggregates][crate::model::maintenance_summary::Stats::aggregates].
591        ///
592        /// # Example
593        /// ```ignore,no_run
594        /// # use google_cloud_maintenance_api_v1::model::maintenance_summary::Stats;
595        /// use google_cloud_maintenance_api_v1::model::maintenance_summary::Aggregate;
596        /// let x = Stats::new()
597        ///     .set_aggregates([
598        ///         Aggregate::default()/* use setters */,
599        ///         Aggregate::default()/* use (different) setters */,
600        ///     ]);
601        /// ```
602        pub fn set_aggregates<T, V>(mut self, v: T) -> Self
603        where
604            T: std::iter::IntoIterator<Item = V>,
605            V: std::convert::Into<crate::model::maintenance_summary::Aggregate>,
606        {
607            use std::iter::Iterator;
608            self.aggregates = v.into_iter().map(|i| i.into()).collect();
609            self
610        }
611    }
612
613    impl wkt::message::Message for Stats {
614        fn typename() -> &'static str {
615            "type.googleapis.com/google.cloud.maintenance.api.v1.MaintenanceSummary.Stats"
616        }
617    }
618
619    /// Aggregate is a <group, count> pair.
620    #[derive(Clone, Default, PartialEq)]
621    #[non_exhaustive]
622    pub struct Aggregate {
623        /// Specifies what specific value of the group_by the count represents. For
624        /// example if group_by is `"state"` its corresponding group could be
625        /// `"SCHEDULED"`.
626        pub group: std::string::String,
627
628        /// The count of the group.
629        pub count: i64,
630
631        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
632    }
633
634    impl Aggregate {
635        /// Creates a new default instance.
636        pub fn new() -> Self {
637            std::default::Default::default()
638        }
639
640        /// Sets the value of [group][crate::model::maintenance_summary::Aggregate::group].
641        ///
642        /// # Example
643        /// ```ignore,no_run
644        /// # use google_cloud_maintenance_api_v1::model::maintenance_summary::Aggregate;
645        /// let x = Aggregate::new().set_group("example");
646        /// ```
647        pub fn set_group<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
648            self.group = v.into();
649            self
650        }
651
652        /// Sets the value of [count][crate::model::maintenance_summary::Aggregate::count].
653        ///
654        /// # Example
655        /// ```ignore,no_run
656        /// # use google_cloud_maintenance_api_v1::model::maintenance_summary::Aggregate;
657        /// let x = Aggregate::new().set_count(42);
658        /// ```
659        pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
660            self.count = v.into();
661            self
662        }
663    }
664
665    impl wkt::message::Message for Aggregate {
666        fn typename() -> &'static str {
667            "type.googleapis.com/google.cloud.maintenance.api.v1.MaintenanceSummary.Aggregate"
668        }
669    }
670}
671
672/// ResourceMaintenance is a resource that represents a maintenance operation
673/// on a resource.
674#[derive(Clone, Default, PartialEq)]
675#[non_exhaustive]
676pub struct ResourceMaintenance {
677    /// Identifier. The name of the resource_maintenance resource.
678    /// Format:
679    /// `"projects/{project}/locations/{location}/resourceMaintenance/{resource-maintenance-id}"`
680    pub name: std::string::String,
681
682    /// Output only. The resource spec of the resource maintenance.
683    pub resource: std::option::Option<crate::model::resource_maintenance::Resource>,
684
685    /// Output only. The details of the maintenance.
686    pub maintenance: std::option::Option<crate::model::resource_maintenance::Maintenance>,
687
688    /// Output only. The state of the resource maintenance.
689    pub state: crate::model::resource_maintenance::State,
690
691    /// Output only. The create time of the resource maintenance.
692    pub create_time: std::option::Option<wkt::Timestamp>,
693
694    /// Output only. The update time of the resource maintenance.
695    pub update_time: std::option::Option<wkt::Timestamp>,
696
697    /// Output only. The time when the resource maintenance has started.
698    pub maintenance_start_time: std::option::Option<wkt::Timestamp>,
699
700    /// Output only. The time when the resource maintenance has completed.
701    pub maintenance_end_time: std::option::Option<wkt::Timestamp>,
702
703    /// Output only. The time when the resource maintenance was cancelled.
704    pub maintenance_cancel_time: std::option::Option<wkt::Timestamp>,
705
706    /// Output only. The time when the maintenance on the resource was scheduled to
707    /// start.
708    pub maintenance_scheduled_start_time: std::option::Option<wkt::Timestamp>,
709
710    /// Output only. The time when the maintenance on the resource was scheduled to
711    /// end.
712    pub maintenance_scheduled_end_time: std::option::Option<wkt::Timestamp>,
713
714    /// Output only. Indicates whether the user has some control over that
715    /// maintenance, either proactively before maintenance was scheduled with
716    /// maintenance policy or with reactive controls after it was scheduled (see
717    /// controls field)
718    pub user_controllable: bool,
719
720    /// Output only. The controls of the maintenance.
721    pub controls: std::vec::Vec<crate::model::MaintenanceControl>,
722
723    /// Optional. The labels on the resource, which can be used for categorization.
724    /// similar to Kubernetes resource labels.
725    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
726
727    /// Optional. Annotations is an unstructured key-value map stored with a
728    /// resource that may be set by external tools to store and retrieve arbitrary
729    /// metadata. They are not queryable and should be preserved when modifying
730    /// objects.
731    ///
732    /// More info: <https://kubernetes.io/docs/user-guide/annotations>
733    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
734
735    /// Output only. The unique identifier of the resource. UID is unique in the
736    /// time and space for this resource within the scope of the service. It is
737    /// typically generated by the server on successful creation of a resource
738    /// and must not be changed. UID is used to uniquely identify resources
739    /// with resource name reuses. This should be a UUID4.
740    pub uid: std::string::String,
741
742    /// Output only. An opaque value that uniquely identifies a version or
743    /// generation of a resource. It can be used to confirm that the client
744    /// and server agree on the ordering of a resource being written.
745    pub etag: std::string::String,
746
747    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
748}
749
750impl ResourceMaintenance {
751    /// Creates a new default instance.
752    pub fn new() -> Self {
753        std::default::Default::default()
754    }
755
756    /// Sets the value of [name][crate::model::ResourceMaintenance::name].
757    ///
758    /// # Example
759    /// ```ignore,no_run
760    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
761    /// # let project_id = "project_id";
762    /// # let location_id = "location_id";
763    /// # let resource_maintenance_id = "resource_maintenance_id";
764    /// let x = ResourceMaintenance::new().set_name(format!("projects/{project_id}/locations/{location_id}/resourceMaintenances/{resource_maintenance_id}"));
765    /// ```
766    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
767        self.name = v.into();
768        self
769    }
770
771    /// Sets the value of [resource][crate::model::ResourceMaintenance::resource].
772    ///
773    /// # Example
774    /// ```ignore,no_run
775    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
776    /// use google_cloud_maintenance_api_v1::model::resource_maintenance::Resource;
777    /// let x = ResourceMaintenance::new().set_resource(Resource::default()/* use setters */);
778    /// ```
779    pub fn set_resource<T>(mut self, v: T) -> Self
780    where
781        T: std::convert::Into<crate::model::resource_maintenance::Resource>,
782    {
783        self.resource = std::option::Option::Some(v.into());
784        self
785    }
786
787    /// Sets or clears the value of [resource][crate::model::ResourceMaintenance::resource].
788    ///
789    /// # Example
790    /// ```ignore,no_run
791    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
792    /// use google_cloud_maintenance_api_v1::model::resource_maintenance::Resource;
793    /// let x = ResourceMaintenance::new().set_or_clear_resource(Some(Resource::default()/* use setters */));
794    /// let x = ResourceMaintenance::new().set_or_clear_resource(None::<Resource>);
795    /// ```
796    pub fn set_or_clear_resource<T>(mut self, v: std::option::Option<T>) -> Self
797    where
798        T: std::convert::Into<crate::model::resource_maintenance::Resource>,
799    {
800        self.resource = v.map(|x| x.into());
801        self
802    }
803
804    /// Sets the value of [maintenance][crate::model::ResourceMaintenance::maintenance].
805    ///
806    /// # Example
807    /// ```ignore,no_run
808    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
809    /// use google_cloud_maintenance_api_v1::model::resource_maintenance::Maintenance;
810    /// let x = ResourceMaintenance::new().set_maintenance(Maintenance::default()/* use setters */);
811    /// ```
812    pub fn set_maintenance<T>(mut self, v: T) -> Self
813    where
814        T: std::convert::Into<crate::model::resource_maintenance::Maintenance>,
815    {
816        self.maintenance = std::option::Option::Some(v.into());
817        self
818    }
819
820    /// Sets or clears the value of [maintenance][crate::model::ResourceMaintenance::maintenance].
821    ///
822    /// # Example
823    /// ```ignore,no_run
824    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
825    /// use google_cloud_maintenance_api_v1::model::resource_maintenance::Maintenance;
826    /// let x = ResourceMaintenance::new().set_or_clear_maintenance(Some(Maintenance::default()/* use setters */));
827    /// let x = ResourceMaintenance::new().set_or_clear_maintenance(None::<Maintenance>);
828    /// ```
829    pub fn set_or_clear_maintenance<T>(mut self, v: std::option::Option<T>) -> Self
830    where
831        T: std::convert::Into<crate::model::resource_maintenance::Maintenance>,
832    {
833        self.maintenance = v.map(|x| x.into());
834        self
835    }
836
837    /// Sets the value of [state][crate::model::ResourceMaintenance::state].
838    ///
839    /// # Example
840    /// ```ignore,no_run
841    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
842    /// use google_cloud_maintenance_api_v1::model::resource_maintenance::State;
843    /// let x0 = ResourceMaintenance::new().set_state(State::Scheduled);
844    /// let x1 = ResourceMaintenance::new().set_state(State::Running);
845    /// let x2 = ResourceMaintenance::new().set_state(State::Cancelled);
846    /// ```
847    pub fn set_state<T: std::convert::Into<crate::model::resource_maintenance::State>>(
848        mut self,
849        v: T,
850    ) -> Self {
851        self.state = v.into();
852        self
853    }
854
855    /// Sets the value of [create_time][crate::model::ResourceMaintenance::create_time].
856    ///
857    /// # Example
858    /// ```ignore,no_run
859    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
860    /// use wkt::Timestamp;
861    /// let x = ResourceMaintenance::new().set_create_time(Timestamp::default()/* use setters */);
862    /// ```
863    pub fn set_create_time<T>(mut self, v: T) -> Self
864    where
865        T: std::convert::Into<wkt::Timestamp>,
866    {
867        self.create_time = std::option::Option::Some(v.into());
868        self
869    }
870
871    /// Sets or clears the value of [create_time][crate::model::ResourceMaintenance::create_time].
872    ///
873    /// # Example
874    /// ```ignore,no_run
875    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
876    /// use wkt::Timestamp;
877    /// let x = ResourceMaintenance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
878    /// let x = ResourceMaintenance::new().set_or_clear_create_time(None::<Timestamp>);
879    /// ```
880    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
881    where
882        T: std::convert::Into<wkt::Timestamp>,
883    {
884        self.create_time = v.map(|x| x.into());
885        self
886    }
887
888    /// Sets the value of [update_time][crate::model::ResourceMaintenance::update_time].
889    ///
890    /// # Example
891    /// ```ignore,no_run
892    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
893    /// use wkt::Timestamp;
894    /// let x = ResourceMaintenance::new().set_update_time(Timestamp::default()/* use setters */);
895    /// ```
896    pub fn set_update_time<T>(mut self, v: T) -> Self
897    where
898        T: std::convert::Into<wkt::Timestamp>,
899    {
900        self.update_time = std::option::Option::Some(v.into());
901        self
902    }
903
904    /// Sets or clears the value of [update_time][crate::model::ResourceMaintenance::update_time].
905    ///
906    /// # Example
907    /// ```ignore,no_run
908    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
909    /// use wkt::Timestamp;
910    /// let x = ResourceMaintenance::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
911    /// let x = ResourceMaintenance::new().set_or_clear_update_time(None::<Timestamp>);
912    /// ```
913    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
914    where
915        T: std::convert::Into<wkt::Timestamp>,
916    {
917        self.update_time = v.map(|x| x.into());
918        self
919    }
920
921    /// Sets the value of [maintenance_start_time][crate::model::ResourceMaintenance::maintenance_start_time].
922    ///
923    /// # Example
924    /// ```ignore,no_run
925    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
926    /// use wkt::Timestamp;
927    /// let x = ResourceMaintenance::new().set_maintenance_start_time(Timestamp::default()/* use setters */);
928    /// ```
929    pub fn set_maintenance_start_time<T>(mut self, v: T) -> Self
930    where
931        T: std::convert::Into<wkt::Timestamp>,
932    {
933        self.maintenance_start_time = std::option::Option::Some(v.into());
934        self
935    }
936
937    /// Sets or clears the value of [maintenance_start_time][crate::model::ResourceMaintenance::maintenance_start_time].
938    ///
939    /// # Example
940    /// ```ignore,no_run
941    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
942    /// use wkt::Timestamp;
943    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_start_time(Some(Timestamp::default()/* use setters */));
944    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_start_time(None::<Timestamp>);
945    /// ```
946    pub fn set_or_clear_maintenance_start_time<T>(mut self, v: std::option::Option<T>) -> Self
947    where
948        T: std::convert::Into<wkt::Timestamp>,
949    {
950        self.maintenance_start_time = v.map(|x| x.into());
951        self
952    }
953
954    /// Sets the value of [maintenance_end_time][crate::model::ResourceMaintenance::maintenance_end_time].
955    ///
956    /// # Example
957    /// ```ignore,no_run
958    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
959    /// use wkt::Timestamp;
960    /// let x = ResourceMaintenance::new().set_maintenance_end_time(Timestamp::default()/* use setters */);
961    /// ```
962    pub fn set_maintenance_end_time<T>(mut self, v: T) -> Self
963    where
964        T: std::convert::Into<wkt::Timestamp>,
965    {
966        self.maintenance_end_time = std::option::Option::Some(v.into());
967        self
968    }
969
970    /// Sets or clears the value of [maintenance_end_time][crate::model::ResourceMaintenance::maintenance_end_time].
971    ///
972    /// # Example
973    /// ```ignore,no_run
974    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
975    /// use wkt::Timestamp;
976    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_end_time(Some(Timestamp::default()/* use setters */));
977    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_end_time(None::<Timestamp>);
978    /// ```
979    pub fn set_or_clear_maintenance_end_time<T>(mut self, v: std::option::Option<T>) -> Self
980    where
981        T: std::convert::Into<wkt::Timestamp>,
982    {
983        self.maintenance_end_time = v.map(|x| x.into());
984        self
985    }
986
987    /// Sets the value of [maintenance_cancel_time][crate::model::ResourceMaintenance::maintenance_cancel_time].
988    ///
989    /// # Example
990    /// ```ignore,no_run
991    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
992    /// use wkt::Timestamp;
993    /// let x = ResourceMaintenance::new().set_maintenance_cancel_time(Timestamp::default()/* use setters */);
994    /// ```
995    pub fn set_maintenance_cancel_time<T>(mut self, v: T) -> Self
996    where
997        T: std::convert::Into<wkt::Timestamp>,
998    {
999        self.maintenance_cancel_time = std::option::Option::Some(v.into());
1000        self
1001    }
1002
1003    /// Sets or clears the value of [maintenance_cancel_time][crate::model::ResourceMaintenance::maintenance_cancel_time].
1004    ///
1005    /// # Example
1006    /// ```ignore,no_run
1007    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1008    /// use wkt::Timestamp;
1009    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_cancel_time(Some(Timestamp::default()/* use setters */));
1010    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_cancel_time(None::<Timestamp>);
1011    /// ```
1012    pub fn set_or_clear_maintenance_cancel_time<T>(mut self, v: std::option::Option<T>) -> Self
1013    where
1014        T: std::convert::Into<wkt::Timestamp>,
1015    {
1016        self.maintenance_cancel_time = v.map(|x| x.into());
1017        self
1018    }
1019
1020    /// Sets the value of [maintenance_scheduled_start_time][crate::model::ResourceMaintenance::maintenance_scheduled_start_time].
1021    ///
1022    /// # Example
1023    /// ```ignore,no_run
1024    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1025    /// use wkt::Timestamp;
1026    /// let x = ResourceMaintenance::new().set_maintenance_scheduled_start_time(Timestamp::default()/* use setters */);
1027    /// ```
1028    pub fn set_maintenance_scheduled_start_time<T>(mut self, v: T) -> Self
1029    where
1030        T: std::convert::Into<wkt::Timestamp>,
1031    {
1032        self.maintenance_scheduled_start_time = std::option::Option::Some(v.into());
1033        self
1034    }
1035
1036    /// Sets or clears the value of [maintenance_scheduled_start_time][crate::model::ResourceMaintenance::maintenance_scheduled_start_time].
1037    ///
1038    /// # Example
1039    /// ```ignore,no_run
1040    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1041    /// use wkt::Timestamp;
1042    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_scheduled_start_time(Some(Timestamp::default()/* use setters */));
1043    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_scheduled_start_time(None::<Timestamp>);
1044    /// ```
1045    pub fn set_or_clear_maintenance_scheduled_start_time<T>(
1046        mut self,
1047        v: std::option::Option<T>,
1048    ) -> Self
1049    where
1050        T: std::convert::Into<wkt::Timestamp>,
1051    {
1052        self.maintenance_scheduled_start_time = v.map(|x| x.into());
1053        self
1054    }
1055
1056    /// Sets the value of [maintenance_scheduled_end_time][crate::model::ResourceMaintenance::maintenance_scheduled_end_time].
1057    ///
1058    /// # Example
1059    /// ```ignore,no_run
1060    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1061    /// use wkt::Timestamp;
1062    /// let x = ResourceMaintenance::new().set_maintenance_scheduled_end_time(Timestamp::default()/* use setters */);
1063    /// ```
1064    pub fn set_maintenance_scheduled_end_time<T>(mut self, v: T) -> Self
1065    where
1066        T: std::convert::Into<wkt::Timestamp>,
1067    {
1068        self.maintenance_scheduled_end_time = std::option::Option::Some(v.into());
1069        self
1070    }
1071
1072    /// Sets or clears the value of [maintenance_scheduled_end_time][crate::model::ResourceMaintenance::maintenance_scheduled_end_time].
1073    ///
1074    /// # Example
1075    /// ```ignore,no_run
1076    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1077    /// use wkt::Timestamp;
1078    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_scheduled_end_time(Some(Timestamp::default()/* use setters */));
1079    /// let x = ResourceMaintenance::new().set_or_clear_maintenance_scheduled_end_time(None::<Timestamp>);
1080    /// ```
1081    pub fn set_or_clear_maintenance_scheduled_end_time<T>(
1082        mut self,
1083        v: std::option::Option<T>,
1084    ) -> Self
1085    where
1086        T: std::convert::Into<wkt::Timestamp>,
1087    {
1088        self.maintenance_scheduled_end_time = v.map(|x| x.into());
1089        self
1090    }
1091
1092    /// Sets the value of [user_controllable][crate::model::ResourceMaintenance::user_controllable].
1093    ///
1094    /// # Example
1095    /// ```ignore,no_run
1096    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1097    /// let x = ResourceMaintenance::new().set_user_controllable(true);
1098    /// ```
1099    pub fn set_user_controllable<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1100        self.user_controllable = v.into();
1101        self
1102    }
1103
1104    /// Sets the value of [controls][crate::model::ResourceMaintenance::controls].
1105    ///
1106    /// # Example
1107    /// ```ignore,no_run
1108    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1109    /// use google_cloud_maintenance_api_v1::model::MaintenanceControl;
1110    /// let x = ResourceMaintenance::new()
1111    ///     .set_controls([
1112    ///         MaintenanceControl::default()/* use setters */,
1113    ///         MaintenanceControl::default()/* use (different) setters */,
1114    ///     ]);
1115    /// ```
1116    pub fn set_controls<T, V>(mut self, v: T) -> Self
1117    where
1118        T: std::iter::IntoIterator<Item = V>,
1119        V: std::convert::Into<crate::model::MaintenanceControl>,
1120    {
1121        use std::iter::Iterator;
1122        self.controls = v.into_iter().map(|i| i.into()).collect();
1123        self
1124    }
1125
1126    /// Sets the value of [labels][crate::model::ResourceMaintenance::labels].
1127    ///
1128    /// # Example
1129    /// ```ignore,no_run
1130    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1131    /// let x = ResourceMaintenance::new().set_labels([
1132    ///     ("key0", "abc"),
1133    ///     ("key1", "xyz"),
1134    /// ]);
1135    /// ```
1136    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
1137    where
1138        T: std::iter::IntoIterator<Item = (K, V)>,
1139        K: std::convert::Into<std::string::String>,
1140        V: std::convert::Into<std::string::String>,
1141    {
1142        use std::iter::Iterator;
1143        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1144        self
1145    }
1146
1147    /// Sets the value of [annotations][crate::model::ResourceMaintenance::annotations].
1148    ///
1149    /// # Example
1150    /// ```ignore,no_run
1151    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1152    /// let x = ResourceMaintenance::new().set_annotations([
1153    ///     ("key0", "abc"),
1154    ///     ("key1", "xyz"),
1155    /// ]);
1156    /// ```
1157    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1158    where
1159        T: std::iter::IntoIterator<Item = (K, V)>,
1160        K: std::convert::Into<std::string::String>,
1161        V: std::convert::Into<std::string::String>,
1162    {
1163        use std::iter::Iterator;
1164        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1165        self
1166    }
1167
1168    /// Sets the value of [uid][crate::model::ResourceMaintenance::uid].
1169    ///
1170    /// # Example
1171    /// ```ignore,no_run
1172    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1173    /// let x = ResourceMaintenance::new().set_uid("example");
1174    /// ```
1175    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1176        self.uid = v.into();
1177        self
1178    }
1179
1180    /// Sets the value of [etag][crate::model::ResourceMaintenance::etag].
1181    ///
1182    /// # Example
1183    /// ```ignore,no_run
1184    /// # use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1185    /// let x = ResourceMaintenance::new().set_etag("example");
1186    /// ```
1187    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1188        self.etag = v.into();
1189        self
1190    }
1191}
1192
1193impl wkt::message::Message for ResourceMaintenance {
1194    fn typename() -> &'static str {
1195        "type.googleapis.com/google.cloud.maintenance.api.v1.ResourceMaintenance"
1196    }
1197}
1198
1199/// Defines additional types related to [ResourceMaintenance].
1200pub mod resource_maintenance {
1201    #[allow(unused_imports)]
1202    use super::*;
1203
1204    /// Resource contains information about the resource affected by maintenance.
1205    #[derive(Clone, Default, PartialEq)]
1206    #[non_exhaustive]
1207    pub struct Resource {
1208        /// Output only. Name is the reference to the consumer resource affected by
1209        /// the maintenance. Available values can be found here:
1210        /// <https://cloud.google.com/asset-inventory/docs/asset-names>
1211        pub resource_name: std::string::String,
1212
1213        /// Output only. The location of the resource.
1214        /// Format:
1215        /// `us-central1`
1216        pub location: std::string::String,
1217
1218        /// Output only. The type of the resource.
1219        /// Available values can be found here:
1220        /// <https://cloud.google.com/asset-inventory/docs/asset-types#supported_resource_types>
1221        /// Please note that not all the resource types will have their maintenances
1222        /// reported.
1223        pub r#type: std::string::String,
1224
1225        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1226    }
1227
1228    impl Resource {
1229        /// Creates a new default instance.
1230        pub fn new() -> Self {
1231            std::default::Default::default()
1232        }
1233
1234        /// Sets the value of [resource_name][crate::model::resource_maintenance::Resource::resource_name].
1235        ///
1236        /// # Example
1237        /// ```ignore,no_run
1238        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Resource;
1239        /// let x = Resource::new().set_resource_name("example");
1240        /// ```
1241        pub fn set_resource_name<T: std::convert::Into<std::string::String>>(
1242            mut self,
1243            v: T,
1244        ) -> Self {
1245            self.resource_name = v.into();
1246            self
1247        }
1248
1249        /// Sets the value of [location][crate::model::resource_maintenance::Resource::location].
1250        ///
1251        /// # Example
1252        /// ```ignore,no_run
1253        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Resource;
1254        /// let x = Resource::new().set_location("example");
1255        /// ```
1256        pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1257            self.location = v.into();
1258            self
1259        }
1260
1261        /// Sets the value of [r#type][crate::model::resource_maintenance::Resource::type].
1262        ///
1263        /// # Example
1264        /// ```ignore,no_run
1265        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Resource;
1266        /// let x = Resource::new().set_type("example");
1267        /// ```
1268        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1269            self.r#type = v.into();
1270            self
1271        }
1272    }
1273
1274    impl wkt::message::Message for Resource {
1275        fn typename() -> &'static str {
1276            "type.googleapis.com/google.cloud.maintenance.api.v1.ResourceMaintenance.Resource"
1277        }
1278    }
1279
1280    /// Maintenance is the maintenance details of a resource's maintenance.
1281    #[derive(Clone, Default, PartialEq)]
1282    #[non_exhaustive]
1283    pub struct Maintenance {
1284        /// Maintenance is the name of the corresponding maintenance resource
1285        /// following the standard naming scheme: `"{maintenance-id}"`
1286        pub maintenance_name: std::string::String,
1287
1288        /// Output only. The title of the maintenance.
1289        pub title: std::string::String,
1290
1291        /// Output only. The description of the maintenance.
1292        pub description: std::string::String,
1293
1294        /// Output only. The category of the maintenance.
1295        pub category: crate::model::MaintenanceCategory,
1296
1297        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1298    }
1299
1300    impl Maintenance {
1301        /// Creates a new default instance.
1302        pub fn new() -> Self {
1303            std::default::Default::default()
1304        }
1305
1306        /// Sets the value of [maintenance_name][crate::model::resource_maintenance::Maintenance::maintenance_name].
1307        ///
1308        /// # Example
1309        /// ```ignore,no_run
1310        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Maintenance;
1311        /// let x = Maintenance::new().set_maintenance_name("example");
1312        /// ```
1313        pub fn set_maintenance_name<T: std::convert::Into<std::string::String>>(
1314            mut self,
1315            v: T,
1316        ) -> Self {
1317            self.maintenance_name = v.into();
1318            self
1319        }
1320
1321        /// Sets the value of [title][crate::model::resource_maintenance::Maintenance::title].
1322        ///
1323        /// # Example
1324        /// ```ignore,no_run
1325        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Maintenance;
1326        /// let x = Maintenance::new().set_title("example");
1327        /// ```
1328        pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1329            self.title = v.into();
1330            self
1331        }
1332
1333        /// Sets the value of [description][crate::model::resource_maintenance::Maintenance::description].
1334        ///
1335        /// # Example
1336        /// ```ignore,no_run
1337        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Maintenance;
1338        /// let x = Maintenance::new().set_description("example");
1339        /// ```
1340        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1341            self.description = v.into();
1342            self
1343        }
1344
1345        /// Sets the value of [category][crate::model::resource_maintenance::Maintenance::category].
1346        ///
1347        /// # Example
1348        /// ```ignore,no_run
1349        /// # use google_cloud_maintenance_api_v1::model::resource_maintenance::Maintenance;
1350        /// use google_cloud_maintenance_api_v1::model::MaintenanceCategory;
1351        /// let x0 = Maintenance::new().set_category(MaintenanceCategory::Infrastructure);
1352        /// let x1 = Maintenance::new().set_category(MaintenanceCategory::ServiceUpdate);
1353        /// ```
1354        pub fn set_category<T: std::convert::Into<crate::model::MaintenanceCategory>>(
1355            mut self,
1356            v: T,
1357        ) -> Self {
1358            self.category = v.into();
1359            self
1360        }
1361    }
1362
1363    impl wkt::message::Message for Maintenance {
1364        fn typename() -> &'static str {
1365            "type.googleapis.com/google.cloud.maintenance.api.v1.ResourceMaintenance.Maintenance"
1366        }
1367    }
1368
1369    /// State is the state of a resource maintenance.
1370    ///
1371    /// # Working with unknown values
1372    ///
1373    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1374    /// additional enum variants at any time. Adding new variants is not considered
1375    /// a breaking change. Applications should write their code in anticipation of:
1376    ///
1377    /// - New values appearing in future releases of the client library, **and**
1378    /// - New values received dynamically, without application changes.
1379    ///
1380    /// Please consult the [Working with enums] section in the user guide for some
1381    /// guidelines.
1382    ///
1383    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1384    #[derive(Clone, Debug, PartialEq)]
1385    #[non_exhaustive]
1386    pub enum State {
1387        /// Unspecified state.
1388        Unspecified,
1389        /// Scheduled for a particular window. For disruptive maintenance it should
1390        /// respect maintenance policy, i.e. its available windows, exclusions and
1391        /// notification period.
1392        Scheduled,
1393        /// Maintenance is ongoing.
1394        Running,
1395        /// No longer planned, typically when other maintenance (e.g. upgrade to
1396        /// newer version) already happened, or the user skipped the maintenance.
1397        Cancelled,
1398        /// Successfully completed.
1399        Succeeded,
1400        /// If set, the enum was initialized with an unknown value.
1401        ///
1402        /// Applications can examine the value using [State::value] or
1403        /// [State::name].
1404        UnknownValue(state::UnknownValue),
1405    }
1406
1407    #[doc(hidden)]
1408    pub mod state {
1409        #[allow(unused_imports)]
1410        use super::*;
1411        #[derive(Clone, Debug, PartialEq)]
1412        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1413    }
1414
1415    impl State {
1416        /// Gets the enum value.
1417        ///
1418        /// Returns `None` if the enum contains an unknown value deserialized from
1419        /// the string representation of enums.
1420        pub fn value(&self) -> std::option::Option<i32> {
1421            match self {
1422                Self::Unspecified => std::option::Option::Some(0),
1423                Self::Scheduled => std::option::Option::Some(1),
1424                Self::Running => std::option::Option::Some(2),
1425                Self::Cancelled => std::option::Option::Some(3),
1426                Self::Succeeded => std::option::Option::Some(4),
1427                Self::UnknownValue(u) => u.0.value(),
1428            }
1429        }
1430
1431        /// Gets the enum value as a string.
1432        ///
1433        /// Returns `None` if the enum contains an unknown value deserialized from
1434        /// the integer representation of enums.
1435        pub fn name(&self) -> std::option::Option<&str> {
1436            match self {
1437                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1438                Self::Scheduled => std::option::Option::Some("SCHEDULED"),
1439                Self::Running => std::option::Option::Some("RUNNING"),
1440                Self::Cancelled => std::option::Option::Some("CANCELLED"),
1441                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
1442                Self::UnknownValue(u) => u.0.name(),
1443            }
1444        }
1445    }
1446
1447    impl std::default::Default for State {
1448        fn default() -> Self {
1449            use std::convert::From;
1450            Self::from(0)
1451        }
1452    }
1453
1454    impl std::fmt::Display for State {
1455        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1456            wkt::internal::display_enum(f, self.name(), self.value())
1457        }
1458    }
1459
1460    impl std::convert::From<i32> for State {
1461        fn from(value: i32) -> Self {
1462            match value {
1463                0 => Self::Unspecified,
1464                1 => Self::Scheduled,
1465                2 => Self::Running,
1466                3 => Self::Cancelled,
1467                4 => Self::Succeeded,
1468                _ => Self::UnknownValue(state::UnknownValue(
1469                    wkt::internal::UnknownEnumValue::Integer(value),
1470                )),
1471            }
1472        }
1473    }
1474
1475    impl std::convert::From<&str> for State {
1476        fn from(value: &str) -> Self {
1477            use std::string::ToString;
1478            match value {
1479                "STATE_UNSPECIFIED" => Self::Unspecified,
1480                "SCHEDULED" => Self::Scheduled,
1481                "RUNNING" => Self::Running,
1482                "CANCELLED" => Self::Cancelled,
1483                "SUCCEEDED" => Self::Succeeded,
1484                _ => Self::UnknownValue(state::UnknownValue(
1485                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1486                )),
1487            }
1488        }
1489    }
1490
1491    impl serde::ser::Serialize for State {
1492        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1493        where
1494            S: serde::Serializer,
1495        {
1496            match self {
1497                Self::Unspecified => serializer.serialize_i32(0),
1498                Self::Scheduled => serializer.serialize_i32(1),
1499                Self::Running => serializer.serialize_i32(2),
1500                Self::Cancelled => serializer.serialize_i32(3),
1501                Self::Succeeded => serializer.serialize_i32(4),
1502                Self::UnknownValue(u) => u.0.serialize(serializer),
1503            }
1504        }
1505    }
1506
1507    impl<'de> serde::de::Deserialize<'de> for State {
1508        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1509        where
1510            D: serde::Deserializer<'de>,
1511        {
1512            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1513                ".google.cloud.maintenance.api.v1.ResourceMaintenance.State",
1514            ))
1515        }
1516    }
1517}
1518
1519/// The control of the maintenance.
1520#[derive(Clone, Default, PartialEq)]
1521#[non_exhaustive]
1522pub struct MaintenanceControl {
1523    /// The control of the resource maintenance.
1524    pub control: crate::model::maintenance_control::Control,
1525
1526    /// Indicates whether the control is available only in Service Producer API
1527    /// (not through Unified Maintenance).
1528    pub is_custom: bool,
1529
1530    /// Link to Service Producer documentation about maintenance control. Provided
1531    /// only when `isCustom` is `true`.
1532    pub documentation: std::string::String,
1533
1534    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1535}
1536
1537impl MaintenanceControl {
1538    /// Creates a new default instance.
1539    pub fn new() -> Self {
1540        std::default::Default::default()
1541    }
1542
1543    /// Sets the value of [control][crate::model::MaintenanceControl::control].
1544    ///
1545    /// # Example
1546    /// ```ignore,no_run
1547    /// # use google_cloud_maintenance_api_v1::model::MaintenanceControl;
1548    /// use google_cloud_maintenance_api_v1::model::maintenance_control::Control;
1549    /// let x0 = MaintenanceControl::new().set_control(Control::Apply);
1550    /// let x1 = MaintenanceControl::new().set_control(Control::ManagePolicy);
1551    /// let x2 = MaintenanceControl::new().set_control(Control::Reschedule);
1552    /// ```
1553    pub fn set_control<T: std::convert::Into<crate::model::maintenance_control::Control>>(
1554        mut self,
1555        v: T,
1556    ) -> Self {
1557        self.control = v.into();
1558        self
1559    }
1560
1561    /// Sets the value of [is_custom][crate::model::MaintenanceControl::is_custom].
1562    ///
1563    /// # Example
1564    /// ```ignore,no_run
1565    /// # use google_cloud_maintenance_api_v1::model::MaintenanceControl;
1566    /// let x = MaintenanceControl::new().set_is_custom(true);
1567    /// ```
1568    pub fn set_is_custom<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1569        self.is_custom = v.into();
1570        self
1571    }
1572
1573    /// Sets the value of [documentation][crate::model::MaintenanceControl::documentation].
1574    ///
1575    /// # Example
1576    /// ```ignore,no_run
1577    /// # use google_cloud_maintenance_api_v1::model::MaintenanceControl;
1578    /// let x = MaintenanceControl::new().set_documentation("example");
1579    /// ```
1580    pub fn set_documentation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1581        self.documentation = v.into();
1582        self
1583    }
1584}
1585
1586impl wkt::message::Message for MaintenanceControl {
1587    fn typename() -> &'static str {
1588        "type.googleapis.com/google.cloud.maintenance.api.v1.MaintenanceControl"
1589    }
1590}
1591
1592/// Defines additional types related to [MaintenanceControl].
1593pub mod maintenance_control {
1594    #[allow(unused_imports)]
1595    use super::*;
1596
1597    /// Sets the type of control supported. comment (as in logs).
1598    ///
1599    /// # Working with unknown values
1600    ///
1601    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1602    /// additional enum variants at any time. Adding new variants is not considered
1603    /// a breaking change. Applications should write their code in anticipation of:
1604    ///
1605    /// - New values appearing in future releases of the client library, **and**
1606    /// - New values received dynamically, without application changes.
1607    ///
1608    /// Please consult the [Working with enums] section in the user guide for some
1609    /// guidelines.
1610    ///
1611    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1612    #[derive(Clone, Debug, PartialEq)]
1613    #[non_exhaustive]
1614    pub enum Control {
1615        /// Unspecified control.
1616        Unspecified,
1617        /// Apply control.
1618        Apply,
1619        /// Manage policy control.
1620        ManagePolicy,
1621        /// Reschedule control.
1622        Reschedule,
1623        /// If set, the enum was initialized with an unknown value.
1624        ///
1625        /// Applications can examine the value using [Control::value] or
1626        /// [Control::name].
1627        UnknownValue(control::UnknownValue),
1628    }
1629
1630    #[doc(hidden)]
1631    pub mod control {
1632        #[allow(unused_imports)]
1633        use super::*;
1634        #[derive(Clone, Debug, PartialEq)]
1635        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1636    }
1637
1638    impl Control {
1639        /// Gets the enum value.
1640        ///
1641        /// Returns `None` if the enum contains an unknown value deserialized from
1642        /// the string representation of enums.
1643        pub fn value(&self) -> std::option::Option<i32> {
1644            match self {
1645                Self::Unspecified => std::option::Option::Some(0),
1646                Self::Apply => std::option::Option::Some(1),
1647                Self::ManagePolicy => std::option::Option::Some(2),
1648                Self::Reschedule => std::option::Option::Some(3),
1649                Self::UnknownValue(u) => u.0.value(),
1650            }
1651        }
1652
1653        /// Gets the enum value as a string.
1654        ///
1655        /// Returns `None` if the enum contains an unknown value deserialized from
1656        /// the integer representation of enums.
1657        pub fn name(&self) -> std::option::Option<&str> {
1658            match self {
1659                Self::Unspecified => std::option::Option::Some("CONTROL_UNSPECIFIED"),
1660                Self::Apply => std::option::Option::Some("APPLY"),
1661                Self::ManagePolicy => std::option::Option::Some("MANAGE_POLICY"),
1662                Self::Reschedule => std::option::Option::Some("RESCHEDULE"),
1663                Self::UnknownValue(u) => u.0.name(),
1664            }
1665        }
1666    }
1667
1668    impl std::default::Default for Control {
1669        fn default() -> Self {
1670            use std::convert::From;
1671            Self::from(0)
1672        }
1673    }
1674
1675    impl std::fmt::Display for Control {
1676        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1677            wkt::internal::display_enum(f, self.name(), self.value())
1678        }
1679    }
1680
1681    impl std::convert::From<i32> for Control {
1682        fn from(value: i32) -> Self {
1683            match value {
1684                0 => Self::Unspecified,
1685                1 => Self::Apply,
1686                2 => Self::ManagePolicy,
1687                3 => Self::Reschedule,
1688                _ => Self::UnknownValue(control::UnknownValue(
1689                    wkt::internal::UnknownEnumValue::Integer(value),
1690                )),
1691            }
1692        }
1693    }
1694
1695    impl std::convert::From<&str> for Control {
1696        fn from(value: &str) -> Self {
1697            use std::string::ToString;
1698            match value {
1699                "CONTROL_UNSPECIFIED" => Self::Unspecified,
1700                "APPLY" => Self::Apply,
1701                "MANAGE_POLICY" => Self::ManagePolicy,
1702                "RESCHEDULE" => Self::Reschedule,
1703                _ => Self::UnknownValue(control::UnknownValue(
1704                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1705                )),
1706            }
1707        }
1708    }
1709
1710    impl serde::ser::Serialize for Control {
1711        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1712        where
1713            S: serde::Serializer,
1714        {
1715            match self {
1716                Self::Unspecified => serializer.serialize_i32(0),
1717                Self::Apply => serializer.serialize_i32(1),
1718                Self::ManagePolicy => serializer.serialize_i32(2),
1719                Self::Reschedule => serializer.serialize_i32(3),
1720                Self::UnknownValue(u) => u.0.serialize(serializer),
1721            }
1722        }
1723    }
1724
1725    impl<'de> serde::de::Deserialize<'de> for Control {
1726        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1727        where
1728            D: serde::Deserializer<'de>,
1729        {
1730            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Control>::new(
1731                ".google.cloud.maintenance.api.v1.MaintenanceControl.Control",
1732            ))
1733        }
1734    }
1735}
1736
1737/// The request structure for the ListResourceMaintenances method.
1738#[derive(Clone, Default, PartialEq)]
1739#[non_exhaustive]
1740pub struct ListResourceMaintenancesRequest {
1741    /// Required. The parent of the resource maintenance.
1742    pub parent: std::string::String,
1743
1744    /// The maximum number of resource maintenances to send per page.
1745    pub page_size: i32,
1746
1747    /// The page token: If the next_page_token from a previous response
1748    /// is provided, this request will send the subsequent page.
1749    pub page_token: std::string::String,
1750
1751    /// Filter the list as specified in <https://google.aip.dev/160>.
1752    pub filter: std::string::String,
1753
1754    /// Order results as specified in <https://google.aip.dev/132>.
1755    pub order_by: std::string::String,
1756
1757    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1758}
1759
1760impl ListResourceMaintenancesRequest {
1761    /// Creates a new default instance.
1762    pub fn new() -> Self {
1763        std::default::Default::default()
1764    }
1765
1766    /// Sets the value of [parent][crate::model::ListResourceMaintenancesRequest::parent].
1767    ///
1768    /// # Example
1769    /// ```ignore,no_run
1770    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesRequest;
1771    /// # let project_id = "project_id";
1772    /// # let location_id = "location_id";
1773    /// let x = ListResourceMaintenancesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
1774    /// ```
1775    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1776        self.parent = v.into();
1777        self
1778    }
1779
1780    /// Sets the value of [page_size][crate::model::ListResourceMaintenancesRequest::page_size].
1781    ///
1782    /// # Example
1783    /// ```ignore,no_run
1784    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesRequest;
1785    /// let x = ListResourceMaintenancesRequest::new().set_page_size(42);
1786    /// ```
1787    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1788        self.page_size = v.into();
1789        self
1790    }
1791
1792    /// Sets the value of [page_token][crate::model::ListResourceMaintenancesRequest::page_token].
1793    ///
1794    /// # Example
1795    /// ```ignore,no_run
1796    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesRequest;
1797    /// let x = ListResourceMaintenancesRequest::new().set_page_token("example");
1798    /// ```
1799    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1800        self.page_token = v.into();
1801        self
1802    }
1803
1804    /// Sets the value of [filter][crate::model::ListResourceMaintenancesRequest::filter].
1805    ///
1806    /// # Example
1807    /// ```ignore,no_run
1808    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesRequest;
1809    /// let x = ListResourceMaintenancesRequest::new().set_filter("example");
1810    /// ```
1811    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1812        self.filter = v.into();
1813        self
1814    }
1815
1816    /// Sets the value of [order_by][crate::model::ListResourceMaintenancesRequest::order_by].
1817    ///
1818    /// # Example
1819    /// ```ignore,no_run
1820    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesRequest;
1821    /// let x = ListResourceMaintenancesRequest::new().set_order_by("example");
1822    /// ```
1823    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1824        self.order_by = v.into();
1825        self
1826    }
1827}
1828
1829impl wkt::message::Message for ListResourceMaintenancesRequest {
1830    fn typename() -> &'static str {
1831        "type.googleapis.com/google.cloud.maintenance.api.v1.ListResourceMaintenancesRequest"
1832    }
1833}
1834
1835/// The response structure for the ListResourceMaintenances method.
1836#[derive(Clone, Default, PartialEq)]
1837#[non_exhaustive]
1838pub struct ListResourceMaintenancesResponse {
1839    /// The resulting resource maintenances.
1840    pub resource_maintenances: std::vec::Vec<crate::model::ResourceMaintenance>,
1841
1842    /// If present, the next page token can be provided to a subsequent
1843    /// ListResourceMaintenances call to list the next page.
1844    /// If empty, there are no more pages.
1845    pub next_page_token: std::string::String,
1846
1847    /// Locations that could not be reached.
1848    pub unreachable: std::vec::Vec<std::string::String>,
1849
1850    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1851}
1852
1853impl ListResourceMaintenancesResponse {
1854    /// Creates a new default instance.
1855    pub fn new() -> Self {
1856        std::default::Default::default()
1857    }
1858
1859    /// Sets the value of [resource_maintenances][crate::model::ListResourceMaintenancesResponse::resource_maintenances].
1860    ///
1861    /// # Example
1862    /// ```ignore,no_run
1863    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesResponse;
1864    /// use google_cloud_maintenance_api_v1::model::ResourceMaintenance;
1865    /// let x = ListResourceMaintenancesResponse::new()
1866    ///     .set_resource_maintenances([
1867    ///         ResourceMaintenance::default()/* use setters */,
1868    ///         ResourceMaintenance::default()/* use (different) setters */,
1869    ///     ]);
1870    /// ```
1871    pub fn set_resource_maintenances<T, V>(mut self, v: T) -> Self
1872    where
1873        T: std::iter::IntoIterator<Item = V>,
1874        V: std::convert::Into<crate::model::ResourceMaintenance>,
1875    {
1876        use std::iter::Iterator;
1877        self.resource_maintenances = v.into_iter().map(|i| i.into()).collect();
1878        self
1879    }
1880
1881    /// Sets the value of [next_page_token][crate::model::ListResourceMaintenancesResponse::next_page_token].
1882    ///
1883    /// # Example
1884    /// ```ignore,no_run
1885    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesResponse;
1886    /// let x = ListResourceMaintenancesResponse::new().set_next_page_token("example");
1887    /// ```
1888    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1889        self.next_page_token = v.into();
1890        self
1891    }
1892
1893    /// Sets the value of [unreachable][crate::model::ListResourceMaintenancesResponse::unreachable].
1894    ///
1895    /// # Example
1896    /// ```ignore,no_run
1897    /// # use google_cloud_maintenance_api_v1::model::ListResourceMaintenancesResponse;
1898    /// let x = ListResourceMaintenancesResponse::new().set_unreachable(["a", "b", "c"]);
1899    /// ```
1900    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1901    where
1902        T: std::iter::IntoIterator<Item = V>,
1903        V: std::convert::Into<std::string::String>,
1904    {
1905        use std::iter::Iterator;
1906        self.unreachable = v.into_iter().map(|i| i.into()).collect();
1907        self
1908    }
1909}
1910
1911impl wkt::message::Message for ListResourceMaintenancesResponse {
1912    fn typename() -> &'static str {
1913        "type.googleapis.com/google.cloud.maintenance.api.v1.ListResourceMaintenancesResponse"
1914    }
1915}
1916
1917#[doc(hidden)]
1918impl google_cloud_gax::paginator::internal::PageableResponse for ListResourceMaintenancesResponse {
1919    type PageItem = crate::model::ResourceMaintenance;
1920
1921    fn items(self) -> std::vec::Vec<Self::PageItem> {
1922        self.resource_maintenances
1923    }
1924
1925    fn next_page_token(&self) -> std::string::String {
1926        use std::clone::Clone;
1927        self.next_page_token.clone()
1928    }
1929}
1930
1931/// The request structure for the GetResourceMaintenance method.
1932#[derive(Clone, Default, PartialEq)]
1933#[non_exhaustive]
1934pub struct GetResourceMaintenanceRequest {
1935    /// Required. The resource name of the resource within a service.
1936    pub name: std::string::String,
1937
1938    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1939}
1940
1941impl GetResourceMaintenanceRequest {
1942    /// Creates a new default instance.
1943    pub fn new() -> Self {
1944        std::default::Default::default()
1945    }
1946
1947    /// Sets the value of [name][crate::model::GetResourceMaintenanceRequest::name].
1948    ///
1949    /// # Example
1950    /// ```ignore,no_run
1951    /// # use google_cloud_maintenance_api_v1::model::GetResourceMaintenanceRequest;
1952    /// # let project_id = "project_id";
1953    /// # let location_id = "location_id";
1954    /// # let resource_maintenance_id = "resource_maintenance_id";
1955    /// let x = GetResourceMaintenanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/resourceMaintenances/{resource_maintenance_id}"));
1956    /// ```
1957    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1958        self.name = v.into();
1959        self
1960    }
1961}
1962
1963impl wkt::message::Message for GetResourceMaintenanceRequest {
1964    fn typename() -> &'static str {
1965        "type.googleapis.com/google.cloud.maintenance.api.v1.GetResourceMaintenanceRequest"
1966    }
1967}
1968
1969/// The Category of the maintenance.
1970///
1971/// # Working with unknown values
1972///
1973/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1974/// additional enum variants at any time. Adding new variants is not considered
1975/// a breaking change. Applications should write their code in anticipation of:
1976///
1977/// - New values appearing in future releases of the client library, **and**
1978/// - New values received dynamically, without application changes.
1979///
1980/// Please consult the [Working with enums] section in the user guide for some
1981/// guidelines.
1982///
1983/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1984#[derive(Clone, Debug, PartialEq)]
1985#[non_exhaustive]
1986pub enum MaintenanceCategory {
1987    /// Unspecified category.
1988    Unspecified,
1989    /// Infrastructure maintenance events are times that Google Cloud performs
1990    /// regular maintenance on network equipment e.g. Google Cloud Interconnect
1991    /// These events are usually scheduled in advance and we provide
1992    /// notification, when possible, so that users can plan for the
1993    /// infrastructure maintenance event and prevent downtime. Infrastructure
1994    /// maintenance events don't have a set interval between occurrences, but
1995    /// generally occur several times a year.
1996    Infrastructure,
1997    /// Updates that can include bug fixes, changes, or new features that are
1998    /// backward compatible with existing versions (including patches).
1999    /// Some SPs allow users to control the scheduling of these maintenance
2000    /// events using maintenance windows and/or deny maintenance features.
2001    ServiceUpdate,
2002    /// If set, the enum was initialized with an unknown value.
2003    ///
2004    /// Applications can examine the value using [MaintenanceCategory::value] or
2005    /// [MaintenanceCategory::name].
2006    UnknownValue(maintenance_category::UnknownValue),
2007}
2008
2009#[doc(hidden)]
2010pub mod maintenance_category {
2011    #[allow(unused_imports)]
2012    use super::*;
2013    #[derive(Clone, Debug, PartialEq)]
2014    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2015}
2016
2017impl MaintenanceCategory {
2018    /// Gets the enum value.
2019    ///
2020    /// Returns `None` if the enum contains an unknown value deserialized from
2021    /// the string representation of enums.
2022    pub fn value(&self) -> std::option::Option<i32> {
2023        match self {
2024            Self::Unspecified => std::option::Option::Some(0),
2025            Self::Infrastructure => std::option::Option::Some(1),
2026            Self::ServiceUpdate => std::option::Option::Some(3),
2027            Self::UnknownValue(u) => u.0.value(),
2028        }
2029    }
2030
2031    /// Gets the enum value as a string.
2032    ///
2033    /// Returns `None` if the enum contains an unknown value deserialized from
2034    /// the integer representation of enums.
2035    pub fn name(&self) -> std::option::Option<&str> {
2036        match self {
2037            Self::Unspecified => std::option::Option::Some("MAINTENANCE_CATEGORY_UNSPECIFIED"),
2038            Self::Infrastructure => std::option::Option::Some("INFRASTRUCTURE"),
2039            Self::ServiceUpdate => std::option::Option::Some("SERVICE_UPDATE"),
2040            Self::UnknownValue(u) => u.0.name(),
2041        }
2042    }
2043}
2044
2045impl std::default::Default for MaintenanceCategory {
2046    fn default() -> Self {
2047        use std::convert::From;
2048        Self::from(0)
2049    }
2050}
2051
2052impl std::fmt::Display for MaintenanceCategory {
2053    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2054        wkt::internal::display_enum(f, self.name(), self.value())
2055    }
2056}
2057
2058impl std::convert::From<i32> for MaintenanceCategory {
2059    fn from(value: i32) -> Self {
2060        match value {
2061            0 => Self::Unspecified,
2062            1 => Self::Infrastructure,
2063            3 => Self::ServiceUpdate,
2064            _ => Self::UnknownValue(maintenance_category::UnknownValue(
2065                wkt::internal::UnknownEnumValue::Integer(value),
2066            )),
2067        }
2068    }
2069}
2070
2071impl std::convert::From<&str> for MaintenanceCategory {
2072    fn from(value: &str) -> Self {
2073        use std::string::ToString;
2074        match value {
2075            "MAINTENANCE_CATEGORY_UNSPECIFIED" => Self::Unspecified,
2076            "INFRASTRUCTURE" => Self::Infrastructure,
2077            "SERVICE_UPDATE" => Self::ServiceUpdate,
2078            _ => Self::UnknownValue(maintenance_category::UnknownValue(
2079                wkt::internal::UnknownEnumValue::String(value.to_string()),
2080            )),
2081        }
2082    }
2083}
2084
2085impl serde::ser::Serialize for MaintenanceCategory {
2086    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2087    where
2088        S: serde::Serializer,
2089    {
2090        match self {
2091            Self::Unspecified => serializer.serialize_i32(0),
2092            Self::Infrastructure => serializer.serialize_i32(1),
2093            Self::ServiceUpdate => serializer.serialize_i32(3),
2094            Self::UnknownValue(u) => u.0.serialize(serializer),
2095        }
2096    }
2097}
2098
2099impl<'de> serde::de::Deserialize<'de> for MaintenanceCategory {
2100    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2101    where
2102        D: serde::Deserializer<'de>,
2103    {
2104        deserializer.deserialize_any(wkt::internal::EnumVisitor::<MaintenanceCategory>::new(
2105            ".google.cloud.maintenance.api.v1.MaintenanceCategory",
2106        ))
2107    }
2108}