diff --git a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/CloudSchedulerClient.java b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/CloudSchedulerClient.java index 74d95ab0..dbdf7daa 100644 --- a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/CloudSchedulerClient.java +++ b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/CloudSchedulerClient.java @@ -44,6 +44,13 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+ *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ *   Job response = cloudSchedulerClient.getJob(name);
+ * }
+ * }
+ * *

Note: close() needs to be called on the CloudSchedulerClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -147,6 +154,17 @@ public CloudSchedulerStub getStub() { /** * Lists jobs. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Job element : cloudSchedulerClient.listJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -161,6 +179,17 @@ public final ListJobsPagedResponse listJobs(LocationName parent) { /** * Lists jobs. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   for (Job element : cloudSchedulerClient.listJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -174,6 +203,22 @@ public final ListJobsPagedResponse listJobs(String parent) { /** * Lists jobs. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Job element : cloudSchedulerClient.listJobs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -186,6 +231,22 @@ public final ListJobsPagedResponse listJobs(ListJobsRequest request) { * Lists jobs. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.listJobsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Job element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listJobsPagedCallable() { return stub.listJobsPagedCallable(); @@ -196,6 +257,23 @@ public final UnaryCallable listJobsPaged * Lists jobs. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   while (true) {
+   *     ListJobsResponse response = cloudSchedulerClient.listJobsCallable().call(request);
+   *     for (Job element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listJobsCallable() { return stub.listJobsCallable(); @@ -205,6 +283,15 @@ public final UnaryCallable listJobsCallable() /** * Gets a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.getJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -219,6 +306,15 @@ public final Job getJob(JobName name) { /** * Gets a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.getJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -232,6 +328,18 @@ public final Job getJob(String name) { /** * Gets a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   GetJobRequest request =
+   *       GetJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.getJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -244,6 +352,18 @@ public final Job getJob(GetJobRequest request) { * Gets a job. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   GetJobRequest request =
+   *       GetJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.getJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getJobCallable() { return stub.getJobCallable(); @@ -253,6 +373,16 @@ public final UnaryCallable getJobCallable() { /** * Creates a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Job job = Job.newBuilder().build();
+   *   Job response = cloudSchedulerClient.createJob(parent, job);
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @param job Required. The job to add. The user can optionally specify a name for the job in @@ -275,6 +405,16 @@ public final Job createJob(LocationName parent, Job job) { /** * Creates a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job job = Job.newBuilder().build();
+   *   Job response = cloudSchedulerClient.createJob(parent, job);
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @param job Required. The job to add. The user can optionally specify a name for the job in @@ -293,6 +433,19 @@ public final Job createJob(String parent, Job job) { /** * Creates a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .build();
+   *   Job response = cloudSchedulerClient.createJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -305,6 +458,19 @@ public final Job createJob(CreateJobRequest request) { * Creates a job. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.createJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createJobCallable() { return stub.createJobCallable(); @@ -322,6 +488,16 @@ public final UnaryCallable createJobCallable() { * this state may not be executed. If this happens, retry the UpdateJob request until a successful * response is received. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   Job job = Job.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Job response = cloudSchedulerClient.updateJob(job, updateMask);
+   * }
+   * }
+ * * @param job Required. The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be * specified. *

Output only fields cannot be modified using UpdateJob. Any value specified for an output @@ -347,6 +523,19 @@ public final Job updateJob(Job job, FieldMask updateMask) { * this state may not be executed. If this happens, retry the UpdateJob request until a successful * response is received. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Job response = cloudSchedulerClient.updateJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -367,6 +556,19 @@ public final Job updateJob(UpdateJobRequest request) { * response is received. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.updateJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateJobCallable() { return stub.updateJobCallable(); @@ -376,6 +578,15 @@ public final UnaryCallable updateJobCallable() { /** * Deletes a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   cloudSchedulerClient.deleteJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -390,6 +601,15 @@ public final void deleteJob(JobName name) { /** * Deletes a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   cloudSchedulerClient.deleteJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -403,6 +623,18 @@ public final void deleteJob(String name) { /** * Deletes a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   cloudSchedulerClient.deleteJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -415,6 +647,18 @@ public final void deleteJob(DeleteJobRequest request) { * Deletes a job. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.deleteJobCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteJobCallable() { return stub.deleteJobCallable(); @@ -430,6 +674,15 @@ public final UnaryCallable deleteJobCallable() { * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] to be paused. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.pauseJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -450,6 +703,15 @@ public final Job pauseJob(JobName name) { * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] to be paused. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.pauseJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -469,6 +731,18 @@ public final Job pauseJob(String name) { * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED]. A job must be in * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] to be paused. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   PauseJobRequest request =
+   *       PauseJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.pauseJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -487,6 +761,18 @@ public final Job pauseJob(PauseJobRequest request) { * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED] to be paused. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   PauseJobRequest request =
+   *       PauseJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.pauseJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable pauseJobCallable() { return stub.pauseJobCallable(); @@ -502,6 +788,15 @@ public final UnaryCallable pauseJobCallable() { * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.resumeJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -522,6 +817,15 @@ public final Job resumeJob(JobName name) { * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.resumeJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -541,6 +845,18 @@ public final Job resumeJob(String name) { * [Job.State.ENABLED][google.cloud.scheduler.v1.Job.State.ENABLED]. A job must be in * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ResumeJobRequest request =
+   *       ResumeJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.resumeJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -559,6 +875,18 @@ public final Job resumeJob(ResumeJobRequest request) { * [Job.State.PAUSED][google.cloud.scheduler.v1.Job.State.PAUSED] to be resumed. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ResumeJobRequest request =
+   *       ResumeJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.resumeJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable resumeJobCallable() { return stub.resumeJobCallable(); @@ -571,6 +899,15 @@ public final UnaryCallable resumeJobCallable() { *

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

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.runJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -588,6 +925,15 @@ public final Job runJob(JobName name) { *

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

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.runJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -604,6 +950,18 @@ public final Job runJob(String name) { *

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

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.runJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -619,6 +977,18 @@ public final Job runJob(RunJobRequest request) { * already running. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.runJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable runJobCallable() { return stub.runJobCallable(); diff --git a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/package-info.java b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/package-info.java index 96a2410e..2ab883fc 100644 --- a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/package-info.java +++ b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1/package-info.java @@ -23,6 +23,13 @@ * asynchronous jobs. * *

Sample for CloudSchedulerClient: + * + *

{@code
+ * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+ *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ *   Job response = cloudSchedulerClient.getJob(name);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.scheduler.v1; diff --git a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java index ed37f267..89bc5567 100644 --- a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java +++ b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java @@ -44,6 +44,13 @@ *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *

{@code
+ * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+ *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ *   Job response = cloudSchedulerClient.getJob(name);
+ * }
+ * }
+ * *

Note: close() needs to be called on the CloudSchedulerClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * @@ -148,6 +155,17 @@ public CloudSchedulerStub getStub() { /** * Lists jobs. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Job element : cloudSchedulerClient.listJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -162,6 +180,17 @@ public final ListJobsPagedResponse listJobs(LocationName parent) { /** * Lists jobs. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   for (Job element : cloudSchedulerClient.listJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -175,6 +204,22 @@ public final ListJobsPagedResponse listJobs(String parent) { /** * Lists jobs. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Job element : cloudSchedulerClient.listJobs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -187,6 +232,22 @@ public final ListJobsPagedResponse listJobs(ListJobsRequest request) { * Lists jobs. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.listJobsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Job element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listJobsPagedCallable() { return stub.listJobsPagedCallable(); @@ -197,6 +258,23 @@ public final UnaryCallable listJobsPaged * Lists jobs. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   while (true) {
+   *     ListJobsResponse response = cloudSchedulerClient.listJobsCallable().call(request);
+   *     for (Job element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listJobsCallable() { return stub.listJobsCallable(); @@ -206,6 +284,15 @@ public final UnaryCallable listJobsCallable() /** * Gets a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.getJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -220,6 +307,15 @@ public final Job getJob(JobName name) { /** * Gets a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.getJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -233,6 +329,18 @@ public final Job getJob(String name) { /** * Gets a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   GetJobRequest request =
+   *       GetJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.getJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -245,6 +353,18 @@ public final Job getJob(GetJobRequest request) { * Gets a job. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   GetJobRequest request =
+   *       GetJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.getJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getJobCallable() { return stub.getJobCallable(); @@ -254,6 +374,16 @@ public final UnaryCallable getJobCallable() { /** * Creates a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Job job = Job.newBuilder().build();
+   *   Job response = cloudSchedulerClient.createJob(parent, job);
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @param job Required. The job to add. The user can optionally specify a name for the job in @@ -276,6 +406,16 @@ public final Job createJob(LocationName parent, Job job) { /** * Creates a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job job = Job.newBuilder().build();
+   *   Job response = cloudSchedulerClient.createJob(parent, job);
+   * }
+   * }
+ * * @param parent Required. The location name. For example: * `projects/PROJECT_ID/locations/LOCATION_ID`. * @param job Required. The job to add. The user can optionally specify a name for the job in @@ -294,6 +434,19 @@ public final Job createJob(String parent, Job job) { /** * Creates a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .build();
+   *   Job response = cloudSchedulerClient.createJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -306,6 +459,19 @@ public final Job createJob(CreateJobRequest request) { * Creates a job. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.createJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createJobCallable() { return stub.createJobCallable(); @@ -323,6 +489,16 @@ public final UnaryCallable createJobCallable() { * in this state may not be executed. If this happens, retry the UpdateJob request until a * successful response is received. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   Job job = Job.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Job response = cloudSchedulerClient.updateJob(job, updateMask);
+   * }
+   * }
+ * * @param 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 @@ -348,6 +524,19 @@ public final Job updateJob(Job job, FieldMask updateMask) { * in this state may not be executed. If this happens, retry the UpdateJob request until a * successful response is received. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Job response = cloudSchedulerClient.updateJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -368,6 +557,19 @@ public final Job updateJob(UpdateJobRequest request) { * successful response is received. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.updateJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable updateJobCallable() { return stub.updateJobCallable(); @@ -377,6 +579,15 @@ public final UnaryCallable updateJobCallable() { /** * Deletes a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   cloudSchedulerClient.deleteJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -391,6 +602,15 @@ public final void deleteJob(JobName name) { /** * Deletes a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   cloudSchedulerClient.deleteJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -404,6 +624,18 @@ public final void deleteJob(String name) { /** * Deletes a job. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   cloudSchedulerClient.deleteJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -416,6 +648,18 @@ public final void deleteJob(DeleteJobRequest request) { * Deletes a job. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.deleteJobCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deleteJobCallable() { return stub.deleteJobCallable(); @@ -431,6 +675,15 @@ public final UnaryCallable deleteJobCallable() { * [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. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.pauseJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -451,6 +704,15 @@ public final Job pauseJob(JobName name) { * [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. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.pauseJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -470,6 +732,18 @@ public final Job pauseJob(String name) { * [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. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   PauseJobRequest request =
+   *       PauseJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.pauseJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -488,6 +762,18 @@ public final Job pauseJob(PauseJobRequest request) { * [Job.State.ENABLED][google.cloud.scheduler.v1beta1.Job.State.ENABLED] to be paused. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   PauseJobRequest request =
+   *       PauseJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.pauseJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable pauseJobCallable() { return stub.pauseJobCallable(); @@ -503,6 +789,15 @@ public final UnaryCallable pauseJobCallable() { * 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. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.resumeJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -523,6 +818,15 @@ public final Job resumeJob(JobName name) { * 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. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.resumeJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -542,6 +846,18 @@ public final Job resumeJob(String name) { * 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. * + *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ResumeJobRequest request =
+   *       ResumeJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.resumeJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -560,6 +876,18 @@ public final Job resumeJob(ResumeJobRequest request) { * must be in [Job.State.PAUSED][google.cloud.scheduler.v1beta1.Job.State.PAUSED] to be resumed. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   ResumeJobRequest request =
+   *       ResumeJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.resumeJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable resumeJobCallable() { return stub.resumeJobCallable(); @@ -572,6 +900,15 @@ public final UnaryCallable resumeJobCallable() { *

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

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = cloudSchedulerClient.runJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -589,6 +926,15 @@ public final Job runJob(JobName name) { *

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

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = cloudSchedulerClient.runJob(name);
+   * }
+   * }
+ * * @param name Required. 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 @@ -605,6 +951,18 @@ public final Job runJob(String name) { *

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

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = cloudSchedulerClient.runJob(request);
+   * }
+   * }
+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -620,6 +978,18 @@ public final Job runJob(RunJobRequest request) { * already running. * *

Sample code: + * + *

{@code
+   * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = cloudSchedulerClient.runJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
*/ public final UnaryCallable runJobCallable() { return stub.runJobCallable(); diff --git a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/package-info.java b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/package-info.java index 02cdacb1..92761e81 100644 --- a/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/package-info.java +++ b/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/package-info.java @@ -23,6 +23,13 @@ * asynchronous jobs. * *

Sample for CloudSchedulerClient: + * + *

{@code
+ * try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
+ *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ *   Job response = cloudSchedulerClient.getJob(name);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.scheduler.v1beta1; diff --git a/synth.metadata b/synth.metadata index 3e563166..389cab78 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-scheduler.git", - "sha": "36b484df07685d458951490d30101e203646c4fd" + "sha": "89b989d9fe3ee83ae4e6adb0cc762762ebffe3ce" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {