envoy_types/generated/
envoy.extensions.filters.http.ip_tagging.v3.rs

1// This file is @generated by prost-build.
2/// \[\#next-free-field: 6\]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct IpTagging {
5    /// The type of request the filter should apply to.
6    #[prost(enumeration = "ip_tagging::RequestType", tag = "1")]
7    pub request_type: i32,
8    /// \[\#comment:TODO(ccaraman): Extend functionality to load IP tags from file system.
9    /// Tracked by issue <https://github.com/envoyproxy/envoy/issues/2695\]>
10    /// The set of IP tags for the filter.
11    #[prost(message, repeated, tag = "4")]
12    pub ip_tags: ::prost::alloc::vec::Vec<ip_tagging::IpTag>,
13    /// Specify to which header the tags will be written.
14    ///
15    /// If left unspecified, the tags will be appended to the `x-envoy-ip-tags` header.
16    #[prost(message, optional, tag = "5")]
17    pub ip_tag_header: ::core::option::Option<ip_tagging::IpTagHeader>,
18}
19/// Nested message and enum types in `IPTagging`.
20pub mod ip_tagging {
21    /// Supplies the IP tag name and the IP address subnets.
22    #[derive(Clone, PartialEq, ::prost::Message)]
23    pub struct IpTag {
24        /// Specifies the IP tag name to apply.
25        #[prost(string, tag = "1")]
26        pub ip_tag_name: ::prost::alloc::string::String,
27        /// A list of IP address subnets that will be tagged with
28        /// ip_tag_name. Both IPv4 and IPv6 are supported.
29        #[prost(message, repeated, tag = "2")]
30        pub ip_list: ::prost::alloc::vec::Vec<
31            super::super::super::super::super::super::config::core::v3::CidrRange,
32        >,
33    }
34    /// Specify to which header the tags will be written.
35    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
36    pub struct IpTagHeader {
37        /// Header to use for ip-tagging.
38        ///
39        ///
40        /// This header will be sanitized based on the config in
41        /// : ref:`action <envoy_v3_api_field_extensions.filters.http.ip_tagging.v3.IPTagging.IpTagHeader.action>`
42        ///   rather than the defaults for x-envoy prefixed headers.
43        #[prost(string, tag = "1")]
44        pub header: ::prost::alloc::string::String,
45        /// Control if the :ref:`header <envoy_v3_api_field_extensions.filters.http.ip_tagging.v3.IPTagging.IpTagHeader.header>`
46        /// will be sanitized, or be appended to.
47        ///
48        /// Default: *SANITIZE*.
49        #[prost(enumeration = "ip_tag_header::HeaderAction", tag = "2")]
50        pub action: i32,
51    }
52    /// Nested message and enum types in `IpTagHeader`.
53    pub mod ip_tag_header {
54        /// Describes how to apply the tags to the headers.
55        #[derive(
56            Clone,
57            Copy,
58            Debug,
59            PartialEq,
60            Eq,
61            Hash,
62            PartialOrd,
63            Ord,
64            ::prost::Enumeration
65        )]
66        #[repr(i32)]
67        pub enum HeaderAction {
68            /// (DEFAULT) The header specified in :ref:`ip_tag_header <envoy_v3_api_field_extensions.filters.http.ip_tagging.v3.IPTagging.ip_tag_header>`
69            /// will be dropped, before the tags are applied. The incoming header will be "sanitized" regardless of whether the request is internal or external.
70            ///
71            /// Note that the header will be visible unsanitized to any filters that are invoked before the ip-tag-header filter, unless it has an *x-envoy* prefix.
72            Sanitize = 0,
73            ///
74            /// Tags will be appended to the header specified in
75            /// : ref:`ip_tag_header <envoy_v3_api_field_extensions.filters.http.ip_tagging.v3.IPTagging.ip_tag_header>`.
76            ///
77            ///
78            /// Please note that this could cause the header to retain values set by the http client regardless of whether the request is internal or external.
79            AppendIfExistsOrAdd = 1,
80        }
81        impl HeaderAction {
82            /// String value of the enum field names used in the ProtoBuf definition.
83            ///
84            /// The values are not transformed in any way and thus are considered stable
85            /// (if the ProtoBuf definition does not change) and safe for programmatic use.
86            pub fn as_str_name(&self) -> &'static str {
87                match self {
88                    Self::Sanitize => "SANITIZE",
89                    Self::AppendIfExistsOrAdd => "APPEND_IF_EXISTS_OR_ADD",
90                }
91            }
92            /// Creates an enum from field names used in the ProtoBuf definition.
93            pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
94                match value {
95                    "SANITIZE" => Some(Self::Sanitize),
96                    "APPEND_IF_EXISTS_OR_ADD" => Some(Self::AppendIfExistsOrAdd),
97                    _ => None,
98                }
99            }
100        }
101    }
102    ///
103    /// The type of requests the filter should apply to. The supported types
104    /// are internal, external or both. The
105    /// : ref:`x-forwarded-for<config_http_conn_man_headers_x-forwarded-for_internal_origin>` header is
106    ///   used to determine if a request is internal and will result in
107    /// : ref:`x-envoy-internal<config_http_conn_man_headers_x-envoy-internal>`
108    ///   being set. The filter defaults to both, and it will apply to all request types.
109    #[derive(
110        Clone,
111        Copy,
112        Debug,
113        PartialEq,
114        Eq,
115        Hash,
116        PartialOrd,
117        Ord,
118        ::prost::Enumeration
119    )]
120    #[repr(i32)]
121    pub enum RequestType {
122        /// Both external and internal requests will be tagged. This is the default value.
123        Both = 0,
124        /// Only internal requests will be tagged.
125        Internal = 1,
126        /// Only external requests will be tagged.
127        External = 2,
128    }
129    impl RequestType {
130        /// String value of the enum field names used in the ProtoBuf definition.
131        ///
132        /// The values are not transformed in any way and thus are considered stable
133        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
134        pub fn as_str_name(&self) -> &'static str {
135            match self {
136                Self::Both => "BOTH",
137                Self::Internal => "INTERNAL",
138                Self::External => "EXTERNAL",
139            }
140        }
141        /// Creates an enum from field names used in the ProtoBuf definition.
142        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
143            match value {
144                "BOTH" => Some(Self::Both),
145                "INTERNAL" => Some(Self::Internal),
146                "EXTERNAL" => Some(Self::External),
147                _ => None,
148            }
149        }
150    }
151}