Google Cloud Tasks v2beta3 API - Class CloudTasksClientImpl (3.0.0-beta06)

public sealed class CloudTasksClientImpl : CloudTasksClient

Reference documentation and code samples for the Google Cloud Tasks v2beta3 API class CloudTasksClientImpl.

CloudTasks client wrapper implementation, for convenient use.

Inheritance

object > CloudTasksClient > CloudTasksClientImpl

Namespace

Google.Cloud.Tasks.V2Beta3

Assembly

Google.Cloud.Tasks.V2Beta3.dll

Remarks

Cloud Tasks allows developers to manage the execution of background work in their applications.

Constructors

CloudTasksClientImpl(CloudTasksClient, CloudTasksSettings, ILogger)

public CloudTasksClientImpl(CloudTasks.CloudTasksClient grpcClient, CloudTasksSettings settings, ILogger logger)

Constructs a client wrapper for the CloudTasks service, with the specified gRPC client and settings.

Parameters
Name Description
grpcClient CloudTasksCloudTasksClient

The underlying gRPC client.

settings CloudTasksSettings

The base CloudTasksSettings used within this client.

logger ILogger

Optional ILogger to use within this client.

Properties

GrpcClient

public override CloudTasks.CloudTasksClient GrpcClient { get; }

The underlying gRPC CloudTasks client

Property Value
Type Description
CloudTasksCloudTasksClient
Overrides

LocationsClient

public override LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient
Overrides

Methods

CreateQueue(CreateQueueRequest, CallSettings)

public override Queue CreateQueue(CreateQueueRequest request, CallSettings callSettings = null)

Creates a queue.

Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

Parameters
Name Description
request CreateQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Queue

The RPC response.

Overrides

CreateQueueAsync(CreateQueueRequest, CallSettings)

public override Task<Queue> CreateQueueAsync(CreateQueueRequest request, CallSettings callSettings = null)

Creates a queue.

Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

Parameters
Name Description
request CreateQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueue

A Task containing the RPC response.

Overrides

CreateTask(CreateTaskRequest, CallSettings)

public override Task CreateTask(CreateTaskRequest request, CallSettings callSettings = null)

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.
Parameters
Name Description
request CreateTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

The RPC response.

Overrides

CreateTaskAsync(CreateTaskRequest, CallSettings)

public override Task<Task> CreateTaskAsync(CreateTaskRequest request, CallSettings callSettings = null)

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.
Parameters
Name Description
request CreateTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTask

A Task containing the RPC response.

Overrides

DeleteQueue(DeleteQueueRequest, CallSettings)

public override void DeleteQueue(DeleteQueueRequest request, CallSettings callSettings = null)

Deletes a queue.

This command will delete the queue even if it has tasks in it.

Note: If you delete a queue, a queue with the same name can't be created for 7 days.

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

Parameters
Name Description
request DeleteQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DeleteQueueAsync(DeleteQueueRequest, CallSettings)

public override Task DeleteQueueAsync(DeleteQueueRequest request, CallSettings callSettings = null)

Deletes a queue.

This command will delete the queue even if it has tasks in it.

Note: If you delete a queue, a queue with the same name can't be created for 7 days.

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

Parameters
Name Description
request DeleteQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

DeleteTask(DeleteTaskRequest, CallSettings)

public override void DeleteTask(DeleteTaskRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request DeleteTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Overrides

DeleteTaskAsync(DeleteTaskRequest, CallSettings)

public override Task DeleteTaskAsync(DeleteTaskRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request DeleteTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Overrides

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public override Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Returns an empty policy if the resource exists and does not have a policy set.

Authorization requires the following Google IAM permission on the specified resource parent:

  • cloudtasks.queues.getIamPolicy
Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public override Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

Gets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Returns an empty policy if the resource exists and does not have a policy set.

Authorization requires the following Google IAM permission on the specified resource parent:

  • cloudtasks.queues.getIamPolicy
Parameters
Name Description
request GetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

GetQueue(GetQueueRequest, CallSettings)

public override Queue GetQueue(GetQueueRequest request, CallSettings callSettings = null)

Gets a queue.

Parameters
Name Description
request GetQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Queue

The RPC response.

Overrides

GetQueueAsync(GetQueueRequest, CallSettings)

public override Task<Queue> GetQueueAsync(GetQueueRequest request, CallSettings callSettings = null)

Gets a queue.

Parameters
Name Description
request GetQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueue

A Task containing the RPC response.

Overrides

GetTask(GetTaskRequest, CallSettings)

public override Task GetTask(GetTaskRequest request, CallSettings callSettings = null)

Gets a task.

Parameters
Name Description
request GetTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

The RPC response.

Overrides

GetTaskAsync(GetTaskRequest, CallSettings)

public override Task<Task> GetTaskAsync(GetTaskRequest request, CallSettings callSettings = null)

Gets a task.

Parameters
Name Description
request GetTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTask

A Task containing the RPC response.

Overrides

ListQueues(ListQueuesRequest, CallSettings)

public override PagedEnumerable<ListQueuesResponse, Queue> ListQueues(ListQueuesRequest request, CallSettings callSettings = null)

Lists queues.

Queues are returned in lexicographical order.

Parameters
Name Description
request ListQueuesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListQueuesResponseQueue

A pageable sequence of Queue resources.

Overrides

ListQueuesAsync(ListQueuesRequest, CallSettings)

public override PagedAsyncEnumerable<ListQueuesResponse, Queue> ListQueuesAsync(ListQueuesRequest request, CallSettings callSettings = null)

Lists queues.

Queues are returned in lexicographical order.

Parameters
Name Description
request ListQueuesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListQueuesResponseQueue

A pageable asynchronous sequence of Queue resources.

Overrides

ListTasks(ListTasksRequest, CallSettings)

public override PagedEnumerable<ListTasksResponse, Task> ListTasks(ListTasksRequest request, CallSettings callSettings = null)

Lists the tasks in a queue.

By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.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.

Parameters
Name Description
request ListTasksRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListTasksResponseTask

A pageable sequence of Task resources.

Overrides

ListTasksAsync(ListTasksRequest, CallSettings)

public override PagedAsyncEnumerable<ListTasksResponse, Task> ListTasksAsync(ListTasksRequest request, CallSettings callSettings = null)

Lists the tasks in a queue.

By default, only the [BASIC][google.cloud.tasks.v2beta3.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2beta3.ListTasksRequest.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.

Parameters
Name Description
request ListTasksRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListTasksResponseTask

A pageable asynchronous sequence of Task resources.

Overrides

PauseQueue(PauseQueueRequest, CallSettings)

public override Queue PauseQueue(PauseQueueRequest request, CallSettings callSettings = null)

Pauses the queue.

If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2beta3.Queue.state] is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].

Parameters
Name Description
request PauseQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Queue

The RPC response.

Overrides

PauseQueueAsync(PauseQueueRequest, CallSettings)

public override Task<Queue> PauseQueueAsync(PauseQueueRequest request, CallSettings callSettings = null)

Pauses the queue.

If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2beta3.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2beta3.Queue.state] is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].

