class ProjectsLocationsQueuesTasks extends Resource (View source)

The "tasks" collection of methods.

Typical usage is:

 $cloudtasksService = new Google\Service\CloudTasks(...);
 $tasks = $cloudtasksService->projects_locations_queues_tasks;

Methods

buffer(string $queue, string $taskId, BufferTaskRequest $postBody, array $optParams = [])

Creates and buffers a new task without the need to explicitly define a Task message. The queue must have HTTP target. To create the task with a custom ID, use the following format and set TASK_ID to your desired ID: projects/PRO JECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer To create the task with an automatically generated ID, use the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.

create(string $parent, CreateTaskRequest $postBody, array $optParams = [])

Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * The maximum task size is 100KB.

delete(string $name, array $optParams = [])

Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.

get(string $name, array $optParams = [])

Gets a task. (tasks.get)

listProjectsLocationsQueuesTasks(string $parent, array $optParams = [])

Lists the tasks in a queue. By default, only the BASIC view is retrieved due to performance considerations; response_view controls the subset of information which is returned. The tasks may be returned in any order. The ordering may change at any time. (tasks.listProjectsLocationsQueuesTasks)

run(string $name, RunTaskRequest $postBody, array $optParams = [])

Forces a task to run now. When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its RateLimits or is PAUSED. This command is meant to be used for manual debugging. For example, RunTask can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now. The dispatched task is returned. That is, the task that is returned contains the status after the task is dispatched but before the task is received by its target. If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's schedule_time will be reset to the time that RunTask was called plus the retry delay specified in the queue's RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has already succeeded or permanently failed. (tasks.run)

Details

BufferTaskResponse buffer(string $queue, string $taskId, BufferTaskRequest $postBody, array $optParams = [])

Creates and buffers a new task without the need to explicitly define a Task message. The queue must have HTTP target. To create the task with a custom ID, use the following format and set TASK_ID to your desired ID: projects/PRO JECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID:buffer To create the task with an automatically generated ID, use the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks:buffer.

(tasks.buffer)

Parameters

string $queue

Required. The parent queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` The queue must already exist.

string $taskId

Optional. Task ID for the task being created. If not provided, Cloud Tasks generates an ID for the task.

BufferTaskRequest $postBody
array $optParams

Optional parameters.

Return Value

BufferTaskResponse

Exceptions

Exception

Task create(string $parent, CreateTaskRequest $postBody, array $optParams = [])

Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * The maximum task size is 100KB.

(tasks.create)

Parameters

string $parent

Required. The queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID The queue must already exist.

CreateTaskRequest $postBody
array $optParams

Optional parameters.

Return Value

Task

Exceptions

Exception

CloudtasksEmpty delete(string $name, array $optParams = [])

Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.

(tasks.delete)

Parameters

string $name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

array $optParams

Optional parameters.

Return Value

CloudtasksEmpty

Exceptions

Exception

Task get(string $name, array $optParams = [])

Gets a task. (tasks.get)

Parameters

string $name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

array $optParams

Optional parameters.

Return Value

Task

Exceptions

Exception

ListTasksResponse listProjectsLocationsQueuesTasks(string $parent, array $optParams = [])

Lists the tasks in a queue. By default, only the BASIC view is retrieved due to performance considerations; response_view controls the subset of information which is returned. The tasks may be returned in any order. The ordering may change at any time. (tasks.listProjectsLocationsQueuesTasks)

Parameters

string $parent

Required. The queue name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID

array $optParams

Optional parameters.

Return Value

ListTasksResponse

Exceptions

Exception

Task run(string $name, RunTaskRequest $postBody, array $optParams = [])

Forces a task to run now. When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its RateLimits or is PAUSED. This command is meant to be used for manual debugging. For example, RunTask can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now. The dispatched task is returned. That is, the task that is returned contains the status after the task is dispatched but before the task is received by its target. If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's schedule_time will be reset to the time that RunTask was called plus the retry delay specified in the queue's RetryConfig. RunTask returns NOT_FOUND when it is called on a task that has already succeeded or permanently failed. (tasks.run)

Parameters

string $name

Required. The task name. For example: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

RunTaskRequest $postBody
array $optParams

Optional parameters.

Return Value

Task

Exceptions

Exception