Class v2beta3.CloudTasksClient (2.4.2)

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

Package

@google-cloud/tasks

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of CloudTasksClient.

Parameter
NameDescription
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

cloudTasksStub

cloudTasksStub?: Promise<{
        [name: string]: Function;
    }>;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

createQueue(request, options)

createQueue(request?: protos.google.cloud.tasks.v2beta3.ICreateQueueRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.ICreateQueueRequest | undefined, {} | undefined]>;

Creates a queue.

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

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.ICreateQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.ICreateQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Queue]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  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.
   */
  // const parent = 'abc123'
  /**
   *  Required. The queue to create.
   *  Queue's name google.cloud.tasks.v2beta3.Queue.name  cannot be the same as an existing queue.
   */
  // const queue = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callCreateQueue() {
    // Construct request
    const request = {
      parent,
      queue,
    };

    // Run request
    const response = await tasksClient.createQueue(request);
    console.log(response);
  }

  callCreateQueue();

createQueue(request, options, callback)

createQueue(request: protos.google.cloud.tasks.v2beta3.ICreateQueueRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.ICreateQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.ICreateQueueRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.ICreateQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createQueue(request, callback)

createQueue(request: protos.google.cloud.tasks.v2beta3.ICreateQueueRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.ICreateQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.ICreateQueueRequest
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.ICreateQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createTask(request, options)

createTask(request?: protos.google.cloud.tasks.v2beta3.ICreateTaskRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.ICreateTaskRequest | undefined, {} | undefined]>;

Creates a task and adds it to a queue.

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

* The maximum task size is 100KB.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.ICreateTaskRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.ICreateTaskRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Task]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue name. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
   *  The queue must already exist.
   */
  // const parent = 'abc123'
  /**
   *  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 google.cloud.tasks.v2beta3.Task.name. 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 google.cloud.tasks.v2beta3.Task.name.
   *  If schedule_time google.cloud.tasks.v2beta3.Task.schedule_time  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 executed 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 ~1hour after the original task was
   *  deleted or executed. 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 ~9days after the original task was deleted or executed.
   *  Because there is an extra lookup cost to identify duplicate task
   *  names, these CreateTask google.cloud.tasks.v2beta3.CloudTasks.CreateTask  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.
   */
  // const task = {}
  /**
   *  The response_view specifies which subset of the Task google.cloud.tasks.v2beta3.Task  will be
   *  returned.
   *  By default response_view is BASIC google.cloud.tasks.v2beta3.Task.View.BASIC; not all
   *  information is retrieved by default because some data, such as
   *  payloads, might be desirable to return only when needed because
   *  of its large size or because of the sensitivity of data that it
   *  contains.
   *  Authorization for FULL google.cloud.tasks.v2beta3.Task.View.FULL  requires
   *  `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/)
   *  permission on the Task google.cloud.tasks.v2beta3.Task  resource.
   */
  // const responseView = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callCreateTask() {
    // Construct request
    const request = {
      parent,
      task,
    };

    // Run request
    const response = await tasksClient.createTask(request);
    console.log(response);
  }

  callCreateTask();

createTask(request, options, callback)

createTask(request: protos.google.cloud.tasks.v2beta3.ICreateTaskRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.ICreateTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.ICreateTaskRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.ICreateTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createTask(request, callback)

createTask(request: protos.google.cloud.tasks.v2beta3.ICreateTaskRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.ICreateTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.ICreateTaskRequest
callback Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.ICreateTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteQueue(request, options)

deleteQueue(request?: protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest | undefined, {} | undefined]>;

Deletes a queue.

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

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

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue name. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
   */
  // const name = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callDeleteQueue() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.deleteQueue(request);
    console.log(response);
  }

  callDeleteQueue();

deleteQueue(request, options, callback)

deleteQueue(request: protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteQueue(request, callback)

deleteQueue(request: protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteTask(request, options)

deleteTask(request?: protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest | undefined, {} | undefined]>;

Deletes a task.

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

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The task name. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
   */
  // const name = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callDeleteTask() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.deleteTask(request);
    console.log(response);
  }

  callDeleteTask();

deleteTask(request, options, callback)

deleteTask(request: protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deleteTask(request, callback)

deleteTask(request: protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.tasks.v2beta3.IDeleteTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, options)

getIamPolicy(request?: protos.google.iam.v1.IGetIamPolicyRequest, options?: CallOptions): Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | undefined, {} | undefined]>;

Gets the access control policy for a . 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

Parameters
NameDescription
request protos.google.iam.v1.IGetIamPolicyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Policy]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  REQUIRED: The resource for which the policy is being requested.
   *  See the operation documentation for the appropriate value for this field.
   */
  // const resource = 'abc123'
  /**
   *  OPTIONAL: A `GetPolicyOptions` object for specifying options to
   *  `GetIamPolicy`. This field is only used by Cloud IAM.
   */
  // const options = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callGetIamPolicy() {
    // Construct request
    const request = {
      resource,
    };

    // Run request
    const response = await tasksClient.getIamPolicy(request);
    console.log(response);
  }

  callGetIamPolicy();

