1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
// This file is @generated by prost-build.
/// The notification categories that an essential contact can be subscribed to.
/// Each notification will be categorized by the sender into one of the following
/// categories. All contacts that are subscribed to that category will receive
/// the notification.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NotificationCategory {
    /// Notification category is unrecognized or unspecified.
    Unspecified = 0,
    /// All notifications related to the resource, including notifications
    /// pertaining to categories added in the future.
    All = 2,
    /// Notifications related to imminent account suspension.
    Suspension = 3,
    /// Notifications related to security/privacy incidents, notifications, and
    /// vulnerabilities.
    Security = 5,
    /// Notifications related to technical events and issues such as outages,
    /// errors, or bugs.
    Technical = 6,
    /// Notifications related to billing and payments notifications, price updates,
    /// errors, or credits.
    Billing = 7,
    /// Notifications related to enforcement actions, regulatory compliance, or
    /// government notices.
    Legal = 8,
    /// Notifications related to new versions, product terms updates, or
    /// deprecations.
    ProductUpdates = 9,
    /// Child category of TECHNICAL. If assigned, technical incident notifications
    /// will go to these contacts instead of TECHNICAL.
    TechnicalIncidents = 10,
}
impl NotificationCategory {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            NotificationCategory::Unspecified => "NOTIFICATION_CATEGORY_UNSPECIFIED",
            NotificationCategory::All => "ALL",
            NotificationCategory::Suspension => "SUSPENSION",
            NotificationCategory::Security => "SECURITY",
            NotificationCategory::Technical => "TECHNICAL",
            NotificationCategory::Billing => "BILLING",
            NotificationCategory::Legal => "LEGAL",
            NotificationCategory::ProductUpdates => "PRODUCT_UPDATES",
            NotificationCategory::TechnicalIncidents => "TECHNICAL_INCIDENTS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "NOTIFICATION_CATEGORY_UNSPECIFIED" => Some(Self::Unspecified),
            "ALL" => Some(Self::All),
            "SUSPENSION" => Some(Self::Suspension),
            "SECURITY" => Some(Self::Security),
            "TECHNICAL" => Some(Self::Technical),
            "BILLING" => Some(Self::Billing),
            "LEGAL" => Some(Self::Legal),
            "PRODUCT_UPDATES" => Some(Self::ProductUpdates),
            "TECHNICAL_INCIDENTS" => Some(Self::TechnicalIncidents),
            _ => None,
        }
    }
}
/// A contact's validation state indicates whether or not it is the correct
/// contact to be receiving notifications for a particular resource.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ValidationState {
    /// The validation state is unknown or unspecified.
    Unspecified = 0,
    /// The contact is marked as valid. This is usually done manually by the
    /// contact admin. All new contacts begin in the valid state.
    Valid = 1,
    /// The contact is considered invalid. This may become the state if the
    /// contact's email is found to be unreachable.
    Invalid = 2,
}
impl ValidationState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            ValidationState::Unspecified => "VALIDATION_STATE_UNSPECIFIED",
            ValidationState::Valid => "VALID",
            ValidationState::Invalid => "INVALID",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "VALIDATION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "VALID" => Some(Self::Valid),
            "INVALID" => Some(Self::Invalid),
            _ => None,
        }
    }
}
/// A contact that will receive notifications from Google Cloud.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Contact {
    /// Output only. The identifier for the contact.
    /// Format: {resource_type}/{resource_id}/contacts/{contact_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Required. The email address to send notifications to. The email address
    /// does not need to be a Google Account.
    #[prost(string, tag = "2")]
    pub email: ::prost::alloc::string::String,
    /// Required. The categories of notifications that the contact will receive
    /// communications for.
    #[prost(enumeration = "NotificationCategory", repeated, packed = "false", tag = "3")]
    pub notification_category_subscriptions: ::prost::alloc::vec::Vec<i32>,
    /// Required. The preferred language for notifications, as a ISO 639-1 language
    /// code. See [Supported
    /// languages](<https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages>)
    /// for a list of supported languages.
    #[prost(string, tag = "4")]
    pub language_tag: ::prost::alloc::string::String,
    /// The validity of the contact. A contact is considered valid if it is the
    /// correct recipient for notifications for a particular resource.
    #[prost(enumeration = "ValidationState", tag = "8")]
    pub validation_state: i32,
    /// The last time the validation_state was updated, either manually or
    /// automatically. A contact is considered stale if its validation state was
    /// updated more than 1 year ago.
    #[prost(message, optional, tag = "9")]
    pub validate_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Request message for the ListContacts method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListContactsRequest {
    /// Required. The parent resource name.
    /// Format: organizations/{organization_id}, folders/{folder_id} or
    /// projects/{project_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Optional. The maximum number of results to return from this request.
    /// Non-positive values are ignored. The presence of `next_page_token` in the
    /// response indicates that more results might be available.
    /// If not specified, the default page_size is 100.
    #[prost(int32, tag = "2")]
    pub page_size: i32,
    /// Optional. If present, retrieves the next batch of results from the
    /// preceding call to this method. `page_token` must be the value of
    /// `next_page_token` from the previous response. The values of other method
    /// parameters should be identical to those in the previous call.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
}
/// Response message for the ListContacts method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListContactsResponse {
    /// The contacts for the specified resource.
    #[prost(message, repeated, tag = "1")]
    pub contacts: ::prost::alloc::vec::Vec<Contact>,
    /// If there are more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token` and the
    /// rest of the parameters the same as the original request.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the GetContact method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetContactRequest {
    /// Required. The name of the contact to retrieve.
    /// Format: organizations/{organization_id}/contacts/{contact_id},
    /// folders/{folder_id}/contacts/{contact_id} or
    /// projects/{project_id}/contacts/{contact_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request message for the DeleteContact method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteContactRequest {
    /// Required. The name of the contact to delete.
    /// Format: organizations/{organization_id}/contacts/{contact_id},
    /// folders/{folder_id}/contacts/{contact_id} or
    /// projects/{project_id}/contacts/{contact_id}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request message for the CreateContact method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateContactRequest {
    /// Required. The resource to save this contact for.
    /// Format: organizations/{organization_id}, folders/{folder_id} or
    /// projects/{project_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. The contact to create. Must specify an email address and language
    /// tag.
    #[prost(message, optional, tag = "2")]
    pub contact: ::core::option::Option<Contact>,
}
/// Request message for the UpdateContact method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateContactRequest {
    /// Required. The contact resource to replace the existing saved contact. Note:
    /// the email address of the contact cannot be modified.
    #[prost(message, optional, tag = "2")]
    pub contact: ::core::option::Option<Contact>,
    /// Optional. The update mask applied to the resource. For the `FieldMask`
    /// definition, see
    /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask>
    #[prost(message, optional, tag = "3")]
    pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Request message for the ComputeContacts method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeContactsRequest {
    /// Required. The name of the resource to compute contacts for.
    /// Format: organizations/{organization_id},
    /// folders/{folder_id} or projects/{project_id}
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// The categories of notifications to compute contacts for. If ALL is included
    /// in this list, contacts subscribed to any notification category will be
    /// returned.
    #[prost(enumeration = "NotificationCategory", repeated, tag = "6")]
    pub notification_categories: ::prost::alloc::vec::Vec<i32>,
    /// Optional. The maximum number of results to return from this request.
    /// Non-positive values are ignored. The presence of `next_page_token` in the
    /// response indicates that more results might be available.
    /// If not specified, the default page_size is 100.
    #[prost(int32, tag = "3")]
    pub page_size: i32,
    /// Optional. If present, retrieves the next batch of results from the
    /// preceding call to this method. `page_token` must be the value of
    /// `next_page_token` from the previous response. The values of other method
    /// parameters should be identical to those in the previous call.
    #[prost(string, tag = "4")]
    pub page_token: ::prost::alloc::string::String,
}
/// Response message for the ComputeContacts method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputeContactsResponse {
    /// All contacts for the resource that are subscribed to the specified
    /// notification categories, including contacts inherited from any parent
    /// resources.
    #[prost(message, repeated, tag = "1")]
    pub contacts: ::prost::alloc::vec::Vec<Contact>,
    /// If there are more results than those appearing in this response, then
    /// `next_page_token` is included. To get the next set of results, call this
    /// method again using the value of `next_page_token` as `page_token` and the
    /// rest of the parameters the same as the original request.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
