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