* Create a new Task Queue
( project = 'my-project-id', // Your GCP Project id queue = 'my-appengine-queue', // Name of the Queue to create location = 'us-central1' // The GCP region in which to create the queue )
| 18 | * Create a new Task Queue |
| 19 | */ |
| 20 | function main( |
| 21 | project = 'my-project-id', // Your GCP Project id |
| 22 | queue = 'my-appengine-queue', // Name of the Queue to create |
| 23 | location = 'us-central1' // The GCP region in which to create the queue |
| 24 | ) { |
| 25 | // [START cloud_tasks_create_queue] |
| 26 | // Imports the Google Cloud Tasks library. |
| 27 | const cloudTasks = require('@google-cloud/tasks'); |
| 28 | |
| 29 | // Instantiates a client. |
| 30 | const client = new cloudTasks.CloudTasksClient(); |
| 31 | |
| 32 | async function createQueue() { |
| 33 | // Send create queue request. |
| 34 | const [response] = await client.createQueue({ |
| 35 | // The fully qualified path to the location where the queue is created |
| 36 | parent: client.locationPath(project, location), |
| 37 | queue: { |
| 38 | // The fully qualified path to the queue |
| 39 | name: client.queuePath(project, location, queue), |
| 40 | appEngineHttpQueue: { |
| 41 | appEngineRoutingOverride: { |
| 42 | // The App Engine service that will receive the tasks. |
| 43 | service: 'default', |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | }); |
| 48 | console.log(`Created queue ${response.name}`); |
| 49 | } |
| 50 | createQueue(); |
| 51 | // [END cloud_tasks_create_queue] |
| 52 | } |
| 53 | |
| 54 | process.on('unhandledRejection', err => { |
| 55 | console.error(err.message); |
no test coverage detected