MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

batch/delete/delete_job.js:27–62  ·  view source on GitHub ↗

* Deletes the specified job. * * @param {string} projectId - ID or number of the Google Cloud project you want to use. * @param {string} region - The Google Cloud region to use, e.g. 'us-central1' * @param {string} jobName - ID used to uniquely identify the Job within this project and region. *

(projectId, region, jobName)

Source from the content-addressed store, hash-verified

25 * The '-' character cannot be the first or the last one.
26 */
27async function main(projectId, region, jobName) {
28 // [START batch_delete_job]
29 /**
30 * TODO(developer): Uncomment and replace these variables before running the sample.
31 */
32 // const projectId = 'YOUR_PROJECT_ID';
33 /**
34 * The region that hosts the job.
35 */
36 // const region = 'us-central-1';
37 /**
38 * The name of the job you want to delete.
39 */
40 // const jobName = 'YOUR_JOB_NAME';
41
42 // Imports the Batch library
43 const batchLib = require('@google-cloud/batch');
44
45 // Instantiates a client
46 const batchClient = new batchLib.v1.BatchServiceClient();
47
48 async function callDeleteJob() {
49 // Construct request
50 const request = {
51 name: `projects/${projectId}/locations/${region}/jobs/${jobName}`,
52 };
53
54 // Run request
55 const [operation] = await batchClient.deleteJob(request);
56 const [response] = await operation.promise();
57 console.log(response);
58 }
59
60 await callDeleteJob();
61 // [END batch_delete_job]
62}
63
64main(...process.argv.slice(2)).catch(err => {
65 console.error(err.message);

Callers 1

delete_job.jsFile · 0.70

Calls 1

callDeleteJobFunction · 0.85

Tested by

no test coverage detected