#[non_exhaustive]pub struct HttpHeaderMatch {
pub exact_match: Option<String>,
pub header_name: Option<String>,
pub invert_match: Option<bool>,
pub prefix_match: Option<String>,
pub present_match: Option<bool>,
pub range_match: Option<Int64RangeMatch>,
pub regex_match: Option<String>,
pub suffix_match: Option<String>,
/* private fields */
}region-url-maps or url-maps only.Expand description
matchRule criteria for request header matches.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.exact_match: Option<String>The value should exactly match contents of exactMatch.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
header_name: Option<String>The name of the HTTP header to match.
For matching against the HTTP request’s authority, use a headerMatch with the header name “:authority”.
For matching a request’s method, use the headerName “:method”.
When the URL map is bound to a target gRPC proxy that has
the validateForProxyless field set to true, only
non-binary
user-specified custom metadata and the content-type header are supported.
The following transport-level headers cannot be used in header matching
rules:
:authority, :method, :path, :scheme, user-agent,
accept-encoding, content-encoding, grpc-accept-encoding,
grpc-encoding, grpc-previous-rpc-attempts, grpc-tags-bin,
grpc-timeout and grpc-trace-bin.
invert_match: Option<bool>If set to false, the headerMatch is considered a match if the preceding match criteria are met. If set to true, the headerMatch is considered a match if the preceding match criteria are NOT met.
The default setting is false.
prefix_match: Option<String>The value of the header must start with the contents ofprefixMatch.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
present_match: Option<bool>A header with the contents of headerName must exist. The match takes place whether or not the request’s header has a value.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
range_match: Option<Int64RangeMatch>The header value must be an integer and its value must be in the range specified in rangeMatch. If the header does not contain an integer, number or is empty, the match fails.
For example for a range [-5, 0]
- -3 will match.
- 0 will not match.
- 0.25 will not match.
- -3someString will not match.Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
rangeMatch is not supported for load balancers that have loadBalancingScheme set to EXTERNAL.
regex_match: Option<String>The value of the header must match the regular expression specified inregexMatch. For more information about regular expression syntax, see Syntax.
For matching against a port specified in the HTTP request, use a headerMatch with headerName set to PORT and a regular expression that satisfies the RFC2616 Host header’s port specifier.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED, EXTERNAL_MANAGED (regional scope) or INTERNAL_MANAGED.
suffix_match: Option<String>The value of the header must end with the contents ofsuffixMatch.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
Implementations§
Source§impl HttpHeaderMatch
impl HttpHeaderMatch
pub fn new() -> Self
Sourcepub fn set_exact_match<T>(self, v: T) -> Self
pub fn set_exact_match<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_exact_match<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_exact_match<T>(self, v: Option<T>) -> Self
Sets or clears the value of exact_match.
§Example
let x = HttpHeaderMatch::new().set_or_clear_exact_match(Some("example"));
let x = HttpHeaderMatch::new().set_or_clear_exact_match(None::<String>);Sourcepub fn set_header_name<T>(self, v: T) -> Self
pub fn set_header_name<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_header_name<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_header_name<T>(self, v: Option<T>) -> Self
Sets or clears the value of header_name.
§Example
let x = HttpHeaderMatch::new().set_or_clear_header_name(Some("example"));
let x = HttpHeaderMatch::new().set_or_clear_header_name(None::<String>);Sourcepub fn set_invert_match<T>(self, v: T) -> Self
pub fn set_invert_match<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_invert_match<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_invert_match<T>(self, v: Option<T>) -> Self
Sets or clears the value of invert_match.
§Example
let x = HttpHeaderMatch::new().set_or_clear_invert_match(Some(false));
let x = HttpHeaderMatch::new().set_or_clear_invert_match(None::<bool>);Sourcepub fn set_prefix_match<T>(self, v: T) -> Self
pub fn set_prefix_match<T>(self, v: T) -> Self
Sets the value of prefix_match.
§Example
let x = HttpHeaderMatch::new().set_prefix_match("example");Sourcepub fn set_or_clear_prefix_match<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_prefix_match<T>(self, v: Option<T>) -> Self
Sets or clears the value of prefix_match.
§Example
let x = HttpHeaderMatch::new().set_or_clear_prefix_match(Some("example"));
let x = HttpHeaderMatch::new().set_or_clear_prefix_match(None::<String>);Sourcepub fn set_present_match<T>(self, v: T) -> Self
pub fn set_present_match<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_present_match<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_present_match<T>(self, v: Option<T>) -> Self
Sets or clears the value of present_match.
§Example
let x = HttpHeaderMatch::new().set_or_clear_present_match(Some(false));
let x = HttpHeaderMatch::new().set_or_clear_present_match(None::<bool>);Sourcepub fn set_range_match<T>(self, v: T) -> Selfwhere
T: Into<Int64RangeMatch>,
pub fn set_range_match<T>(self, v: T) -> Selfwhere
T: Into<Int64RangeMatch>,
Sets the value of range_match.
§Example
use google_cloud_compute_v1::model::Int64RangeMatch;
let x = HttpHeaderMatch::new().set_range_match(Int64RangeMatch::default()/* use setters */);Sourcepub fn set_or_clear_range_match<T>(self, v: Option<T>) -> Selfwhere
T: Into<Int64RangeMatch>,
pub fn set_or_clear_range_match<T>(self, v: Option<T>) -> Selfwhere
T: Into<Int64RangeMatch>,
Sets or clears the value of range_match.
§Example
use google_cloud_compute_v1::model::Int64RangeMatch;
let x = HttpHeaderMatch::new().set_or_clear_range_match(Some(Int64RangeMatch::default()/* use setters */));
let x = HttpHeaderMatch::new().set_or_clear_range_match(None::<Int64RangeMatch>);Sourcepub fn set_regex_match<T>(self, v: T) -> Self
pub fn set_regex_match<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_regex_match<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_regex_match<T>(self, v: Option<T>) -> Self
Sets or clears the value of regex_match.
§Example
let x = HttpHeaderMatch::new().set_or_clear_regex_match(Some("example"));
let x = HttpHeaderMatch::new().set_or_clear_regex_match(None::<String>);Sourcepub fn set_suffix_match<T>(self, v: T) -> Self
pub fn set_suffix_match<T>(self, v: T) -> Self
Sets the value of suffix_match.
§Example
let x = HttpHeaderMatch::new().set_suffix_match("example");Sourcepub fn set_or_clear_suffix_match<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_suffix_match<T>(self, v: Option<T>) -> Self
Sets or clears the value of suffix_match.
§Example
let x = HttpHeaderMatch::new().set_or_clear_suffix_match(Some("example"));
let x = HttpHeaderMatch::new().set_or_clear_suffix_match(None::<String>);Trait Implementations§
Source§impl Clone for HttpHeaderMatch
impl Clone for HttpHeaderMatch
Source§fn clone(&self) -> HttpHeaderMatch
fn clone(&self) -> HttpHeaderMatch
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more