#[non_exhaustive]pub struct HttpRedirectAction {
pub host_redirect: Option<String>,
pub https_redirect: Option<bool>,
pub path_redirect: Option<String>,
pub prefix_redirect: Option<String>,
pub redirect_response_code: Option<RedirectResponseCode>,
pub strip_query: Option<bool>,
/* private fields */
}region-url-maps or url-maps only.Expand description
Specifies settings for an HTTP redirect.
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.host_redirect: Option<String>The host that is used in the redirect response instead of the one that was supplied in the request.
The value must be from 1 to 255 characters.
https_redirect: Option<bool>If set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request.
This must only be set for URL maps used inTargetHttpProxys. Setting this true forTargetHttpsProxy is not permitted.
The default is set to false.
path_redirect: Option<String>The path that is used in the redirect response instead of the one that was supplied in the request.
pathRedirect cannot be supplied together withprefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect.
The value must be from 1 to 1024 characters.
prefix_redirect: Option<String>The prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request.
prefixRedirect cannot be supplied together withpathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect.
The value must be from 1 to 1024 characters.
redirect_response_code: Option<RedirectResponseCode>The HTTP Status code to use for this RedirectAction.
Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained.
strip_query: Option<bool>If set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained.
The default is set to false.
Implementations§
Source§impl HttpRedirectAction
impl HttpRedirectAction
pub fn new() -> Self
Sourcepub fn set_host_redirect<T>(self, v: T) -> Self
pub fn set_host_redirect<T>(self, v: T) -> Self
Sets the value of host_redirect.
§Example
let x = HttpRedirectAction::new().set_host_redirect("example");Sourcepub fn set_or_clear_host_redirect<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_host_redirect<T>(self, v: Option<T>) -> Self
Sets or clears the value of host_redirect.
§Example
let x = HttpRedirectAction::new().set_or_clear_host_redirect(Some("example"));
let x = HttpRedirectAction::new().set_or_clear_host_redirect(None::<String>);Sourcepub fn set_https_redirect<T>(self, v: T) -> Self
pub fn set_https_redirect<T>(self, v: T) -> Self
Sets the value of https_redirect.
§Example
let x = HttpRedirectAction::new().set_https_redirect(true);Sourcepub fn set_or_clear_https_redirect<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_https_redirect<T>(self, v: Option<T>) -> Self
Sets or clears the value of https_redirect.
§Example
let x = HttpRedirectAction::new().set_or_clear_https_redirect(Some(false));
let x = HttpRedirectAction::new().set_or_clear_https_redirect(None::<bool>);Sourcepub fn set_path_redirect<T>(self, v: T) -> Self
pub fn set_path_redirect<T>(self, v: T) -> Self
Sets the value of path_redirect.
§Example
let x = HttpRedirectAction::new().set_path_redirect("example");Sourcepub fn set_or_clear_path_redirect<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_path_redirect<T>(self, v: Option<T>) -> Self
Sets or clears the value of path_redirect.
§Example
let x = HttpRedirectAction::new().set_or_clear_path_redirect(Some("example"));
let x = HttpRedirectAction::new().set_or_clear_path_redirect(None::<String>);Sourcepub fn set_prefix_redirect<T>(self, v: T) -> Self
pub fn set_prefix_redirect<T>(self, v: T) -> Self
Sets the value of prefix_redirect.
§Example
let x = HttpRedirectAction::new().set_prefix_redirect("example");Sourcepub fn set_or_clear_prefix_redirect<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_prefix_redirect<T>(self, v: Option<T>) -> Self
Sets or clears the value of prefix_redirect.
§Example
let x = HttpRedirectAction::new().set_or_clear_prefix_redirect(Some("example"));
let x = HttpRedirectAction::new().set_or_clear_prefix_redirect(None::<String>);Sourcepub fn set_redirect_response_code<T>(self, v: T) -> Selfwhere
T: Into<RedirectResponseCode>,
pub fn set_redirect_response_code<T>(self, v: T) -> Selfwhere
T: Into<RedirectResponseCode>,
Sets the value of redirect_response_code.
§Example
use google_cloud_compute_v1::model::http_redirect_action::RedirectResponseCode;
let x0 = HttpRedirectAction::new().set_redirect_response_code(RedirectResponseCode::MovedPermanentlyDefault);
let x1 = HttpRedirectAction::new().set_redirect_response_code(RedirectResponseCode::PermanentRedirect);
let x2 = HttpRedirectAction::new().set_redirect_response_code(RedirectResponseCode::SeeOther);Sourcepub fn set_or_clear_redirect_response_code<T>(self, v: Option<T>) -> Selfwhere
T: Into<RedirectResponseCode>,
pub fn set_or_clear_redirect_response_code<T>(self, v: Option<T>) -> Selfwhere
T: Into<RedirectResponseCode>,
Sets or clears the value of redirect_response_code.
§Example
use google_cloud_compute_v1::model::http_redirect_action::RedirectResponseCode;
let x0 = HttpRedirectAction::new().set_or_clear_redirect_response_code(Some(RedirectResponseCode::MovedPermanentlyDefault));
let x1 = HttpRedirectAction::new().set_or_clear_redirect_response_code(Some(RedirectResponseCode::PermanentRedirect));
let x2 = HttpRedirectAction::new().set_or_clear_redirect_response_code(Some(RedirectResponseCode::SeeOther));
let x_none = HttpRedirectAction::new().set_or_clear_redirect_response_code(None::<RedirectResponseCode>);Sourcepub fn set_strip_query<T>(self, v: T) -> Self
pub fn set_strip_query<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_strip_query<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_strip_query<T>(self, v: Option<T>) -> Self
Sets or clears the value of strip_query.
§Example
let x = HttpRedirectAction::new().set_or_clear_strip_query(Some(false));
let x = HttpRedirectAction::new().set_or_clear_strip_query(None::<bool>);Trait Implementations§
Source§impl Clone for HttpRedirectAction
impl Clone for HttpRedirectAction
Source§fn clone(&self) -> HttpRedirectAction
fn clone(&self) -> HttpRedirectAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more