getIamPolicy(request, options, callback)

getIamPolicy(request: protos.google.iam.v1.IGetIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.iam.v1.IGetIamPolicyRequest
options CallOptions
callback Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, callback)

getIamPolicy(request: protos.google.iam.v1.IGetIamPolicyRequest, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.iam.v1.IGetIamPolicyRequest
callback Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.IGetIamPolicyRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

getQueue(request, options)

getQueue(request?: protos.google.cloud.tasks.v2beta3.IGetQueueRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IGetQueueRequest | undefined, {} | undefined]>;

Gets a queue.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IGetQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IGetQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Queue]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the queue. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
   */
  // const name = 'abc123'
  /**
   *  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.
   */
  // const readMask = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callGetQueue() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.getQueue(request);
    console.log(response);
  }

  callGetQueue();

getQueue(request, options, callback)

getQueue(request: protos.google.cloud.tasks.v2beta3.IGetQueueRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IGetQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IGetQueueRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IGetQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getQueue(request, callback)

getQueue(request: protos.google.cloud.tasks.v2beta3.IGetQueueRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IGetQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IGetQueueRequest
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IGetQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getTask(request, options)

getTask(request?: protos.google.cloud.tasks.v2beta3.IGetTaskRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IGetTaskRequest | undefined, {} | undefined]>;

Gets a task.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IGetTaskRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IGetTaskRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Task]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The task name. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
   */
  // const name = 'abc123'
  /**
   *  The response_view specifies which subset of the Task google.cloud.tasks.v2beta3.Task  will be
   *  returned.
   *  By default response_view is BASIC google.cloud.tasks.v2beta3.Task.View.BASIC; not all
   *  information is retrieved by default because some data, such as
   *  payloads, might be desirable to return only when needed because
   *  of its large size or because of the sensitivity of data that it
   *  contains.
   *  Authorization for FULL google.cloud.tasks.v2beta3.Task.View.FULL  requires
   *  `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/)
   *  permission on the Task google.cloud.tasks.v2beta3.Task  resource.
   */
  // const responseView = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callGetTask() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.getTask(request);
    console.log(response);
  }

  callGetTask();

getTask(request, options, callback)