/// Request message for the SendTestMessage method.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendTestMessageRequest {
    /// Required. The list of names of the contacts to send a test message to.
    /// Format: organizations/{organization_id}/contacts/{contact_id},
    /// folders/{folder_id}/contacts/{contact_id} or
    /// projects/{project_id}/contacts/{contact_id}
    #[prost(string, repeated, tag = "1")]
    pub contacts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Required. The name of the resource to send the test message for. All
    /// contacts must either be set directly on this resource or inherited from
    /// another resource that is an ancestor of this one. Format:
    /// organizations/{organization_id}, folders/{folder_id} or
    /// projects/{project_id}
    #[prost(string, tag = "2")]
    pub resource: ::prost::alloc::string::String,
    /// Required. The notification category to send the test message for. All
    /// contacts must be subscribed to this category.
    #[prost(enumeration = "NotificationCategory", tag = "3")]
    pub notification_category: i32,
}
/// Generated client implementations.
pub mod essential_contacts_service_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Manages contacts for important Google Cloud notifications.
    #[derive(Debug, Clone)]
    pub struct EssentialContactsServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl<T> EssentialContactsServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::BoxBody>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> EssentialContactsServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::BoxBody>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            EssentialContactsServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Adds a new contact for a resource.
        pub async fn create_contact(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateContactRequest>,
        ) -> std::result::Result<tonic::Response<super::Contact>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/CreateContact",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "CreateContact",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Updates a contact.
        /// Note: A contact's email address cannot be changed.
        pub async fn update_contact(
            &mut self,
            request: impl tonic::IntoRequest<super::UpdateContactRequest>,
        ) -> std::result::Result<tonic::Response<super::Contact>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/UpdateContact",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "UpdateContact",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Lists the contacts that have been set on a resource.
        pub async fn list_contacts(
            &mut self,
            request: impl tonic::IntoRequest<super::ListContactsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListContactsResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/ListContacts",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "ListContacts",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Gets a single contact.
        pub async fn get_contact(
            &mut self,
            request: impl tonic::IntoRequest<super::GetContactRequest>,
        ) -> std::result::Result<tonic::Response<super::Contact>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/GetContact",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "GetContact",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Deletes a contact.
        pub async fn delete_contact(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteContactRequest>,
        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/DeleteContact",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "DeleteContact",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Lists all contacts for the resource that are subscribed to the
        /// specified notification categories, including contacts inherited from
        /// any parent resources.
        pub async fn compute_contacts(
            &mut self,
            request: impl tonic::IntoRequest<super::ComputeContactsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ComputeContactsResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/ComputeContacts",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "ComputeContacts",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Allows a contact admin to send a test message to contact to verify that it
        /// has been configured correctly.
        pub async fn send_test_message(
            &mut self,
            request: impl tonic::IntoRequest<super::SendTestMessageRequest>,
        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::new(
                        tonic::Code::Unknown,
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/google.cloud.essentialcontacts.v1.EssentialContactsService/SendTestMessage",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.essentialcontacts.v1.EssentialContactsService",
                        "SendTestMessage",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}