#[non_exhaustive]pub struct CustomErrorResponsePolicy {
pub error_response_rules: Vec<CustomErrorResponsePolicyCustomErrorResponseRule>,
pub error_service: Option<String>,
/* private fields */
}region-url-maps or url-maps only.Expand description
Specifies the custom error response policy that must be applied when the backend service or backend bucket responds with an error.
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.error_response_rules: Vec<CustomErrorResponsePolicyCustomErrorResponseRule>Specifies rules for returning error responses.
In a given policy, if you specify rules for both a range of error codes as well as rules for specific error codes then rules with specific error codes have a higher priority. For example, assume that you configure a rule for 401 (Un-authorized) code, and another for all 4 series error codes (4XX). If the backend service returns a401, then the rule for 401 will be applied. However if the backend service returns a 403, the rule for4xx takes effect.
error_service: Option<String>The full or partial URL to the BackendBucket resource that contains the custom error content. Examples are:
- https://www.googleapis.com/compute/v1/projects/project/global/backendBuckets/myBackendBucket
- compute/v1/projects/project/global/backendBuckets/myBackendBucket
- global/backendBuckets/myBackendBucketIf errorService is not specified at lower levels likepathMatcher, pathRule and routeRule, an errorService specified at a higher level in theUrlMap will be used. IfUrlMap.defaultCustomErrorResponsePolicy contains one or moreerrorResponseRules[], it must specifyerrorService.
If load balancer cannot reach the backendBucket, a simple Not Found Error will be returned, with the original response code (oroverrideResponseCode if configured).
errorService is not supported for internal or regionalHTTP/HTTPS load balancers.
Implementations§
Source§impl CustomErrorResponsePolicy
impl CustomErrorResponsePolicy
pub fn new() -> Self
Sourcepub fn set_error_response_rules<T, V>(self, v: T) -> Self
pub fn set_error_response_rules<T, V>(self, v: T) -> Self
Sets the value of error_response_rules.
§Example
use google_cloud_compute_v1::model::CustomErrorResponsePolicyCustomErrorResponseRule;
let x = CustomErrorResponsePolicy::new()
.set_error_response_rules([
CustomErrorResponsePolicyCustomErrorResponseRule::default()/* use setters */,
CustomErrorResponsePolicyCustomErrorResponseRule::default()/* use (different) setters */,
]);Sourcepub fn set_error_service<T>(self, v: T) -> Self
pub fn set_error_service<T>(self, v: T) -> Self
Sets the value of error_service.
§Example
let x = CustomErrorResponsePolicy::new().set_error_service("example");Sourcepub fn set_or_clear_error_service<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_error_service<T>(self, v: Option<T>) -> Self
Sets or clears the value of error_service.
§Example
let x = CustomErrorResponsePolicy::new().set_or_clear_error_service(Some("example"));
let x = CustomErrorResponsePolicy::new().set_or_clear_error_service(None::<String>);Trait Implementations§
Source§impl Clone for CustomErrorResponsePolicy
impl Clone for CustomErrorResponsePolicy
Source§fn clone(&self) -> CustomErrorResponsePolicy
fn clone(&self) -> CustomErrorResponsePolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more