# Cloud Tasks V2beta2 API - Class Google::Cloud::Tasks::V2beta2::CloudTasks::Client (v0.18.0)

0.18.0 (latest) 0.17.0 0.16.1 0.15.0 0.14.1 0.13.0 0.12.1 0.11.3 0.10.0 0.9.2 0.8.0 0.7.0 0.6.0 0.5.5 Reference documentation and code samples for the Cloud Tasks V2beta2 API class Google::Cloud::Tasks::V2beta2::CloudTasks::Client.

Client for the CloudTasks service.


<br />

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

## Inherits

- Object

## Includes

- [Google::Cloud::Tasks::V2beta2::CloudTasks::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the CloudTasks Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration "Google::Cloud::Tasks::V2beta2::CloudTasks::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all CloudTasks clients
::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.configure do |config|
  config.timeout = 10.0
end
```

### #acknowledge_task

    def acknowledge_task(request, options = nil) -> ::Google::Protobuf::Empty
    def acknowledge_task(name: nil, schedule_time: nil) -> ::Google::Protobuf::Empty

Acknowledges a pull task.


The worker, that is, the entity that
[leased](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") this task must
call this method to indicate that the work associated with the task has
finished.

<br />

The worker must acknowledge a task within the
[lease_duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksRequest#Google__Cloud__Tasks__V2beta2__LeaseTasksRequest_lease_duration_instance_ "Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#lease_duration (method)")
or the lease will expire and the task will become available to be leased
again. After the task is acknowledged, it will not be returned
by a later [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)"),
[GetTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_get_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#get_task (method)"), or
[ListTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_list_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks (method)").
**Overloads**

    def acknowledge_task(request, options = nil) -> ::Google::Protobuf::Empty

Pass arguments to `acknowledge_task` via a request object, either of type [AcknowledgeTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-AcknowledgeTaskRequest "Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-AcknowledgeTaskRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def acknowledge_task(name: nil, schedule_time: nil) -> ::Google::Protobuf::Empty

Pass arguments to `acknowledge_task` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
- **schedule_time** ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Timestamp), ::Hash) --- Required. The task's current schedule time, available in the [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") returned by [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") response or [RenewLease](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_renew_lease_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease (method)") response. This restriction is to ensure that your worker currently holds the lease.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::AcknowledgeTaskRequest.new

# Call the acknowledge_task method.
result = client.acknowledge_task request

# The returned object is of type Google::Protobuf::Empty.
p result
```

### #cancel_lease

    def cancel_lease(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task
    def cancel_lease(name: nil, schedule_time: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Cancel a pull task's lease.


<br />

The worker can use this method to cancel a task's lease by
setting its [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)")
to now. This will make the task available to be leased to the next caller
of [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)").
**Overloads**

    def cancel_lease(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `cancel_lease` via a request object, either of type [Google::Cloud::Tasks::V2beta2::CancelLeaseRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CancelLeaseRequest "Google::Cloud::Tasks::V2beta2::CancelLeaseRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::CancelLeaseRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CancelLeaseRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def cancel_lease(name: nil, schedule_time: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `cancel_lease` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
- **schedule_time** ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Timestamp), ::Hash) --- Required. The task's current schedule time, available in the [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") returned by [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") response or [RenewLease](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_renew_lease_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease (method)") response. This restriction is to ensure that your worker currently holds the lease.
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::CancelLeaseRequest.new

# Call the cancel_lease method.
result = client.cancel_lease request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Task.
p result
```

### #configure

    def configure() { |config| ... } -> Client::Configuration

Configure the CloudTasks Client instance.


The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on [Client.configure](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_configure_class_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration "Google::Cloud::Tasks::V2beta2::CloudTasks::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration))

### #create_queue

    def create_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue
    def create_queue(parent: nil, queue: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

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.

<br />

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](https://cloud.google.com/tasks/docs/queue-yaml) before using
this method.
**Overloads**

    def create_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `create_queue` via a request object, either of type [Google::Cloud::Tasks::V2beta2::CreateQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CreateQueueRequest "Google::Cloud::Tasks::V2beta2::CreateQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::CreateQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CreateQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def create_queue(parent: nil, queue: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `create_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The location name in which the queue will be created. For example: `projects/PROJECT_ID/locations/LOCATION_ID`


  The list of allowed locations can be obtained by calling Cloud
  Tasks' implementation of
  \[ListLocations\]\[google.cloud.location.Locations.ListLocations\].
- **queue** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue), ::Hash) --- Required. The queue to create.


  \[Queue's name\]\[google.cloud.tasks.v2beta2.Queue.name\] cannot be the same as
  an existing queue.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::CreateQueueRequest.new

# Call the create_queue method.
result = client.create_queue request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Queue.
p result
```

### #create_task

    def create_task(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task
    def create_task(parent: nil, task: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Creates a task and adds it to a queue.

Tasks cannot be updated after creation; there is no UpdateTask command.

- For [App Engine queues](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-AppEngineHttpTarget "Google::Cloud::Tasks::V2beta2::AppEngineHttpTarget (class)"), the maximum task size is 100KB.
- For [pull queues](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PullTarget "Google::Cloud::Tasks::V2beta2::PullTarget (class)"), the maximum task size is 1MB.
**Overloads**

    def create_task(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `create_task` via a request object, either of type [Google::Cloud::Tasks::V2beta2::CreateTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CreateTaskRequest "Google::Cloud::Tasks::V2beta2::CreateTaskRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::CreateTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CreateTaskRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def create_task(parent: nil, task: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `create_task` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`


  The queue must already exist.
- **task** ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task), ::Hash) --- Required. The task to add.


  Task names have the following format:
  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`.
  The user can optionally specify a task
  [name](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_name_instance_ "Google::Cloud::Tasks::V2beta2::Task#name (method)"). If a name is not specified
  then the system will generate a random unique task id, which will be set in
  the task returned in the [response](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_name_instance_ "Google::Cloud::Tasks::V2beta2::Task#name (method)").

  If [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") is not
  set or is in the past then Cloud Tasks will set it to the current time.

  Task De-duplication:

  Explicitly specifying a task ID enables task de-duplication. If
  a task's ID is identical to that of an existing task or a task
  that was deleted or completed recently then the call will fail
  with \[ALREADY_EXISTS\]\[google.rpc.Code.ALREADY_EXISTS\].
  If the task's queue was created using Cloud Tasks, then another task with
  the same name can't be created for \~1 hour after the original task was
  deleted or completed. If the task's queue was created using queue.yaml or
  queue.xml, then another task with the same name can't be created
  for \~9 days after the original task was deleted or completed.

  Because there is an extra lookup cost to identify duplicate task
  names, these [CreateTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_create_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#create_task (method)")
  calls have significantly increased latency. Using hashed strings for the
  task id or for the prefix of the task id is recommended. Choosing task ids
  that are sequential or have sequential prefixes, for example using a
  timestamp, causes an increase in latency and error rates in all
  task commands. The infrastructure relies on an approximately
  uniform distribution of task ids to store and serve tasks
  efficiently.
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::CreateTaskRequest.new

# Call the create_task method.
result = client.create_task request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Task.
p result
```

