#[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
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CustomErrorResponsePolicy
impl Debug for CustomErrorResponsePolicy
Source§impl Default for CustomErrorResponsePolicy
impl Default for CustomErrorResponsePolicy
Source§fn default() -> CustomErrorResponsePolicy
fn default() -> CustomErrorResponsePolicy
Source§impl Message for CustomErrorResponsePolicy
impl Message for CustomErrorResponsePolicy
impl StructuralPartialEq for CustomErrorResponsePolicy
Auto Trait Implementations§
impl Freeze for CustomErrorResponsePolicy
impl RefUnwindSafe for CustomErrorResponsePolicy
impl Send for CustomErrorResponsePolicy
impl Sync for CustomErrorResponsePolicy
impl Unpin for CustomErrorResponsePolicy
impl UnsafeUnpin for CustomErrorResponsePolicy
impl UnwindSafe for CustomErrorResponsePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request