Class CloudSchedulerClient (2.31.0)

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

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

CloudSchedulerClient(CloudSchedulerClient const &)

Copy and move support

Parameter
Name Description
CloudSchedulerClient const &

CloudSchedulerClient(CloudSchedulerClient &&)

Copy and move support

Parameter
Name Description
CloudSchedulerClient &&

CloudSchedulerClient(std::shared_ptr< CloudSchedulerConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< CloudSchedulerConnection >
opts Options

Operators

operator=(CloudSchedulerClient const &)

Copy and move support

Parameter
Name Description
CloudSchedulerClient const &
Returns
Type Description
CloudSchedulerClient &

operator=(CloudSchedulerClient &&)

Copy and move support

Parameter
Name Description
CloudSchedulerClient &&
Returns
Type Description
CloudSchedulerClient &

Functions

ListJobs(std::string const &, Options)

Lists jobs.

Parameters
Name Description
parent std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::scheduler::v1::Job >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.scheduler.v1.Job, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListJobs(google::cloud::scheduler::v1::ListJobsRequest, Options)

Lists jobs.

Parameters
Name Description
request google::cloud::scheduler::v1::ListJobsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.ListJobsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::scheduler::v1::Job >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.scheduler.v1.Job, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetJob(std::string const &, Options)

Gets a job.

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetJob(google::cloud::scheduler::v1::GetJobRequest const &, Options)

Gets a job.

Parameters
Name Description
request google::cloud::scheduler::v1::GetJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.GetJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateJob(std::string const &, google::cloud::scheduler::v1::Job const &, Options)

Creates a job.

Parameters
Name Description
parent std::string const &

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

job google::cloud::scheduler::v1::Job const &

Required. The job to add. The user can optionally specify a name for the job in name. 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) in the response.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateJob(google::cloud::scheduler::v1::CreateJobRequest const &, Options)

Creates a job.

Parameters
Name Description
request google::cloud::scheduler::v1::CreateJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.CreateJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateJob(google::cloud::scheduler::v1::Job const &, google::protobuf::FieldMask const &, Options)

Updates a job.

If successful, the updated 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 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 Description
job google::cloud::scheduler::v1::Job const &

Required. The new job properties. name must be specified.
Output only fields cannot be modified using UpdateJob. Any value specified for an output only field will be ignored.

update_mask google::protobuf::FieldMask const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateJob(google::cloud::scheduler::v1::UpdateJobRequest const &, Options)

Updates a job.

If successful, the updated 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 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 Description
request google::cloud::scheduler::v1::UpdateJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.UpdateJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

DeleteJob(std::string const &, Options)

Deletes a job.

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

DeleteJob(google::cloud::scheduler::v1::DeleteJobRequest const &, Options)

Deletes a job.

Parameters
Name Description
request google::cloud::scheduler::v1::DeleteJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.DeleteJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
Status

a Status object. If the request failed, the status contains the details of the failure.

PauseJob(std::string const &, Options)

Pauses a job.

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

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

PauseJob(google::cloud::scheduler::v1::PauseJobRequest const &, Options)

Pauses a job.

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

Parameters
Name Description
request google::cloud::scheduler::v1::PauseJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.PauseJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ResumeJob(std::string const &, Options)

Resume a job.

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

Parameters
Name Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ResumeJob(google::cloud::scheduler::v1::ResumeJobRequest const &, Options)

Resume a job.

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

Parameters
Name Description
request google::cloud::scheduler::v1::ResumeJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.ResumeJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

RunJob(std::string const &, Options)

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 Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

RunJob(google::cloud::scheduler::v1::RunJobRequest const &, Options)

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 Description
request google::cloud::scheduler::v1::RunJobRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.scheduler.v1.RunJobRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::scheduler::v1::Job >

the result of the RPC. The response message type (google.cloud.scheduler.v1.Job) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

ListLocations(google::cloud::location::ListLocationsRequest, Options)

Lists information about the supported locations for this service.

Parameters
Name Description
request google::cloud::location::ListLocationsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.location.ListLocationsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::cloud::location::Location >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.location.Location, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetLocation(google::cloud::location::GetLocationRequest const &, Options)

Gets information about a location.

Parameters
Name Description
request google::cloud::location::GetLocationRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.location.GetLocationRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::cloud::location::Location >

the result of the RPC. The response message type (google.cloud.location.Location) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.