cloud_scheduler

package
v1.78.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package cloud_scheduler manages Cloud Scheduler jobs over the REST API.

Only the HTTP target is modelled. The API also schedules App Engine requests and Pub/Sub messages; nothing here uses either, and a type for something no caller sends is a type nobody checks.

A job's identity is its full resource name, projects/P/locations/L/jobs/J. Create takes the parent and the id separately because that is how the API takes them; everything else takes the name Create returned.

Index

Constants

View Source
const Domain = "cloudscheduler.googleapis.com"
View Source
const Scope = "https://www.googleapis.com/auth/cloud-scheduler"

Scope is the OAuth scope a token must carry to manage jobs. The broader cloud-platform scope also works and is what a Cloud Run runtime identity usually has.

Variables

This section is empty.

Functions

func Parent

func Parent(project string, location string) (string, error)

Parent is the location a job belongs to, projects/P/locations/L. Cloud Scheduler is regional, so the location is part of a job's identity rather than a detail of where it happens to run.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options ...cloud_scheduler_config.Option) *Client

func (*Client) CreateJob

func (client *Client) CreateJob(
	ctx context.Context,
	parent string,
	jobId string,
	newJob *job.Job,
	options ...fetch_config.Option,
) (*job.Job, error)

CreateJob creates a job under parent with the id given, and returns it as the server recorded it -- with its full name, which is what every other call addresses it by.

func (*Client) DeleteJob

func (client *Client) DeleteJob(ctx context.Context, name string, options ...fetch_config.Option) error

DeleteJob removes a job.

func (*Client) GetJob

func (client *Client) GetJob(
	ctx context.Context,
	name string,
	options ...fetch_config.Option,
) (*job.Job, error)

GetJob reads one job by its full resource name.

func (*Client) ListJobs

func (client *Client) ListJobs(
	ctx context.Context,
	parent string,
	options ...fetch_config.Option,
) ([]*job.Job, error)

ListJobs reads every job under parent, following the pages until there are none left.

The caller gets the whole list rather than a page and a token: a location holds the schedules of one deployment, which is tens of jobs rather than thousands, and every caller here wants all of them.

func (*Client) PatchJob

func (client *Client) PatchJob(
	ctx context.Context,
	name string,
	updated *job.Job,
	updateMask []string,
	options ...fetch_config.Option,
) (*job.Job, error)

PatchJob updates the fields named in updateMask and leaves the rest alone.

The mask is required rather than optional: patching without one replaces the whole job with what was sent, so a caller that meant to change a schedule would silently drop its target.

func (*Client) PauseJob

func (client *Client) PauseJob(ctx context.Context, name string, options ...fetch_config.Option) (*job.Job, error)

PauseJob stops a job running until it is resumed.

func (*Client) ResumeJob

func (client *Client) ResumeJob(ctx context.Context, name string, options ...fetch_config.Option) (*job.Job, error)

ResumeJob starts a paused job running again.

func (*Client) RunJob

func (client *Client) RunJob(ctx context.Context, name string, options ...fetch_config.Option) (*job.Job, error)

RunJob runs a job now, without regard to its schedule and without disturbing it. It is what an administrator asking for a run on demand calls.

Directories

Path Synopsis
Package cloud_scheduler_config holds the settings of a Cloud Scheduler client.
Package cloud_scheduler_config holds the settings of a Cloud Scheduler client.
types
job

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL