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