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