Class CloudTasksClientImpl

public sealed class CloudTasksClientImpl : CloudTasksClient

CloudTasks client wrapper implementation, for convenient use.

Inheritance

Object > CloudTasksClient > CloudTasksClientImpl

Namespace

Google.Cloud.Tasks.V2

Assembly

Google.Cloud.Tasks.V2.dll

Remarks

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

Constructors

CloudTasksClientImpl(CloudTasks.CloudTasksClient, CloudTasksSettings)

public CloudTasksClientImpl(CloudTasks.CloudTasksClient grpcClient, CloudTasksSettings settings)

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

Parameters
NameDescription
grpcClientCloudTasks.CloudTasksClient

The underlying gRPC client.

settingsCloudTasksSettings

The base CloudTasksSettings used within this client.

Properties

GrpcClient

public override CloudTasks.CloudTasksClient GrpcClient { get; }

The underlying gRPC CloudTasks client

Property Value
TypeDescription
CloudTasks.CloudTasksClient
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
NameDescription
requestCreateQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestCreateQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Queue>

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
NameDescription
requestCreateTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestCreateTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Task>

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
NameDescription
requestDeleteQueueRequest

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

callSettingsCallSettings

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
NameDescription
requestDeleteQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestDeleteTaskRequest

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

callSettingsCallSettings

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
NameDescription
requestDeleteTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.v2.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
NameDescription
requestGetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.v2.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
NameDescription
requestGetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

Overrides

GetQueue(GetQueueRequest, CallSettings)

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

Gets a queue.

Parameters
NameDescription
requestGetQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Queue

The RPC response.

Overrides

GetQueueAsync(GetQueueRequest, CallSettings)

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

Gets a queue.

Parameters
NameDescription
requestGetQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Queue>

A Task containing the RPC response.

Overrides

GetTask(GetTaskRequest, CallSettings)

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

Gets a task.

Parameters
NameDescription
requestGetTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

The RPC response.

Overrides

GetTaskAsync(GetTaskRequest, CallSettings)

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

Gets a task.

Parameters
NameDescription
requestGetTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Task>

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
NameDescription
requestListQueuesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListQueuesResponse, Queue>

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
NameDescription
requestListQueuesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListQueuesResponse, Queue>

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.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.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
NameDescription
requestListTasksRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListTasksResponse, Task>

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.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.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
NameDescription
requestListTasksRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListTasksResponse, Task>

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.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].

Parameters
NameDescription
requestPauseQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].

Parameters
NameDescription
requestPauseQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Queue>

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
NameDescription
requestPurgeQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestPurgeQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Queue>

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.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.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
NameDescription
requestResumeQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.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
NameDescription
requestResumeQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Queue>

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

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

[RunTask][google.cloud.tasks.v2.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
NameDescription
requestRunTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

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

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

[RunTask][google.cloud.tasks.v2.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
NameDescription
requestRunTaskRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Task>

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.v2.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
NameDescription
requestSetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.v2.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
NameDescription
requestSetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

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.v2.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
NameDescription
requestTestIamPermissionsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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.v2.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
NameDescription
requestTestIamPermissionsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

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
NameDescription
requestUpdateQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestUpdateQueueRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Queue>

A Task containing the RPC response.

Overrides