google-cloudevents 0.2.0

Prost/Serde structs for Google CloudEvent types with axum integration
Documentation
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
// This file is @generated by prost-build.
/// An API that can be served by one or more Gateways.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Api {
    /// Output only. Resource name of the API.
    /// Format: projects/{project}/locations/global/apis/{api}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Output only. Created time.
    #[prost(message, optional, tag = "2")]
    pub create_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Output only. Updated time.
    #[prost(message, optional, tag = "3")]
    pub update_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Optional. Resource labels to represent user-provided metadata.
    /// Refer to cloud documentation on labels for more details.
    /// <https://cloud.google.com/compute/docs/labeling-resources>
    #[prost(map = "string, string", tag = "4")]
    pub labels: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Optional. Display name.
    #[prost(string, tag = "5")]
    pub display_name: ::prost::alloc::string::String,
    /// Optional. Immutable. The name of a Google Managed Service (
    /// <https://cloud.google.com/service-infrastructure/docs/glossary#managed>).
    /// If not specified, a new Service will automatically be created in the same
    /// project as this API.
    #[prost(string, tag = "7")]
    pub managed_service: ::prost::alloc::string::String,
    /// Output only. State of the API.
    #[prost(enumeration = "api::State", tag = "12")]
    pub state: i32,
}
/// Nested message and enum types in `Api`.
pub mod api {
    /// All the possible API states.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum State {
        /// API does not have a state yet.
        Unspecified = 0,
        /// API is being created.
        Creating = 1,
        /// API is active.
        Active = 2,
        /// API creation failed.
        Failed = 3,
        /// API is being deleted.
        Deleting = 4,
        /// API is being updated.
        Updating = 5,
    }
    impl State {
        /// 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 {
                Self::Unspecified => "STATE_UNSPECIFIED",
                Self::Creating => "CREATING",
                Self::Active => "ACTIVE",
                Self::Failed => "FAILED",
                Self::Deleting => "DELETING",
                Self::Updating => "UPDATING",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "STATE_UNSPECIFIED" => Some(Self::Unspecified),
                "CREATING" => Some(Self::Creating),
                "ACTIVE" => Some(Self::Active),
                "FAILED" => Some(Self::Failed),
                "DELETING" => Some(Self::Deleting),
                "UPDATING" => Some(Self::Updating),
                _ => None,
            }
        }
    }
}
/// An API Configuration is a combination of settings for both the Managed
/// Service and Gateways serving this API Config.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiConfig {
    /// Output only. Resource name of the API Config.
    /// Format: projects/{project}/locations/global/apis/{api}/configs/{api_config}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Output only. Created time.
    #[prost(message, optional, tag = "2")]
    pub create_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Output only. Updated time.
    #[prost(message, optional, tag = "3")]
    pub update_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Optional. Resource labels to represent user-provided metadata.
    /// Refer to cloud documentation on labels for more details.
    /// <https://cloud.google.com/compute/docs/labeling-resources>
    #[prost(map = "string, string", tag = "4")]
    pub labels: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Optional. Display name.
    #[prost(string, tag = "5")]
    pub display_name: ::prost::alloc::string::String,
    /// Immutable. The Google Cloud IAM Service Account that Gateways serving this
    /// config should use to authenticate to other services. This may either be the
    /// Service Account's email
    /// (`{ACCOUNT_ID}@{PROJECT}.iam.gserviceaccount.com`) or its full resource
    /// name (`projects/{PROJECT}/accounts/{UNIQUE_ID}`). This is most often used
    /// when the service is a GCP resource such as a Cloud Run Service or an
    /// IAP-secured service.
    #[prost(string, tag = "14")]
    pub gateway_service_account: ::prost::alloc::string::String,
    /// Output only. The ID of the associated Service Config (
    /// <https://cloud.google.com/service-infrastructure/docs/glossary#config>).
    #[prost(string, tag = "12")]
    pub service_config_id: ::prost::alloc::string::String,
    /// Output only. State of the API Config.
    #[prost(enumeration = "api_config::State", tag = "8")]
    pub state: i32,
    /// Optional. OpenAPI specification documents. If specified, grpc_services and
    /// managed_service_configs must not be included.
    #[prost(message, repeated, tag = "9")]
    pub openapi_documents: ::prost::alloc::vec::Vec<api_config::OpenApiDocument>,
    /// Optional. gRPC service definition files. If specified, openapi_documents
    /// must not be included.
    #[prost(message, repeated, tag = "10")]
    pub grpc_services: ::prost::alloc::vec::Vec<api_config::GrpcServiceDefinition>,
    /// Optional. Service Configuration files. At least one must be included when
    /// using gRPC service definitions. See
    /// <https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#service_configuration_overview>
    /// for the expected file contents.
    ///
    /// If multiple files are specified, the files are merged with the following
    /// rules:
    /// * All singular scalar fields are merged using "last one wins" semantics in
    /// the order of the files uploaded.
    /// * Repeated fields are concatenated.
    /// * Singular embedded messages are merged using these rules for nested
    /// fields.
    #[prost(message, repeated, tag = "11")]
    pub managed_service_configs: ::prost::alloc::vec::Vec<api_config::File>,
}
/// Nested message and enum types in `ApiConfig`.
pub mod api_config {
    /// A lightweight description of a file.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct File {
        /// The file path (full or relative path). This is typically the path of the
        /// file when it is uploaded.
        #[prost(string, tag = "1")]
        pub path: ::prost::alloc::string::String,
        /// The bytes that constitute the file.
        #[prost(bytes = "vec", tag = "2")]
        pub contents: ::prost::alloc::vec::Vec<u8>,
    }
    /// An OpenAPI Specification Document describing an API.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct OpenApiDocument {
        /// The OpenAPI Specification document file.
        #[prost(message, optional, tag = "1")]
        pub document: ::core::option::Option<File>,
    }
    /// A gRPC service definition.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct GrpcServiceDefinition {
        /// Optional. Uncompiled proto files associated with the descriptor set, used
        /// for display purposes (server-side compilation is not supported). These
        /// should match the inputs to 'protoc' command used to generate
        /// file_descriptor_set.
        #[prost(message, repeated, tag = "2")]
        pub source: ::prost::alloc::vec::Vec<File>,
    }
    /// All the possible API Config states.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum State {
        /// API Config does not have a state yet.
        Unspecified = 0,
        /// API Config is being created and deployed to the API Controller.
        Creating = 1,
        /// API Config is ready for use by Gateways.
        Active = 2,
        /// API Config creation failed.
        Failed = 3,
        /// API Config is being deleted.
        Deleting = 4,
        /// API Config is being updated.
        Updating = 5,
        /// API Config settings are being activated in downstream systems.
        /// API Configs in this state cannot be used by Gateways.
        Activating = 6,
    }
    impl State {
        /// 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 {
                Self::Unspecified => "STATE_UNSPECIFIED",
                Self::Creating => "CREATING",
                Self::Active => "ACTIVE",
                Self::Failed => "FAILED",
                Self::Deleting => "DELETING",
                Self::Updating => "UPDATING",
                Self::Activating => "ACTIVATING",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "STATE_UNSPECIFIED" => Some(Self::Unspecified),
                "CREATING" => Some(Self::Creating),
                "ACTIVE" => Some(Self::Active),
                "FAILED" => Some(Self::Failed),
                "DELETING" => Some(Self::Deleting),
                "UPDATING" => Some(Self::Updating),
                "ACTIVATING" => Some(Self::Activating),
                _ => None,
            }
        }
    }
}
/// A Gateway is an API-aware HTTP proxy. It performs API-Method and/or
/// API-Consumer specific actions based on an API Config such as authentication,
/// policy enforcement, and backend selection.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Gateway {
    /// Output only. Resource name of the Gateway.
    /// Format: projects/{project}/locations/{location}/gateways/{gateway}
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Output only. Created time.
    #[prost(message, optional, tag = "2")]
    pub create_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Output only. Updated time.
    #[prost(message, optional, tag = "3")]
    pub update_time: ::core::option::Option<::pbjson_types::Timestamp>,
    /// Optional. Resource labels to represent user-provided metadata.
    /// Refer to cloud documentation on labels for more details.
    /// <https://cloud.google.com/compute/docs/labeling-resources>
    #[prost(map = "string, string", tag = "4")]
    pub labels: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Optional. Display name.
    #[prost(string, tag = "5")]
    pub display_name: ::prost::alloc::string::String,
    /// Required. Resource name of the API Config for this Gateway.
    /// Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
    #[prost(string, tag = "6")]
    pub api_config: ::prost::alloc::string::String,
    /// Output only. The current state of the Gateway.
    #[prost(enumeration = "gateway::State", tag = "7")]
    pub state: i32,
    /// Output only. The default API Gateway host name of the form
    /// `{gateway_id}-{hash}.{region_code}.gateway.dev`.
    #[prost(string, tag = "9")]
    pub default_hostname: ::prost::alloc::string::String,
}
/// Nested message and enum types in `Gateway`.
pub mod gateway {
    /// All the possible Gateway states.
    #[derive(serde::Serialize, serde::Deserialize)]
    #[serde(default)]
    #[serde(rename_all = "snake_case")]
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum State {
        /// Gateway does not have a state yet.
        Unspecified = 0,
        /// Gateway is being created.
        Creating = 1,
        /// Gateway is running and ready for requests.
        Active = 2,
        /// Gateway creation failed.
        Failed = 3,
        /// Gateway is being deleted.
        Deleting = 4,
        /// Gateway is being updated.
        Updating = 5,
    }
    impl State {
        /// 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 {
                Self::Unspecified => "STATE_UNSPECIFIED",
                Self::Creating => "CREATING",
                Self::Active => "ACTIVE",
                Self::Failed => "FAILED",
                Self::Deleting => "DELETING",
                Self::Updating => "UPDATING",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "STATE_UNSPECIFIED" => Some(Self::Unspecified),
                "CREATING" => Some(Self::Creating),
                "ACTIVE" => Some(Self::Active),
                "FAILED" => Some(Self::Failed),
                "DELETING" => Some(Self::Deleting),
                "UPDATING" => Some(Self::Updating),
                _ => None,
            }
        }
    }
}
/// The data within all Gateway events.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GatewayEventData {
    /// Optional. The Gateway event payload. Unset for deletion events.
    #[prost(message, optional, tag = "1")]
    pub payload: ::core::option::Option<Gateway>,
}
/// The data within all ApiConfig events.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiConfigEventData {
    /// Optional. The ApiConfig event payload. Unset for deletion events.
    #[prost(message, optional, tag = "1")]
    pub payload: ::core::option::Option<ApiConfig>,
}
/// The data within all Api events.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiEventData {
    /// Optional. The Api event payload. Unset for deletion events.
    #[prost(message, optional, tag = "1")]
    pub payload: ::core::option::Option<Api>,
}
/// The CloudEvent raised when a Gateway is created.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GatewayCreatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<GatewayEventData>,
}
/// The CloudEvent raised when a Gateway is updated.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GatewayUpdatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<GatewayEventData>,
}
/// The CloudEvent raised when a Gateway is deleted.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GatewayDeletedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<GatewayEventData>,
}
/// The CloudEvent raised when an Api is created.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiCreatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<ApiEventData>,
}
/// The CloudEvent raised when an Api is updated.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiUpdatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<ApiEventData>,
}
/// The CloudEvent raised when an Api is deleted.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiDeletedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<ApiEventData>,
}
/// The CloudEvent raised when an ApiConfig is created.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiConfigCreatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<ApiConfigEventData>,
}
/// The CloudEvent raised when an ApiConfig is updated.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiConfigUpdatedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<ApiConfigEventData>,
}
/// The CloudEvent raised when an ApiConfig is deleted.
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(default)]
#[serde(rename_all = "snake_case")]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ApiConfigDeletedEvent {
    /// The data associated with the event.
    #[prost(message, optional, tag = "1")]
    pub data: ::core::option::Option<ApiConfigEventData>,
}