CloudSchedulerClient

CloudSchedulerClient

The Cloud Scheduler API allows external entities to reliably schedule asynchronous jobs.

Constructor

new CloudSchedulerClient(optionsopt)

Construct an instance of CloudSchedulerClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. See the subsequent parameters for more details.

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

promise function <optional>

Custom promise module to use instead of native Promises.

apiEndpoint string <optional>

The domain name of the API remote host.

Source:

Members

(static) apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

Source:

(static) port

The port for this API service.

Source:

(static) scopes

The scopes needed to make gRPC calls for every method defined in this service.

Source:

(static) servicePath

The DNS address for this API service.

Source:

Methods

close()

Terminate the GRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Source:

createJob(request, optionsopt) → {Promise}

Creates a job.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The location name. For example: projects/PROJECT_ID/locations/LOCATION_ID.

job google.cloud.scheduler.v1beta1.Job

Required. The job to add. The user can optionally specify a name for the job in [name][google.cloud.scheduler.v1beta1.Job.name]. [name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an existing job. If a name is not specified then the system will generate a random unique name that will be returned ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response.

options object <optional>

Call options. See CallOptions for more details.

Source:

deleteJob(request, optionsopt) → {Promise}

Deletes a job.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID.

options object <optional>

Call options. See CallOptions for more details.

Source:

getJob(request, optionsopt) → {Promise}

Gets a job.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID.

options object <optional>

Call options. See CallOptions for more details.

Source:

getProjectId(callback)

Return the project ID used by this class.

Parameters:
Name Type Description
callback function

the callback to be called with the current project Id.

Source:

jobPath(project, location, job) → {string}

Return a fully-qualified job resource name string.

Parameters:
Name Type Description
project string
location string
job string
Source:

listJobs(request, optionsopt) → {Promise}

Lists jobs.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The location name. For example: projects/PROJECT_ID/locations/LOCATION_ID.

pageSize number

Requested page size.

The maximum page size is 500. If unspecified, the page size will be the maximum. Fewer jobs than requested might be returned, even if more jobs exist; use next_page_token to determine if more jobs exist.

pageToken string

A token identifying a page of results the server will return. To request the first page results, page_token must be empty. To request the next page of results, page_token must be the value of [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token] returned from the previous call to [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is an error to switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages.

options object <optional>

Call options. See CallOptions for more details.

Source:

listJobsStream(request, optionsopt) → {Stream}

Equivalent to listJobs, but returns a NodeJS Stream object.

This fetches the paged responses for listJobs continuously and invokes the callback registered for 'data' event for each element in the responses.

The returned object has 'end' method when no more elements are required.

autoPaginate option will be ignored.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

Required. The location name. For example: projects/PROJECT_ID/locations/LOCATION_ID.

pageSize number

Requested page size.

The maximum page size is 500. If unspecified, the page size will be the maximum. Fewer jobs than requested might be returned, even if more jobs exist; use next_page_token to determine if more jobs exist.

pageToken string

A token identifying a page of results the server will return. To request the first page results, page_token must be empty. To request the next page of results, page_token must be the value of [next_page_token][google.cloud.scheduler.v1beta1.ListJobsResponse.next_page_token] returned from the previous call to [ListJobs][google.cloud.scheduler.v1beta1.CloudScheduler.ListJobs]. It is an error to switch the value of [filter][google.cloud.scheduler.v1beta1.ListJobsRequest.filter] or [order_by][google.cloud.scheduler.v1beta1.ListJobsRequest.order_by] while iterating through pages.

options object <optional>

Call options. See CallOptions for more details.

Source:
See:

locationPath(project, location) → {string}

Return a fully-qualified location resource name string.

Parameters:
Name Type Description
project string
location string
Source:

matchJobFromJobName(jobName) → {string}

Parse the job from Job resource.

Parameters:
Name Type Description
jobName string

A fully-qualified path representing Job resource.

Source:

matchLocationFromJobName(jobName) → {string}

Parse the location from Job resource.

Parameters:
Name Type Description
jobName string

A fully-qualified path representing Job resource.

Source:

matchLocationFromLocationName(locationName) → {string}

Parse the location from Location resource.

Parameters:
Name Type Description
locationName string

A fully-qualified path representing Location resource.

Source:

matchProjectFromJobName(jobName) → {string}

Parse the project from Job resource.

Parameters:
Name Type Description
jobName string

A fully-qualified path representing Job resource.

Source:

matchProjectFromLocationName(locationName) → {string}

Parse the project from Location resource.

Parameters:
Name Type Description
locationName string

A fully-qualified path representing Location resource.

Source:

matchProjectFromProjectName(projectName) → {string}

Parse the project from Project resource.

Parameters:
Name Type Description
projectName string

A fully-qualified path representing Project resource.

Source:

pauseJob(request, optionsopt) → {Promise}

Pauses a job.

If a job is paused then the system will stop executing the job until it is re-enabled via [ResumeJob][google.cloud.scheduler.v1beta1.CloudScheduler.ResumeJob]. The state of the job is stored in [state][google.cloud.scheduler.v1beta1.Job.state]; if paused it will be set to [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. A job must be in [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] to be paused.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID.

options object <optional>

Call options. See CallOptions for more details.

Source:

projectPath(project) → {string}

Return a fully-qualified project resource name string.

Parameters:
Name Type Description
project string
Source:

resumeJob(request, optionsopt) → {Promise}

Resume a job.

This method reenables a job after it has been [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED]. The state of a job is stored in [Job.state][google.cloud.scheduler.v1beta1.Job.state]; after calling this method it will be set to [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED]. A job must be in [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID.

options object <optional>

Call options. See CallOptions for more details.

Source:

runJob(request, optionsopt) → {Promise}

Forces a job to run now.

When this method is called, Cloud Scheduler will dispatch the job, even if the job is already running.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. The job name. For example: projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID.

options object <optional>

Call options. See CallOptions for more details.

Source:

updateJob(request, optionsopt) → {Promise}

Updates a job.

If successful, the updated [Job][google.cloud.scheduler.v1beta1.Job] is returned. If the job does not exist, NOT_FOUND is returned.

If UpdateJob does not successfully return, it is possible for the job to be in an [Job.State.UPDATE_FAILED][google.cloud.scheduler.v1beta1.Job.State.UPDATE_FAILED] state. A job in this state may not be executed. If this happens, retry the UpdateJob request until a successful response is received.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
job google.cloud.scheduler.v1beta1.Job

Required. The new job properties. [name][google.cloud.scheduler.v1beta1.Job.name] must be specified.

Output only fields cannot be modified using UpdateJob. Any value specified for an output only field will be ignored.

updateMask google.protobuf.FieldMask

A mask used to specify which fields of the job are being updated.

options object <optional>

Call options. See CallOptions for more details.

Source: