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