#[non_exhaustive]pub struct HttpTarget {
pub uri_override: Option<UriOverride>,
pub http_method: HttpMethod,
pub header_overrides: Vec<HeaderOverride>,
pub authorization_header: Option<AuthorizationHeader>,
/* private fields */
}Expand description
HTTP target.
When specified at the Queue level, all tasks with HttpRequest are overridden according to the target.
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.uri_override: Option<UriOverride>URI override.
When specified, overrides the execution URI for all the tasks in the queue.
http_method: HttpMethodThe HTTP method to use for the request.
When specified, it overrides HttpRequest for the task. Note that if the value is set to [HttpMethod][GET] the [HttpRequest][body] of the task will be ignored at execution time.
header_overrides: Vec<HeaderOverride>HTTP target headers.
This map contains the header field names and values. Headers will be set when running the CreateTask and/or [BufferTask][google.cloud.tasks.v2.CloudTasks.BufferTask].
These headers represent a subset of the headers that will be configured for the task’s HTTP request. Some HTTP request headers will be ignored or replaced.
A partial list of headers that will be ignored or replaced is:
- Several predefined headers, prefixed with “X-CloudTasks-”, can be used to define properties of the task.
- Host: This will be computed by Cloud Tasks and derived from [HttpRequest.url][google.cloud.tasks.v2.Target.HttpRequest.url].
- Content-Length: This will be computed by Cloud Tasks.
Content-Type won’t be set by Cloud Tasks. You can explicitly set
Content-Type to a media type when the
task is created.
For example, Content-Type can be set to "application/octet-stream" or
"application/json". The default value is set to "application/json".
- User-Agent: This will be set to
"Google-Cloud-Tasks".
Headers which can have multiple values (according to RFC2616) can be specified using comma-separated values.
The size of the headers must be less than 80KB. Queue-level headers to override headers of all the tasks in the queue.
Do not put business sensitive or personally identifying data in the HTTP Header Override Configuration or other similar fields in accordance with Section 12 (Resource Fields) of the Service Specific Terms.
The mode for generating an Authorization header for HTTP requests.
If specified, all Authorization headers in the
HttpRequest.headers field are
overridden.
Implementations§
Source§impl HttpTarget
impl HttpTarget
Sourcepub fn set_uri_override<T>(self, v: T) -> Selfwhere
T: Into<UriOverride>,
pub fn set_uri_override<T>(self, v: T) -> Selfwhere
T: Into<UriOverride>,
Sets the value of uri_override.
§Example
use google_cloud_tasks_v2::model::UriOverride;
let x = HttpTarget::new().set_uri_override(UriOverride::default()/* use setters */);Sourcepub fn set_or_clear_uri_override<T>(self, v: Option<T>) -> Selfwhere
T: Into<UriOverride>,
pub fn set_or_clear_uri_override<T>(self, v: Option<T>) -> Selfwhere
T: Into<UriOverride>,
Sets or clears the value of uri_override.
§Example
use google_cloud_tasks_v2::model::UriOverride;
let x = HttpTarget::new().set_or_clear_uri_override(Some(UriOverride::default()/* use setters */));
let x = HttpTarget::new().set_or_clear_uri_override(None::<UriOverride>);Sourcepub fn set_http_method<T: Into<HttpMethod>>(self, v: T) -> Self
pub fn set_http_method<T: Into<HttpMethod>>(self, v: T) -> Self
Sets the value of http_method.
§Example
use google_cloud_tasks_v2::model::HttpMethod;
let x0 = HttpTarget::new().set_http_method(HttpMethod::Post);
let x1 = HttpTarget::new().set_http_method(HttpMethod::Get);
let x2 = HttpTarget::new().set_http_method(HttpMethod::Head);Sourcepub fn set_header_overrides<T, V>(self, v: T) -> Self
pub fn set_header_overrides<T, V>(self, v: T) -> Self
Sets the value of header_overrides.
§Example
use google_cloud_tasks_v2::model::http_target::HeaderOverride;
let x = HttpTarget::new()
.set_header_overrides([
HeaderOverride::default()/* use setters */,
HeaderOverride::default()/* use (different) setters */,
]);Sets the value of authorization_header.
Note that all the setters affecting authorization_header are mutually
exclusive.
§Example
use google_cloud_tasks_v2::model::OAuthToken;
let x = HttpTarget::new().set_authorization_header(Some(
google_cloud_tasks_v2::model::http_target::AuthorizationHeader::OauthToken(OAuthToken::default().into())));Sourcepub fn oauth_token(&self) -> Option<&Box<OAuthToken>>
pub fn oauth_token(&self) -> Option<&Box<OAuthToken>>
The value of authorization_header
if it holds a OauthToken, None if the field is not set or
holds a different branch.
Sourcepub fn set_oauth_token<T: Into<Box<OAuthToken>>>(self, v: T) -> Self
pub fn set_oauth_token<T: Into<Box<OAuthToken>>>(self, v: T) -> Self
Sets the value of authorization_header
to hold a OauthToken.
Note that all the setters affecting authorization_header are
mutually exclusive.
§Example
use google_cloud_tasks_v2::model::OAuthToken;
let x = HttpTarget::new().set_oauth_token(OAuthToken::default()/* use setters */);
assert!(x.oauth_token().is_some());
assert!(x.oidc_token().is_none());Sourcepub fn oidc_token(&self) -> Option<&Box<OidcToken>>
pub fn oidc_token(&self) -> Option<&Box<OidcToken>>
The value of authorization_header
if it holds a OidcToken, None if the field is not set or
holds a different branch.
Sourcepub fn set_oidc_token<T: Into<Box<OidcToken>>>(self, v: T) -> Self
pub fn set_oidc_token<T: Into<Box<OidcToken>>>(self, v: T) -> Self
Sets the value of authorization_header
to hold a OidcToken.
Note that all the setters affecting authorization_header are
mutually exclusive.
§Example
use google_cloud_tasks_v2::model::OidcToken;
let x = HttpTarget::new().set_oidc_token(OidcToken::default()/* use setters */);
assert!(x.oidc_token().is_some());
assert!(x.oauth_token().is_none());Trait Implementations§
Source§impl Clone for HttpTarget
impl Clone for HttpTarget
Source§impl Debug for HttpTarget
impl Debug for HttpTarget
Source§impl Default for HttpTarget
impl Default for HttpTarget
Source§impl PartialEq for HttpTarget
impl PartialEq for HttpTarget
impl StructuralPartialEq for HttpTarget
Auto Trait Implementations§
impl Freeze for HttpTarget
impl RefUnwindSafe for HttpTarget
impl Send for HttpTarget
impl Sync for HttpTarget
impl Unpin for HttpTarget
impl UnsafeUnpin for HttpTarget
impl UnwindSafe for HttpTarget
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