Skip to main content

BackendRule

Struct BackendRule 

Source
#[non_exhaustive]
pub struct BackendRule { pub selector: String, pub address: String, pub deadline: f64, pub min_deadline: f64, pub operation_deadline: f64, pub path_translation: PathTranslation, pub protocol: String, pub overrides_by_request_protocol: HashMap<String, BackendRule>, pub load_balancing_policy: String, pub authentication: Option<Authentication>, /* private fields */ }
Expand description

A backend rule provides configuration for an individual API element.

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.
§selector: String

Selects the methods to which this rule applies.

Refer to selector for syntax details.

§address: String

The address of the API backend.

The scheme is used to determine the backend protocol and security. The following schemes are accepted:

SCHEME PROTOCOL SECURITY http:// HTTP None https:// HTTP TLS grpc:// gRPC None grpcs:// gRPC TLS

It is recommended to explicitly include a scheme. Leaving out the scheme may cause constrasting behaviors across platforms.

If the port is unspecified, the default is:

  • 80 for schemes without TLS
  • 443 for schemes with TLS

For HTTP backends, use protocol to specify the protocol version.

§deadline: f64

The number of seconds to wait for a response from a request. The default varies based on the request protocol and deployment environment.

§min_deadline: f64
👎Deprecated

Deprecated, do not use.

§operation_deadline: f64

The number of seconds to wait for the completion of a long running operation. The default is no deadline.

§path_translation: PathTranslation

Path translation specifies how to combine the backend address with the request path in order to produce the appropriate forwarding URL for the request. See PathTranslation for more details.

§protocol: String

The protocol used for sending a request to the backend. The supported values are “http/1.1” and “h2”.

The default value is inferred from the scheme in the address field:

SCHEME PROTOCOL http:// http/1.1 https:// http/1.1 grpc:// h2 grpcs:// h2

For secure HTTP backends (https://) that support HTTP/2, set this field to “h2” for improved performance.

Configuring this field to non-default values is only supported for secure HTTP backends. This field will be ignored for all other backends.

See https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids for more details on the supported values.

§overrides_by_request_protocol: HashMap<String, BackendRule>

The map between request protocol and the backend address.

§load_balancing_policy: String

The load balancing policy used for connection to the application backend.

Defined as an arbitrary string to accomondate custom load balancing policies supported by the underlying channel, but suggest most users use one of the standard policies, such as the default, “RoundRobin”.

§authentication: Option<Authentication>

Authentication settings used by the backend.

These are typically used to provide service management functionality to a backend served on a publicly-routable URL. The authentication details should match the authentication behavior used by the backend.

For example, specifying jwt_audience implies that the backend expects authentication via a JWT.

When authentication is unspecified, the resulting behavior is the same as disable_auth set to true.

Refer to https://developers.google.com/identity/protocols/OpenIDConnect for JWT ID token.

Implementations§

Source§

impl BackendRule

Source

pub fn new() -> Self

Source

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

Sets the value of selector.

§Example
let x = BackendRule::new().set_selector("example");
Source

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

Sets the value of address.

§Example
let x = BackendRule::new().set_address("example");
Source

pub fn set_deadline<T: Into<f64>>(self, v: T) -> Self

Sets the value of deadline.

§Example
let x = BackendRule::new().set_deadline(42.0);
Source

pub fn set_min_deadline<T: Into<f64>>(self, v: T) -> Self

👎Deprecated

Sets the value of min_deadline.

§Example
let x = BackendRule::new().set_min_deadline(42.0);
Source

pub fn set_operation_deadline<T: Into<f64>>(self, v: T) -> Self

Sets the value of operation_deadline.

§Example
let x = BackendRule::new().set_operation_deadline(42.0);
Source

pub fn set_path_translation<T: Into<PathTranslation>>(self, v: T) -> Self

Sets the value of path_translation.

§Example
use google_cloud_api::model::backend_rule::PathTranslation;
let x0 = BackendRule::new().set_path_translation(PathTranslation::ConstantAddress);
let x1 = BackendRule::new().set_path_translation(PathTranslation::AppendPathToAddress);
Source

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

Sets the value of protocol.

§Example
let x = BackendRule::new().set_protocol("example");
Source

pub fn set_overrides_by_request_protocol<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<BackendRule>,

Sets the value of overrides_by_request_protocol.

§Example
let x = BackendRule::new().set_overrides_by_request_protocol([
    ("key0", BackendRule::default()/* use setters */),
    ("key1", BackendRule::default()/* use (different) setters */),
]);
Source

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

Sets the value of load_balancing_policy.

§Example
let x = BackendRule::new().set_load_balancing_policy("example");
Source

pub fn set_authentication<T: Into<Option<Authentication>>>(self, v: T) -> Self

Sets the value of authentication.

Note that all the setters affecting authentication are mutually exclusive.

§Example
use google_cloud_api::model::backend_rule::Authentication;
let x = BackendRule::new().set_authentication(Some(Authentication::JwtAudience("example".to_string())));
Source

pub fn jwt_audience(&self) -> Option<&String>

The value of authentication if it holds a JwtAudience, None if the field is not set or holds a different branch.

Source

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

Sets the value of authentication to hold a JwtAudience.

Note that all the setters affecting authentication are mutually exclusive.

§Example
let x = BackendRule::new().set_jwt_audience("example");
assert!(x.jwt_audience().is_some());
assert!(x.disable_auth().is_none());
Source

pub fn disable_auth(&self) -> Option<&bool>

The value of authentication if it holds a DisableAuth, None if the field is not set or holds a different branch.

Source

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

Sets the value of authentication to hold a DisableAuth.

Note that all the setters affecting authentication are mutually exclusive.

§Example
let x = BackendRule::new().set_disable_auth(true);
assert!(x.disable_auth().is_some());
assert!(x.jwt_audience().is_none());

Trait Implementations§

Source§

impl Clone for BackendRule

Source§

fn clone(&self) -> BackendRule

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 BackendRule

Source§

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

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

impl Default for BackendRule

Source§

fn default() -> BackendRule

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

impl Message for BackendRule

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for BackendRule

Source§

fn eq(&self, other: &BackendRule) -> 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 BackendRule

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, 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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,