### #delete_queue

    def delete_queue(request, options = nil) -> ::Google::Protobuf::Empty
    def delete_queue(name: nil) -> ::Google::Protobuf::Empty

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.

<br />

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](https://cloud.google.com/tasks/docs/queue-yaml) before using
this method.
**Overloads**

    def delete_queue(request, options = nil) -> ::Google::Protobuf::Empty

Pass arguments to `delete_queue` via a request object, either of type [DeleteQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-DeleteQueueRequest "Google::Cloud::Tasks::V2beta2::DeleteQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::DeleteQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-DeleteQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def delete_queue(name: nil) -> ::Google::Protobuf::Empty

Pass arguments to `delete_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::DeleteQueueRequest.new

# Call the delete_queue method.
result = client.delete_queue request

# The returned object is of type Google::Protobuf::Empty.
p result
```

### #delete_task

    def delete_task(request, options = nil) -> ::Google::Protobuf::Empty
    def delete_task(name: nil) -> ::Google::Protobuf::Empty

Deletes a task.


<br />

A task can be deleted if it is scheduled or dispatched. A task
cannot be deleted if it has completed successfully or permanently
failed.
**Overloads**

    def delete_task(request, options = nil) -> ::Google::Protobuf::Empty

Pass arguments to `delete_task` via a request object, either of type [DeleteTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-DeleteTaskRequest "Google::Cloud::Tasks::V2beta2::DeleteTaskRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::DeleteTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-DeleteTaskRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def delete_task(name: nil) -> ::Google::Protobuf::Empty

Pass arguments to `delete_task` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::DeleteTaskRequest.new

# Call the delete_task method.
result = client.delete_task request

# The returned object is of type Google::Protobuf::Empty.
p result
```

### #get_iam_policy

    def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
    def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

Gets the access control policy for a
[Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue "Google::Cloud::Tasks::V2beta2::Queue (class)"). Returns an empty policy if the
resource exists and does not have a policy set.

Authorization requires the following
[Google IAM](https://cloud.google.com/iam) permission on the specified
resource parent:

- `cloudtasks.queues.getIamPolicy`
**Overloads**

    def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy

Pass arguments to `get_iam_policy` via a request object, either of type [Iam::V1::GetIamPolicyRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-GetIamPolicyRequest "Google::Iam::V1::GetIamPolicyRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Iam::V1::GetIamPolicyRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-GetIamPolicyRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

Pass arguments to `get_iam_policy` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **resource** (::String) --- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
- **options** ([::Google::Iam::V1::GetPolicyOptions](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-GetPolicyOptions), ::Hash) --- OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-Policy))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-Policy))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result
```

### #get_queue

    def get_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue
    def get_queue(name: nil, read_mask: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Gets a queue.
**Overloads**

    def get_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `get_queue` via a request object, either of type [GetQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-GetQueueRequest "Google::Cloud::Tasks::V2beta2::GetQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::GetQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-GetQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def get_queue(name: nil, read_mask: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `get_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The resource name of the queue. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
- **read_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-FieldMask), ::Hash) --- Optional. Read mask is used for a more granular control over what the API returns. If the mask is not present all fields will be returned except \[Queue.stats\]. \[Queue.stats\] will be returned only if it was explicitly specified in the mask.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::GetQueueRequest.new

# Call the get_queue method.
result = client.get_queue request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Queue.
p result
```

### #get_task

    def get_task(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task
    def get_task(name: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Gets a task.
**Overloads**

    def get_task(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `get_task` via a request object, either of type [GetTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-GetTaskRequest "Google::Cloud::Tasks::V2beta2::GetTaskRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::GetTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-GetTaskRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def get_task(name: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `get_task` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::GetTaskRequest.new

# Call the get_task method.
result = client.get_task request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Task.
p result
```

### #initialize

    def initialize() { |config| ... } -> Client

Create a new CloudTasks client object.
**Yields**

- (config) --- Configure the CloudTasks client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new do |config|
  config.timeout = 10.0
end
```

### #lease_tasks

    def lease_tasks(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse
    def lease_tasks(parent: nil, max_tasks: nil, lease_duration: nil, response_view: nil, filter: nil) -> ::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse

Leases tasks from a pull queue for
[lease_duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksRequest#Google__Cloud__Tasks__V2beta2__LeaseTasksRequest_lease_duration_instance_ "Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#lease_duration (method)").


This method is invoked by the worker to obtain a lease. The
worker must acknowledge the task via
[AcknowledgeTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_acknowledge_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task (method)")
after they have performed the work associated with the task.

The [payload](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PullMessage#Google__Cloud__Tasks__V2beta2__PullMessage_payload_instance_ "Google::Cloud::Tasks::V2beta2::PullMessage#payload (method)") is intended
to store data that the worker needs to perform the work associated with the
task. To return the payloads in the
[response](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksResponse "Google::Cloud::Tasks::V2beta2::LeaseTasksResponse (class)"), set
[response_view](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksRequest#Google__Cloud__Tasks__V2beta2__LeaseTasksRequest_response_view_instance_ "Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#response_view (method)")
to [FULL](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)").

<br />

A maximum of 10 qps of
[LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") requests are
allowed per queue. \[RESOURCE_EXHAUSTED\]\[google.rpc.Code.RESOURCE_EXHAUSTED\]
is returned when this limit is
exceeded. \[RESOURCE_EXHAUSTED\]\[google.rpc.Code.RESOURCE_EXHAUSTED\]
is also returned when
[max_tasks_dispatched_per_second](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RateLimits#Google__Cloud__Tasks__V2beta2__RateLimits_max_tasks_dispatched_per_second_instance_ "Google::Cloud::Tasks::V2beta2::RateLimits#max_tasks_dispatched_per_second (method)")
is exceeded.
**Overloads**

    def lease_tasks(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse

Pass arguments to `lease_tasks` via a request object, either of type [LeaseTasksRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksRequest "Google::Cloud::Tasks::V2beta2::LeaseTasksRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::LeaseTasksRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def lease_tasks(parent: nil, max_tasks: nil, lease_duration: nil, response_view: nil, filter: nil) -> ::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse

Pass arguments to `lease_tasks` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
- **max_tasks** (::Integer) --- The maximum number of tasks to lease.


  The system will make a best effort to return as close to as
  `max_tasks` as possible.

  The largest that `max_tasks` can be is 1000.

  The maximum total size of a \[lease tasks
  response\]\[google.cloud.tasks.v2beta2.LeaseTasksResponse\] is 32 MB. If the
  sum of all task sizes requested reaches this limit, fewer tasks than
  requested are returned.
- **lease_duration** ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Duration), ::Hash) --- Required. The duration of the lease.


  Each task returned in the
  [response](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksResponse "Google::Cloud::Tasks::V2beta2::LeaseTasksResponse (class)") will have its
  [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") set to the
  current time plus the `lease_duration`. The task is leased until its
  [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)"); thus, the
  task will not be returned to another
  [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") call before
  its [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)").

  After the worker has successfully finished the work associated
  with the task, the worker must call via
  [AcknowledgeTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_acknowledge_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#acknowledge_task (method)")
  before the [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)").
  Otherwise the task will be returned to a later
  [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") call so that
  another worker can retry it.

  The maximum lease duration is 1 week.
  `lease_duration` will be truncated to the nearest second.
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
- **filter** (::String) --- `filter` can be used to specify a subset of tasks to lease.


  When `filter` is set to `tag=<my-tag>` then the
  [response](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksResponse "Google::Cloud::Tasks::V2beta2::LeaseTasksResponse (class)") will contain only
  tasks whose [tag](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PullMessage#Google__Cloud__Tasks__V2beta2__PullMessage_tag_instance_ "Google::Cloud::Tasks::V2beta2::PullMessage#tag (method)") is equal to
  `<my-tag>`. `<my-tag>` must be less than 500 characters.

  When `filter` is set to `tag_function=oldest_tag()`, only tasks which have
  the same tag as the task with the oldest
  [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") will be
  returned.

  Grammar Syntax:
  - `filter = "tag=" tag | "tag_function=" function`

  - `tag = string`

  - `function = "oldest_tag()"`

  The `oldest_tag()` function returns tasks which have the same tag as the
  oldest task (ordered by schedule time).

  SDK compatibility: Although the SDK allows tags to be either
  string or
  [bytes](https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/taskqueue/TaskOptions.html#tag-byte:A-),
  only UTF-8 encoded tags can be used in Cloud Tasks. Tag which
  aren't UTF-8 encoded can't be used in the
  [filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksRequest#Google__Cloud__Tasks__V2beta2__LeaseTasksRequest_filter_instance_ "Google::Cloud::Tasks::V2beta2::LeaseTasksRequest#filter (method)") and the
  task's [tag](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PullMessage#Google__Cloud__Tasks__V2beta2__PullMessage_tag_instance_ "Google::Cloud::Tasks::V2beta2::PullMessage#tag (method)") will be displayed
  as empty in Cloud Tasks.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::LeaseTasksResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-LeaseTasksResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::LeaseTasksRequest.new

# Call the lease_tasks method.
result = client.lease_tasks request

# The returned object is of type Google::Cloud::Tasks::V2beta2::LeaseTasksResponse.
p result
```

### #list_queues

    def list_queues(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Queue>
    def list_queues(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Queue>

Lists queues.


<br />

Queues are returned in lexicographical order.
**Overloads**

    def list_queues(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Queue>

Pass arguments to `list_queues` via a request object, either of type [ListQueuesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListQueuesRequest "Google::Cloud::Tasks::V2beta2::ListQueuesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::ListQueuesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListQueuesRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def list_queues(parent: nil, filter: nil, page_size: nil, page_token: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Queue>

Pass arguments to `list_queues` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`
- **filter** (::String) --- `filter` can be used to specify a subset of queues. Any [Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue "Google::Cloud::Tasks::V2beta2::Queue (class)") field can be used as a filter and several operators as supported. For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as described in [Stackdriver's Advanced Logs
  Filters](https://cloud.google.com/logging/docs/view/advanced_filters).


  Sample filter "app_engine_http_target: \*".

  Note that using filters might cause fewer queues than the
  requested_page size to be returned.
- **page_size** (::Integer) --- Requested page size.


  The maximum page size is 9800. If unspecified, the page size will
  be the maximum. Fewer queues than requested might be returned,
  even if more queues exist; use the
  [next_page_token](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListQueuesResponse#Google__Cloud__Tasks__V2beta2__ListQueuesResponse_next_page_token_instance_ "Google::Cloud::Tasks::V2beta2::ListQueuesResponse#next_page_token (method)")
  in the response to determine if more queues exist.
- **page_token** (::String) --- A token identifying the page of results to return.


  To request the first page results, page_token must be empty. To
  request the next page of results, page_token must be the value of
  [next_page_token](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListQueuesResponse#Google__Cloud__Tasks__V2beta2__ListQueuesResponse_next_page_token_instance_ "Google::Cloud::Tasks::V2beta2::ListQueuesResponse#next_page_token (method)")
  returned from the previous call to
  [ListQueues](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_list_queues_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_queues (method)") method. It
  is an error to switch the value of the
  [filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListQueuesRequest#Google__Cloud__Tasks__V2beta2__ListQueuesRequest_filter_instance_ "Google::Cloud::Tasks::V2beta2::ListQueuesRequest#filter (method)") while
  iterating through pages.
- **read_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-FieldMask), ::Hash) --- Optional. Read mask is used for a more granular control over what the API returns. If the mask is not present all fields will be returned except \[Queue.stats\]. \[Queue.stats\] will be returned only if it was explicitly specified in the mask.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::ListQueuesRequest.new

# Call the list_queues method.
result = client.list_queues request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Tasks::V2beta2::Queue.
  p item
end
```

### #list_tasks

    def list_tasks(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Task>
    def list_tasks(parent: nil, response_view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Task>

Lists the tasks in a queue.


By default, only the [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)")
view is retrieved due to performance considerations;
[response_view](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListTasksRequest#Google__Cloud__Tasks__V2beta2__ListTasksRequest_response_view_instance_ "Google::Cloud::Tasks::V2beta2::ListTasksRequest#response_view (method)")
controls the subset of information which is returned.

<br />

The tasks may be returned in any order. The ordering may change at any
time.
**Overloads**

    def list_tasks(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Task>

Pass arguments to `list_tasks` via a request object, either of type [ListTasksRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListTasksRequest "Google::Cloud::Tasks::V2beta2::ListTasksRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::ListTasksRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListTasksRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def list_tasks(parent: nil, response_view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Tasks::V2beta2::Task>

Pass arguments to `list_tasks` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
- **page_size** (::Integer) --- Maximum page size.


  Fewer tasks than requested might be returned, even if more tasks exist; use
  [next_page_token](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListTasksResponse#Google__Cloud__Tasks__V2beta2__ListTasksResponse_next_page_token_instance_ "Google::Cloud::Tasks::V2beta2::ListTasksResponse#next_page_token (method)")
  in the response to determine if more tasks exist.

  The maximum page size is 1000. If unspecified, the page size will be the
  maximum.
- **page_token** (::String) --- A token identifying the page of results to return.


  To request the first page results, page_token must be empty. To
  request the next page of results, page_token must be the value of
  [next_page_token](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ListTasksResponse#Google__Cloud__Tasks__V2beta2__ListTasksResponse_next_page_token_instance_ "Google::Cloud::Tasks::V2beta2::ListTasksResponse#next_page_token (method)")
  returned from the previous call to
  [ListTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_list_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#list_tasks (method)") method.

  The page token is valid for only 2 hours.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::ListTasksRequest.new

# Call the list_tasks method.
result = client.list_tasks request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Tasks::V2beta2::Task.
  p item
end
```

### #location_client

    def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.
**Returns**

- (Google::Cloud::Location::Locations::Client)

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #pause_queue

    def pause_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue
    def pause_queue(name: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pauses the queue.


<br />

If a queue is paused then the system will stop dispatching tasks
until the queue is resumed via
[ResumeQueue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_resume_queue_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#resume_queue (method)"). Tasks can
still be added when the queue is paused. A queue is paused if its
[state](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue#Google__Cloud__Tasks__V2beta2__Queue_state_instance_ "Google::Cloud::Tasks::V2beta2::Queue#state (method)") is
[PAUSED](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue-State#Google__Cloud__Tasks__V2beta2__Queue__State__PAUSED "Google::Cloud::Tasks::V2beta2::Queue::State::PAUSED (constant)").
**Overloads**

    def pause_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `pause_queue` via a request object, either of type [PauseQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PauseQueueRequest "Google::Cloud::Tasks::V2beta2::PauseQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::PauseQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PauseQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def pause_queue(name: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `pause_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::PauseQueueRequest.new

# Call the pause_queue method.
result = client.pause_queue request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Queue.
p result
```

### #purge_queue

    def purge_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue
    def purge_queue(name: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Purges a queue by deleting all of its tasks.


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

<br />

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

    def purge_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `purge_queue` via a request object, either of type [PurgeQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PurgeQueueRequest "Google::Cloud::Tasks::V2beta2::PurgeQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::PurgeQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PurgeQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def purge_queue(name: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `purge_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::PurgeQueueRequest.new

# Call the purge_queue method.
result = client.purge_queue request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Queue.
p result
```

### #renew_lease

    def renew_lease(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task
    def renew_lease(name: nil, schedule_time: nil, lease_duration: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Renew the current lease of a pull task.


<br />

The worker can use this method to extend the lease by a new
duration, starting from now. The new task lease will be
returned in the task's
[schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)").
**Overloads**

    def renew_lease(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `renew_lease` via a request object, either of type [RenewLeaseRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RenewLeaseRequest "Google::Cloud::Tasks::V2beta2::RenewLeaseRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::RenewLeaseRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RenewLeaseRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def renew_lease(name: nil, schedule_time: nil, lease_duration: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `renew_lease` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
- **schedule_time** ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Timestamp), ::Hash) --- Required. The task's current schedule time, available in the [schedule_time](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") returned by [LeaseTasks](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_lease_tasks_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#lease_tasks (method)") response or [RenewLease](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_renew_lease_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#renew_lease (method)") response. This restriction is to ensure that your worker currently holds the lease.
- **lease_duration** ([::Google::Protobuf::Duration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Duration), ::Hash) --- Required. The desired new lease duration, starting from now.


  The maximum lease duration is 1 week.
  `lease_duration` will be truncated to the nearest second.
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::RenewLeaseRequest.new

# Call the renew_lease method.
result = client.renew_lease request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Task.
p result
```

### #resume_queue

    def resume_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue
    def resume_queue(name: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Resume a queue.


This method resumes a queue after it has been
[PAUSED](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue-State#Google__Cloud__Tasks__V2beta2__Queue__State__PAUSED "Google::Cloud::Tasks::V2beta2::Queue::State::PAUSED (constant)") or
[DISABLED](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue-State#Google__Cloud__Tasks__V2beta2__Queue__State__DISABLED "Google::Cloud::Tasks::V2beta2::Queue::State::DISABLED (constant)"). The state of a
queue is stored in the queue's
[state](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue#Google__Cloud__Tasks__V2beta2__Queue_state_instance_ "Google::Cloud::Tasks::V2beta2::Queue#state (method)"); after calling this method
it will be set to
[RUNNING](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue-State#Google__Cloud__Tasks__V2beta2__Queue__State__RUNNING "Google::Cloud::Tasks::V2beta2::Queue::State::RUNNING (constant)").

<br />

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](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).
**Overloads**

    def resume_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `resume_queue` via a request object, either of type [ResumeQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ResumeQueueRequest "Google::Cloud::Tasks::V2beta2::ResumeQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::ResumeQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-ResumeQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def resume_queue(name: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `resume_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The queue name. For example: `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::ResumeQueueRequest.new

# Call the resume_queue method.
result = client.resume_queue request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Queue.
p result
```

### #run_task

    def run_task(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task
    def run_task(name: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RateLimits "Google::Cloud::Tasks::V2beta2::RateLimits (class)") or is
[PAUSED](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue-State#Google__Cloud__Tasks__V2beta2__Queue__State__PAUSED "Google::Cloud::Tasks::V2beta2::Queue::State::PAUSED (constant)").

This command is meant to be used for manual debugging. For
example, [RunTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_run_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task (method)") 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_status_instance_ "Google::Cloud::Tasks::V2beta2::Task#status (method)") 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task#Google__Cloud__Tasks__V2beta2__Task_schedule_time_instance_ "Google::Cloud::Tasks::V2beta2::Task#schedule_time (method)") will be
reset to the time that
[RunTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_run_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task (method)") was called plus
the retry delay specified in the queue's
[RetryConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RetryConfig "Google::Cloud::Tasks::V2beta2::RetryConfig (class)").

[RunTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_run_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task (method)") returns
\[NOT_FOUND\]\[google.rpc.Code.NOT_FOUND\] when it is called on a
task that has already succeeded or permanently failed.

<br />

[RunTask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-CloudTasks-Client#Google__Cloud__Tasks__V2beta2__CloudTasks__Client_run_task_instance_ "Google::Cloud::Tasks::V2beta2::CloudTasks::Client#run_task (method)") cannot be called
on a [pull task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-PullMessage "Google::Cloud::Tasks::V2beta2::PullMessage (class)").
**Overloads**

    def run_task(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `run_task` via a request object, either of type [RunTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RunTaskRequest "Google::Cloud::Tasks::V2beta2::RunTaskRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::RunTaskRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-RunTaskRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def run_task(name: nil, response_view: nil) -> ::Google::Cloud::Tasks::V2beta2::Task

Pass arguments to `run_task` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
- **response_view** ([::Google::Cloud::Tasks::V2beta2::Task::View](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View)) --- The response_view specifies which subset of the [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") will be returned.


  By default response_view is
  [BASIC](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__BASIC "Google::Cloud::Tasks::V2beta2::Task::View::BASIC (constant)"); 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task-View#Google__Cloud__Tasks__V2beta2__Task__View__FULL "Google::Cloud::Tasks::V2beta2::Task::View::FULL (constant)")
  requires `cloudtasks.tasks.fullView` [Google
  IAM](https://cloud.google.com/iam/) permission on the
  [Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task "Google::Cloud::Tasks::V2beta2::Task (class)") resource.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Task](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Task))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::RunTaskRequest.new

# Call the run_task method.
result = client.run_task request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Task.
p result
```

### #set_iam_policy

    def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
    def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

Sets the access control policy for a
[Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue "Google::Cloud::Tasks::V2beta2::Queue (class)"). 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](https://cloud.google.com/iam) permission on the specified
resource parent:

- `cloudtasks.queues.setIamPolicy`
**Overloads**

    def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy

Pass arguments to `set_iam_policy` via a request object, either of type [Iam::V1::SetIamPolicyRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-SetIamPolicyRequest "Google::Iam::V1::SetIamPolicyRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Iam::V1::SetIamPolicyRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-SetIamPolicyRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

Pass arguments to `set_iam_policy` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **resource** (::String) --- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
- **policy** ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-Policy), ::Hash) --- REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-FieldMask), ::Hash) --- OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:


  `paths: "bindings, etag"`
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-Policy))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Iam::V1::Policy](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-Policy))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result
```

### #test_iam_permissions

    def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
    def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Returns permissions that a caller has on a
[Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue "Google::Cloud::Tasks::V2beta2::Queue (class)"). If the resource does not exist,
this will return an empty set of permissions, not a
\[NOT_FOUND\]\[google.rpc.Code.NOT_FOUND\] error.


<br />

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.
**Overloads**

    def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Pass arguments to `test_iam_permissions` via a request object, either of type [Iam::V1::TestIamPermissionsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-TestIamPermissionsRequest "Google::Iam::V1::TestIamPermissionsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Iam::V1::TestIamPermissionsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-TestIamPermissionsRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Pass arguments to `test_iam_permissions` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **resource** (::String) --- REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
- **permissions** (::Array\<::String\>) --- The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.* ') are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Iam::V1::TestIamPermissionsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-TestIamPermissionsResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Iam::V1::TestIamPermissionsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Iam-V1-TestIamPermissionsResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)

### #update_queue

    def update_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue
    def update_queue(queue: nil, update_mask: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

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.

<br />

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](https://cloud.google.com/tasks/docs/queue-yaml) before using
this method.
**Overloads**

    def update_queue(request, options = nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `update_queue` via a request object, either of type [UpdateQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-UpdateQueueRequest "Google::Cloud::Tasks::V2beta2::UpdateQueueRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::UpdateQueueRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-UpdateQueueRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def update_queue(queue: nil, update_mask: nil) -> ::Google::Cloud::Tasks::V2beta2::Queue

Pass arguments to `update_queue` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **queue** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue), ::Hash) --- Required. The queue to create or update.


  The queue's [name](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue#Google__Cloud__Tasks__V2beta2__Queue_name_instance_ "Google::Cloud::Tasks::V2beta2::Queue#name (method)") must be
  specified.

  Output only fields cannot be modified using UpdateQueue.
  Any value specified for an output only field will be ignored.
  The queue's [name](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue#Google__Cloud__Tasks__V2beta2__Queue_name_instance_ "Google::Cloud::Tasks::V2beta2::Queue#name (method)") cannot be
  changed.
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-FieldMask), ::Hash) --- A mask used to specify which fields of the queue are being updated.


  If empty, then all fields will be updated.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::Tasks::V2beta2::Queue](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-Queue))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::UpdateQueueRequest.new

# Call the update_queue method.
result = client.update_queue request

# The returned object is of type Google::Cloud::Tasks::V2beta2::Queue.
p result
```

### #upload_queue_yaml

    def upload_queue_yaml(request, options = nil) -> ::Google::Protobuf::Empty
    def upload_queue_yaml(app_id: nil, http_body: nil) -> ::Google::Protobuf::Empty

Update queue list by uploading a queue.yaml file.


<br />

The queue.yaml file is supplied in the request body as a YAML encoded
string. This method was added to support gcloud clients versions before
322.0.0. New clients should use CreateQueue instead of this method.
**Overloads**

    def upload_queue_yaml(request, options = nil) -> ::Google::Protobuf::Empty

Pass arguments to `upload_queue_yaml` via a request object, either of type [UploadQueueYamlRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-UploadQueueYamlRequest "Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Cloud-Tasks-V2beta2-UploadQueueYamlRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

    def upload_queue_yaml(app_id: nil, http_body: nil) -> ::Google::Protobuf::Empty

Pass arguments to `upload_queue_yaml` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **app_id** (::String) --- Required. The App ID is supplied as an HTTP parameter. Unlike internal usage of App ID, it does not include a region prefix. Rather, the App ID represents the Project ID against which to make the request.
- **http_body** ([::Google::Api::HttpBody](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Api-HttpBody), ::Hash) --- The http body contains the queue.yaml file which used to update queue lists
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-tasks-v2beta2/latest/Google-Protobuf-Empty))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/tasks/v2beta2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Tasks::V2beta2::CloudTasks::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Tasks::V2beta2::UploadQueueYamlRequest.new

# Call the upload_queue_yaml method.
result = client.upload_queue_yaml request

# The returned object is of type Google::Protobuf::Empty.
p result
```