Struct gapi_grpc::google::cloud::tasks::v2::HttpRequest [−][src]
HTTP request.
The task will be pushed to the worker as an HTTP request. If the worker
or the redirected worker acknowledges the task by returning a successful HTTP
response code ([200
- 299
]), the task will be removed from the queue. If
any other HTTP response code is returned or no response is received, the
task will be retried according to the following:
-
User-specified throttling: [retry configuration][google.cloud.tasks.v2.Queue.retry_config], [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue’s state][google.cloud.tasks.v2.Queue.state].
-
System throttling: To prevent the worker from overloading, Cloud Tasks may temporarily reduce the queue’s effective rate. User-specified settings will not be changed.
System throttling happens because:
-
Cloud Tasks backs off on all errors. Normally the backoff specified in [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But if the worker returns
429
(Too Many Requests),503
(Service Unavailable), or the rate of errors is high, Cloud Tasks will use a higher backoff rate. The retry specified in theRetry-After
HTTP response header is considered. -
To prevent traffic spikes and to smooth sudden increases in traffic, dispatches ramp up slowly when the queue is newly created or idle and if large numbers of tasks suddenly become available to dispatch (due to spikes in create task rates, the queue being unpaused, or many tasks that are scheduled at the same time).
Fields
url: String
Required. The full url path that the request will be sent to.
This string must begin with either “http://” or “https://”. Some examples
are: http://acme.com
and https://acme.com/sales:8080
. Cloud Tasks will
encode some characters for safety and compatibility. The maximum allowed
URL length is 2083 characters after encoding.
The Location
header response from a redirect response [300
- 399
]
may be followed. The redirect is not counted as a separate attempt.
http_method: i32
The HTTP method to use for the request. The default is POST.
headers: HashMap<String, String>
HTTP request headers.
This map contains the header field names and values. Headers can be set when the [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
These headers represent a subset of the headers that will accompany 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:
- Host: This will be computed by Cloud Tasks and derived from [HttpRequest.url][google.cloud.tasks.v2.HttpRequest.url].
- Content-Length: This will be computed by Cloud Tasks.
- User-Agent: This will be set to
"Google-Cloud-Tasks"
. - X-Google-*: Google use only.
- X-AppEngine-*: Google use only.
Content-Type
won’t be set by Cloud Tasks. You can explicitly set
Content-Type
to a media type when the
[task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask].
For example, Content-Type
can be set to "application/octet-stream"
or
"application/json"
.
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.
body: Vec<u8>
HTTP request body.
A request body is allowed only if the [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT, or PATCH. It is an error to set body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2.HttpMethod].
The mode for generating an Authorization
header for HTTP requests.
If specified, all Authorization
headers in the [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers]
field will be overridden.
Implementations
impl HttpRequest
[src]
pub fn http_method(&self) -> HttpMethod
[src]
Returns the enum value of http_method
, or the default if the field is set to an invalid enum value.
pub fn set_http_method(&mut self, value: HttpMethod)
[src]
Sets http_method
to the provided enum value.
Trait Implementations
impl Clone for HttpRequest
[src]
fn clone(&self) -> HttpRequest
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for HttpRequest
[src]
impl Default for HttpRequest
[src]
fn default() -> HttpRequest
[src]
impl Message for HttpRequest
[src]
fn encode_raw<B>(&self, buf: &mut B) where
B: BufMut,
[src]
B: BufMut,
fn merge_field<B>(
&mut self,
tag: u32,
wire_type: WireType,
buf: &mut B,
ctx: DecodeContext
) -> Result<(), DecodeError> where
B: Buf,
[src]
&mut self,
tag: u32,
wire_type: WireType,
buf: &mut B,
ctx: DecodeContext
) -> Result<(), DecodeError> where
B: Buf,
fn encoded_len(&self) -> usize
[src]
fn clear(&mut self)
[src]
pub fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
[src]
B: BufMut,
pub fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
[src]
B: BufMut,
pub fn decode<B>(buf: B) -> Result<Self, DecodeError> where
Self: Default,
B: Buf,
[src]
Self: Default,
B: Buf,
pub fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
Self: Default,
B: Buf,
[src]
Self: Default,
B: Buf,
pub fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
[src]
B: Buf,
pub fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
[src]
B: Buf,
impl PartialEq<HttpRequest> for HttpRequest
[src]
fn eq(&self, other: &HttpRequest) -> bool
[src]
fn ne(&self, other: &HttpRequest) -> bool
[src]
impl StructuralPartialEq for HttpRequest
[src]
Auto Trait Implementations
impl RefUnwindSafe for HttpRequest
impl Send for HttpRequest
impl Sync for HttpRequest
impl Unpin for HttpRequest
impl UnwindSafe for HttpRequest
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoRequest<T> for T
[src]
pub fn into_request(self) -> Request<T>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,