Skip to main content

google_cloud_essentialcontacts_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 contact that will receive notifications from Google Cloud.
36#[derive(Clone, Default, PartialEq)]
37#[non_exhaustive]
38pub struct Contact {
39    /// Output only. The identifier for the contact.
40    /// Format: {resource_type}/{resource_id}/contacts/{contact_id}
41    pub name: std::string::String,
42
43    /// Required. The email address to send notifications to. The email address
44    /// does not need to be a Google Account.
45    pub email: std::string::String,
46
47    /// Required. The categories of notifications that the contact will receive
48    /// communications for.
49    pub notification_category_subscriptions: std::vec::Vec<crate::model::NotificationCategory>,
50
51    /// Required. The preferred language for notifications, as a ISO 639-1 language
52    /// code. See [Supported
53    /// languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
54    /// for a list of supported languages.
55    pub language_tag: std::string::String,
56
57    /// Output only. The validity of the contact. A contact is considered valid if
58    /// it is the correct recipient for notifications for a particular resource.
59    pub validation_state: crate::model::ValidationState,
60
61    /// The last time the validation_state was updated, either manually or
62    /// automatically. A contact is considered stale if its validation state was
63    /// updated more than 1 year ago.
64    pub validate_time: std::option::Option<wkt::Timestamp>,
65
66    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
67}
68
69impl Contact {
70    pub fn new() -> Self {
71        std::default::Default::default()
72    }
73
74    /// Sets the value of [name][crate::model::Contact::name].
75    ///
76    /// # Example
77    /// ```ignore,no_run
78    /// # use google_cloud_essentialcontacts_v1::model::Contact;
79    /// let x = Contact::new().set_name("example");
80    /// ```
81    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82        self.name = v.into();
83        self
84    }
85
86    /// Sets the value of [email][crate::model::Contact::email].
87    ///
88    /// # Example
89    /// ```ignore,no_run
90    /// # use google_cloud_essentialcontacts_v1::model::Contact;
91    /// let x = Contact::new().set_email("example");
92    /// ```
93    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94        self.email = v.into();
95        self
96    }
97
98    /// Sets the value of [notification_category_subscriptions][crate::model::Contact::notification_category_subscriptions].
99    ///
100    /// # Example
101    /// ```ignore,no_run
102    /// # use google_cloud_essentialcontacts_v1::model::Contact;
103    /// use google_cloud_essentialcontacts_v1::model::NotificationCategory;
104    /// let x = Contact::new().set_notification_category_subscriptions([
105    ///     NotificationCategory::All,
106    ///     NotificationCategory::Suspension,
107    ///     NotificationCategory::Security,
108    /// ]);
109    /// ```
110    pub fn set_notification_category_subscriptions<T, V>(mut self, v: T) -> Self
111    where
112        T: std::iter::IntoIterator<Item = V>,
113        V: std::convert::Into<crate::model::NotificationCategory>,
114    {
115        use std::iter::Iterator;
116        self.notification_category_subscriptions = v.into_iter().map(|i| i.into()).collect();
117        self
118    }
119
120    /// Sets the value of [language_tag][crate::model::Contact::language_tag].
121    ///
122    /// # Example
123    /// ```ignore,no_run
124    /// # use google_cloud_essentialcontacts_v1::model::Contact;
125    /// let x = Contact::new().set_language_tag("example");
126    /// ```
127    pub fn set_language_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
128        self.language_tag = v.into();
129        self
130    }
131
132    /// Sets the value of [validation_state][crate::model::Contact::validation_state].
133    ///
134    /// # Example
135    /// ```ignore,no_run
136    /// # use google_cloud_essentialcontacts_v1::model::Contact;
137    /// use google_cloud_essentialcontacts_v1::model::ValidationState;
138    /// let x0 = Contact::new().set_validation_state(ValidationState::Valid);
139    /// let x1 = Contact::new().set_validation_state(ValidationState::Invalid);
140    /// ```
141    pub fn set_validation_state<T: std::convert::Into<crate::model::ValidationState>>(
142        mut self,
143        v: T,
144    ) -> Self {
145        self.validation_state = v.into();
146        self
147    }
148
149    /// Sets the value of [validate_time][crate::model::Contact::validate_time].
150    ///
151    /// # Example
152    /// ```ignore,no_run
153    /// # use google_cloud_essentialcontacts_v1::model::Contact;
154    /// use wkt::Timestamp;
155    /// let x = Contact::new().set_validate_time(Timestamp::default()/* use setters */);
156    /// ```
157    pub fn set_validate_time<T>(mut self, v: T) -> Self
158    where
159        T: std::convert::Into<wkt::Timestamp>,
160    {
161        self.validate_time = std::option::Option::Some(v.into());
162        self
163    }
164
165    /// Sets or clears the value of [validate_time][crate::model::Contact::validate_time].
166    ///
167    /// # Example
168    /// ```ignore,no_run
169    /// # use google_cloud_essentialcontacts_v1::model::Contact;
170    /// use wkt::Timestamp;
171    /// let x = Contact::new().set_or_clear_validate_time(Some(Timestamp::default()/* use setters */));
172    /// let x = Contact::new().set_or_clear_validate_time(None::<Timestamp>);
173    /// ```
174    pub fn set_or_clear_validate_time<T>(mut self, v: std::option::Option<T>) -> Self
175    where
176        T: std::convert::Into<wkt::Timestamp>,
177    {
178        self.validate_time = v.map(|x| x.into());
179        self
180    }
181}
182
183impl wkt::message::Message for Contact {
184    fn typename() -> &'static str {
185        "type.googleapis.com/google.cloud.essentialcontacts.v1.Contact"
186    }
187}
188
189/// Request message for the ListContacts method.
190#[derive(Clone, Default, PartialEq)]
191#[non_exhaustive]
192pub struct ListContactsRequest {
193    /// Required. The parent resource name.
194    /// Format: organizations/{organization_id}, folders/{folder_id} or
195    /// projects/{project_id}
196    pub parent: std::string::String,
197
198    /// Optional. The maximum number of results to return from this request.
199    /// Non-positive values are ignored. The presence of `next_page_token` in the
200    /// response indicates that more results might be available.
201    /// If not specified, the default page_size is 100.
202    pub page_size: i32,
203
204    /// Optional. If present, retrieves the next batch of results from the
205    /// preceding call to this method. `page_token` must be the value of
206    /// `next_page_token` from the previous response. The values of other method
207    /// parameters should be identical to those in the previous call.
208    pub page_token: std::string::String,
209
210    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
211}
212
213impl ListContactsRequest {
214    pub fn new() -> Self {
215        std::default::Default::default()
216    }
217
218    /// Sets the value of [parent][crate::model::ListContactsRequest::parent].
219    ///
220    /// # Example
221    /// ```ignore,no_run
222    /// # use google_cloud_essentialcontacts_v1::model::ListContactsRequest;
223    /// let x = ListContactsRequest::new().set_parent("example");
224    /// ```
225    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
226        self.parent = v.into();
227        self
228    }
229
230    /// Sets the value of [page_size][crate::model::ListContactsRequest::page_size].
231    ///
232    /// # Example
233    /// ```ignore,no_run
234    /// # use google_cloud_essentialcontacts_v1::model::ListContactsRequest;
235    /// let x = ListContactsRequest::new().set_page_size(42);
236    /// ```
237    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
238        self.page_size = v.into();
239        self
240    }
241
242    /// Sets the value of [page_token][crate::model::ListContactsRequest::page_token].
243    ///
244    /// # Example
245    /// ```ignore,no_run
246    /// # use google_cloud_essentialcontacts_v1::model::ListContactsRequest;
247    /// let x = ListContactsRequest::new().set_page_token("example");
248    /// ```
249    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250        self.page_token = v.into();
251        self
252    }
253}
254
255impl wkt::message::Message for ListContactsRequest {
256    fn typename() -> &'static str {
257        "type.googleapis.com/google.cloud.essentialcontacts.v1.ListContactsRequest"
258    }
259}
260
261/// Response message for the ListContacts method.
262#[derive(Clone, Default, PartialEq)]
263#[non_exhaustive]
264pub struct ListContactsResponse {
265    /// The contacts for the specified resource.
266    pub contacts: std::vec::Vec<crate::model::Contact>,
267
268    /// If there are more results than those appearing in this response, then
269    /// `next_page_token` is included. To get the next set of results, call this
270    /// method again using the value of `next_page_token` as `page_token` and the
271    /// rest of the parameters the same as the original request.
272    pub next_page_token: std::string::String,
273
274    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
275}
276
277impl ListContactsResponse {
278    pub fn new() -> Self {
279        std::default::Default::default()
280    }
281
282    /// Sets the value of [contacts][crate::model::ListContactsResponse::contacts].
283    ///
284    /// # Example
285    /// ```ignore,no_run
286    /// # use google_cloud_essentialcontacts_v1::model::ListContactsResponse;
287    /// use google_cloud_essentialcontacts_v1::model::Contact;
288    /// let x = ListContactsResponse::new()
289    ///     .set_contacts([
290    ///         Contact::default()/* use setters */,
291    ///         Contact::default()/* use (different) setters */,
292    ///     ]);
293    /// ```
294    pub fn set_contacts<T, V>(mut self, v: T) -> Self
295    where
296        T: std::iter::IntoIterator<Item = V>,
297        V: std::convert::Into<crate::model::Contact>,
298    {
299        use std::iter::Iterator;
300        self.contacts = v.into_iter().map(|i| i.into()).collect();
301        self
302    }
303
304    /// Sets the value of [next_page_token][crate::model::ListContactsResponse::next_page_token].
305    ///
306    /// # Example
307    /// ```ignore,no_run
308    /// # use google_cloud_essentialcontacts_v1::model::ListContactsResponse;
309    /// let x = ListContactsResponse::new().set_next_page_token("example");
310    /// ```
311    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
312        self.next_page_token = v.into();
313        self
314    }
315}
316
317impl wkt::message::Message for ListContactsResponse {
318    fn typename() -> &'static str {
319        "type.googleapis.com/google.cloud.essentialcontacts.v1.ListContactsResponse"
320    }
321}
322
323#[doc(hidden)]
324impl google_cloud_gax::paginator::internal::PageableResponse for ListContactsResponse {
325    type PageItem = crate::model::Contact;
326
327    fn items(self) -> std::vec::Vec<Self::PageItem> {
328        self.contacts
329    }
330
331    fn next_page_token(&self) -> std::string::String {
332        use std::clone::Clone;
333        self.next_page_token.clone()
334    }
335}
336
337/// Request message for the GetContact method.
338#[derive(Clone, Default, PartialEq)]
339#[non_exhaustive]
340pub struct GetContactRequest {
341    /// Required. The name of the contact to retrieve.
342    /// Format: organizations/{organization_id}/contacts/{contact_id},
343    /// folders/{folder_id}/contacts/{contact_id} or
344    /// projects/{project_id}/contacts/{contact_id}
345    pub name: std::string::String,
346
347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
348}
349
350impl GetContactRequest {
351    pub fn new() -> Self {
352        std::default::Default::default()
353    }
354
355    /// Sets the value of [name][crate::model::GetContactRequest::name].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_essentialcontacts_v1::model::GetContactRequest;
360    /// let x = GetContactRequest::new().set_name("example");
361    /// ```
362    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
363        self.name = v.into();
364        self
365    }
366}
367
368impl wkt::message::Message for GetContactRequest {
369    fn typename() -> &'static str {
370        "type.googleapis.com/google.cloud.essentialcontacts.v1.GetContactRequest"
371    }
372}
373
374/// Request message for the DeleteContact method.
375#[derive(Clone, Default, PartialEq)]
376#[non_exhaustive]
377pub struct DeleteContactRequest {
378    /// Required. The name of the contact to delete.
379    /// Format: organizations/{organization_id}/contacts/{contact_id},
380    /// folders/{folder_id}/contacts/{contact_id} or
381    /// projects/{project_id}/contacts/{contact_id}
382    pub name: std::string::String,
383
384    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
385}
386
387impl DeleteContactRequest {
388    pub fn new() -> Self {
389        std::default::Default::default()
390    }
391
392    /// Sets the value of [name][crate::model::DeleteContactRequest::name].
393    ///
394    /// # Example
395    /// ```ignore,no_run
396    /// # use google_cloud_essentialcontacts_v1::model::DeleteContactRequest;
397    /// let x = DeleteContactRequest::new().set_name("example");
398    /// ```
399    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
400        self.name = v.into();
401        self
402    }
403}
404
405impl wkt::message::Message for DeleteContactRequest {
406    fn typename() -> &'static str {
407        "type.googleapis.com/google.cloud.essentialcontacts.v1.DeleteContactRequest"
408    }
409}
410
411/// Request message for the CreateContact method.
412#[derive(Clone, Default, PartialEq)]
413#[non_exhaustive]
414pub struct CreateContactRequest {
415    /// Required. The resource to save this contact for.
416    /// Format: organizations/{organization_id}, folders/{folder_id} or
417    /// projects/{project_id}
418    pub parent: std::string::String,
419
420    /// Required. The contact to create. Must specify an email address and language
421    /// tag.
422    pub contact: std::option::Option<crate::model::Contact>,
423
424    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
425}
426
427impl CreateContactRequest {
428    pub fn new() -> Self {
429        std::default::Default::default()
430    }
431
432    /// Sets the value of [parent][crate::model::CreateContactRequest::parent].
433    ///
434    /// # Example
435    /// ```ignore,no_run
436    /// # use google_cloud_essentialcontacts_v1::model::CreateContactRequest;
437    /// let x = CreateContactRequest::new().set_parent("example");
438    /// ```
439    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
440        self.parent = v.into();
441        self
442    }
443
444    /// Sets the value of [contact][crate::model::CreateContactRequest::contact].
445    ///
446    /// # Example
447    /// ```ignore,no_run
448    /// # use google_cloud_essentialcontacts_v1::model::CreateContactRequest;
449    /// use google_cloud_essentialcontacts_v1::model::Contact;
450    /// let x = CreateContactRequest::new().set_contact(Contact::default()/* use setters */);
451    /// ```
452    pub fn set_contact<T>(mut self, v: T) -> Self
453    where
454        T: std::convert::Into<crate::model::Contact>,
455    {
456        self.contact = std::option::Option::Some(v.into());
457        self
458    }
459
460    /// Sets or clears the value of [contact][crate::model::CreateContactRequest::contact].
461    ///
462    /// # Example
463    /// ```ignore,no_run
464    /// # use google_cloud_essentialcontacts_v1::model::CreateContactRequest;
465    /// use google_cloud_essentialcontacts_v1::model::Contact;
466    /// let x = CreateContactRequest::new().set_or_clear_contact(Some(Contact::default()/* use setters */));
467    /// let x = CreateContactRequest::new().set_or_clear_contact(None::<Contact>);
468    /// ```
469    pub fn set_or_clear_contact<T>(mut self, v: std::option::Option<T>) -> Self
470    where
471        T: std::convert::Into<crate::model::Contact>,
472    {
473        self.contact = v.map(|x| x.into());
474        self
475    }
476}
477
478impl wkt::message::Message for CreateContactRequest {
479    fn typename() -> &'static str {
480        "type.googleapis.com/google.cloud.essentialcontacts.v1.CreateContactRequest"
481    }
482}
483
484/// Request message for the UpdateContact method.
485#[derive(Clone, Default, PartialEq)]
486#[non_exhaustive]
487pub struct UpdateContactRequest {
488    /// Required. The contact resource to replace the existing saved contact. Note:
489    /// the email address of the contact cannot be modified.
490    pub contact: std::option::Option<crate::model::Contact>,
491
492    /// Optional. The update mask applied to the resource. For the `FieldMask`
493    /// definition, see
494    /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask>
495    pub update_mask: std::option::Option<wkt::FieldMask>,
496
497    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
498}
499
500impl UpdateContactRequest {
501    pub fn new() -> Self {
502        std::default::Default::default()
503    }
504
505    /// Sets the value of [contact][crate::model::UpdateContactRequest::contact].
506    ///
507    /// # Example
508    /// ```ignore,no_run
509    /// # use google_cloud_essentialcontacts_v1::model::UpdateContactRequest;
510    /// use google_cloud_essentialcontacts_v1::model::Contact;
511    /// let x = UpdateContactRequest::new().set_contact(Contact::default()/* use setters */);
512    /// ```
513    pub fn set_contact<T>(mut self, v: T) -> Self
514    where
515        T: std::convert::Into<crate::model::Contact>,
516    {
517        self.contact = std::option::Option::Some(v.into());
518        self
519    }
520
521    /// Sets or clears the value of [contact][crate::model::UpdateContactRequest::contact].
522    ///
523    /// # Example
524    /// ```ignore,no_run
525    /// # use google_cloud_essentialcontacts_v1::model::UpdateContactRequest;
526    /// use google_cloud_essentialcontacts_v1::model::Contact;
527    /// let x = UpdateContactRequest::new().set_or_clear_contact(Some(Contact::default()/* use setters */));
528    /// let x = UpdateContactRequest::new().set_or_clear_contact(None::<Contact>);
529    /// ```
530    pub fn set_or_clear_contact<T>(mut self, v: std::option::Option<T>) -> Self
531    where
532        T: std::convert::Into<crate::model::Contact>,
533    {
534        self.contact = v.map(|x| x.into());
535        self
536    }
537
538    /// Sets the value of [update_mask][crate::model::UpdateContactRequest::update_mask].
539    ///
540    /// # Example
541    /// ```ignore,no_run
542    /// # use google_cloud_essentialcontacts_v1::model::UpdateContactRequest;
543    /// use wkt::FieldMask;
544    /// let x = UpdateContactRequest::new().set_update_mask(FieldMask::default()/* use setters */);
545    /// ```
546    pub fn set_update_mask<T>(mut self, v: T) -> Self
547    where
548        T: std::convert::Into<wkt::FieldMask>,
549    {
550        self.update_mask = std::option::Option::Some(v.into());
551        self
552    }
553
554    /// Sets or clears the value of [update_mask][crate::model::UpdateContactRequest::update_mask].
555    ///
556    /// # Example
557    /// ```ignore,no_run
558    /// # use google_cloud_essentialcontacts_v1::model::UpdateContactRequest;
559    /// use wkt::FieldMask;
560    /// let x = UpdateContactRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
561    /// let x = UpdateContactRequest::new().set_or_clear_update_mask(None::<FieldMask>);
562    /// ```
563    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
564    where
565        T: std::convert::Into<wkt::FieldMask>,
566    {
567        self.update_mask = v.map(|x| x.into());
568        self
569    }
570}
571
572impl wkt::message::Message for UpdateContactRequest {
573    fn typename() -> &'static str {
574        "type.googleapis.com/google.cloud.essentialcontacts.v1.UpdateContactRequest"
575    }
576}
577
578/// Request message for the ComputeContacts method.
579#[derive(Clone, Default, PartialEq)]
580#[non_exhaustive]
581pub struct ComputeContactsRequest {
582    /// Required. The name of the resource to compute contacts for.
583    /// Format: organizations/{organization_id},
584    /// folders/{folder_id} or projects/{project_id}
585    pub parent: std::string::String,
586
587    /// The categories of notifications to compute contacts for. If ALL is included
588    /// in this list, contacts subscribed to any notification category will be
589    /// returned.
590    pub notification_categories: std::vec::Vec<crate::model::NotificationCategory>,
591
592    /// Optional. The maximum number of results to return from this request.
593    /// Non-positive values are ignored. The presence of `next_page_token` in the
594    /// response indicates that more results might be available.
595    /// If not specified, the default page_size is 100.
596    pub page_size: i32,
597
598    /// Optional. If present, retrieves the next batch of results from the
599    /// preceding call to this method. `page_token` must be the value of
600    /// `next_page_token` from the previous response. The values of other method
601    /// parameters should be identical to those in the previous call.
602    pub page_token: std::string::String,
603
604    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
605}
606
607impl ComputeContactsRequest {
608    pub fn new() -> Self {
609        std::default::Default::default()
610    }
611
612    /// Sets the value of [parent][crate::model::ComputeContactsRequest::parent].
613    ///
614    /// # Example
615    /// ```ignore,no_run
616    /// # use google_cloud_essentialcontacts_v1::model::ComputeContactsRequest;
617    /// let x = ComputeContactsRequest::new().set_parent("example");
618    /// ```
619    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
620        self.parent = v.into();
621        self
622    }
623
624    /// Sets the value of [notification_categories][crate::model::ComputeContactsRequest::notification_categories].
625    ///
626    /// # Example
627    /// ```ignore,no_run
628    /// # use google_cloud_essentialcontacts_v1::model::ComputeContactsRequest;
629    /// use google_cloud_essentialcontacts_v1::model::NotificationCategory;
630    /// let x = ComputeContactsRequest::new().set_notification_categories([
631    ///     NotificationCategory::All,
632    ///     NotificationCategory::Suspension,
633    ///     NotificationCategory::Security,
634    /// ]);
635    /// ```
636    pub fn set_notification_categories<T, V>(mut self, v: T) -> Self
637    where
638        T: std::iter::IntoIterator<Item = V>,
639        V: std::convert::Into<crate::model::NotificationCategory>,
640    {
641        use std::iter::Iterator;
642        self.notification_categories = v.into_iter().map(|i| i.into()).collect();
643        self
644    }
645
646    /// Sets the value of [page_size][crate::model::ComputeContactsRequest::page_size].
647    ///
648    /// # Example
649    /// ```ignore,no_run
650    /// # use google_cloud_essentialcontacts_v1::model::ComputeContactsRequest;
651    /// let x = ComputeContactsRequest::new().set_page_size(42);
652    /// ```
653    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
654        self.page_size = v.into();
655        self
656    }
657
658    /// Sets the value of [page_token][crate::model::ComputeContactsRequest::page_token].
659    ///
660    /// # Example
661    /// ```ignore,no_run
662    /// # use google_cloud_essentialcontacts_v1::model::ComputeContactsRequest;
663    /// let x = ComputeContactsRequest::new().set_page_token("example");
664    /// ```
665    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
666        self.page_token = v.into();
667        self
668    }
669}
670
671impl wkt::message::Message for ComputeContactsRequest {
672    fn typename() -> &'static str {
673        "type.googleapis.com/google.cloud.essentialcontacts.v1.ComputeContactsRequest"
674    }
675}
676
677/// Response message for the ComputeContacts method.
678#[derive(Clone, Default, PartialEq)]
679#[non_exhaustive]
680pub struct ComputeContactsResponse {
681    /// All contacts for the resource that are subscribed to the specified
682    /// notification categories, including contacts inherited from any parent
683    /// resources.
684    pub contacts: std::vec::Vec<crate::model::Contact>,
685
686    /// If there are more results than those appearing in this response, then
687    /// `next_page_token` is included. To get the next set of results, call this
688    /// method again using the value of `next_page_token` as `page_token` and the
689    /// rest of the parameters the same as the original request.
690    pub next_page_token: std::string::String,
691
692    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
693}
694
695impl ComputeContactsResponse {
696    pub fn new() -> Self {
697        std::default::Default::default()
698    }
699
700    /// Sets the value of [contacts][crate::model::ComputeContactsResponse::contacts].
701    ///
702    /// # Example
703    /// ```ignore,no_run
704    /// # use google_cloud_essentialcontacts_v1::model::ComputeContactsResponse;
705    /// use google_cloud_essentialcontacts_v1::model::Contact;
706    /// let x = ComputeContactsResponse::new()
707    ///     .set_contacts([
708    ///         Contact::default()/* use setters */,
709    ///         Contact::default()/* use (different) setters */,
710    ///     ]);
711    /// ```
712    pub fn set_contacts<T, V>(mut self, v: T) -> Self
713    where
714        T: std::iter::IntoIterator<Item = V>,
715        V: std::convert::Into<crate::model::Contact>,
716    {
717        use std::iter::Iterator;
718        self.contacts = v.into_iter().map(|i| i.into()).collect();
719        self
720    }
721
722    /// Sets the value of [next_page_token][crate::model::ComputeContactsResponse::next_page_token].
723    ///
724    /// # Example
725    /// ```ignore,no_run
726    /// # use google_cloud_essentialcontacts_v1::model::ComputeContactsResponse;
727    /// let x = ComputeContactsResponse::new().set_next_page_token("example");
728    /// ```
729    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
730        self.next_page_token = v.into();
731        self
732    }
733}
734
735impl wkt::message::Message for ComputeContactsResponse {
736    fn typename() -> &'static str {
737        "type.googleapis.com/google.cloud.essentialcontacts.v1.ComputeContactsResponse"
738    }
739}
740
741#[doc(hidden)]
742impl google_cloud_gax::paginator::internal::PageableResponse for ComputeContactsResponse {
743    type PageItem = crate::model::Contact;
744
745    fn items(self) -> std::vec::Vec<Self::PageItem> {
746        self.contacts
747    }
748
749    fn next_page_token(&self) -> std::string::String {
750        use std::clone::Clone;
751        self.next_page_token.clone()
752    }
753}
754
755/// Request message for the SendTestMessage method.
756#[derive(Clone, Default, PartialEq)]
757#[non_exhaustive]
758pub struct SendTestMessageRequest {
759    /// Required. The list of names of the contacts to send a test message to.
760    /// Format: organizations/{organization_id}/contacts/{contact_id},
761    /// folders/{folder_id}/contacts/{contact_id} or
762    /// projects/{project_id}/contacts/{contact_id}
763    pub contacts: std::vec::Vec<std::string::String>,
764
765    /// Required. The name of the resource to send the test message for. All
766    /// contacts must either be set directly on this resource or inherited from
767    /// another resource that is an ancestor of this one. Format:
768    /// organizations/{organization_id}, folders/{folder_id} or
769    /// projects/{project_id}
770    pub resource: std::string::String,
771
772    /// Required. The notification category to send the test message for. All
773    /// contacts must be subscribed to this category.
774    pub notification_category: crate::model::NotificationCategory,
775
776    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
777}
778
779impl SendTestMessageRequest {
780    pub fn new() -> Self {
781        std::default::Default::default()
782    }
783
784    /// Sets the value of [contacts][crate::model::SendTestMessageRequest::contacts].
785    ///
786    /// # Example
787    /// ```ignore,no_run
788    /// # use google_cloud_essentialcontacts_v1::model::SendTestMessageRequest;
789    /// let x = SendTestMessageRequest::new().set_contacts(["a", "b", "c"]);
790    /// ```
791    pub fn set_contacts<T, V>(mut self, v: T) -> Self
792    where
793        T: std::iter::IntoIterator<Item = V>,
794        V: std::convert::Into<std::string::String>,
795    {
796        use std::iter::Iterator;
797        self.contacts = v.into_iter().map(|i| i.into()).collect();
798        self
799    }
800
801    /// Sets the value of [resource][crate::model::SendTestMessageRequest::resource].
802    ///
803    /// # Example
804    /// ```ignore,no_run
805    /// # use google_cloud_essentialcontacts_v1::model::SendTestMessageRequest;
806    /// let x = SendTestMessageRequest::new().set_resource("example");
807    /// ```
808    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
809        self.resource = v.into();
810        self
811    }
812
813    /// Sets the value of [notification_category][crate::model::SendTestMessageRequest::notification_category].
814    ///
815    /// # Example
816    /// ```ignore,no_run
817    /// # use google_cloud_essentialcontacts_v1::model::SendTestMessageRequest;
818    /// use google_cloud_essentialcontacts_v1::model::NotificationCategory;
819    /// let x0 = SendTestMessageRequest::new().set_notification_category(NotificationCategory::All);
820    /// let x1 = SendTestMessageRequest::new().set_notification_category(NotificationCategory::Suspension);
821    /// let x2 = SendTestMessageRequest::new().set_notification_category(NotificationCategory::Security);
822    /// ```
823    pub fn set_notification_category<T: std::convert::Into<crate::model::NotificationCategory>>(
824        mut self,
825        v: T,
826    ) -> Self {
827        self.notification_category = v.into();
828        self
829    }
830}
831
832impl wkt::message::Message for SendTestMessageRequest {
833    fn typename() -> &'static str {
834        "type.googleapis.com/google.cloud.essentialcontacts.v1.SendTestMessageRequest"
835    }
836}
837
838/// The notification categories that an essential contact can be subscribed to.
839/// Each notification will be categorized by the sender into one of the following
840/// categories. All contacts that are subscribed to that category will receive
841/// the notification.
842///
843/// # Working with unknown values
844///
845/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
846/// additional enum variants at any time. Adding new variants is not considered
847/// a breaking change. Applications should write their code in anticipation of:
848///
849/// - New values appearing in future releases of the client library, **and**
850/// - New values received dynamically, without application changes.
851///
852/// Please consult the [Working with enums] section in the user guide for some
853/// guidelines.
854///
855/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
856#[derive(Clone, Debug, PartialEq)]
857#[non_exhaustive]
858pub enum NotificationCategory {
859    /// Notification category is unrecognized or unspecified.
860    Unspecified,
861    /// All notifications related to the resource, including notifications
862    /// pertaining to categories added in the future.
863    All,
864    /// Notifications related to imminent account suspension.
865    Suspension,
866    /// Notifications related to security/privacy incidents, notifications, and
867    /// vulnerabilities.
868    Security,
869    /// Notifications related to technical events and issues such as outages,
870    /// errors, or bugs.
871    Technical,
872    /// Notifications related to billing and payments notifications, price updates,
873    /// errors, or credits.
874    Billing,
875    /// Notifications related to enforcement actions, regulatory compliance, or
876    /// government notices.
877    Legal,
878    /// Notifications related to new versions, product terms updates, or
879    /// deprecations.
880    ProductUpdates,
881    /// Child category of TECHNICAL. If assigned, technical incident notifications
882    /// will go to these contacts instead of TECHNICAL.
883    TechnicalIncidents,
884    /// If set, the enum was initialized with an unknown value.
885    ///
886    /// Applications can examine the value using [NotificationCategory::value] or
887    /// [NotificationCategory::name].
888    UnknownValue(notification_category::UnknownValue),
889}
890
891#[doc(hidden)]
892pub mod notification_category {
893    #[allow(unused_imports)]
894    use super::*;
895    #[derive(Clone, Debug, PartialEq)]
896    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
897}
898
899impl NotificationCategory {
900    /// Gets the enum value.
901    ///
902    /// Returns `None` if the enum contains an unknown value deserialized from
903    /// the string representation of enums.
904    pub fn value(&self) -> std::option::Option<i32> {
905        match self {
906            Self::Unspecified => std::option::Option::Some(0),
907            Self::All => std::option::Option::Some(2),
908            Self::Suspension => std::option::Option::Some(3),
909            Self::Security => std::option::Option::Some(5),
910            Self::Technical => std::option::Option::Some(6),
911            Self::Billing => std::option::Option::Some(7),
912            Self::Legal => std::option::Option::Some(8),
913            Self::ProductUpdates => std::option::Option::Some(9),
914            Self::TechnicalIncidents => std::option::Option::Some(10),
915            Self::UnknownValue(u) => u.0.value(),
916        }
917    }
918
919    /// Gets the enum value as a string.
920    ///
921    /// Returns `None` if the enum contains an unknown value deserialized from
922    /// the integer representation of enums.
923    pub fn name(&self) -> std::option::Option<&str> {
924        match self {
925            Self::Unspecified => std::option::Option::Some("NOTIFICATION_CATEGORY_UNSPECIFIED"),
926            Self::All => std::option::Option::Some("ALL"),
927            Self::Suspension => std::option::Option::Some("SUSPENSION"),
928            Self::Security => std::option::Option::Some("SECURITY"),
929            Self::Technical => std::option::Option::Some("TECHNICAL"),
930            Self::Billing => std::option::Option::Some("BILLING"),
931            Self::Legal => std::option::Option::Some("LEGAL"),
932            Self::ProductUpdates => std::option::Option::Some("PRODUCT_UPDATES"),
933            Self::TechnicalIncidents => std::option::Option::Some("TECHNICAL_INCIDENTS"),
934            Self::UnknownValue(u) => u.0.name(),
935        }
936    }
937}
938
939impl std::default::Default for NotificationCategory {
940    fn default() -> Self {
941        use std::convert::From;
942        Self::from(0)
943    }
944}
945
946impl std::fmt::Display for NotificationCategory {
947    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
948        wkt::internal::display_enum(f, self.name(), self.value())
949    }
950}
951
952impl std::convert::From<i32> for NotificationCategory {
953    fn from(value: i32) -> Self {
954        match value {
955            0 => Self::Unspecified,
956            2 => Self::All,
957            3 => Self::Suspension,
958            5 => Self::Security,
959            6 => Self::Technical,
960            7 => Self::Billing,
961            8 => Self::Legal,
962            9 => Self::ProductUpdates,
963            10 => Self::TechnicalIncidents,
964            _ => Self::UnknownValue(notification_category::UnknownValue(
965                wkt::internal::UnknownEnumValue::Integer(value),
966            )),
967        }
968    }
969}
970
971impl std::convert::From<&str> for NotificationCategory {
972    fn from(value: &str) -> Self {
973        use std::string::ToString;
974        match value {
975            "NOTIFICATION_CATEGORY_UNSPECIFIED" => Self::Unspecified,
976            "ALL" => Self::All,
977            "SUSPENSION" => Self::Suspension,
978            "SECURITY" => Self::Security,
979            "TECHNICAL" => Self::Technical,
980            "BILLING" => Self::Billing,
981            "LEGAL" => Self::Legal,
982            "PRODUCT_UPDATES" => Self::ProductUpdates,
983            "TECHNICAL_INCIDENTS" => Self::TechnicalIncidents,
984            _ => Self::UnknownValue(notification_category::UnknownValue(
985                wkt::internal::UnknownEnumValue::String(value.to_string()),
986            )),
987        }
988    }
989}
990
991impl serde::ser::Serialize for NotificationCategory {
992    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
993    where
994        S: serde::Serializer,
995    {
996        match self {
997            Self::Unspecified => serializer.serialize_i32(0),
998            Self::All => serializer.serialize_i32(2),
999            Self::Suspension => serializer.serialize_i32(3),
1000            Self::Security => serializer.serialize_i32(5),
1001            Self::Technical => serializer.serialize_i32(6),
1002            Self::Billing => serializer.serialize_i32(7),
1003            Self::Legal => serializer.serialize_i32(8),
1004            Self::ProductUpdates => serializer.serialize_i32(9),
1005            Self::TechnicalIncidents => serializer.serialize_i32(10),
1006            Self::UnknownValue(u) => u.0.serialize(serializer),
1007        }
1008    }
1009}
1010
1011impl<'de> serde::de::Deserialize<'de> for NotificationCategory {
1012    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1013    where
1014        D: serde::Deserializer<'de>,
1015    {
1016        deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationCategory>::new(
1017            ".google.cloud.essentialcontacts.v1.NotificationCategory",
1018        ))
1019    }
1020}
1021
1022/// A contact's validation state indicates whether or not it is the correct
1023/// contact to be receiving notifications for a particular resource.
1024///
1025/// # Working with unknown values
1026///
1027/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1028/// additional enum variants at any time. Adding new variants is not considered
1029/// a breaking change. Applications should write their code in anticipation of:
1030///
1031/// - New values appearing in future releases of the client library, **and**
1032/// - New values received dynamically, without application changes.
1033///
1034/// Please consult the [Working with enums] section in the user guide for some
1035/// guidelines.
1036///
1037/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1038#[derive(Clone, Debug, PartialEq)]
1039#[non_exhaustive]
1040pub enum ValidationState {
1041    /// The validation state is unknown or unspecified.
1042    Unspecified,
1043    /// The contact is marked as valid. This is usually done manually by the
1044    /// contact admin. All new contacts begin in the valid state.
1045    Valid,
1046    /// The contact is considered invalid. This may become the state if the
1047    /// contact's email is found to be unreachable.
1048    Invalid,
1049    /// If set, the enum was initialized with an unknown value.
1050    ///
1051    /// Applications can examine the value using [ValidationState::value] or
1052    /// [ValidationState::name].
1053    UnknownValue(validation_state::UnknownValue),
1054}
1055
1056#[doc(hidden)]
1057pub mod validation_state {
1058    #[allow(unused_imports)]
1059    use super::*;
1060    #[derive(Clone, Debug, PartialEq)]
1061    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1062}
1063
1064impl ValidationState {
1065    /// Gets the enum value.
1066    ///
1067    /// Returns `None` if the enum contains an unknown value deserialized from
1068    /// the string representation of enums.
1069    pub fn value(&self) -> std::option::Option<i32> {
1070        match self {
1071            Self::Unspecified => std::option::Option::Some(0),
1072            Self::Valid => std::option::Option::Some(1),
1073            Self::Invalid => std::option::Option::Some(2),
1074            Self::UnknownValue(u) => u.0.value(),
1075        }
1076    }
1077
1078    /// Gets the enum value as a string.
1079    ///
1080    /// Returns `None` if the enum contains an unknown value deserialized from
1081    /// the integer representation of enums.
1082    pub fn name(&self) -> std::option::Option<&str> {
1083        match self {
1084            Self::Unspecified => std::option::Option::Some("VALIDATION_STATE_UNSPECIFIED"),
1085            Self::Valid => std::option::Option::Some("VALID"),
1086            Self::Invalid => std::option::Option::Some("INVALID"),
1087            Self::UnknownValue(u) => u.0.name(),
1088        }
1089    }
1090}
1091
1092impl std::default::Default for ValidationState {
1093    fn default() -> Self {
1094        use std::convert::From;
1095        Self::from(0)
1096    }
1097}
1098
1099impl std::fmt::Display for ValidationState {
1100    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1101        wkt::internal::display_enum(f, self.name(), self.value())
1102    }
1103}
1104
1105impl std::convert::From<i32> for ValidationState {
1106    fn from(value: i32) -> Self {
1107        match value {
1108            0 => Self::Unspecified,
1109            1 => Self::Valid,
1110            2 => Self::Invalid,
1111            _ => Self::UnknownValue(validation_state::UnknownValue(
1112                wkt::internal::UnknownEnumValue::Integer(value),
1113            )),
1114        }
1115    }
1116}
1117
1118impl std::convert::From<&str> for ValidationState {
1119    fn from(value: &str) -> Self {
1120        use std::string::ToString;
1121        match value {
1122            "VALIDATION_STATE_UNSPECIFIED" => Self::Unspecified,
1123            "VALID" => Self::Valid,
1124            "INVALID" => Self::Invalid,
1125            _ => Self::UnknownValue(validation_state::UnknownValue(
1126                wkt::internal::UnknownEnumValue::String(value.to_string()),
1127            )),
1128        }
1129    }
1130}
1131
1132impl serde::ser::Serialize for ValidationState {
1133    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1134    where
1135        S: serde::Serializer,
1136    {
1137        match self {
1138            Self::Unspecified => serializer.serialize_i32(0),
1139            Self::Valid => serializer.serialize_i32(1),
1140            Self::Invalid => serializer.serialize_i32(2),
1141            Self::UnknownValue(u) => u.0.serialize(serializer),
1142        }
1143    }
1144}
1145
1146impl<'de> serde::de::Deserialize<'de> for ValidationState {
1147    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1148    where
1149        D: serde::Deserializer<'de>,
1150    {
1151        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationState>::new(
1152            ".google.cloud.essentialcontacts.v1.ValidationState",
1153        ))
1154    }
1155}