async function main(projectId, region) {
  // [START batch_list_jobs]
  /**
   * TODO(developer): Uncomment and replace these variables before running the sample.
   */
  // const projectId = 'YOUR_PROJECT_ID';
  /**
   * The region that hosts the job.
   */
  // const region = 'us-central-1';

  // Imports the Batch library
  const batchLib = require('@google-cloud/batch');

  // Instantiates a client
  const batchClient = new batchLib.v1.BatchServiceClient();

  async function callListJobs() {
    // Construct request
    const request = {
      parent: `projects/${projectId}/locations/${region}`,
    };

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

  await callListJobs();
  // [END batch_list_jobs]
}
Get a list of all jobs defined in given region.

@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'