getTask(request: protos.google.cloud.tasks.v2beta3.IGetTaskRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IGetTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IGetTaskRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IGetTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getTask(request, callback)

getTask(request: protos.google.cloud.tasks.v2beta3.IGetTaskRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IGetTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IGetTaskRequest
callback Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IGetTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listQueues(request, options)

listQueues(request?: protos.google.cloud.tasks.v2beta3.IListQueuesRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue[], protos.google.cloud.tasks.v2beta3.IListQueuesRequest | null, protos.google.cloud.tasks.v2beta3.IListQueuesResponse]>;

Lists queues.

Queues are returned in lexicographical order.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListQueuesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue[], protos.google.cloud.tasks.v2beta3.IListQueuesRequest | null, protos.google.cloud.tasks.v2beta3.IListQueuesResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Queue]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listQueuesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listQueues(request, options, callback)

listQueues(request: protos.google.cloud.tasks.v2beta3.IListQueuesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.tasks.v2beta3.IListQueuesRequest, protos.google.cloud.tasks.v2beta3.IListQueuesResponse | null | undefined, protos.google.cloud.tasks.v2beta3.IQueue>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListQueuesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.tasks.v2beta3.IListQueuesRequest, protos.google.cloud.tasks.v2beta3.IListQueuesResponse | null | undefined, protos.google.cloud.tasks.v2beta3.IQueue>
Returns
TypeDescription
void

listQueues(request, callback)

listQueues(request: protos.google.cloud.tasks.v2beta3.IListQueuesRequest, callback: PaginationCallback<protos.google.cloud.tasks.v2beta3.IListQueuesRequest, protos.google.cloud.tasks.v2beta3.IListQueuesResponse | null | undefined, protos.google.cloud.tasks.v2beta3.IQueue>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListQueuesRequest
callback PaginationCallback<protos.google.cloud.tasks.v2beta3.IListQueuesRequest, protos.google.cloud.tasks.v2beta3.IListQueuesResponse | null | undefined, protos.google.cloud.tasks.v2beta3.IQueue>
Returns
TypeDescription
void

listQueuesAsync(request, options)

listQueuesAsync(request?: protos.google.cloud.tasks.v2beta3.IListQueuesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.tasks.v2beta3.IQueue>;

Equivalent to listQueues, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListQueuesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.tasks.v2beta3.IQueue>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Queue]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The location name.
   *  For example: `projects/PROJECT_ID/locations/LOCATION_ID`
   */
  // const parent = 'abc123'
  /**
   *  `filter` can be used to specify a subset of queues. Any Queue google.cloud.tasks.v2beta3.Queue
   *  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 "state: PAUSED".
   *  Note that using filters might cause fewer queues than the
   *  requested page_size to be returned.
   */
  // const filter = 'abc123'
  /**
   *  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 google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token  in the
   *  response to determine if more queues exist.
   */
  // const pageSize = 1234
  /**
   *  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 google.cloud.tasks.v2beta3.ListQueuesResponse.next_page_token  returned
   *  from the previous call to ListQueues google.cloud.tasks.v2beta3.CloudTasks.ListQueues
   *  method. It is an error to switch the value of the
   *  filter google.cloud.tasks.v2beta3.ListQueuesRequest.filter  while iterating through pages.
   */
  // const pageToken = 'abc123'
  /**
   *  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.
   */
  // const readMask = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callListQueues() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await tasksClient.listQueuesAsync(request);
    for await (const response of iterable) {
      console.log(response);
    }
  }

  callListQueues();

listQueuesStream(request, options)

listQueuesStream(request?: protos.google.cloud.tasks.v2beta3.IListQueuesRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListQueuesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Queue] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listQueuesAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listTasks(request, options)

listTasks(request?: protos.google.cloud.tasks.v2beta3.IListTasksRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.ITask[], protos.google.cloud.tasks.v2beta3.IListTasksRequest | null, protos.google.cloud.tasks.v2beta3.IListTasksResponse]>;

Lists the tasks in a queue.

By default, only the view is retrieved due to performance considerations; controls the subset of information which is returned.

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

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListTasksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.ITask[], protos.google.cloud.tasks.v2beta3.IListTasksRequest | null, protos.google.cloud.tasks.v2beta3.IListTasksResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of [Task]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listTasksAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

listTasks(request, options, callback)

listTasks(request: protos.google.cloud.tasks.v2beta3.IListTasksRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.tasks.v2beta3.IListTasksRequest, protos.google.cloud.tasks.v2beta3.IListTasksResponse | null | undefined, protos.google.cloud.tasks.v2beta3.ITask>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListTasksRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.tasks.v2beta3.IListTasksRequest, protos.google.cloud.tasks.v2beta3.IListTasksResponse | null | undefined, protos.google.cloud.tasks.v2beta3.ITask>
Returns
TypeDescription
void

listTasks(request, callback)

listTasks(request: protos.google.cloud.tasks.v2beta3.IListTasksRequest, callback: PaginationCallback<protos.google.cloud.tasks.v2beta3.IListTasksRequest, protos.google.cloud.tasks.v2beta3.IListTasksResponse | null | undefined, protos.google.cloud.tasks.v2beta3.ITask>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListTasksRequest
callback PaginationCallback<protos.google.cloud.tasks.v2beta3.IListTasksRequest, protos.google.cloud.tasks.v2beta3.IListTasksResponse | null | undefined, protos.google.cloud.tasks.v2beta3.ITask>
Returns
TypeDescription
void

listTasksAsync(request, options)

listTasksAsync(request?: protos.google.cloud.tasks.v2beta3.IListTasksRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.tasks.v2beta3.ITask>;

Equivalent to listTasks, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListTasksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.tasks.v2beta3.ITask>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [Task]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue name. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID`
   */
  // const parent = 'abc123'
  /**
   *  The response_view specifies which subset of the Task google.cloud.tasks.v2beta3.Task  will be
   *  returned.
   *  By default response_view is BASIC google.cloud.tasks.v2beta3.Task.View.BASIC; not all
   *  information is retrieved by default because some data, such as
   *  payloads, might be desirable to return only when needed because
   *  of its large size or because of the sensitivity of data that it
   *  contains.
   *  Authorization for FULL google.cloud.tasks.v2beta3.Task.View.FULL  requires
   *  `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/)
   *  permission on the Task google.cloud.tasks.v2beta3.Task  resource.
   */
  // const responseView = {}
  /**
   *  Maximum page size.
   *  Fewer tasks than requested might be returned, even if more tasks exist; use
   *  next_page_token google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token  in the response to
   *  determine if more tasks exist.
   *  The maximum page size is 1000. If unspecified, the page size will be the
   *  maximum.
   */
  // const pageSize = 1234
  /**
   *  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 google.cloud.tasks.v2beta3.ListTasksResponse.next_page_token  returned
   *  from the previous call to ListTasks google.cloud.tasks.v2beta3.CloudTasks.ListTasks
   *  method.
   *  The page token is valid for only 2 hours.
   */
  // const pageToken = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callListTasks() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await tasksClient.listTasksAsync(request);
    for await (const response of iterable) {
      console.log(response);
    }
  }

  callListTasks();

listTasksStream(request, options)

listTasksStream(request?: protos.google.cloud.tasks.v2beta3.IListTasksRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IListTasksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing [Task] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listTasksAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromQueueName(queueName)

matchLocationFromQueueName(queueName: string): string | number;

Parse the location from Queue resource.

Parameter
NameDescription
queueName string

A fully-qualified path representing Queue resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromTaskName(taskName)

matchLocationFromTaskName(taskName: string): string | number;

Parse the location from Task resource.

Parameter
NameDescription
taskName string

A fully-qualified path representing Task resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProjectName(projectName)

matchProjectFromProjectName(projectName: string): string | number;

Parse the project from Project resource.

Parameter
NameDescription
projectName string

A fully-qualified path representing Project resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromQueueName(queueName)

matchProjectFromQueueName(queueName: string): string | number;

Parse the project from Queue resource.

Parameter
NameDescription
queueName string

A fully-qualified path representing Queue resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromTaskName(taskName)

matchProjectFromTaskName(taskName: string): string | number;

Parse the project from Task resource.

Parameter
NameDescription
taskName string

A fully-qualified path representing Task resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchQueueFromQueueName(queueName)

matchQueueFromQueueName(queueName: string): string | number;

Parse the queue from Queue resource.

Parameter
NameDescription
queueName string

A fully-qualified path representing Queue resource.

Returns
TypeDescription
string | number

{string} A string representing the queue.

matchQueueFromTaskName(taskName)

matchQueueFromTaskName(taskName: string): string | number;

Parse the queue from Task resource.

Parameter
NameDescription
taskName string

A fully-qualified path representing Task resource.

Returns
TypeDescription
string | number

{string} A string representing the queue.

matchTaskFromTaskName(taskName)

matchTaskFromTaskName(taskName: string): string | number;

Parse the task from Task resource.

Parameter
NameDescription
taskName string

A fully-qualified path representing Task resource.

Returns
TypeDescription
string | number

{string} A string representing the task.

pauseQueue(request, options)

pauseQueue(request?: protos.google.cloud.tasks.v2beta3.IPauseQueueRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPauseQueueRequest | undefined, {} | undefined]>;

Pauses the queue.

If a queue is paused then the system will stop dispatching tasks until the queue is resumed via . Tasks can still be added when the queue is paused. A queue is paused if its is .

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IPauseQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPauseQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Queue]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue name. For example:
   *  `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
   */
  // const name = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callPauseQueue() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.pauseQueue(request);
    console.log(response);
  }

  callPauseQueue();

pauseQueue(request, options, callback)

pauseQueue(request: protos.google.cloud.tasks.v2beta3.IPauseQueueRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPauseQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IPauseQueueRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPauseQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

pauseQueue(request, callback)

pauseQueue(request: protos.google.cloud.tasks.v2beta3.IPauseQueueRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPauseQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IPauseQueueRequest
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPauseQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

projectPath(project)

projectPath(project: string): string;

Return a fully-qualified project resource name string.

Parameter
NameDescription
project string
Returns
TypeDescription
string

{string} Resource name string.

purgeQueue(request, options)

purgeQueue(request?: protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest | undefined, {} | undefined]>;

Purges a queue by deleting all of its tasks.

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

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

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Queue]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue name. For example:
   *  `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
   */
  // const name = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callPurgeQueue() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.purgeQueue(request);
    console.log(response);
  }

  callPurgeQueue();

purgeQueue(request, options, callback)

purgeQueue(request: protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

purgeQueue(request, callback)

purgeQueue(request: protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IPurgeQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

queuePath(project, location, queue)

queuePath(project: string, location: string, queue: string): string;

Return a fully-qualified queue resource name string.

Parameters
NameDescription
project string
location string
queue string
Returns
TypeDescription
string

{string} Resource name string.

resumeQueue(request, options)

resumeQueue(request?: protos.google.cloud.tasks.v2beta3.IResumeQueueRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IResumeQueueRequest | undefined, {} | undefined]>;

Resume a queue.

This method resumes a queue after it has been or . The state of a queue is stored in the queue's ; after calling this method it will be set to .

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).

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IResumeQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IResumeQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Queue]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue name. For example:
   *  `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID`
   */
  // const name = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callResumeQueue() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.resumeQueue(request);
    console.log(response);
  }

  callResumeQueue();

resumeQueue(request, options, callback)

resumeQueue(request: protos.google.cloud.tasks.v2beta3.IResumeQueueRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IResumeQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IResumeQueueRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IResumeQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

resumeQueue(request, callback)

resumeQueue(request: protos.google.cloud.tasks.v2beta3.IResumeQueueRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IResumeQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IResumeQueueRequest
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IResumeQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

runTask(request, options)

runTask(request?: protos.google.cloud.tasks.v2beta3.IRunTaskRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IRunTaskRequest | undefined, {} | undefined]>;

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 or is .

This command is meant to be used for manual debugging. For example, 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 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 will be reset to the time that was called plus the retry delay specified in the queue's .

returns when it is called on a task that has already succeeded or permanently failed.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IRunTaskRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IRunTaskRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Task]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The task name. For example:
   *  `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
   */
  // const name = 'abc123'
  /**
   *  The response_view specifies which subset of the Task google.cloud.tasks.v2beta3.Task  will be
   *  returned.
   *  By default response_view is BASIC google.cloud.tasks.v2beta3.Task.View.BASIC; not all
   *  information is retrieved by default because some data, such as
   *  payloads, might be desirable to return only when needed because
   *  of its large size or because of the sensitivity of data that it
   *  contains.
   *  Authorization for FULL google.cloud.tasks.v2beta3.Task.View.FULL  requires
   *  `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/)
   *  permission on the Task google.cloud.tasks.v2beta3.Task  resource.
   */
  // const responseView = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callRunTask() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await tasksClient.runTask(request);
    console.log(response);
  }

  callRunTask();

