/** * Pauses a job. * * <p>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. * * <p>Sample code: * * <pre><code> * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { * JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); * Job response = cloudSchedulerClient.pauseJob(name); * } * </code></pre> * * @param name Required. * <p>The job name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Job pauseJob(JobName name) { PauseJobRequest request = PauseJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return pauseJob(request); }
/** * Pauses a job. * * <p>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. * * <p>Sample code: * * <pre><code> * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) { * JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); * Job response = cloudSchedulerClient.pauseJob(name.toString()); * } * </code></pre> * * @param name Required. * <p>The job name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Job pauseJob(String name) { PauseJobRequest request = PauseJobRequest.newBuilder().setName(name).build(); return pauseJob(request); }