Parameters
Name Description
request PauseQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueue

A Task containing the RPC response.

Overrides

PurgeQueue(PurgeQueueRequest, CallSettings)

public override Queue PurgeQueue(PurgeQueueRequest request, CallSettings callSettings = null)

Purges a queue by deleting all of its tasks.

All tasks created before this method is called are permanently deleted.

Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.

Parameters
Name Description
request PurgeQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Queue

The RPC response.

Overrides

PurgeQueueAsync(PurgeQueueRequest, CallSettings)

public override Task<Queue> PurgeQueueAsync(PurgeQueueRequest request, CallSettings callSettings = null)

Purges a queue by deleting all of its tasks.

All tasks created before this method is called are permanently deleted.

Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.

Parameters
Name Description
request PurgeQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueue

A Task containing the RPC response.

Overrides

ResumeQueue(ResumeQueueRequest, CallSettings)

public override Queue ResumeQueue(ResumeQueueRequest request, CallSettings callSettings = null)

Resume a queue.

This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING].

WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in Managing Cloud Tasks Scaling Risks.

Parameters
Name Description
request ResumeQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Queue

The RPC response.

Overrides

ResumeQueueAsync(ResumeQueueRequest, CallSettings)

public override Task<Queue> ResumeQueueAsync(ResumeQueueRequest request, CallSettings callSettings = null)

Resume a queue.

This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2beta3.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2beta3.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2beta3.Queue.State.RUNNING].

WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in Managing Cloud Tasks Scaling Risks.

Parameters
Name Description
request ResumeQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueue

A Task containing the RPC response.

Overrides

RunTask(RunTaskRequest, CallSettings)

public override Task RunTask(RunTaskRequest request, CallSettings callSettings = null)

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][google.cloud.tasks.v2beta3.RateLimits] or is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].

This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.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][Task.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][google.cloud.tasks.v2beta3.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig].

[RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.

Parameters
Name Description
request RunTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

The RPC response.

Overrides

RunTaskAsync(RunTaskRequest, CallSettings)

public override Task<Task> RunTaskAsync(RunTaskRequest request, CallSettings callSettings = null)

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][google.cloud.tasks.v2beta3.RateLimits] or is [PAUSED][google.cloud.tasks.v2beta3.Queue.State.PAUSED].

This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2beta3.CloudTasks.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][Task.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][google.cloud.tasks.v2beta3.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2beta3.RetryConfig].

[RunTask][google.cloud.tasks.v2beta3.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.

Parameters
Name Description
request RunTaskRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTask

A Task containing the RPC response.

Overrides

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public override Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing policy.

Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.

Authorization requires the following Google IAM permission on the specified resource parent:

  • cloudtasks.queues.setIamPolicy
Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Overrides

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public override Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy for a [Queue][google.cloud.tasks.v2beta3.Queue]. Replaces any existing policy.

Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console.

Authorization requires the following Google IAM permission on the specified resource parent:

  • cloudtasks.queues.setIamPolicy
Parameters
Name Description
request SetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Overrides

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public override TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta3.Queue]. If the resource does not exist, this will return an empty set of permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TestIamPermissionsResponse

The RPC response.

Overrides

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public override Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2beta3.Queue]. If the resource does not exist, this will return an empty set of permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request TestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Overrides

UpdateQueue(UpdateQueueRequest, CallSettings)

public override Queue UpdateQueue(UpdateQueueRequest request, CallSettings callSettings = null)

Updates a queue.

This method creates the queue if it does not exist and updates the queue if it does exist.

Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

Parameters
Name Description
request UpdateQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Queue

The RPC response.

Overrides

UpdateQueueAsync(UpdateQueueRequest, CallSettings)

public override Task<Queue> UpdateQueueAsync(UpdateQueueRequest request, CallSettings callSettings = null)

Updates a queue.

This method creates the queue if it does not exist and updates the queue if it does exist.

Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

Parameters
Name Description
request UpdateQueueRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskQueue

A Task containing the RPC response.

Overrides