envoy-types 0.7.3

Collection of protobuf types and other assets to work with the Envoy Proxy through Rust gRPC services.
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
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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
// This file is @generated by prost-build.
/// An attribute is a piece of metadata that describes an activity on a network.
/// For example, the size of an HTTP request, or the status code of an HTTP response.
///
/// Each attribute has a type and a name, which is logically defined as a proto message field
/// of the `AttributeContext`. The `AttributeContext` is a collection of individual attributes
/// supported by Envoy authorization system.
/// \[\#comment: The following items are left out of this proto
/// Request.Auth field for JWTs
/// Request.Api for api management
/// Origin peer that originated the request
/// Caching Protocol
/// request_context return values to inject back into the filter chain
/// peer.claims -- from X.509 extensions
/// Configuration
///
/// * field mask to send
/// * which return values from request_context are copied back
/// * which return values are copied into request_headers\]
///   \[\#next-free-field: 14\]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttributeContext {
    /// The source of a network activity, such as starting a TCP connection.
    /// In a multi hop network activity, the source represents the sender of the
    /// last hop.
    #[prost(message, optional, tag = "1")]
    pub source: ::core::option::Option<attribute_context::Peer>,
    /// The destination of a network activity, such as accepting a TCP connection.
    /// In a multi hop network activity, the destination represents the receiver of
    /// the last hop.
    #[prost(message, optional, tag = "2")]
    pub destination: ::core::option::Option<attribute_context::Peer>,
    /// Represents a network request, such as an HTTP request.
    #[prost(message, optional, tag = "4")]
    pub request: ::core::option::Option<attribute_context::Request>,
    /// This is analogous to http_request.headers, however these contents will not be sent to the
    /// upstream server. Context_extensions provide an extension mechanism for sending additional
    /// information to the auth server without modifying the proto definition. It maps to the
    /// internal opaque context in the filter chain.
    #[prost(map = "string, string", tag = "10")]
    pub context_extensions: ::std::collections::HashMap<
        ::prost::alloc::string::String,
        ::prost::alloc::string::String,
    >,
    /// Dynamic metadata associated with the request.
    #[prost(message, optional, tag = "11")]
    pub metadata_context: ::core::option::Option<
        super::super::super::config::core::v3::Metadata,
    >,
    /// Metadata associated with the selected route.
    #[prost(message, optional, tag = "13")]
    pub route_metadata_context: ::core::option::Option<
        super::super::super::config::core::v3::Metadata,
    >,
    /// TLS session details of the underlying connection.
    /// This is not populated by default and will be populated only if the ext_authz filter has
    /// been specifically configured to include this information.
    /// For HTTP ext_authz, that requires :ref:`include_tls_session <config_http_filters_ext_authz>`
    /// to be set to true.
    /// For network ext_authz, that requires :ref:`include_tls_session <config_network_filters_ext_authz>`
    /// to be set to true.
    #[prost(message, optional, tag = "12")]
    pub tls_session: ::core::option::Option<attribute_context::TlsSession>,
}
/// Nested message and enum types in `AttributeContext`.
pub mod attribute_context {
    /// This message defines attributes for a node that handles a network request.
    /// The node can be either a service or an application that sends, forwards,
    /// or receives the request. Service peers should fill in the `service`,
    /// `principal`, and `labels` as appropriate.
    /// \[\#next-free-field: 6\]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Peer {
        /// The address of the peer, this is typically the IP address.
        /// It can also be UDS path, or others.
        #[prost(message, optional, tag = "1")]
        pub address: ::core::option::Option<
            super::super::super::super::config::core::v3::Address,
        >,
        /// The canonical service name of the peer.
        /// It should be set to :ref:`the HTTP x-envoy-downstream-service-cluster  <config_http_conn_man_headers_downstream-service-cluster>`
        /// If a more trusted source of the service name is available through mTLS/secure naming, it
        /// should be used.
        #[prost(string, tag = "2")]
        pub service: ::prost::alloc::string::String,
        /// The labels associated with the peer.
        /// These could be pod labels for Kubernetes or tags for VMs.
        /// The source of the labels could be an X.509 certificate or other configuration.
        #[prost(map = "string, string", tag = "3")]
        pub labels: ::std::collections::HashMap<
            ::prost::alloc::string::String,
            ::prost::alloc::string::String,
        >,
        /// The authenticated identity of this peer.
        /// For example, the identity associated with the workload such as a service account.
        /// If an X.509 certificate is used to assert the identity this field should be sourced from
        /// `URI Subject Alternative Names`, `DNS Subject Alternate Names` or `Subject` in that order.
        /// The primary identity should be the principal. The principal format is issuer specific.
        ///
        /// Examples:
        ///
        /// * SPIFFE format is `spiffe://trust-domain/path`.
        /// * Google account format is `<https://accounts.google.com/{userid}`.>
        #[prost(string, tag = "4")]
        pub principal: ::prost::alloc::string::String,
        /// The X.509 certificate used to authenticate the identify of this peer.
        /// When present, the certificate contents are encoded in URL and PEM format.
        #[prost(string, tag = "5")]
        pub certificate: ::prost::alloc::string::String,
    }
    impl ::prost::Name for Peer {
        const NAME: &'static str = "Peer";
        const PACKAGE: &'static str = "envoy.service.auth.v3";
        fn full_name() -> ::prost::alloc::string::String {
            "envoy.service.auth.v3.AttributeContext.Peer".into()
        }
        fn type_url() -> ::prost::alloc::string::String {
            "type.googleapis.com/envoy.service.auth.v3.AttributeContext.Peer".into()
        }
    }
    /// Represents a network request, such as an HTTP request.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Request {
        /// The timestamp when the proxy receives the first byte of the request.
        #[prost(message, optional, tag = "1")]
        pub time: ::core::option::Option<
            super::super::super::super::super::google::protobuf::Timestamp,
        >,
        /// Represents an HTTP request or an HTTP-like request.
        #[prost(message, optional, tag = "2")]
        pub http: ::core::option::Option<HttpRequest>,
    }
    impl ::prost::Name for Request {
        const NAME: &'static str = "Request";
        const PACKAGE: &'static str = "envoy.service.auth.v3";
        fn full_name() -> ::prost::alloc::string::String {
            "envoy.service.auth.v3.AttributeContext.Request".into()
        }
        fn type_url() -> ::prost::alloc::string::String {
            "type.googleapis.com/envoy.service.auth.v3.AttributeContext.Request".into()
        }
    }
    /// This message defines attributes for an HTTP request.
    /// HTTP/1.x, HTTP/2, gRPC are all considered as HTTP requests.
    /// \[\#next-free-field: 14\]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct HttpRequest {
        /// The unique ID for a request, which can be propagated to downstream
        /// systems. The ID should have low probability of collision
        /// within a single day for a specific service.
        /// For HTTP requests, it should be X-Request-ID or equivalent.
        #[prost(string, tag = "1")]
        pub id: ::prost::alloc::string::String,
        /// The HTTP request method, such as `GET`, `POST`.
        #[prost(string, tag = "2")]
        pub method: ::prost::alloc::string::String,
        ///
        /// The HTTP request headers. If multiple headers share the same key, they
        /// must be merged according to the HTTP spec. All header keys must be
        /// lower-cased, because HTTP header keys are case-insensitive.
        /// Header value is encoded as UTF-8 string. Non-UTF-8 characters will be replaced by "!".
        /// This field will not be set if
        /// : ref:`encode_raw_headers <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.ExtAuthz.encode_raw_headers>`
        ///   is set to true.
        #[prost(map = "string, string", tag = "3")]
        pub headers: ::std::collections::HashMap<
            ::prost::alloc::string::String,
            ::prost::alloc::string::String,
        >,
        ///
        /// A list of the raw HTTP request headers. This is used instead of
        /// : ref:`headers <envoy_v3_api_field_service.auth.v3.AttributeContext.HttpRequest.headers>` when
        /// : ref:`encode_raw_headers <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.ExtAuthz.encode_raw_headers>`
        ///   is set to true.
        ///
        ///
        /// Note that this is not actually a map type. `header_map` contains a single repeated field
        /// `headers`.
        ///
        ///
        /// Here, only the `key` and `raw_value` fields will be populated for each HeaderValue, and
        /// that is only when
        /// : ref:`encode_raw_headers <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.ExtAuthz.encode_raw_headers>`
        ///   is set to true.
        ///
        /// Also, unlike the
        /// : ref:`headers <envoy_v3_api_field_service.auth.v3.AttributeContext.HttpRequest.headers>`
        ///   field, headers with the same key are not combined into a single comma separated header.
        #[prost(message, optional, tag = "13")]
        pub header_map: ::core::option::Option<
            super::super::super::super::config::core::v3::HeaderMap,
        >,
        /// The request target, as it appears in the first line of the HTTP request. This includes
        /// the URL path and query-string. No decoding is performed.
        #[prost(string, tag = "4")]
        pub path: ::prost::alloc::string::String,
        /// The HTTP request `Host` or `:authority` header value.
        #[prost(string, tag = "5")]
        pub host: ::prost::alloc::string::String,
        /// The HTTP URL scheme, such as `http` and `https`.
        #[prost(string, tag = "6")]
        pub scheme: ::prost::alloc::string::String,
        /// This field is always empty, and exists for compatibility reasons. The HTTP URL query is
        /// included in `path` field.
        #[prost(string, tag = "7")]
        pub query: ::prost::alloc::string::String,
        /// This field is always empty, and exists for compatibility reasons. The URL fragment is
        /// not submitted as part of HTTP requests; it is unknowable.
        #[prost(string, tag = "8")]
        pub fragment: ::prost::alloc::string::String,
        /// The HTTP request size in bytes. If unknown, it must be -1.
        #[prost(int64, tag = "9")]
        pub size: i64,
        /// The network protocol used with the request, such as "HTTP/1.0", "HTTP/1.1", or "HTTP/2".
        ///
        /// See :repo:`headers.h:ProtocolStrings <source/common/http/headers.h>` for a list of all
        /// possible values.
        #[prost(string, tag = "10")]
        pub protocol: ::prost::alloc::string::String,
        /// The HTTP request body.
        #[prost(string, tag = "11")]
        pub body: ::prost::alloc::string::String,
        ///
        /// The HTTP request body in bytes. This is used instead of
        /// : ref:`body <envoy_v3_api_field_service.auth.v3.AttributeContext.HttpRequest.body>` when
        /// : ref:`pack_as_bytes <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.BufferSettings.pack_as_bytes>`
        ///   is set to true.
        #[prost(bytes = "vec", tag = "12")]
        pub raw_body: ::prost::alloc::vec::Vec<u8>,
    }
    impl ::prost::Name for HttpRequest {
        const NAME: &'static str = "HttpRequest";
        const PACKAGE: &'static str = "envoy.service.auth.v3";
        fn full_name() -> ::prost::alloc::string::String {
            "envoy.service.auth.v3.AttributeContext.HttpRequest".into()
        }
        fn type_url() -> ::prost::alloc::string::String {
            "type.googleapis.com/envoy.service.auth.v3.AttributeContext.HttpRequest"
                .into()
        }
    }
    /// This message defines attributes for the underlying TLS session.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct TlsSession {
        /// SNI used for TLS session.
        #[prost(string, tag = "1")]
        pub sni: ::prost::alloc::string::String,
    }
    impl ::prost::Name for TlsSession {
        const NAME: &'static str = "TLSSession";
        const PACKAGE: &'static str = "envoy.service.auth.v3";
        fn full_name() -> ::prost::alloc::string::String {
            "envoy.service.auth.v3.AttributeContext.TLSSession".into()
        }
        fn type_url() -> ::prost::alloc::string::String {
            "type.googleapis.com/envoy.service.auth.v3.AttributeContext.TLSSession"
                .into()
        }
    }
}
impl ::prost::Name for AttributeContext {
    const NAME: &'static str = "AttributeContext";
    const PACKAGE: &'static str = "envoy.service.auth.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "envoy.service.auth.v3.AttributeContext".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/envoy.service.auth.v3.AttributeContext".into()
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckRequest {
    /// The request attributes.
    #[prost(message, optional, tag = "1")]
    pub attributes: ::core::option::Option<AttributeContext>,
}
impl ::prost::Name for CheckRequest {
    const NAME: &'static str = "CheckRequest";
    const PACKAGE: &'static str = "envoy.service.auth.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "envoy.service.auth.v3.CheckRequest".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/envoy.service.auth.v3.CheckRequest".into()
    }
}
/// HTTP attributes for a denied response.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeniedHttpResponse {
    /// This field allows the authorization service to send an HTTP response status code to the
    /// downstream client. If not set, Envoy sends `403 Forbidden` HTTP status code by default.
    #[prost(message, optional, tag = "1")]
    pub status: ::core::option::Option<super::super::super::r#type::v3::HttpStatus>,
    /// This field allows the authorization service to send HTTP response headers
    /// to the downstream client. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>` defaults to
    /// false when used in this message.
    #[prost(message, repeated, tag = "2")]
    pub headers: ::prost::alloc::vec::Vec<
        super::super::super::config::core::v3::HeaderValueOption,
    >,
    /// This field allows the authorization service to send a response body data
    /// to the downstream client.
    #[prost(string, tag = "3")]
    pub body: ::prost::alloc::string::String,
}
impl ::prost::Name for DeniedHttpResponse {
    const NAME: &'static str = "DeniedHttpResponse";
    const PACKAGE: &'static str = "envoy.service.auth.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "envoy.service.auth.v3.DeniedHttpResponse".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/envoy.service.auth.v3.DeniedHttpResponse".into()
    }
}
/// HTTP attributes for an OK response.
/// \[\#next-free-field: 9\]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OkHttpResponse {
    /// HTTP entity headers in addition to the original request headers. This allows the authorization
    /// service to append, to add or to override headers from the original request before
    /// dispatching it to the upstream. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>` defaults to
    /// false when used in this message. By setting the `append` field to `true`,
    /// the filter will append the correspondent header value to the matched request header.
    /// By leaving `append` as false, the filter will either add a new header, or override an existing
    /// one if there is a match.
    #[prost(message, repeated, tag = "2")]
    pub headers: ::prost::alloc::vec::Vec<
        super::super::super::config::core::v3::HeaderValueOption,
    >,
    /// HTTP entity headers to remove from the original request before dispatching
    /// it to the upstream. This allows the authorization service to act on auth
    /// related headers (like `Authorization`), process them, and consume them.
    /// Under this model, the upstream will either receive the request (if it's
    /// authorized) or not receive it (if it's not), but will not see headers
    /// containing authorization credentials.
    ///
    /// Pseudo headers (such as `:authority`, `:method`, `:path` etc), as well as
    /// the header `Host`, may not be removed as that would make the request
    /// malformed. If mentioned in `headers_to_remove` these special headers will
    /// be ignored.
    ///
    /// When using the HTTP service this must instead be set by the HTTP
    /// authorization service as a comma separated list like so:
    /// `x-envoy-auth-headers-to-remove: one-auth-header, another-auth-header`.
    #[prost(string, repeated, tag = "5")]
    pub headers_to_remove: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// This field has been deprecated in favor of :ref:`CheckResponse.dynamic_metadata  <envoy_v3_api_field_service.auth.v3.CheckResponse.dynamic_metadata>`. Until it is removed,
    /// setting this field overrides :ref:`CheckResponse.dynamic_metadata  <envoy_v3_api_field_service.auth.v3.CheckResponse.dynamic_metadata>`.
    #[deprecated]
    #[prost(message, optional, tag = "3")]
    pub dynamic_metadata: ::core::option::Option<
        super::super::super::super::google::protobuf::Struct,
    >,
    /// This field allows the authorization service to send HTTP response headers
    /// to the downstream client on success. Note that the :ref:`append field in HeaderValueOption <envoy_v3_api_field_config.core.v3.HeaderValueOption.append>`
    /// defaults to false when used in this message.
    #[prost(message, repeated, tag = "6")]
    pub response_headers_to_add: ::prost::alloc::vec::Vec<
        super::super::super::config::core::v3::HeaderValueOption,
    >,
    /// This field allows the authorization service to set (and overwrite) query
    /// string parameters on the original request before it is sent upstream.
    #[prost(message, repeated, tag = "7")]
    pub query_parameters_to_set: ::prost::alloc::vec::Vec<
        super::super::super::config::core::v3::QueryParameter,
    >,
    /// This field allows the authorization service to specify which query parameters
    /// should be removed from the original request before it is sent upstream. Each
    /// element in this list is a case-sensitive query parameter name to be removed.
    #[prost(string, repeated, tag = "8")]
    pub query_parameters_to_remove: ::prost::alloc::vec::Vec<
        ::prost::alloc::string::String,
    >,
}
impl ::prost::Name for OkHttpResponse {
    const NAME: &'static str = "OkHttpResponse";
    const PACKAGE: &'static str = "envoy.service.auth.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "envoy.service.auth.v3.OkHttpResponse".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/envoy.service.auth.v3.OkHttpResponse".into()
    }
}
/// Intended for gRPC and Network Authorization servers `only`.
/// \[\#next-free-field: 6\]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckResponse {
    /// Status `OK` allows the request. Any other status indicates the request should be denied, and
    /// for HTTP filter, if not overridden by :ref:`denied HTTP response status <envoy_v3_api_field_service.auth.v3.DeniedHttpResponse.status>`
    /// Envoy sends `403 Forbidden` HTTP status code by default.
    #[prost(message, optional, tag = "1")]
    pub status: ::core::option::Option<super::super::super::super::google::rpc::Status>,
    /// Optional response metadata that will be emitted as dynamic metadata to be consumed by the next
    /// filter. This metadata lives in a namespace specified by the canonical name of extension filter
    /// that requires it:
    ///
    /// * :ref:`envoy.filters.http.ext_authz <config_http_filters_ext_authz_dynamic_metadata>` for HTTP filter.
    /// * :ref:`envoy.filters.network.ext_authz <config_network_filters_ext_authz_dynamic_metadata>` for network filter.
    #[prost(message, optional, tag = "4")]
    pub dynamic_metadata: ::core::option::Option<
        super::super::super::super::google::protobuf::Struct,
    >,
    /// An message that contains HTTP response attributes. This message is
    /// used when the authorization service needs to send custom responses to the
    /// downstream client or, to modify/add request headers being dispatched to the upstream.
    #[prost(oneof = "check_response::HttpResponse", tags = "2, 3, 5")]
    pub http_response: ::core::option::Option<check_response::HttpResponse>,
}
/// Nested message and enum types in `CheckResponse`.
pub mod check_response {
    /// An message that contains HTTP response attributes. This message is
    /// used when the authorization service needs to send custom responses to the
    /// downstream client or, to modify/add request headers being dispatched to the upstream.
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum HttpResponse {
        /// Supplies http attributes for a denied response.
        #[prost(message, tag = "2")]
        DeniedResponse(super::DeniedHttpResponse),
        /// Supplies http attributes for an ok response.
        #[prost(message, tag = "3")]
        OkResponse(super::OkHttpResponse),
        ///
        /// Supplies http attributes for an error response. This is used when the authorization
        /// service encounters an internal error and wants to return custom headers and body to the
        /// downstream client. When `error_response` is set, the ext_authz filter increments the
        /// `ext_authz_error` stat and respects the :ref:`failure_mode_allow  <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.ExtAuthz.failure_mode_allow>`
        /// configuration. The HTTP status code, headers, and body are taken from the
        /// : ref:`DeniedHttpResponse <envoy_v3_api_msg_service.auth.v3.DeniedHttpResponse>` message.
        ///   If the status field is not set, Envoy sends the status code configured via
        /// : ref:`status_on_error <envoy_v3_api_field_extensions.filters.http.ext_authz.v3.ExtAuthz.status_on_error>`,
        ///   which defaults to `403 Forbidden`.
        #[prost(message, tag = "5")]
        ErrorResponse(super::DeniedHttpResponse),
    }
}
impl ::prost::Name for CheckResponse {
    const NAME: &'static str = "CheckResponse";
    const PACKAGE: &'static str = "envoy.service.auth.v3";
    fn full_name() -> ::prost::alloc::string::String {
        "envoy.service.auth.v3.CheckResponse".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "type.googleapis.com/envoy.service.auth.v3.CheckResponse".into()
    }
}
/// Generated client implementations.
pub mod authorization_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// A generic interface for performing authorization check on incoming
    /// requests to a networked service.
    #[derive(Debug, Clone)]
    pub struct AuthorizationClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl AuthorizationClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> AuthorizationClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        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,
        ) -> AuthorizationClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            AuthorizationClient::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
        }
        /// Performs authorization check based on the attributes associated with the
        /// incoming request, and returns status `OK` or not `OK`.
        pub async fn check(
            &mut self,
            request: impl tonic::IntoRequest<super::CheckRequest>,
        ) -> std::result::Result<tonic::Response<super::CheckResponse>, tonic::Status> {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/envoy.service.auth.v3.Authorization/Check",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("envoy.service.auth.v3.Authorization", "Check"));
            self.inner.unary(req, path, codec).await
        }
    }
}
/// Generated server implementations.
pub mod authorization_server {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    /// Generated trait containing gRPC methods that should be implemented for use with AuthorizationServer.
    #[async_trait]
    pub trait Authorization: std::marker::Send + std::marker::Sync + 'static {
        /// Performs authorization check based on the attributes associated with the
        /// incoming request, and returns status `OK` or not `OK`.
        async fn check(
            &self,
            request: tonic::Request<super::CheckRequest>,
        ) -> std::result::Result<tonic::Response<super::CheckResponse>, tonic::Status>;
    }
    /// A generic interface for performing authorization check on incoming
    /// requests to a networked service.
    #[derive(Debug)]
    pub struct AuthorizationServer<T> {
        inner: Arc<T>,
        accept_compression_encodings: EnabledCompressionEncodings,
        send_compression_encodings: EnabledCompressionEncodings,
        max_decoding_message_size: Option<usize>,
        max_encoding_message_size: Option<usize>,
    }
    impl<T> AuthorizationServer<T> {
        pub fn new(inner: T) -> Self {
            Self::from_arc(Arc::new(inner))
        }
        pub fn from_arc(inner: Arc<T>) -> Self {
            Self {
                inner,
                accept_compression_encodings: Default::default(),
                send_compression_encodings: Default::default(),
                max_decoding_message_size: None,
                max_encoding_message_size: None,
            }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InterceptedService<Self, F>
        where
            F: tonic::service::Interceptor,
        {
            InterceptedService::new(Self::new(inner), interceptor)
        }
        /// Enable decompressing requests with the given encoding.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.accept_compression_encodings.enable(encoding);
            self
        }
        /// Compress responses with the given encoding, if the client supports it.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.send_compression_encodings.enable(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.max_decoding_message_size = Some(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.max_encoding_message_size = Some(limit);
            self
        }
    }
    impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthorizationServer<T>
    where
        T: Authorization,
        B: Body + std::marker::Send + 'static,
        B::Error: Into<StdError> + std::marker::Send + 'static,
    {
        type Response = http::Response<tonic::body::Body>;
        type Error = std::convert::Infallible;
        type Future = BoxFuture<Self::Response, Self::Error>;
        fn poll_ready(
            &mut self,
            _cx: &mut Context<'_>,
        ) -> Poll<std::result::Result<(), Self::Error>> {
            Poll::Ready(Ok(()))
        }
        fn call(&mut self, req: http::Request<B>) -> Self::Future {
            match req.uri().path() {
                "/envoy.service.auth.v3.Authorization/Check" => {
                    #[allow(non_camel_case_types)]
                    struct CheckSvc<T: Authorization>(pub Arc<T>);
                    impl<
                        T: Authorization,
                    > tonic::server::UnaryService<super::CheckRequest> for CheckSvc<T> {
                        type Response = super::CheckResponse;
                        type Future = BoxFuture<
                            tonic::Response<Self::Response>,
                            tonic::Status,
                        >;
                        fn call(
                            &mut self,
                            request: tonic::Request<super::CheckRequest>,
                        ) -> Self::Future {
                            let inner = Arc::clone(&self.0);
                            let fut = async move {
                                <T as Authorization>::check(&inner, request).await
                            };
                            Box::pin(fut)
                        }
                    }
                    let accept_compression_encodings = self.accept_compression_encodings;
                    let send_compression_encodings = self.send_compression_encodings;
                    let max_decoding_message_size = self.max_decoding_message_size;
                    let max_encoding_message_size = self.max_encoding_message_size;
                    let inner = self.inner.clone();
                    let fut = async move {
                        let method = CheckSvc(inner);
                        let codec = tonic_prost::ProstCodec::default();
                        let mut grpc = tonic::server::Grpc::new(codec)
                            .apply_compression_config(
                                accept_compression_encodings,
                                send_compression_encodings,
                            )
                            .apply_max_message_size_config(
                                max_decoding_message_size,
                                max_encoding_message_size,
                            );
                        let res = grpc.unary(method, req).await;
                        Ok(res)
                    };
                    Box::pin(fut)
                }
                _ => {
                    Box::pin(async move {
                        let mut response = http::Response::new(
                            tonic::body::Body::default(),
                        );
                        let headers = response.headers_mut();
                        headers
                            .insert(
                                tonic::Status::GRPC_STATUS,
                                (tonic::Code::Unimplemented as i32).into(),
                            );
                        headers
                            .insert(
                                http::header::CONTENT_TYPE,
                                tonic::metadata::GRPC_CONTENT_TYPE,
                            );
                        Ok(response)
                    })
                }
            }
        }
    }
    impl<T> Clone for AuthorizationServer<T> {
        fn clone(&self) -> Self {
            let inner = self.inner.clone();
            Self {
                inner,
                accept_compression_encodings: self.accept_compression_encodings,
                send_compression_encodings: self.send_compression_encodings,
                max_decoding_message_size: self.max_decoding_message_size,
                max_encoding_message_size: self.max_encoding_message_size,
            }
        }
    }
    /// Generated gRPC service name
    pub const SERVICE_NAME: &str = "envoy.service.auth.v3.Authorization";
    impl<T> tonic::server::NamedService for AuthorizationServer<T> {
        const NAME: &'static str = SERVICE_NAME;
    }
}