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