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