runTask(request, options, callback)

runTask(request: protos.google.cloud.tasks.v2beta3.IRunTaskRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IRunTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IRunTaskRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IRunTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

runTask(request, callback)

runTask(request: protos.google.cloud.tasks.v2beta3.IRunTaskRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IRunTaskRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IRunTaskRequest
callback Callback<protos.google.cloud.tasks.v2beta3.ITask, protos.google.cloud.tasks.v2beta3.IRunTaskRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, options)

setIamPolicy(request?: protos.google.iam.v1.ISetIamPolicyRequest, options?: CallOptions): Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | undefined, {} | undefined]>;

Sets the access control policy for a . 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

Parameters
NameDescription
request protos.google.iam.v1.ISetIamPolicyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Policy]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  REQUIRED: The resource for which the policy is being specified.
   *  See the operation documentation for the appropriate value for this field.
   */
  // const resource = 'abc123'
  /**
   *  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.
   */
  // const policy = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callSetIamPolicy() {
    // Construct request
    const request = {
      resource,
      policy,
    };

    // Run request
    const response = await tasksClient.setIamPolicy(request);
    console.log(response);
  }

  callSetIamPolicy();

setIamPolicy(request, options, callback)

setIamPolicy(request: protos.google.iam.v1.ISetIamPolicyRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.iam.v1.ISetIamPolicyRequest
options CallOptions
callback Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, callback)

