Module cloudscheduler

This page documents the language specification for the gcp package. If you're looking for help working with the inputs, outputs, or functions of gcp resources in a Pulumi program, please see the resource documentation for examples and API reference.

Resources

Others

Resources

Resource Job

class Job extends CustomResource

A scheduled job that can publish a pubsub message or a http request every X interval of time, using crontab format string.

To use Cloud Scheduler your project must contain an App Engine app that is located in one of the supported regions. If your project does not have an App Engine app, you must create one.

To get more information about Job, see:

Example Usage - Scheduler Job Http

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const job = new gcp.cloudscheduler.Job("job", {
    attemptDeadline: "320s",
    description: "test http job",
    httpTarget: {
        httpMethod: "POST",
        uri: "https://example.com/ping",
    },
    retryConfig: {
        retryCount: 1,
    },
    schedule: "*/8 * * * *",
    timeZone: "America/New_York",
});

Example Usage - Scheduler Job App Engine

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const job = new gcp.cloudscheduler.Job("job", {
    appEngineHttpTarget: {
        appEngineRouting: {
            instance: "my-instance-001",
            service: "web",
            version: "prod",
        },
        httpMethod: "POST",
        relativeUri: "/ping",
    },
    attemptDeadline: "320s",
    description: "test app engine job",
    retryConfig: {
        maxDoublings: 2,
        maxRetryDuration: "10s",
        minBackoffDuration: "1s",
        retryCount: 3,
    },
    schedule: "*/4 * * * *",
    timeZone: "Europe/London",
});

Example Usage - Scheduler Job Oauth

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const default = gcp.compute.getDefaultServiceAccount({});
const job = new gcp.cloudscheduler.Job("job", {
    description: "test http job",
    schedule: "*/8 * * * *",
    timeZone: "America/New_York",
    attemptDeadline: "320s",
    http_target: {
        httpMethod: "GET",
        uri: "https://cloudscheduler.googleapis.com/v1/projects/my-project-name/locations/us-west1/jobs",
        oauth_token: {
            serviceAccountEmail: _default.then(_default => _default.email),
        },
    },
});

Example Usage - Scheduler Job Oidc

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const default = gcp.compute.getDefaultServiceAccount({});
const job = new gcp.cloudscheduler.Job("job", {
    description: "test http job",
    schedule: "*/8 * * * *",
    timeZone: "America/New_York",
    attemptDeadline: "320s",
    http_target: {
        httpMethod: "GET",
        uri: "https://example.com/ping",
        oidc_token: {
            serviceAccountEmail: _default.then(_default => _default.email),
        },
    },
});

constructor

new Job(name: string, args?: JobArgs, opts?: pulumi.CustomResourceOptions)

Create a Job resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: JobState, opts?: pulumi.CustomResourceOptions): Job

Get an existing Job resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

public static isInstance(obj: any): obj is Job

Returns true if the given object is an instance of Job. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property appEngineHttpTarget

public appEngineHttpTarget: pulumi.Output<JobAppEngineHttpTarget | undefined>;

App Engine HTTP target. If the job providers a App Engine HTTP target the cron will send a request to the service instance Structure is documented below.

property attemptDeadline

public attemptDeadline: pulumi.Output<string | undefined>;

The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig. The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes. * For App Engine HTTP targets, between 15 seconds and 24 hours. A duration in seconds with up to nine fractional digits, terminated by ’s’. Example: “3.5s”

property description

public description: pulumi.Output<string | undefined>;

A human-readable description for the job. This string must not contain more than 500 characters.

property httpTarget

public httpTarget: pulumi.Output<JobHttpTarget | undefined>;

HTTP target. If the job providers a httpTarget the cron will send a request to the targeted url Structure is documented below.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property name

public name: pulumi.Output<string>;

The name of the job.

property project

public project: pulumi.Output<string>;

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

property pubsubTarget

public pubsubTarget: pulumi.Output<JobPubsubTarget | undefined>;

Pub/Sub target If the job providers a Pub/Sub target the cron will publish a message to the provided topic Structure is documented below.

property region

public region: pulumi.Output<string>;

Region where the scheduler job resides

