Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * For App Engine queues, the maximum task size is 100KB. * For pull queues, the maximum task size is 1MB.

Scopes

You will need authorization for the https://www.googleapis.com/auth/cloud-platform scope to make a valid call.

If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform. You can set the scope for this method like this: cloudtasks2-beta2 --scope <scope> projects locations-queues-tasks-create ...

Required Scalar Argument

  • <parent> (string)
    • Required. The queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID The queue must already exist.

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

CreateTaskRequest:
  response-view: string
  task:
    app-engine-http-request:
      app-engine-routing:
        host: string
        instance: string
        service: string
        version: string
      headers: { string: string }
      http-method: string
      payload: string
      relative-url: string
    create-time: string
    http-request:
      body: string
      headers: { string: string }
      http-method: string
      oauth-token:
        scope: string
        service-account-email: string
      oidc-token:
        audience: string
        service-account-email: string
      url: string
    name: string
    pull-message:
      payload: string
      tag: string
    schedule-time: string
    status:
      attempt-dispatch-count: integer
      attempt-response-count: integer
      first-attempt-status:
        dispatch-time: string
        response-status:
          code: integer
          message: string
        response-time: string
        schedule-time: string
      last-attempt-status:
        dispatch-time: string
        response-status:
          code: integer
          message: string
        response-time: string
        schedule-time: string
    view: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . response-view=amet.
    • The response_view specifies which subset of the Task will be returned. By default response_view is BASIC; not all information is retrieved by default because some data, such as payloads, might be desirable to return only when needed because of its large size or because of the sensitivity of data that it contains. Authorization for FULL requires cloudtasks.tasks.fullView Google IAM permission on the Task resource.
  • task.app-engine-http-request.app-engine-routing host=sed
    • Output only. The host that the task is sent to. For more information, see How Requests are Routed. The host is constructed as: * host = [application_domain_name] | [service] + &#39;.&#39; + [application_domain_name] | [version] + &#39;.&#39; + [application_domain_name] | [version_dot_service]+ &#39;.&#39; + [application_domain_name] | [instance] + &#39;.&#39; + [application_domain_name] | [instance_dot_service] + &#39;.&#39; + [application_domain_name] | [instance_dot_version] + &#39;.&#39; + [application_domain_name] | [instance_dot_version_dot_service] + &#39;.&#39; + [application_domain_name] * application_domain_name = The domain name of the app, for example .appspot.com, which is associated with the queue's project ID. Some tasks which were created using the App Engine SDK use a custom domain name. * service = service * version = version * version_dot_service = version + &#39;.&#39; + service * instance = instance * instance_dot_service = instance + &#39;.&#39; + service * instance_dot_version = instance + &#39;.&#39; + version * instance_dot_version_dot_service = instance + &#39;.&#39; + version + &#39;.&#39; + service If service is empty, then the task will be sent to the service which is the default service when the task is attempted. If version is empty, then the task will be sent to the version which is the default version when the task is attempted. If instance is empty, then the task will be sent to an instance which is available when the task is attempted. If service, version, or instance is invalid, then the task will be sent to the default version of the default service when the task is attempted.
  • instance=takimata
  • service=dolores
    • App service. By default, the task is sent to the service which is the default service when the task is attempted. For some queues or tasks which were created using the App Engine Task Queue API, host is not parsable into service, version, and instance. For example, some tasks which were created using the App Engine SDK use a custom domain name; custom domains are not parsed by Cloud Tasks. If host is not parsable, then service, version, and instance are the empty string.
  • version=gubergren

    • App version. By default, the task is sent to the version which is the default version when the task is attempted. For some queues or tasks which were created using the App Engine Task Queue API, host is not parsable into service, version, and instance. For example, some tasks which were created using the App Engine SDK use a custom domain name; custom domains are not parsed by Cloud Tasks. If host is not parsable, then service, version, and instance are the empty string.
  • .. headers=key=et

    • 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 &#34;AppEngine-Google; (+http://code.google.com/appengine)&#34;. This header can be modified, but Cloud Tasks will append &#34;AppEngine-Google; (+http://code.google.com/appengine)&#34; to the modified User-Agent. If the task has a payload, Cloud Tasks sets the following headers: * Content-Type: By default, the Content-Type header is set to &#34;application/octet-stream&#34;. The default can be overridden by explicitly setting Content-Type to a particular media type when the task is created. For example, Content-Type can be set to &#34;application/json&#34;. * 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: * Host * X-Google-* * X-AppEngine-* In addition, Cloud Tasks sets some headers when the task is dispatched, such as headers containing information about the task; see request headers. These headers are set only when the task is dispatched, so they are not visible when the task is returned in a Cloud Tasks response. Although there is no specific limit for the maximum number of headers or the size, there is a limit on the maximum size of the Task. For more information, see the CreateTask documentation.
    • the value will be associated with the given key
  • http-method=accusam
    • 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 fails with error code 405 (Method Not Allowed). See Writing a push task request handler and the App Engine documentation for your runtime on How Requests are Handled.
  • payload=voluptua.
    • 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.
  • relative-url=dolore

    • The relative URL. The relative URL must begin with "/" and must be a valid HTTP relative URL. It can contain a path and query string arguments. 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.
  • .. create-time=dolore

    • Output only. The time that the task was created. create_time will be truncated to the nearest second.
  • http-request body=dolore
    • HTTP request body. A request body is allowed only if the HTTP method is POST, PUT, or PATCH. It is an error to set body on a task with an incompatible HttpMethod.
  • headers=key=voluptua.
    • HTTP request headers. This map contains the header field names and values. Headers can be set when running the task is created or task is created. 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: * Any header that is prefixed with "X-CloudTasks-" will be treated as service header. Service headers define properties of the task and are predefined in CloudTask. * Host: This will be computed by Cloud Tasks and derived from HttpRequest.url. * Content-Length: This will be computed by Cloud Tasks. * User-Agent: This will be set to &#34;Google-Cloud-Tasks&#34;. * 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. For example, Content-Type can be set to &#34;application/octet-stream&#34; or &#34;application/json&#34;. 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.
    • the value will be associated with the given key
  • http-method=amet.
    • The HTTP method to use for the request. The default is POST.
  • oauth-token scope=ea
    • OAuth scope to be used for generating OAuth access token. If not specified, "https://www.googleapis.com/auth/cloud-platform" will be used.
  • service-account-email=sadipscing

    • Service account email to be used for generating OAuth token. The service account must be within the same project as the queue. The caller must have iam.serviceAccounts.actAs permission for the service account.
  • ..oidc-token audience=lorem

    • Audience to be used when generating OIDC token. If not specified, the URI specified in target will be used.
  • service-account-email=invidunt

    • Service account email to be used for generating OIDC token. The service account must be within the same project as the queue. The caller must have iam.serviceAccounts.actAs permission for the service account.
  • .. url=no

    • 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.
  • .. name=est

    • Optionally caller-specified in CreateTask. The task name. The task name must have the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID * PROJECT_ID can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see Identifying projects * LOCATION_ID is the canonical ID for the task's location. The list of available locations can be obtained by calling ListLocations. For more information, see https://cloud.google.com/about/locations/. * QUEUE_ID can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters. * TASK_ID can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The maximum length is 500 characters.
  • pull-message payload=at
    • A data payload consumed by the worker to execute the task.
  • tag=sed

    • The task's tag. Tags allow similar tasks to be processed in a batch. If you label tasks with a tag, your worker can lease tasks with the same tag using filter. For example, if you want to aggregate the events associated with a specific user once a day, you could tag tasks with the user ID. The task's tag can only be set when the task is created. The tag must be less than 500 characters. SDK compatibility: Although the SDK allows tags to be either string or bytes, only UTF-8 encoded tags can be used in Cloud Tasks. If a tag isn't UTF-8 encoded, the tag will be empty when the task is returned by Cloud Tasks.
  • .. schedule-time=sit

    • The time when the task is scheduled to be attempted. For App Engine queues, this is when the task will be attempted or retried. For pull queues, this is the time when the task is available to be leased; if a task is currently leased, this is the time when the current lease expires, that is, the time that the task was leased plus the lease_duration. schedule_time will be truncated to the nearest microsecond.
  • status attempt-dispatch-count=66
    • Output only. The number of attempts dispatched. This count includes attempts which have been dispatched but haven't received a response.
  • attempt-response-count=62
    • Output only. The number of attempts which have received a response. This field is not calculated for pull tasks.
  • first-attempt-status dispatch-time=aliquyam
    • Output only. The time that this attempt was dispatched. dispatch_time will be truncated to the nearest microsecond.
  • response-status code=96
    • The status code, which should be an enum value of google.rpc.Code.
  • message=et

    • A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  • .. response-time=sanctus

    • Output only. The time that this attempt response was received. response_time will be truncated to the nearest microsecond.
  • schedule-time=lorem

    • Output only. The time that this attempt was scheduled. schedule_time will be truncated to the nearest microsecond.
  • ..last-attempt-status dispatch-time=est

    • Output only. The time that this attempt was dispatched. dispatch_time will be truncated to the nearest microsecond.
  • response-status code=71
    • The status code, which should be an enum value of google.rpc.Code.
  • message=diam

    • A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  • .. response-time=dolores

    • Output only. The time that this attempt response was received. response_time will be truncated to the nearest microsecond.
  • schedule-time=dolores

    • Output only. The time that this attempt was scheduled. schedule_time will be truncated to the nearest microsecond.
  • ... view=et

    • Output only. The view specifies which subset of the Task has been returned.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").