setIamPolicy(request: protos.google.iam.v1.ISetIamPolicyRequest, callback: Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.iam.v1.ISetIamPolicyRequest
callback Callback<protos.google.iam.v1.IPolicy, protos.google.iam.v1.ISetIamPolicyRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

taskPath(project, location, queue, task)

taskPath(project: string, location: string, queue: string, task: string): string;

Return a fully-qualified task resource name string.

Parameters
NameDescription
project string
location string
queue string
task string
Returns
TypeDescription
string

{string} Resource name string.

testIamPermissions(request, options)

testIamPermissions(request?: protos.google.iam.v1.ITestIamPermissionsRequest, options?: CallOptions): Promise<[protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | undefined, {} | undefined]>;

Returns permissions that a caller has on a . If the resource does not exist, this will return an empty set of permissions, not a error.

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

Parameters
NameDescription
request protos.google.iam.v1.ITestIamPermissionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [TestIamPermissionsResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  REQUIRED: The resource for which the policy detail is being requested.
   *  See the operation documentation for the appropriate value for this field.
   */
  // const resource = 'abc123'
  /**
   *  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).
   */
  // const permissions = 'abc123'

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callTestIamPermissions() {
    // Construct request
    const request = {
      resource,
      permissions,
    };

    // Run request
    const response = await tasksClient.testIamPermissions(request);
    console.log(response);
  }

  callTestIamPermissions();

testIamPermissions(request, options, callback)

testIamPermissions(request: protos.google.iam.v1.ITestIamPermissionsRequest, options: CallOptions, callback: Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.iam.v1.ITestIamPermissionsRequest
options CallOptions
callback Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, callback)

testIamPermissions(request: protos.google.iam.v1.ITestIamPermissionsRequest, callback: Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.iam.v1.ITestIamPermissionsRequest
callback Callback<protos.google.iam.v1.ITestIamPermissionsResponse, protos.google.iam.v1.ITestIamPermissionsRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateQueue(request, options)

updateQueue(request?: protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest, options?: CallOptions): Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest | undefined, {} | undefined]>;

Updates a queue.

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

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

WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.

Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest | undefined, {} | undefined]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [Queue]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The queue to create or update.
   *  The queue's name google.cloud.tasks.v2beta3.Queue.name  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 google.cloud.tasks.v2beta3.Queue.name  cannot be changed.
   */
  // const queue = {}
  /**
   *  A mask used to specify which fields of the queue are being updated.
   *  If empty, then all fields will be updated.
   */
  // const updateMask = {}

  // Imports the Tasks library
  const {CloudTasksClient} = require('@google-cloud/tasks').v2beta3;

  // Instantiates a client
  const tasksClient = new CloudTasksClient();

  async function callUpdateQueue() {
    // Construct request
    const request = {
      queue,
    };

    // Run request
    const response = await tasksClient.updateQueue(request);
    console.log(response);
  }

  callUpdateQueue();

updateQueue(request, options, callback)

updateQueue(request: protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest, options: CallOptions, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest
options CallOptions
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

updateQueue(request, callback)

updateQueue(request: protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest, callback: Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest
callback Callback<protos.google.cloud.tasks.v2beta3.IQueue, protos.google.cloud.tasks.v2beta3.IUpdateQueueRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void