How to use @google-cloud/scheduler - 4 common examples

To help you get started, we’ve selected a few @google-cloud/scheduler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-scheduler / samples / deleteJob.js View on Github external
async function deleteJob(projectId, locationId, jobId) {
  // [START cloud_scheduler_delete_job]
  const scheduler = require('@google-cloud/scheduler');

  // Create a client.
  const client = new scheduler.CloudSchedulerClient();

  // TODO(developer): Uncomment and set the following variables
  // const projectId = "PROJECT_ID"
  // const locationId = "LOCATION_ID"
  // const jobId = "JOB_ID"

  // Construct the fully qualified location path.
  const job = client.jobPath(projectId, locationId, jobId);

  // Use the client to send the job creation request.
  await client.deleteJob({name: job});
  console.log('Job deleted.');
  // [END cloud_scheduler_delete_job]
}
github googleapis / nodejs-scheduler / samples / quickstart.js View on Github external
async function main(projectId, locationId, url) {
  // [START scheduler_quickstart]
  // const projectId = "PROJECT_ID"
  // const locationId = "LOCATION_ID" // see: https://cloud.google.com/about/locations/
  // const url = "https://postb.in/..." // where should we say hello?

  const scheduler = require('@google-cloud/scheduler');

  // Create a client.
  const client = new scheduler.CloudSchedulerClient();

  // Construct the fully qualified location path.
  const parent = client.locationPath(projectId, locationId);

  // Construct the request body.
  const job = {
    httpTarget: {
      uri: url,
      httpMethod: 'POST',
      body: Buffer.from('Hello World'),
    },
    schedule: '* * * * *',
    timeZone: 'America/Los_Angeles',
  };

  const request = {
github googleapis / nodejs-scheduler / samples / createJob.js View on Github external
async function createJob(projectId, locationId, serviceId) {
  // [START cloud_scheduler_create_job]
  const scheduler = require('@google-cloud/scheduler');

  // Create a client.
  const client = new scheduler.CloudSchedulerClient();

  // TODO(developer): Uncomment and set the following variables
  // const projectId = "PROJECT_ID"
  // const locationId = "LOCATION_ID"
  // const serviceId = "my-serivce"

  // Construct the fully qualified location path.
  const parent = client.locationPath(projectId, locationId);

  // Construct the request body.
  const job = {
    appEngineHttpTarget: {
      appEngineRouting: {
        service: serviceId,
      },
      relativeUri: '/log_payload',
github googleapis / nodejs-scheduler / system-test / fixtures / sample / src / index.ts View on Github external
function main() {
  const cloudSchedulerClient = new CloudSchedulerClient();
}

@google-cloud/scheduler

Cloud Scheduler API client for Node.js

Apache-2.0
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis

Popular @google-cloud/scheduler functions