Struct google_cloudtasks2_beta2::AppEngineHttpRequest
[−]
[src]
pub struct AppEngineHttpRequest {
pub relative_url: Option<String>,
pub headers: Option<HashMap<String, String>>,
pub app_engine_routing: Option<AppEngineRouting>,
pub payload: Option<String>,
pub http_method: Option<String>,
}App Engine HTTP request.
The message defines the HTTP request that is sent to an App Engine app when the task is dispatched.
This proto can only be used for tasks in a queue which has Queue.app_engine_http_target set.
Using AppEngineHttpRequest requires
appengine.applications.get
Google IAM permission for the project
and the following scope:
https://www.googleapis.com/auth/cloud-platform
The task will be delivered to the App Engine app which belongs to the same project as the queue. For more information, see How Requests are Routed and how routing is affected by dispatch files.
The AppEngineRouting used to construct the URL that the task is delivered to can be set at the queue-level or task-level:
- If set, AppEngineHttpTarget.app_engine_routing_override is used for all tasks in the queue, no matter what the setting is for the task-level app_engine_routing.
The url that the task will be sent to is:
url =AppEngineRouting.host+AppEngineHttpRequest.relative_url
The task will be sent to a task handler by an HTTP request using the specified AppEngineHttpRequest.http_method (for example POST, HTTP GET, etc). The task attempt has succeeded if the task handler returns an HTTP response code in the range [200 - 299]. Error 503 is considered an App Engine system error instead of an application error. Requests returning error 503 will be retried regardless of retry configuration and not counted against retry counts. Any other response code or a failure to receive a response before the deadline is a failed attempt.
This type is not used in any activity, and only used as part of another schema.
Fields
relative_url: Option<String>
The relative URL.
The relative URL must begin with "/" and must be a valid HTTP relative URL.
It can contain a path, query string arguments, and # fragments.
If the relative URL is empty, then the root path "/" will be used.
No spaces are allowed, and the maximum length allowed is 2083 characters.
headers: Option<HashMap<String, String>>
HTTP request headers.
This map contains the header field names and values. Headers can be set when the task is created. Repeated headers are not supported but a header value can contain commas.
Cloud Tasks sets some headers to default values:
User-Agent: By default, this header is"AppEngine-Google; (+http://code.google.com/appengine)". This header can be modified, but Cloud Tasks will append"AppEngine-Google; (+http://code.google.com/appengine)"to the modifiedUser-Agent.
If the task has an AppEngineHttpRequest.payload, Cloud Tasks sets the following headers:
Content-Type: By default, theContent-Typeheader is set to"application/octet-stream". The default can be overridden by explictly settingContent-Typeto a particular media type when the task is created. For example,Content-Typecan be set to"application/json".Content-Length: This is computed by Cloud Tasks. This value is output only. It cannot be changed.
The headers below cannot be set or overridden:
HostX-Google-*X-AppEngine-*
In addition, some App Engine headers, which contain task-specific information, are also be sent to the task handler; see request headers.
app_engine_routing: Option<AppEngineRouting>
Task-level setting for App Engine routing.
If set, AppEngineHttpTarget.app_engine_routing_override is used for all tasks in the queue, no matter what the setting is for the task-level app_engine_routing.
payload: Option<String>
Payload.
The payload will be sent as the HTTP message body. A message body, and thus a payload, is allowed only if the HTTP method is POST or PUT. It is an error to set a data payload on a task with an incompatible HttpMethod.
http_method: Option<String>
The HTTP method to use for the request. The default is POST.
The app's request handler for the task's target URL must be able to handle HTTP requests with this http_method, otherwise the task attempt will fail with error code 405 "Method Not Allowed" because "the method specified in the Request-Line is not allowed for the resource identified by the Request-URI". See Writing a push task request handler and the documentation for the request handlers in the language your app is written in e.g. python RequestHandler.
Trait Implementations
impl Default for AppEngineHttpRequest[src]
fn default() -> AppEngineHttpRequest[src]
Returns the "default value" for a type. Read more
impl Clone for AppEngineHttpRequest[src]
fn clone(&self) -> AppEngineHttpRequest[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more