Skip to main content

HttpHeaderMatch

Struct HttpHeaderMatch 

Source
#[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 */ }
Available on crate features 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

Source

pub fn new() -> Self

Source

pub fn set_exact_match<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of exact_match.

§Example
let x = HttpHeaderMatch::new().set_exact_match("example");
Source

pub fn set_or_clear_exact_match<T>(self, v: Option<T>) -> Self
where T: Into<String>,

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>);
Source

pub fn set_header_name<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of header_name.

§Example
let x = HttpHeaderMatch::new().set_header_name("example");
Source

pub fn set_or_clear_header_name<T>(self, v: Option<T>) -> Self
where T: Into<String>,

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>);
Source

pub fn set_invert_match<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of invert_match.

§Example
let x = HttpHeaderMatch::new().set_invert_match(true);
Source

pub fn set_or_clear_invert_match<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

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>);
Source

pub fn set_prefix_match<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of prefix_match.

§Example
let x = HttpHeaderMatch::new().set_prefix_match("example");
Source

pub fn set_or_clear_prefix_match<T>(self, v: Option<T>) -> Self
where T: Into<String>,

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>);
Source

pub fn set_present_match<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of present_match.

§Example
let x = HttpHeaderMatch::new().set_present_match(true);
Source

pub fn set_or_clear_present_match<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

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>);
Source

pub fn set_range_match<T>(self, v: T) -> Self

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 */);
Source

pub fn set_or_clear_range_match<T>(self, v: Option<T>) -> Self

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>);
Source

pub fn set_regex_match<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of regex_match.

§Example
let x = HttpHeaderMatch::new().set_regex_match("example");
Source

pub fn set_or_clear_regex_match<T>(self, v: Option<T>) -> Self
where T: Into<String>,

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>);
Source

pub fn set_suffix_match<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of suffix_match.

§Example
let x = HttpHeaderMatch::new().set_suffix_match("example");
Source

pub fn set_or_clear_suffix_match<T>(self, v: Option<T>) -> Self
where T: Into<String>,

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

Source§

fn clone(&self) -> HttpHeaderMatch

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpHeaderMatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HttpHeaderMatch

Source§

fn default() -> HttpHeaderMatch

Returns the “default value” for a type. Read more
Source§

impl Message for HttpHeaderMatch

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for HttpHeaderMatch

Source§

fn eq(&self, other: &HttpHeaderMatch) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for HttpHeaderMatch

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,