Show / Hide Table of Contents

Class Job

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:

  • API documentation
  • How-to Guides
  • Official Documentation

Example Usage - Scheduler Job Http

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var job = new Gcp.CloudScheduler.Job("job", new Gcp.CloudScheduler.JobArgs
    {
        AttemptDeadline = "320s",
        Description = "test http job",
        HttpTarget = new Gcp.CloudScheduler.Inputs.JobHttpTargetArgs
        {
            HttpMethod = "POST",
            Uri = "https://example.com/ping",
        },
        RetryConfig = new Gcp.CloudScheduler.Inputs.JobRetryConfigArgs
        {
            RetryCount = 1,
        },
        Schedule = "*/8 * * * *",
        TimeZone = "America/New_York",
    });
}

}

Example Usage - Scheduler Job App Engine

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var job = new Gcp.CloudScheduler.Job("job", new Gcp.CloudScheduler.JobArgs
    {
        AppEngineHttpTarget = new Gcp.CloudScheduler.Inputs.JobAppEngineHttpTargetArgs
        {
            AppEngineRouting = new Gcp.CloudScheduler.Inputs.JobAppEngineHttpTargetAppEngineRoutingArgs
            {
                Instance = "my-instance-001",
                Service = "web",
                Version = "prod",
            },
            HttpMethod = "POST",
            RelativeUri = "/ping",
        },
        AttemptDeadline = "320s",
        Description = "test app engine job",
        RetryConfig = new Gcp.CloudScheduler.Inputs.JobRetryConfigArgs
        {
            MaxDoublings = 2,
            MaxRetryDuration = "10s",
            MinBackoffDuration = "1s",
            RetryCount = 3,
        },
        Schedule = "*/4 * * * *",
        TimeZone = "Europe/London",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Job
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.CloudScheduler
Assembly: Pulumi.Gcp.dll
Syntax
public class Job : CustomResource

Constructors

View Source

Job(String, JobArgs, CustomResourceOptions)

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

Declaration
public Job(string name, JobArgs args = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

JobArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AppEngineHttpTarget

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.

Declaration
public Output<JobAppEngineHttpTarget> AppEngineHttpTarget { get; }
Property Value
Type Description
Output<JobAppEngineHttpTarget>
View Source

AttemptDeadline

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"
Declaration
public Output<string> AttemptDeadline { get; }
Property Value
Type Description
Output<System.String>
View Source

Description

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

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

HttpTarget

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

Declaration
public Output<JobHttpTarget> HttpTarget { get; }
Property Value
Type Description
Output<JobHttpTarget>
View Source

Name

The name of the job.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Project

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

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

PubsubTarget

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.

Declaration
public Output<JobPubsubTarget> PubsubTarget { get; }
Property Value
Type Description
Output<JobPubsubTarget>
View Source

Region

Region where the scheduler job resides

Declaration
public Output<string> Region { get; }
Property Value
Type Description
Output<System.String>
View Source

RetryConfig

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.

Declaration
public Output<JobRetryConfig> RetryConfig { get; }
Property Value
Type Description
Output<JobRetryConfig>
View Source

Schedule

Describes the schedule on which the job will be executed.

Declaration
public Output<string> Schedule { get; }
Property Value
Type Description
Output<System.String>
View Source

TimeZone

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.

Declaration
public Output<string> TimeZone { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, JobState, CustomResourceOptions)

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

Declaration
public static Job Get(string name, Input<string> id, JobState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

JobState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Job
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.