google_cloud_advisorynotifications_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35/// A notification object for notifying customers about security and privacy
36/// issues.
37#[derive(Clone, Default, PartialEq)]
38#[non_exhaustive]
39pub struct Notification {
40 /// The resource name of the notification.
41 /// Format:
42 /// organizations/{organization}/locations/{location}/notifications/{notification}
43 /// or projects/{project}/locations/{location}/notifications/{notification}.
44 pub name: std::string::String,
45
46 /// The subject line of the notification.
47 pub subject: std::option::Option<crate::model::Subject>,
48
49 /// A list of messages in the notification.
50 pub messages: std::vec::Vec<crate::model::Message>,
51
52 /// Output only. Time the notification was created.
53 pub create_time: std::option::Option<wkt::Timestamp>,
54
55 /// Type of notification
56 pub notification_type: crate::model::NotificationType,
57
58 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
59}
60
61impl Notification {
62 /// Creates a new default instance.
63 pub fn new() -> Self {
64 std::default::Default::default()
65 }
66
67 /// Sets the value of [name][crate::model::Notification::name].
68 ///
69 /// # Example
70 /// ```ignore,no_run
71 /// # use google_cloud_advisorynotifications_v1::model::Notification;
72 /// let x = Notification::new().set_name("example");
73 /// ```
74 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
75 self.name = v.into();
76 self
77 }
78
79 /// Sets the value of [subject][crate::model::Notification::subject].
80 ///
81 /// # Example
82 /// ```ignore,no_run
83 /// # use google_cloud_advisorynotifications_v1::model::Notification;
84 /// use google_cloud_advisorynotifications_v1::model::Subject;
85 /// let x = Notification::new().set_subject(Subject::default()/* use setters */);
86 /// ```
87 pub fn set_subject<T>(mut self, v: T) -> Self
88 where
89 T: std::convert::Into<crate::model::Subject>,
90 {
91 self.subject = std::option::Option::Some(v.into());
92 self
93 }
94
95 /// Sets or clears the value of [subject][crate::model::Notification::subject].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_advisorynotifications_v1::model::Notification;
100 /// use google_cloud_advisorynotifications_v1::model::Subject;
101 /// let x = Notification::new().set_or_clear_subject(Some(Subject::default()/* use setters */));
102 /// let x = Notification::new().set_or_clear_subject(None::<Subject>);
103 /// ```
104 pub fn set_or_clear_subject<T>(mut self, v: std::option::Option<T>) -> Self
105 where
106 T: std::convert::Into<crate::model::Subject>,
107 {
108 self.subject = v.map(|x| x.into());
109 self
110 }
111
112 /// Sets the value of [messages][crate::model::Notification::messages].
113 ///
114 /// # Example
115 /// ```ignore,no_run
116 /// # use google_cloud_advisorynotifications_v1::model::Notification;
117 /// use google_cloud_advisorynotifications_v1::model::Message;
118 /// let x = Notification::new()
119 /// .set_messages([
120 /// Message::default()/* use setters */,
121 /// Message::default()/* use (different) setters */,
122 /// ]);
123 /// ```
124 pub fn set_messages<T, V>(mut self, v: T) -> Self
125 where
126 T: std::iter::IntoIterator<Item = V>,
127 V: std::convert::Into<crate::model::Message>,
128 {
129 use std::iter::Iterator;
130 self.messages = v.into_iter().map(|i| i.into()).collect();
131 self
132 }
133
134 /// Sets the value of [create_time][crate::model::Notification::create_time].
135 ///
136 /// # Example
137 /// ```ignore,no_run
138 /// # use google_cloud_advisorynotifications_v1::model::Notification;
139 /// use wkt::Timestamp;
140 /// let x = Notification::new().set_create_time(Timestamp::default()/* use setters */);
141 /// ```
142 pub fn set_create_time<T>(mut self, v: T) -> Self
143 where
144 T: std::convert::Into<wkt::Timestamp>,
145 {
146 self.create_time = std::option::Option::Some(v.into());
147 self
148 }
149
150 /// Sets or clears the value of [create_time][crate::model::Notification::create_time].
151 ///
152 /// # Example
153 /// ```ignore,no_run
154 /// # use google_cloud_advisorynotifications_v1::model::Notification;
155 /// use wkt::Timestamp;
156 /// let x = Notification::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
157 /// let x = Notification::new().set_or_clear_create_time(None::<Timestamp>);
158 /// ```
159 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
160 where
161 T: std::convert::Into<wkt::Timestamp>,
162 {
163 self.create_time = v.map(|x| x.into());
164 self
165 }
166
167 /// Sets the value of [notification_type][crate::model::Notification::notification_type].
168 ///
169 /// # Example
170 /// ```ignore,no_run
171 /// # use google_cloud_advisorynotifications_v1::model::Notification;
172 /// use google_cloud_advisorynotifications_v1::model::NotificationType;
173 /// let x0 = Notification::new().set_notification_type(NotificationType::SecurityPrivacyAdvisory);
174 /// let x1 = Notification::new().set_notification_type(NotificationType::SensitiveActions);
175 /// let x2 = Notification::new().set_notification_type(NotificationType::SecurityMsa);
176 /// ```
177 pub fn set_notification_type<T: std::convert::Into<crate::model::NotificationType>>(
178 mut self,
179 v: T,
180 ) -> Self {
181 self.notification_type = v.into();
182 self
183 }
184}
185
186impl wkt::message::Message for Notification {
187 fn typename() -> &'static str {
188 "type.googleapis.com/google.cloud.advisorynotifications.v1.Notification"
189 }
190}
191
192/// A text object containing the English text and its localized copies.
193#[derive(Clone, Default, PartialEq)]
194#[non_exhaustive]
195pub struct Text {
196 /// The English copy.
197 pub en_text: std::string::String,
198
199 /// The requested localized copy (if applicable).
200 pub localized_text: std::string::String,
201
202 /// Status of the localization.
203 pub localization_state: crate::model::LocalizationState,
204
205 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
206}
207
208impl Text {
209 /// Creates a new default instance.
210 pub fn new() -> Self {
211 std::default::Default::default()
212 }
213
214 /// Sets the value of [en_text][crate::model::Text::en_text].
215 ///
216 /// # Example
217 /// ```ignore,no_run
218 /// # use google_cloud_advisorynotifications_v1::model::Text;
219 /// let x = Text::new().set_en_text("example");
220 /// ```
221 pub fn set_en_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
222 self.en_text = v.into();
223 self
224 }
225
226 /// Sets the value of [localized_text][crate::model::Text::localized_text].
227 ///
228 /// # Example
229 /// ```ignore,no_run
230 /// # use google_cloud_advisorynotifications_v1::model::Text;
231 /// let x = Text::new().set_localized_text("example");
232 /// ```
233 pub fn set_localized_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
234 self.localized_text = v.into();
235 self
236 }
237
238 /// Sets the value of [localization_state][crate::model::Text::localization_state].
239 ///
240 /// # Example
241 /// ```ignore,no_run
242 /// # use google_cloud_advisorynotifications_v1::model::Text;
243 /// use google_cloud_advisorynotifications_v1::model::LocalizationState;
244 /// let x0 = Text::new().set_localization_state(LocalizationState::NotApplicable);
245 /// let x1 = Text::new().set_localization_state(LocalizationState::Pending);
246 /// let x2 = Text::new().set_localization_state(LocalizationState::Completed);
247 /// ```
248 pub fn set_localization_state<T: std::convert::Into<crate::model::LocalizationState>>(
249 mut self,
250 v: T,
251 ) -> Self {
252 self.localization_state = v.into();
253 self
254 }
255}
256
257impl wkt::message::Message for Text {
258 fn typename() -> &'static str {
259 "type.googleapis.com/google.cloud.advisorynotifications.v1.Text"
260 }
261}
262
263/// A subject line of a notification.
264#[derive(Clone, Default, PartialEq)]
265#[non_exhaustive]
266pub struct Subject {
267 /// The text content.
268 pub text: std::option::Option<crate::model::Text>,
269
270 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
271}
272
273impl Subject {
274 /// Creates a new default instance.
275 pub fn new() -> Self {
276 std::default::Default::default()
277 }
278
279 /// Sets the value of [text][crate::model::Subject::text].
280 ///
281 /// # Example
282 /// ```ignore,no_run
283 /// # use google_cloud_advisorynotifications_v1::model::Subject;
284 /// use google_cloud_advisorynotifications_v1::model::Text;
285 /// let x = Subject::new().set_text(Text::default()/* use setters */);
286 /// ```
287 pub fn set_text<T>(mut self, v: T) -> Self
288 where
289 T: std::convert::Into<crate::model::Text>,
290 {
291 self.text = std::option::Option::Some(v.into());
292 self
293 }
294
295 /// Sets or clears the value of [text][crate::model::Subject::text].
296 ///
297 /// # Example
298 /// ```ignore,no_run
299 /// # use google_cloud_advisorynotifications_v1::model::Subject;
300 /// use google_cloud_advisorynotifications_v1::model::Text;
301 /// let x = Subject::new().set_or_clear_text(Some(Text::default()/* use setters */));
302 /// let x = Subject::new().set_or_clear_text(None::<Text>);
303 /// ```
304 pub fn set_or_clear_text<T>(mut self, v: std::option::Option<T>) -> Self
305 where
306 T: std::convert::Into<crate::model::Text>,
307 {
308 self.text = v.map(|x| x.into());
309 self
310 }
311}
312
313impl wkt::message::Message for Subject {
314 fn typename() -> &'static str {
315 "type.googleapis.com/google.cloud.advisorynotifications.v1.Subject"
316 }
317}
318
319/// A message which contains notification details.
320#[derive(Clone, Default, PartialEq)]
321#[non_exhaustive]
322pub struct Message {
323 /// The message content.
324 pub body: std::option::Option<crate::model::message::Body>,
325
326 /// The attachments to download.
327 pub attachments: std::vec::Vec<crate::model::Attachment>,
328
329 /// The Message creation timestamp.
330 pub create_time: std::option::Option<wkt::Timestamp>,
331
332 /// Time when Message was localized
333 pub localization_time: std::option::Option<wkt::Timestamp>,
334
335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
336}
337
338impl Message {
339 /// Creates a new default instance.
340 pub fn new() -> Self {
341 std::default::Default::default()
342 }
343
344 /// Sets the value of [body][crate::model::Message::body].
345 ///
346 /// # Example
347 /// ```ignore,no_run
348 /// # use google_cloud_advisorynotifications_v1::model::Message;
349 /// use google_cloud_advisorynotifications_v1::model::message::Body;
350 /// let x = Message::new().set_body(Body::default()/* use setters */);
351 /// ```
352 pub fn set_body<T>(mut self, v: T) -> Self
353 where
354 T: std::convert::Into<crate::model::message::Body>,
355 {
356 self.body = std::option::Option::Some(v.into());
357 self
358 }
359
360 /// Sets or clears the value of [body][crate::model::Message::body].
361 ///
362 /// # Example
363 /// ```ignore,no_run
364 /// # use google_cloud_advisorynotifications_v1::model::Message;
365 /// use google_cloud_advisorynotifications_v1::model::message::Body;
366 /// let x = Message::new().set_or_clear_body(Some(Body::default()/* use setters */));
367 /// let x = Message::new().set_or_clear_body(None::<Body>);
368 /// ```
369 pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
370 where
371 T: std::convert::Into<crate::model::message::Body>,
372 {
373 self.body = v.map(|x| x.into());
374 self
375 }
376
377 /// Sets the value of [attachments][crate::model::Message::attachments].
378 ///
379 /// # Example
380 /// ```ignore,no_run
381 /// # use google_cloud_advisorynotifications_v1::model::Message;
382 /// use google_cloud_advisorynotifications_v1::model::Attachment;
383 /// let x = Message::new()
384 /// .set_attachments([
385 /// Attachment::default()/* use setters */,
386 /// Attachment::default()/* use (different) setters */,
387 /// ]);
388 /// ```
389 pub fn set_attachments<T, V>(mut self, v: T) -> Self
390 where
391 T: std::iter::IntoIterator<Item = V>,
392 V: std::convert::Into<crate::model::Attachment>,
393 {
394 use std::iter::Iterator;
395 self.attachments = v.into_iter().map(|i| i.into()).collect();
396 self
397 }
398
399 /// Sets the value of [create_time][crate::model::Message::create_time].
400 ///
401 /// # Example
402 /// ```ignore,no_run
403 /// # use google_cloud_advisorynotifications_v1::model::Message;
404 /// use wkt::Timestamp;
405 /// let x = Message::new().set_create_time(Timestamp::default()/* use setters */);
406 /// ```
407 pub fn set_create_time<T>(mut self, v: T) -> Self
408 where
409 T: std::convert::Into<wkt::Timestamp>,
410 {
411 self.create_time = std::option::Option::Some(v.into());
412 self
413 }
414
415 /// Sets or clears the value of [create_time][crate::model::Message::create_time].
416 ///
417 /// # Example
418 /// ```ignore,no_run
419 /// # use google_cloud_advisorynotifications_v1::model::Message;
420 /// use wkt::Timestamp;
421 /// let x = Message::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
422 /// let x = Message::new().set_or_clear_create_time(None::<Timestamp>);
423 /// ```
424 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
425 where
426 T: std::convert::Into<wkt::Timestamp>,
427 {
428 self.create_time = v.map(|x| x.into());
429 self
430 }
431
432 /// Sets the value of [localization_time][crate::model::Message::localization_time].
433 ///
434 /// # Example
435 /// ```ignore,no_run
436 /// # use google_cloud_advisorynotifications_v1::model::Message;
437 /// use wkt::Timestamp;
438 /// let x = Message::new().set_localization_time(Timestamp::default()/* use setters */);
439 /// ```
440 pub fn set_localization_time<T>(mut self, v: T) -> Self
441 where
442 T: std::convert::Into<wkt::Timestamp>,
443 {
444 self.localization_time = std::option::Option::Some(v.into());
445 self
446 }
447
448 /// Sets or clears the value of [localization_time][crate::model::Message::localization_time].
449 ///
450 /// # Example
451 /// ```ignore,no_run
452 /// # use google_cloud_advisorynotifications_v1::model::Message;
453 /// use wkt::Timestamp;
454 /// let x = Message::new().set_or_clear_localization_time(Some(Timestamp::default()/* use setters */));
455 /// let x = Message::new().set_or_clear_localization_time(None::<Timestamp>);
456 /// ```
457 pub fn set_or_clear_localization_time<T>(mut self, v: std::option::Option<T>) -> Self
458 where
459 T: std::convert::Into<wkt::Timestamp>,
460 {
461 self.localization_time = v.map(|x| x.into());
462 self
463 }
464}
465
466impl wkt::message::Message for Message {
467 fn typename() -> &'static str {
468 "type.googleapis.com/google.cloud.advisorynotifications.v1.Message"
469 }
470}
471
472/// Defines additional types related to [Message].
473pub mod message {
474 #[allow(unused_imports)]
475 use super::*;
476
477 /// A message body containing text.
478 #[derive(Clone, Default, PartialEq)]
479 #[non_exhaustive]
480 pub struct Body {
481 /// The text content of the message body.
482 pub text: std::option::Option<crate::model::Text>,
483
484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
485 }
486
487 impl Body {
488 /// Creates a new default instance.
489 pub fn new() -> Self {
490 std::default::Default::default()
491 }
492
493 /// Sets the value of [text][crate::model::message::Body::text].
494 ///
495 /// # Example
496 /// ```ignore,no_run
497 /// # use google_cloud_advisorynotifications_v1::model::message::Body;
498 /// use google_cloud_advisorynotifications_v1::model::Text;
499 /// let x = Body::new().set_text(Text::default()/* use setters */);
500 /// ```
501 pub fn set_text<T>(mut self, v: T) -> Self
502 where
503 T: std::convert::Into<crate::model::Text>,
504 {
505 self.text = std::option::Option::Some(v.into());
506 self
507 }
508
509 /// Sets or clears the value of [text][crate::model::message::Body::text].
510 ///
511 /// # Example
512 /// ```ignore,no_run
513 /// # use google_cloud_advisorynotifications_v1::model::message::Body;
514 /// use google_cloud_advisorynotifications_v1::model::Text;
515 /// let x = Body::new().set_or_clear_text(Some(Text::default()/* use setters */));
516 /// let x = Body::new().set_or_clear_text(None::<Text>);
517 /// ```
518 pub fn set_or_clear_text<T>(mut self, v: std::option::Option<T>) -> Self
519 where
520 T: std::convert::Into<crate::model::Text>,
521 {
522 self.text = v.map(|x| x.into());
523 self
524 }
525 }
526
527 impl wkt::message::Message for Body {
528 fn typename() -> &'static str {
529 "type.googleapis.com/google.cloud.advisorynotifications.v1.Message.Body"
530 }
531 }
532}
533
534/// Attachment with specific information about the issue.
535#[derive(Clone, Default, PartialEq)]
536#[non_exhaustive]
537pub struct Attachment {
538 /// The title of the attachment.
539 pub display_name: std::string::String,
540
541 /// Data type of the attachment.
542 pub data: std::option::Option<crate::model::attachment::Data>,
543
544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
545}
546
547impl Attachment {
548 /// Creates a new default instance.
549 pub fn new() -> Self {
550 std::default::Default::default()
551 }
552
553 /// Sets the value of [display_name][crate::model::Attachment::display_name].
554 ///
555 /// # Example
556 /// ```ignore,no_run
557 /// # use google_cloud_advisorynotifications_v1::model::Attachment;
558 /// let x = Attachment::new().set_display_name("example");
559 /// ```
560 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
561 self.display_name = v.into();
562 self
563 }
564
565 /// Sets the value of [data][crate::model::Attachment::data].
566 ///
567 /// Note that all the setters affecting `data` are mutually
568 /// exclusive.
569 ///
570 /// # Example
571 /// ```ignore,no_run
572 /// # use google_cloud_advisorynotifications_v1::model::Attachment;
573 /// use google_cloud_advisorynotifications_v1::model::Csv;
574 /// let x = Attachment::new().set_data(Some(
575 /// google_cloud_advisorynotifications_v1::model::attachment::Data::Csv(Csv::default().into())));
576 /// ```
577 pub fn set_data<T: std::convert::Into<std::option::Option<crate::model::attachment::Data>>>(
578 mut self,
579 v: T,
580 ) -> Self {
581 self.data = v.into();
582 self
583 }
584
585 /// The value of [data][crate::model::Attachment::data]
586 /// if it holds a `Csv`, `None` if the field is not set or
587 /// holds a different branch.
588 pub fn csv(&self) -> std::option::Option<&std::boxed::Box<crate::model::Csv>> {
589 #[allow(unreachable_patterns)]
590 self.data.as_ref().and_then(|v| match v {
591 crate::model::attachment::Data::Csv(v) => std::option::Option::Some(v),
592 _ => std::option::Option::None,
593 })
594 }
595
596 /// Sets the value of [data][crate::model::Attachment::data]
597 /// to hold a `Csv`.
598 ///
599 /// Note that all the setters affecting `data` are
600 /// mutually exclusive.
601 ///
602 /// # Example
603 /// ```ignore,no_run
604 /// # use google_cloud_advisorynotifications_v1::model::Attachment;
605 /// use google_cloud_advisorynotifications_v1::model::Csv;
606 /// let x = Attachment::new().set_csv(Csv::default()/* use setters */);
607 /// assert!(x.csv().is_some());
608 /// ```
609 pub fn set_csv<T: std::convert::Into<std::boxed::Box<crate::model::Csv>>>(
610 mut self,
611 v: T,
612 ) -> Self {
613 self.data = std::option::Option::Some(crate::model::attachment::Data::Csv(v.into()));
614 self
615 }
616}
617
618impl wkt::message::Message for Attachment {
619 fn typename() -> &'static str {
620 "type.googleapis.com/google.cloud.advisorynotifications.v1.Attachment"
621 }
622}
623
624/// Defines additional types related to [Attachment].
625pub mod attachment {
626 #[allow(unused_imports)]
627 use super::*;
628
629 /// Data type of the attachment.
630 #[derive(Clone, Debug, PartialEq)]
631 #[non_exhaustive]
632 pub enum Data {
633 /// A CSV file attachment. Max size is 10 MB.
634 Csv(std::boxed::Box<crate::model::Csv>),
635 }
636}
637
638/// A representation of a CSV file attachment, as a list of column headers and
639/// a list of data rows.
640#[derive(Clone, Default, PartialEq)]
641#[non_exhaustive]
642pub struct Csv {
643 /// The list of headers for data columns in a CSV file.
644 pub headers: std::vec::Vec<std::string::String>,
645
646 /// The list of data rows in a CSV file, as string arrays rather than as a
647 /// single comma-separated string.
648 pub data_rows: std::vec::Vec<crate::model::csv::CsvRow>,
649
650 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
651}
652
653impl Csv {
654 /// Creates a new default instance.
655 pub fn new() -> Self {
656 std::default::Default::default()
657 }
658
659 /// Sets the value of [headers][crate::model::Csv::headers].
660 ///
661 /// # Example
662 /// ```ignore,no_run
663 /// # use google_cloud_advisorynotifications_v1::model::Csv;
664 /// let x = Csv::new().set_headers(["a", "b", "c"]);
665 /// ```
666 pub fn set_headers<T, V>(mut self, v: T) -> Self
667 where
668 T: std::iter::IntoIterator<Item = V>,
669 V: std::convert::Into<std::string::String>,
670 {
671 use std::iter::Iterator;
672 self.headers = v.into_iter().map(|i| i.into()).collect();
673 self
674 }
675
676 /// Sets the value of [data_rows][crate::model::Csv::data_rows].
677 ///
678 /// # Example
679 /// ```ignore,no_run
680 /// # use google_cloud_advisorynotifications_v1::model::Csv;
681 /// use google_cloud_advisorynotifications_v1::model::csv::CsvRow;
682 /// let x = Csv::new()
683 /// .set_data_rows([
684 /// CsvRow::default()/* use setters */,
685 /// CsvRow::default()/* use (different) setters */,
686 /// ]);
687 /// ```
688 pub fn set_data_rows<T, V>(mut self, v: T) -> Self
689 where
690 T: std::iter::IntoIterator<Item = V>,
691 V: std::convert::Into<crate::model::csv::CsvRow>,
692 {
693 use std::iter::Iterator;
694 self.data_rows = v.into_iter().map(|i| i.into()).collect();
695 self
696 }
697}
698
699impl wkt::message::Message for Csv {
700 fn typename() -> &'static str {
701 "type.googleapis.com/google.cloud.advisorynotifications.v1.Csv"
702 }
703}
704
705/// Defines additional types related to [Csv].
706pub mod csv {
707 #[allow(unused_imports)]
708 use super::*;
709
710 /// A representation of a single data row in a CSV file.
711 #[derive(Clone, Default, PartialEq)]
712 #[non_exhaustive]
713 pub struct CsvRow {
714 /// The data entries in a CSV file row, as a string array rather than a
715 /// single comma-separated string.
716 pub entries: std::vec::Vec<std::string::String>,
717
718 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
719 }
720
721 impl CsvRow {
722 /// Creates a new default instance.
723 pub fn new() -> Self {
724 std::default::Default::default()
725 }
726
727 /// Sets the value of [entries][crate::model::csv::CsvRow::entries].
728 ///
729 /// # Example
730 /// ```ignore,no_run
731 /// # use google_cloud_advisorynotifications_v1::model::csv::CsvRow;
732 /// let x = CsvRow::new().set_entries(["a", "b", "c"]);
733 /// ```
734 pub fn set_entries<T, V>(mut self, v: T) -> Self
735 where
736 T: std::iter::IntoIterator<Item = V>,
737 V: std::convert::Into<std::string::String>,
738 {
739 use std::iter::Iterator;
740 self.entries = v.into_iter().map(|i| i.into()).collect();
741 self
742 }
743 }
744
745 impl wkt::message::Message for CsvRow {
746 fn typename() -> &'static str {
747 "type.googleapis.com/google.cloud.advisorynotifications.v1.Csv.CsvRow"
748 }
749 }
750}
751
752/// Request for fetching all notifications for a given parent.
753#[derive(Clone, Default, PartialEq)]
754#[non_exhaustive]
755pub struct ListNotificationsRequest {
756 /// Required. The parent, which owns this collection of notifications.
757 /// Must be of the form "organizations/{organization}/locations/{location}"
758 /// or "projects/{project}/locations/{location}".
759 pub parent: std::string::String,
760
761 /// The maximum number of notifications to return. The service may return
762 /// fewer than this value. If unspecified or equal to 0, at most 50
763 /// notifications will be returned. The maximum value is 50; values above 50
764 /// will be coerced to 50.
765 pub page_size: i32,
766
767 /// A page token returned from a previous request.
768 /// When paginating, all other parameters provided in the request
769 /// must match the call that returned the page token.
770 pub page_token: std::string::String,
771
772 /// Specifies which parts of the notification resource should be returned
773 /// in the response.
774 pub view: crate::model::NotificationView,
775
776 /// ISO code for requested localization language. If unset, will be
777 /// interpereted as "en". If the requested language is valid, but not supported
778 /// for this notification, English will be returned with an "Not applicable"
779 /// LocalizationState. If the ISO code is invalid (i.e. not a real language),
780 /// this RPC will throw an error.
781 pub language_code: std::string::String,
782
783 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
784}
785
786impl ListNotificationsRequest {
787 /// Creates a new default instance.
788 pub fn new() -> Self {
789 std::default::Default::default()
790 }
791
792 /// Sets the value of [parent][crate::model::ListNotificationsRequest::parent].
793 ///
794 /// # Example
795 /// ```ignore,no_run
796 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsRequest;
797 /// let x = ListNotificationsRequest::new().set_parent("example");
798 /// ```
799 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
800 self.parent = v.into();
801 self
802 }
803
804 /// Sets the value of [page_size][crate::model::ListNotificationsRequest::page_size].
805 ///
806 /// # Example
807 /// ```ignore,no_run
808 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsRequest;
809 /// let x = ListNotificationsRequest::new().set_page_size(42);
810 /// ```
811 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
812 self.page_size = v.into();
813 self
814 }
815
816 /// Sets the value of [page_token][crate::model::ListNotificationsRequest::page_token].
817 ///
818 /// # Example
819 /// ```ignore,no_run
820 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsRequest;
821 /// let x = ListNotificationsRequest::new().set_page_token("example");
822 /// ```
823 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
824 self.page_token = v.into();
825 self
826 }
827
828 /// Sets the value of [view][crate::model::ListNotificationsRequest::view].
829 ///
830 /// # Example
831 /// ```ignore,no_run
832 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsRequest;
833 /// use google_cloud_advisorynotifications_v1::model::NotificationView;
834 /// let x0 = ListNotificationsRequest::new().set_view(NotificationView::Basic);
835 /// let x1 = ListNotificationsRequest::new().set_view(NotificationView::Full);
836 /// ```
837 pub fn set_view<T: std::convert::Into<crate::model::NotificationView>>(mut self, v: T) -> Self {
838 self.view = v.into();
839 self
840 }
841
842 /// Sets the value of [language_code][crate::model::ListNotificationsRequest::language_code].
843 ///
844 /// # Example
845 /// ```ignore,no_run
846 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsRequest;
847 /// let x = ListNotificationsRequest::new().set_language_code("example");
848 /// ```
849 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
850 self.language_code = v.into();
851 self
852 }
853}
854
855impl wkt::message::Message for ListNotificationsRequest {
856 fn typename() -> &'static str {
857 "type.googleapis.com/google.cloud.advisorynotifications.v1.ListNotificationsRequest"
858 }
859}
860
861/// Response of ListNotifications endpoint.
862#[derive(Clone, Default, PartialEq)]
863#[non_exhaustive]
864pub struct ListNotificationsResponse {
865 /// List of notifications under a given parent.
866 pub notifications: std::vec::Vec<crate::model::Notification>,
867
868 /// A token, which can be sent as `page_token` to retrieve the next page.
869 /// If this field is omitted, there are no subsequent pages.
870 pub next_page_token: std::string::String,
871
872 /// Estimation of a total number of notifications.
873 pub total_size: i32,
874
875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
876}
877
878impl ListNotificationsResponse {
879 /// Creates a new default instance.
880 pub fn new() -> Self {
881 std::default::Default::default()
882 }
883
884 /// Sets the value of [notifications][crate::model::ListNotificationsResponse::notifications].
885 ///
886 /// # Example
887 /// ```ignore,no_run
888 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsResponse;
889 /// use google_cloud_advisorynotifications_v1::model::Notification;
890 /// let x = ListNotificationsResponse::new()
891 /// .set_notifications([
892 /// Notification::default()/* use setters */,
893 /// Notification::default()/* use (different) setters */,
894 /// ]);
895 /// ```
896 pub fn set_notifications<T, V>(mut self, v: T) -> Self
897 where
898 T: std::iter::IntoIterator<Item = V>,
899 V: std::convert::Into<crate::model::Notification>,
900 {
901 use std::iter::Iterator;
902 self.notifications = v.into_iter().map(|i| i.into()).collect();
903 self
904 }
905
906 /// Sets the value of [next_page_token][crate::model::ListNotificationsResponse::next_page_token].
907 ///
908 /// # Example
909 /// ```ignore,no_run
910 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsResponse;
911 /// let x = ListNotificationsResponse::new().set_next_page_token("example");
912 /// ```
913 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
914 self.next_page_token = v.into();
915 self
916 }
917
918 /// Sets the value of [total_size][crate::model::ListNotificationsResponse::total_size].
919 ///
920 /// # Example
921 /// ```ignore,no_run
922 /// # use google_cloud_advisorynotifications_v1::model::ListNotificationsResponse;
923 /// let x = ListNotificationsResponse::new().set_total_size(42);
924 /// ```
925 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
926 self.total_size = v.into();
927 self
928 }
929}
930
931impl wkt::message::Message for ListNotificationsResponse {
932 fn typename() -> &'static str {
933 "type.googleapis.com/google.cloud.advisorynotifications.v1.ListNotificationsResponse"
934 }
935}
936
937#[doc(hidden)]
938impl google_cloud_gax::paginator::internal::PageableResponse for ListNotificationsResponse {
939 type PageItem = crate::model::Notification;
940
941 fn items(self) -> std::vec::Vec<Self::PageItem> {
942 self.notifications
943 }
944
945 fn next_page_token(&self) -> std::string::String {
946 use std::clone::Clone;
947 self.next_page_token.clone()
948 }
949}
950
951/// Request for fetching a notification.
952#[derive(Clone, Default, PartialEq)]
953#[non_exhaustive]
954pub struct GetNotificationRequest {
955 /// Required. A name of the notification to retrieve.
956 /// Format:
957 /// organizations/{organization}/locations/{location}/notifications/{notification}
958 /// or projects/{projects}/locations/{location}/notifications/{notification}.
959 pub name: std::string::String,
960
961 /// ISO code for requested localization language. If unset, will be
962 /// interpereted as "en". If the requested language is valid, but not supported
963 /// for this notification, English will be returned with an "Not applicable"
964 /// LocalizationState. If the ISO code is invalid (i.e. not a real language),
965 /// this RPC will throw an error.
966 pub language_code: std::string::String,
967
968 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
969}
970
971impl GetNotificationRequest {
972 /// Creates a new default instance.
973 pub fn new() -> Self {
974 std::default::Default::default()
975 }
976
977 /// Sets the value of [name][crate::model::GetNotificationRequest::name].
978 ///
979 /// # Example
980 /// ```ignore,no_run
981 /// # use google_cloud_advisorynotifications_v1::model::GetNotificationRequest;
982 /// let x = GetNotificationRequest::new().set_name("example");
983 /// ```
984 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
985 self.name = v.into();
986 self
987 }
988
989 /// Sets the value of [language_code][crate::model::GetNotificationRequest::language_code].
990 ///
991 /// # Example
992 /// ```ignore,no_run
993 /// # use google_cloud_advisorynotifications_v1::model::GetNotificationRequest;
994 /// let x = GetNotificationRequest::new().set_language_code("example");
995 /// ```
996 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
997 self.language_code = v.into();
998 self
999 }
1000}
1001
1002impl wkt::message::Message for GetNotificationRequest {
1003 fn typename() -> &'static str {
1004 "type.googleapis.com/google.cloud.advisorynotifications.v1.GetNotificationRequest"
1005 }
1006}
1007
1008/// Settings for Advisory Notifications.
1009#[derive(Clone, Default, PartialEq)]
1010#[non_exhaustive]
1011pub struct Settings {
1012 /// Identifier. The resource name of the settings to retrieve.
1013 /// Format:
1014 /// organizations/{organization}/locations/{location}/settings or
1015 /// projects/{projects}/locations/{location}/settings.
1016 pub name: std::string::String,
1017
1018 /// Required. Map of each notification type and its settings to get/set all
1019 /// settings at once. The server will validate the value for each notification
1020 /// type.
1021 pub notification_settings:
1022 std::collections::HashMap<std::string::String, crate::model::NotificationSettings>,
1023
1024 /// Required. Fingerprint for optimistic concurrency returned in Get requests.
1025 /// Must be provided for Update requests. If the value provided does not match
1026 /// the value known to the server, ABORTED will be thrown, and the client
1027 /// should retry the read-modify-write cycle.
1028 pub etag: std::string::String,
1029
1030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1031}
1032
1033impl Settings {
1034 /// Creates a new default instance.
1035 pub fn new() -> Self {
1036 std::default::Default::default()
1037 }
1038
1039 /// Sets the value of [name][crate::model::Settings::name].
1040 ///
1041 /// # Example
1042 /// ```ignore,no_run
1043 /// # use google_cloud_advisorynotifications_v1::model::Settings;
1044 /// let x = Settings::new().set_name("example");
1045 /// ```
1046 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1047 self.name = v.into();
1048 self
1049 }
1050
1051 /// Sets the value of [notification_settings][crate::model::Settings::notification_settings].
1052 ///
1053 /// # Example
1054 /// ```ignore,no_run
1055 /// # use google_cloud_advisorynotifications_v1::model::Settings;
1056 /// use google_cloud_advisorynotifications_v1::model::NotificationSettings;
1057 /// let x = Settings::new().set_notification_settings([
1058 /// ("key0", NotificationSettings::default()/* use setters */),
1059 /// ("key1", NotificationSettings::default()/* use (different) setters */),
1060 /// ]);
1061 /// ```
1062 pub fn set_notification_settings<T, K, V>(mut self, v: T) -> Self
1063 where
1064 T: std::iter::IntoIterator<Item = (K, V)>,
1065 K: std::convert::Into<std::string::String>,
1066 V: std::convert::Into<crate::model::NotificationSettings>,
1067 {
1068 use std::iter::Iterator;
1069 self.notification_settings = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1070 self
1071 }
1072
1073 /// Sets the value of [etag][crate::model::Settings::etag].
1074 ///
1075 /// # Example
1076 /// ```ignore,no_run
1077 /// # use google_cloud_advisorynotifications_v1::model::Settings;
1078 /// let x = Settings::new().set_etag("example");
1079 /// ```
1080 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1081 self.etag = v.into();
1082 self
1083 }
1084}
1085
1086impl wkt::message::Message for Settings {
1087 fn typename() -> &'static str {
1088 "type.googleapis.com/google.cloud.advisorynotifications.v1.Settings"
1089 }
1090}
1091
1092/// Settings for each NotificationType.
1093#[derive(Clone, Default, PartialEq)]
1094#[non_exhaustive]
1095pub struct NotificationSettings {
1096 /// Whether the associated NotificationType is enabled.
1097 pub enabled: bool,
1098
1099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1100}
1101
1102impl NotificationSettings {
1103 /// Creates a new default instance.
1104 pub fn new() -> Self {
1105 std::default::Default::default()
1106 }
1107
1108 /// Sets the value of [enabled][crate::model::NotificationSettings::enabled].
1109 ///
1110 /// # Example
1111 /// ```ignore,no_run
1112 /// # use google_cloud_advisorynotifications_v1::model::NotificationSettings;
1113 /// let x = NotificationSettings::new().set_enabled(true);
1114 /// ```
1115 pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1116 self.enabled = v.into();
1117 self
1118 }
1119}
1120
1121impl wkt::message::Message for NotificationSettings {
1122 fn typename() -> &'static str {
1123 "type.googleapis.com/google.cloud.advisorynotifications.v1.NotificationSettings"
1124 }
1125}
1126
1127/// Request of GetSettings endpoint.
1128#[derive(Clone, Default, PartialEq)]
1129#[non_exhaustive]
1130pub struct GetSettingsRequest {
1131 /// Required. The resource name of the settings to retrieve.
1132 /// Format:
1133 /// organizations/{organization}/locations/{location}/settings or
1134 /// projects/{projects}/locations/{location}/settings.
1135 pub name: std::string::String,
1136
1137 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1138}
1139
1140impl GetSettingsRequest {
1141 /// Creates a new default instance.
1142 pub fn new() -> Self {
1143 std::default::Default::default()
1144 }
1145
1146 /// Sets the value of [name][crate::model::GetSettingsRequest::name].
1147 ///
1148 /// # Example
1149 /// ```ignore,no_run
1150 /// # use google_cloud_advisorynotifications_v1::model::GetSettingsRequest;
1151 /// let x = GetSettingsRequest::new().set_name("example");
1152 /// ```
1153 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1154 self.name = v.into();
1155 self
1156 }
1157}
1158
1159impl wkt::message::Message for GetSettingsRequest {
1160 fn typename() -> &'static str {
1161 "type.googleapis.com/google.cloud.advisorynotifications.v1.GetSettingsRequest"
1162 }
1163}
1164
1165/// Request of UpdateSettings endpoint.
1166#[derive(Clone, Default, PartialEq)]
1167#[non_exhaustive]
1168pub struct UpdateSettingsRequest {
1169 /// Required. New settings.
1170 pub settings: std::option::Option<crate::model::Settings>,
1171
1172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1173}
1174
1175impl UpdateSettingsRequest {
1176 /// Creates a new default instance.
1177 pub fn new() -> Self {
1178 std::default::Default::default()
1179 }
1180
1181 /// Sets the value of [settings][crate::model::UpdateSettingsRequest::settings].
1182 ///
1183 /// # Example
1184 /// ```ignore,no_run
1185 /// # use google_cloud_advisorynotifications_v1::model::UpdateSettingsRequest;
1186 /// use google_cloud_advisorynotifications_v1::model::Settings;
1187 /// let x = UpdateSettingsRequest::new().set_settings(Settings::default()/* use setters */);
1188 /// ```
1189 pub fn set_settings<T>(mut self, v: T) -> Self
1190 where
1191 T: std::convert::Into<crate::model::Settings>,
1192 {
1193 self.settings = std::option::Option::Some(v.into());
1194 self
1195 }
1196
1197 /// Sets or clears the value of [settings][crate::model::UpdateSettingsRequest::settings].
1198 ///
1199 /// # Example
1200 /// ```ignore,no_run
1201 /// # use google_cloud_advisorynotifications_v1::model::UpdateSettingsRequest;
1202 /// use google_cloud_advisorynotifications_v1::model::Settings;
1203 /// let x = UpdateSettingsRequest::new().set_or_clear_settings(Some(Settings::default()/* use setters */));
1204 /// let x = UpdateSettingsRequest::new().set_or_clear_settings(None::<Settings>);
1205 /// ```
1206 pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
1207 where
1208 T: std::convert::Into<crate::model::Settings>,
1209 {
1210 self.settings = v.map(|x| x.into());
1211 self
1212 }
1213}
1214
1215impl wkt::message::Message for UpdateSettingsRequest {
1216 fn typename() -> &'static str {
1217 "type.googleapis.com/google.cloud.advisorynotifications.v1.UpdateSettingsRequest"
1218 }
1219}
1220
1221/// Notification view.
1222///
1223/// # Working with unknown values
1224///
1225/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1226/// additional enum variants at any time. Adding new variants is not considered
1227/// a breaking change. Applications should write their code in anticipation of:
1228///
1229/// - New values appearing in future releases of the client library, **and**
1230/// - New values received dynamically, without application changes.
1231///
1232/// Please consult the [Working with enums] section in the user guide for some
1233/// guidelines.
1234///
1235/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1236#[derive(Clone, Debug, PartialEq)]
1237#[non_exhaustive]
1238pub enum NotificationView {
1239 /// Not specified, equivalent to BASIC.
1240 Unspecified,
1241 /// Server responses only include title, creation time and Notification ID.
1242 /// Note: for internal use responses also include the last update time,
1243 /// the latest message text and whether notification has attachments.
1244 Basic,
1245 /// Include everything.
1246 Full,
1247 /// If set, the enum was initialized with an unknown value.
1248 ///
1249 /// Applications can examine the value using [NotificationView::value] or
1250 /// [NotificationView::name].
1251 UnknownValue(notification_view::UnknownValue),
1252}
1253
1254#[doc(hidden)]
1255pub mod notification_view {
1256 #[allow(unused_imports)]
1257 use super::*;
1258 #[derive(Clone, Debug, PartialEq)]
1259 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1260}
1261
1262impl NotificationView {
1263 /// Gets the enum value.
1264 ///
1265 /// Returns `None` if the enum contains an unknown value deserialized from
1266 /// the string representation of enums.
1267 pub fn value(&self) -> std::option::Option<i32> {
1268 match self {
1269 Self::Unspecified => std::option::Option::Some(0),
1270 Self::Basic => std::option::Option::Some(1),
1271 Self::Full => std::option::Option::Some(2),
1272 Self::UnknownValue(u) => u.0.value(),
1273 }
1274 }
1275
1276 /// Gets the enum value as a string.
1277 ///
1278 /// Returns `None` if the enum contains an unknown value deserialized from
1279 /// the integer representation of enums.
1280 pub fn name(&self) -> std::option::Option<&str> {
1281 match self {
1282 Self::Unspecified => std::option::Option::Some("NOTIFICATION_VIEW_UNSPECIFIED"),
1283 Self::Basic => std::option::Option::Some("BASIC"),
1284 Self::Full => std::option::Option::Some("FULL"),
1285 Self::UnknownValue(u) => u.0.name(),
1286 }
1287 }
1288}
1289
1290impl std::default::Default for NotificationView {
1291 fn default() -> Self {
1292 use std::convert::From;
1293 Self::from(0)
1294 }
1295}
1296
1297impl std::fmt::Display for NotificationView {
1298 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1299 wkt::internal::display_enum(f, self.name(), self.value())
1300 }
1301}
1302
1303impl std::convert::From<i32> for NotificationView {
1304 fn from(value: i32) -> Self {
1305 match value {
1306 0 => Self::Unspecified,
1307 1 => Self::Basic,
1308 2 => Self::Full,
1309 _ => Self::UnknownValue(notification_view::UnknownValue(
1310 wkt::internal::UnknownEnumValue::Integer(value),
1311 )),
1312 }
1313 }
1314}
1315
1316impl std::convert::From<&str> for NotificationView {
1317 fn from(value: &str) -> Self {
1318 use std::string::ToString;
1319 match value {
1320 "NOTIFICATION_VIEW_UNSPECIFIED" => Self::Unspecified,
1321 "BASIC" => Self::Basic,
1322 "FULL" => Self::Full,
1323 _ => Self::UnknownValue(notification_view::UnknownValue(
1324 wkt::internal::UnknownEnumValue::String(value.to_string()),
1325 )),
1326 }
1327 }
1328}
1329
1330impl serde::ser::Serialize for NotificationView {
1331 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1332 where
1333 S: serde::Serializer,
1334 {
1335 match self {
1336 Self::Unspecified => serializer.serialize_i32(0),
1337 Self::Basic => serializer.serialize_i32(1),
1338 Self::Full => serializer.serialize_i32(2),
1339 Self::UnknownValue(u) => u.0.serialize(serializer),
1340 }
1341 }
1342}
1343
1344impl<'de> serde::de::Deserialize<'de> for NotificationView {
1345 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1346 where
1347 D: serde::Deserializer<'de>,
1348 {
1349 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationView>::new(
1350 ".google.cloud.advisorynotifications.v1.NotificationView",
1351 ))
1352 }
1353}
1354
1355/// Status of localized text.
1356///
1357/// # Working with unknown values
1358///
1359/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1360/// additional enum variants at any time. Adding new variants is not considered
1361/// a breaking change. Applications should write their code in anticipation of:
1362///
1363/// - New values appearing in future releases of the client library, **and**
1364/// - New values received dynamically, without application changes.
1365///
1366/// Please consult the [Working with enums] section in the user guide for some
1367/// guidelines.
1368///
1369/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1370#[derive(Clone, Debug, PartialEq)]
1371#[non_exhaustive]
1372pub enum LocalizationState {
1373 /// Not used.
1374 Unspecified,
1375 /// Localization is not applicable for requested language. This can happen
1376 /// when:
1377 ///
1378 /// - The requested language was not supported by Advisory Notifications at the
1379 /// time of localization (including notifications created before the
1380 /// localization feature was launched).
1381 /// - The requested language is English, so only the English text is returned.
1382 NotApplicable,
1383 /// Localization for requested language is in progress, and not ready yet.
1384 Pending,
1385 /// Localization for requested language is completed.
1386 Completed,
1387 /// If set, the enum was initialized with an unknown value.
1388 ///
1389 /// Applications can examine the value using [LocalizationState::value] or
1390 /// [LocalizationState::name].
1391 UnknownValue(localization_state::UnknownValue),
1392}
1393
1394#[doc(hidden)]
1395pub mod localization_state {
1396 #[allow(unused_imports)]
1397 use super::*;
1398 #[derive(Clone, Debug, PartialEq)]
1399 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1400}
1401
1402impl LocalizationState {
1403 /// Gets the enum value.
1404 ///
1405 /// Returns `None` if the enum contains an unknown value deserialized from
1406 /// the string representation of enums.
1407 pub fn value(&self) -> std::option::Option<i32> {
1408 match self {
1409 Self::Unspecified => std::option::Option::Some(0),
1410 Self::NotApplicable => std::option::Option::Some(1),
1411 Self::Pending => std::option::Option::Some(2),
1412 Self::Completed => std::option::Option::Some(3),
1413 Self::UnknownValue(u) => u.0.value(),
1414 }
1415 }
1416
1417 /// Gets the enum value as a string.
1418 ///
1419 /// Returns `None` if the enum contains an unknown value deserialized from
1420 /// the integer representation of enums.
1421 pub fn name(&self) -> std::option::Option<&str> {
1422 match self {
1423 Self::Unspecified => std::option::Option::Some("LOCALIZATION_STATE_UNSPECIFIED"),
1424 Self::NotApplicable => std::option::Option::Some("LOCALIZATION_STATE_NOT_APPLICABLE"),
1425 Self::Pending => std::option::Option::Some("LOCALIZATION_STATE_PENDING"),
1426 Self::Completed => std::option::Option::Some("LOCALIZATION_STATE_COMPLETED"),
1427 Self::UnknownValue(u) => u.0.name(),
1428 }
1429 }
1430}
1431
1432impl std::default::Default for LocalizationState {
1433 fn default() -> Self {
1434 use std::convert::From;
1435 Self::from(0)
1436 }
1437}
1438
1439impl std::fmt::Display for LocalizationState {
1440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1441 wkt::internal::display_enum(f, self.name(), self.value())
1442 }
1443}
1444
1445impl std::convert::From<i32> for LocalizationState {
1446 fn from(value: i32) -> Self {
1447 match value {
1448 0 => Self::Unspecified,
1449 1 => Self::NotApplicable,
1450 2 => Self::Pending,
1451 3 => Self::Completed,
1452 _ => Self::UnknownValue(localization_state::UnknownValue(
1453 wkt::internal::UnknownEnumValue::Integer(value),
1454 )),
1455 }
1456 }
1457}
1458
1459impl std::convert::From<&str> for LocalizationState {
1460 fn from(value: &str) -> Self {
1461 use std::string::ToString;
1462 match value {
1463 "LOCALIZATION_STATE_UNSPECIFIED" => Self::Unspecified,
1464 "LOCALIZATION_STATE_NOT_APPLICABLE" => Self::NotApplicable,
1465 "LOCALIZATION_STATE_PENDING" => Self::Pending,
1466 "LOCALIZATION_STATE_COMPLETED" => Self::Completed,
1467 _ => Self::UnknownValue(localization_state::UnknownValue(
1468 wkt::internal::UnknownEnumValue::String(value.to_string()),
1469 )),
1470 }
1471 }
1472}
1473
1474impl serde::ser::Serialize for LocalizationState {
1475 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1476 where
1477 S: serde::Serializer,
1478 {
1479 match self {
1480 Self::Unspecified => serializer.serialize_i32(0),
1481 Self::NotApplicable => serializer.serialize_i32(1),
1482 Self::Pending => serializer.serialize_i32(2),
1483 Self::Completed => serializer.serialize_i32(3),
1484 Self::UnknownValue(u) => u.0.serialize(serializer),
1485 }
1486 }
1487}
1488
1489impl<'de> serde::de::Deserialize<'de> for LocalizationState {
1490 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1491 where
1492 D: serde::Deserializer<'de>,
1493 {
1494 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LocalizationState>::new(
1495 ".google.cloud.advisorynotifications.v1.LocalizationState",
1496 ))
1497 }
1498}
1499
1500/// Type of notification
1501///
1502/// # Working with unknown values
1503///
1504/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1505/// additional enum variants at any time. Adding new variants is not considered
1506/// a breaking change. Applications should write their code in anticipation of:
1507///
1508/// - New values appearing in future releases of the client library, **and**
1509/// - New values received dynamically, without application changes.
1510///
1511/// Please consult the [Working with enums] section in the user guide for some
1512/// guidelines.
1513///
1514/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1515#[derive(Clone, Debug, PartialEq)]
1516#[non_exhaustive]
1517pub enum NotificationType {
1518 /// Default type
1519 Unspecified,
1520 /// Security and privacy advisory notifications
1521 SecurityPrivacyAdvisory,
1522 /// Sensitive action notifications
1523 SensitiveActions,
1524 /// General security MSA
1525 SecurityMsa,
1526 /// Threat horizons MSA
1527 ThreatHorizons,
1528 /// If set, the enum was initialized with an unknown value.
1529 ///
1530 /// Applications can examine the value using [NotificationType::value] or
1531 /// [NotificationType::name].
1532 UnknownValue(notification_type::UnknownValue),
1533}
1534
1535#[doc(hidden)]
1536pub mod notification_type {
1537 #[allow(unused_imports)]
1538 use super::*;
1539 #[derive(Clone, Debug, PartialEq)]
1540 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1541}
1542
1543impl NotificationType {
1544 /// Gets the enum value.
1545 ///
1546 /// Returns `None` if the enum contains an unknown value deserialized from
1547 /// the string representation of enums.
1548 pub fn value(&self) -> std::option::Option<i32> {
1549 match self {
1550 Self::Unspecified => std::option::Option::Some(0),
1551 Self::SecurityPrivacyAdvisory => std::option::Option::Some(1),
1552 Self::SensitiveActions => std::option::Option::Some(2),
1553 Self::SecurityMsa => std::option::Option::Some(3),
1554 Self::ThreatHorizons => std::option::Option::Some(4),
1555 Self::UnknownValue(u) => u.0.value(),
1556 }
1557 }
1558
1559 /// Gets the enum value as a string.
1560 ///
1561 /// Returns `None` if the enum contains an unknown value deserialized from
1562 /// the integer representation of enums.
1563 pub fn name(&self) -> std::option::Option<&str> {
1564 match self {
1565 Self::Unspecified => std::option::Option::Some("NOTIFICATION_TYPE_UNSPECIFIED"),
1566 Self::SecurityPrivacyAdvisory => {
1567 std::option::Option::Some("NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY")
1568 }
1569 Self::SensitiveActions => {
1570 std::option::Option::Some("NOTIFICATION_TYPE_SENSITIVE_ACTIONS")
1571 }
1572 Self::SecurityMsa => std::option::Option::Some("NOTIFICATION_TYPE_SECURITY_MSA"),
1573 Self::ThreatHorizons => std::option::Option::Some("NOTIFICATION_TYPE_THREAT_HORIZONS"),
1574 Self::UnknownValue(u) => u.0.name(),
1575 }
1576 }
1577}
1578
1579impl std::default::Default for NotificationType {
1580 fn default() -> Self {
1581 use std::convert::From;
1582 Self::from(0)
1583 }
1584}
1585
1586impl std::fmt::Display for NotificationType {
1587 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1588 wkt::internal::display_enum(f, self.name(), self.value())
1589 }
1590}
1591
1592impl std::convert::From<i32> for NotificationType {
1593 fn from(value: i32) -> Self {
1594 match value {
1595 0 => Self::Unspecified,
1596 1 => Self::SecurityPrivacyAdvisory,
1597 2 => Self::SensitiveActions,
1598 3 => Self::SecurityMsa,
1599 4 => Self::ThreatHorizons,
1600 _ => Self::UnknownValue(notification_type::UnknownValue(
1601 wkt::internal::UnknownEnumValue::Integer(value),
1602 )),
1603 }
1604 }
1605}
1606
1607impl std::convert::From<&str> for NotificationType {
1608 fn from(value: &str) -> Self {
1609 use std::string::ToString;
1610 match value {
1611 "NOTIFICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
1612 "NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY" => Self::SecurityPrivacyAdvisory,
1613 "NOTIFICATION_TYPE_SENSITIVE_ACTIONS" => Self::SensitiveActions,
1614 "NOTIFICATION_TYPE_SECURITY_MSA" => Self::SecurityMsa,
1615 "NOTIFICATION_TYPE_THREAT_HORIZONS" => Self::ThreatHorizons,
1616 _ => Self::UnknownValue(notification_type::UnknownValue(
1617 wkt::internal::UnknownEnumValue::String(value.to_string()),
1618 )),
1619 }
1620 }
1621}
1622
1623impl serde::ser::Serialize for NotificationType {
1624 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1625 where
1626 S: serde::Serializer,
1627 {
1628 match self {
1629 Self::Unspecified => serializer.serialize_i32(0),
1630 Self::SecurityPrivacyAdvisory => serializer.serialize_i32(1),
1631 Self::SensitiveActions => serializer.serialize_i32(2),
1632 Self::SecurityMsa => serializer.serialize_i32(3),
1633 Self::ThreatHorizons => serializer.serialize_i32(4),
1634 Self::UnknownValue(u) => u.0.serialize(serializer),
1635 }
1636 }
1637}
1638
1639impl<'de> serde::de::Deserialize<'de> for NotificationType {
1640 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1641 where
1642 D: serde::Deserializer<'de>,
1643 {
1644 deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationType>::new(
1645 ".google.cloud.advisorynotifications.v1.NotificationType",
1646 ))
1647 }
1648}