Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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]
}
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 = {
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',
function main() {
const cloudSchedulerClient = new CloudSchedulerClient();
}