property retryConfig

public retryConfig: pulumi.Output<JobRetryConfig | undefined>;

By default, if a job does not complete successfully, meaning that an acknowledgement is not received from the handler, then it will be retried with exponential backoff according to the settings Structure is documented below.

property schedule

public schedule: pulumi.Output<string | undefined>;

Describes the schedule on which the job will be executed.

property timeZone

public timeZone: pulumi.Output<string | undefined>;

Specifies the time zone to be used in interpreting schedule. The value of this field must be a time zone name from the tz database.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

Others

interface JobArgs

interface JobArgs

The set of arguments for constructing a Job resource.

property appEngineHttpTarget

appEngineHttpTarget?: pulumi.Input<JobAppEngineHttpTarget>;

App Engine HTTP target. If the job providers a App Engine HTTP target the cron will send a request to the service instance Structure is documented below.

property attemptDeadline

attemptDeadline?: pulumi.Input<string>;

The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig. The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes. * For App Engine HTTP targets, between 15 seconds and 24 hours. A duration in seconds with up to nine fractional digits, terminated by ’s’. Example: “3.5s”

property description

description?: pulumi.Input<string>;

A human-readable description for the job. This string must not contain more than 500 characters.

property httpTarget

httpTarget?: pulumi.Input<JobHttpTarget>;

HTTP target. If the job providers a httpTarget the cron will send a request to the targeted url Structure is documented below.

property name

name?: pulumi.Input<string>;

The name of the job.

property project

project?: pulumi.Input<string>;

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

property pubsubTarget

pubsubTarget?: pulumi.Input<JobPubsubTarget>;

Pub/Sub target If the job providers a Pub/Sub target the cron will publish a message to the provided topic Structure is documented below.

property region

region?: pulumi.Input<string>;

Region where the scheduler job resides

property retryConfig

retryConfig?: pulumi.Input<JobRetryConfig>;

By default, if a job does not complete successfully, meaning that an acknowledgement is not received from the handler, then it will be retried with exponential backoff according to the settings Structure is documented below.

property schedule

schedule?: pulumi.Input<string>;

Describes the schedule on which the job will be executed.

property timeZone

timeZone?: pulumi.Input<string>;

Specifies the time zone to be used in interpreting schedule. The value of this field must be a time zone name from the tz database.

interface JobState

interface JobState

Input properties used for looking up and filtering Job resources.

property appEngineHttpTarget

appEngineHttpTarget?: pulumi.Input<JobAppEngineHttpTarget>;

App Engine HTTP target. If the job providers a App Engine HTTP target the cron will send a request to the service instance Structure is documented below.

property attemptDeadline

attemptDeadline?: pulumi.Input<string>;

The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig. The allowed duration for this deadline is: * For HTTP targets, between 15 seconds and 30 minutes. * For App Engine HTTP targets, between 15 seconds and 24 hours. A duration in seconds with up to nine fractional digits, terminated by ’s’. Example: “3.5s”

property description

description?: pulumi.Input<string>;

A human-readable description for the job. This string must not contain more than 500 characters.

property httpTarget

httpTarget?: pulumi.Input<JobHttpTarget>;

HTTP target. If the job providers a httpTarget the cron will send a request to the targeted url Structure is documented below.

property name

name?: pulumi.Input<string>;

The name of the job.

property project

project?: pulumi.Input<string>;

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

property pubsubTarget

pubsubTarget?: pulumi.Input<JobPubsubTarget>;

Pub/Sub target If the job providers a Pub/Sub target the cron will publish a message to the provided topic Structure is documented below.

property region

region?: pulumi.Input<string>;

Region where the scheduler job resides

property retryConfig

retryConfig?: pulumi.Input<JobRetryConfig>;

By default, if a job does not complete successfully, meaning that an acknowledgement is not received from the handler, then it will be retried with exponential backoff according to the settings Structure is documented below.

property schedule

schedule?: pulumi.Input<string>;

Describes the schedule on which the job will be executed.

property timeZone

timeZone?: pulumi.Input<string>;

Specifies the time zone to be used in interpreting schedule. The value of this field must be a time zone name from the tz database.