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
// This file is @generated by prost-build.
/// A notification object for notifying customers about security and privacy
/// issues.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Notification {
    /// The resource name of the notification.
    /// Format:
    /// organizations/{organization}/locations/{location}/notifications/{notification}
    /// or projects/{project}/locations/{location}/notifications/{notification}.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// The subject line of the notification.
    #[prost(message, optional, tag = "2")]
    pub subject: ::core::option::Option<Subject>,
    /// A list of messages in the notification.
    #[prost(message, repeated, tag = "3")]
    pub messages: ::prost::alloc::vec::Vec<Message>,
    /// Output only. Time the notification was created.
    #[prost(message, optional, tag = "4")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Type of notification
    #[prost(enumeration = "NotificationType", tag = "12")]
    pub notification_type: i32,
}
/// A text object containing the English text and its localized copies.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Text {
    /// The English copy.
    #[prost(string, tag = "1")]
    pub en_text: ::prost::alloc::string::String,
    /// The requested localized copy (if applicable).
    #[prost(string, tag = "2")]
    pub localized_text: ::prost::alloc::string::String,
    /// Status of the localization.
    #[prost(enumeration = "LocalizationState", tag = "3")]
    pub localization_state: i32,
}
/// A subject line of a notification.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Subject {
    /// The text content.
    #[prost(message, optional, tag = "1")]
    pub text: ::core::option::Option<Text>,
}
/// A message which contains notification details.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Message {
    /// The message content.
    #[prost(message, optional, tag = "1")]
    pub body: ::core::option::Option<message::Body>,
    /// The attachments to download.
    #[prost(message, repeated, tag = "2")]
    pub attachments: ::prost::alloc::vec::Vec<Attachment>,
    /// The Message creation timestamp.
    #[prost(message, optional, tag = "3")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Time when Message was localized
    #[prost(message, optional, tag = "4")]
    pub localization_time: ::core::option::Option<::prost_types::Timestamp>,
}
/// Nested message and enum types in `Message`.
pub mod message {
    /// A message body containing text.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Body {
        /// The text content of the message body.
        #[prost(message, optional, tag = "1")]
        pub text: ::core::option::Option<super::Text>,
    }
}
/// Attachment with specific information about the issue.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attachment {
    /// The title of the attachment.
    #[prost(string, tag = "1")]
    pub display_name: ::prost::alloc::string::String,
    /// Data type of the attachment.
    #[prost(oneof = "attachment::Data", tags = "2")]
    pub data: ::core::option::Option<attachment::Data>,
}
/// Nested message and enum types in `Attachment`.
pub mod attachment {
    /// Data type of the attachment.
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Data {
        /// A CSV file attachment. Max size is 10 MB.
        #[prost(message, tag = "2")]
        Csv(super::Csv),
    }
}
/// A representation of a CSV file attachment, as a list of column headers and
/// a list of data rows.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Csv {
    /// The list of headers for data columns in a CSV file.
    #[prost(string, repeated, tag = "1")]
    pub headers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// The list of data rows in a CSV file, as string arrays rather than as a
    /// single comma-separated string.
    #[prost(message, repeated, tag = "2")]
    pub data_rows: ::prost::alloc::vec::Vec<csv::CsvRow>,
}
/// Nested message and enum types in `Csv`.
pub mod csv {
    /// A representation of a single data row in a CSV file.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct CsvRow {
        /// The data entries in a CSV file row, as a string array rather than a
        /// single comma-separated string.
        #[prost(string, repeated, tag = "1")]
        pub entries: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    }
}
/// Request for fetching all notifications for a given parent.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNotificationsRequest {
    /// Required. The parent, which owns this collection of notifications.
    /// Must be of the form "organizations/{organization}/locations/{location}"
    /// or "projects/{project}/locations/{location}".
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// The maximum number of notifications to return. The service may return
    /// fewer than this value. If unspecified or equal to 0, at most 50
    /// notifications will be returned. The maximum value is 50; values above 50
    /// will be coerced to 50.
    #[prost(int32, tag = "2")]
    pub page_size: i32,
    /// A page token returned from a previous request.
    /// When paginating, all other parameters provided in the request
    /// must match the call that returned the page token.
    #[prost(string, tag = "3")]
    pub page_token: ::prost::alloc::string::String,
    /// Specifies which parts of the notification resource should be returned
    /// in the response.
    #[prost(enumeration = "NotificationView", tag = "4")]
    pub view: i32,
    /// ISO code for requested localization language.  If unset, will be
    /// interpereted as "en". If the requested language is valid, but not supported
    /// for this notification, English will be returned with an "Not applicable"
    /// LocalizationState. If the ISO code is invalid (i.e. not a real language),
    /// this RPC will throw an error.
    #[prost(string, tag = "5")]
    pub language_code: ::prost::alloc::string::String,
}
/// Response of ListNotifications endpoint.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNotificationsResponse {
    /// List of notifications under a given parent.
    #[prost(message, repeated, tag = "1")]
    pub notifications: ::prost::alloc::vec::Vec<Notification>,
    /// A token, which can be sent as `page_token` to retrieve the next page.
    /// If this field is omitted, there are no subsequent pages.
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
    /// Estimation of a total number of notifications.
    #[prost(int32, tag = "3")]
    pub total_size: i32,
}
/// Request for fetching a notification.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNotificationRequest {
    /// Required. A name of the notification to retrieve.
    /// Format:
    /// organizations/{organization}/locations/{location}/notifications/{notification}
    /// or projects/{projects}/locations/{location}/notifications/{notification}.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// ISO code for requested localization language. If unset, will be
    /// interpereted as "en". If the requested language is valid, but not supported
    /// for this notification, English will be returned with an "Not applicable"
    /// LocalizationState. If the ISO code is invalid (i.e. not a real language),
    /// this RPC will throw an error.
    #[prost(string, tag = "5")]
    pub language_code: ::prost::alloc::string::String,
}
/// Settings for Advisory Notifications.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Settings {
    /// Identifier. The resource name of the settings to retrieve.
    /// Format:
    /// organizations/{organization}/locations/{location}/settings or
    /// projects/{projects}/locations/{location}/settings.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Required. Map of each notification type and its settings to get/set all
    /// settings at once. The server will validate the value for each notification
    /// type.
    #[prost(btree_map = "string, message", tag = "2")]
    pub notification_settings: ::prost::alloc::collections::BTreeMap<
        ::prost::alloc::string::String,
        NotificationSettings,
    >,
    /// Required. Fingerprint for optimistic concurrency returned in Get requests.
    /// Must be provided for Update requests. If the value provided does not match
    /// the value known to the server, ABORTED will be thrown, and the client
    /// should retry the read-modify-write cycle.
    #[prost(string, tag = "3")]
    pub etag: ::prost::alloc::string::String,
}
/// Settings for each NotificationType.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NotificationSettings {
    /// Whether the associated NotificationType is enabled.
    #[prost(bool, tag = "1")]
    pub enabled: bool,
}
/// Request of GetSettings endpoint.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSettingsRequest {
    /// Required. The resource name of the settings to retrieve.
    /// Format:
    /// organizations/{organization}/locations/{location}/settings or
    /// projects/{projects}/locations/{location}/settings.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Request of UpdateSettings endpoint.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSettingsRequest {
    /// Required. New settings.
    #[prost(message, optional, tag = "1")]
    pub settings: ::core::option::Option<Settings>,
}
/// Notification view.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NotificationView {
    /// Not specified, equivalent to BASIC.
    Unspecified = 0,
    /// Server responses only include title, creation time and Notification ID.
    /// Note: for internal use responses also include the last update time,
    /// the latest message text and whether notification has attachments.
    Basic = 1,
    /// Include everything.
    Full = 2,
}
impl NotificationView {
    /// 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 {
            NotificationView::Unspecified => "NOTIFICATION_VIEW_UNSPECIFIED",
            NotificationView::Basic => "BASIC",
            NotificationView::Full => "FULL",
        }
    }
    /// 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_VIEW_UNSPECIFIED" => Some(Self::Unspecified),
            "BASIC" => Some(Self::Basic),
            "FULL" => Some(Self::Full),
            _ => None,
        }
    }
}
/// Status of localized text.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum LocalizationState {
    /// Not used.
    Unspecified = 0,
    /// Localization is not applicable for requested language. This can happen
    /// when:
    /// - The requested language was not supported by Advisory Notifications at the
    /// time of localization (including notifications created before the
    /// localization feature was launched).
    /// - The requested language is English, so only the English text is returned.
    NotApplicable = 1,
    /// Localization for requested language is in progress, and not ready yet.
    Pending = 2,
    /// Localization for requested language is completed.
    Completed = 3,
}
impl LocalizationState {
    /// 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 {
            LocalizationState::Unspecified => "LOCALIZATION_STATE_UNSPECIFIED",
            LocalizationState::NotApplicable => "LOCALIZATION_STATE_NOT_APPLICABLE",
            LocalizationState::Pending => "LOCALIZATION_STATE_PENDING",
            LocalizationState::Completed => "LOCALIZATION_STATE_COMPLETED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "LOCALIZATION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "LOCALIZATION_STATE_NOT_APPLICABLE" => Some(Self::NotApplicable),
            "LOCALIZATION_STATE_PENDING" => Some(Self::Pending),
            "LOCALIZATION_STATE_COMPLETED" => Some(Self::Completed),
            _ => None,
        }
    }
}
/// Type of notification
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NotificationType {
    /// Default type
    Unspecified = 0,
    /// Security and privacy advisory notifications
    SecurityPrivacyAdvisory = 1,
    /// Sensitive action notifications
    SensitiveActions = 2,
    /// General security MSA
    SecurityMsa = 3,
    /// Threat horizons MSA
    ThreatHorizons = 4,
}
impl NotificationType {
    /// 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 {
            NotificationType::Unspecified => "NOTIFICATION_TYPE_UNSPECIFIED",
            NotificationType::SecurityPrivacyAdvisory => {
                "NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY"
            }
            NotificationType::SensitiveActions => "NOTIFICATION_TYPE_SENSITIVE_ACTIONS",
            NotificationType::SecurityMsa => "NOTIFICATION_TYPE_SECURITY_MSA",
            NotificationType::ThreatHorizons => "NOTIFICATION_TYPE_THREAT_HORIZONS",
        }
    }
    /// 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_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY" => {
                Some(Self::SecurityPrivacyAdvisory)
            }
            "NOTIFICATION_TYPE_SENSITIVE_ACTIONS" => Some(Self::SensitiveActions),
            "NOTIFICATION_TYPE_SECURITY_MSA" => Some(Self::SecurityMsa),
            "NOTIFICATION_TYPE_THREAT_HORIZONS" => Some(Self::ThreatHorizons),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod advisory_notifications_service_client {
    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Service to manage Security and Privacy Notifications.
    #[derive(Debug, Clone)]
    pub struct AdvisoryNotificationsServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl<T> AdvisoryNotificationsServiceClient<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,
        ) -> AdvisoryNotificationsServiceClient<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,
        {
            AdvisoryNotificationsServiceClient::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
        }
        /// Lists notifications under a given parent.
        pub async fn list_notifications(
            &mut self,
            request: impl tonic::IntoRequest<super::ListNotificationsRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListNotificationsResponse>,
            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.advisorynotifications.v1.AdvisoryNotificationsService/ListNotifications",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.advisorynotifications.v1.AdvisoryNotificationsService",
                        "ListNotifications",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Gets a notification.
        pub async fn get_notification(
            &mut self,
            request: impl tonic::IntoRequest<super::GetNotificationRequest>,
        ) -> std::result::Result<tonic::Response<super::Notification>, 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.advisorynotifications.v1.AdvisoryNotificationsService/GetNotification",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.advisorynotifications.v1.AdvisoryNotificationsService",
                        "GetNotification",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Get notification settings.
        pub async fn get_settings(
            &mut self,
            request: impl tonic::IntoRequest<super::GetSettingsRequest>,
        ) -> std::result::Result<tonic::Response<super::Settings>, 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.advisorynotifications.v1.AdvisoryNotificationsService/GetSettings",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.advisorynotifications.v1.AdvisoryNotificationsService",
                        "GetSettings",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Update notification settings.
        pub async fn update_settings(
            &mut self,
            request: impl tonic::IntoRequest<super::UpdateSettingsRequest>,
        ) -> std::result::Result<tonic::Response<super::Settings>, 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.advisorynotifications.v1.AdvisoryNotificationsService/UpdateSettings",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.advisorynotifications.v1.AdvisoryNotificationsService",
                        "UpdateSettings",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}