#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.selector: StringSelects the methods to which this rule applies.
Refer to selector for syntax details.
address: StringThe 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: f64The number of seconds to wait for a response from a request. The default varies based on the request protocol and deployment environment.
min_deadline: f64Deprecated, do not use.
operation_deadline: f64The number of seconds to wait for the completion of a long running operation. The default is no deadline.
path_translation: PathTranslationPath 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: StringThe 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: StringThe 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
impl BackendRule
pub fn new() -> Self
Sourcepub fn set_selector<T: Into<String>>(self, v: T) -> Self
pub fn set_selector<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_address<T: Into<String>>(self, v: T) -> Self
pub fn set_address<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_deadline<T: Into<f64>>(self, v: T) -> Self
pub fn set_deadline<T: Into<f64>>(self, v: T) -> Self
Sourcepub fn set_min_deadline<T: Into<f64>>(self, v: T) -> Self
👎Deprecated
pub fn set_min_deadline<T: Into<f64>>(self, v: T) -> Self
Sourcepub fn set_operation_deadline<T: Into<f64>>(self, v: T) -> Self
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);Sourcepub fn set_path_translation<T: Into<PathTranslation>>(self, v: T) -> Self
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);Sourcepub fn set_protocol<T: Into<String>>(self, v: T) -> Self
pub fn set_protocol<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_overrides_by_request_protocol<T, K, V>(self, v: T) -> Self
pub fn set_overrides_by_request_protocol<T, K, V>(self, v: T) -> Self
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 */),
]);Sourcepub fn set_load_balancing_policy<T: Into<String>>(self, v: T) -> Self
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");Sourcepub fn set_authentication<T: Into<Option<Authentication>>>(self, v: T) -> Self
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())));Sourcepub fn jwt_audience(&self) -> Option<&String>
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.
Sourcepub fn set_jwt_audience<T: Into<String>>(self, v: T) -> Self
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());Sourcepub fn disable_auth(&self) -> Option<&bool>
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.
Sourcepub fn set_disable_auth<T: Into<bool>>(self, v: T) -> Self
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
impl Clone for BackendRule
Source§fn clone(&self) -> BackendRule
fn clone(&self) -> BackendRule
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more