diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java index 52437aca..639dffc4 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/OsConfigServiceClient.java @@ -45,6 +45,20 @@ *

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 (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+ *   PatchJobs.ExecutePatchJobRequest request =
+ *       PatchJobs.ExecutePatchJobRequest.newBuilder()
+ *           .setParent(ProjectName.of("[PROJECT]").toString())
+ *           .setDescription("description-1724546052")
+ *           .setDuration(Duration.newBuilder().build())
+ *           .setDryRun(true)
+ *           .setDisplayName("displayName1714148973")
+ *           .build();
+ *   PatchJobs.PatchJob response = osConfigServiceClient.executePatchJob(request);
+ * }
+ * }
+ * *

Note: close() needs to be called on the OsConfigServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). @@ -151,6 +165,22 @@ public OsConfigServiceStub getStub() { /** * Patch VM instances by creating and running a patch job. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.ExecutePatchJobRequest request =
+   *       PatchJobs.ExecutePatchJobRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setDescription("description-1724546052")
+   *           .setDuration(Duration.newBuilder().build())
+   *           .setDryRun(true)
+   *           .setDisplayName("displayName1714148973")
+   *           .build();
+   *   PatchJobs.PatchJob response = osConfigServiceClient.executePatchJob(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 */ @@ -163,6 +193,23 @@ public final PatchJobs.PatchJob executePatchJob(PatchJobs.ExecutePatchJobRequest * Patch VM instances by creating and running a patch job. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.ExecutePatchJobRequest request =
+   *       PatchJobs.ExecutePatchJobRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setDescription("description-1724546052")
+   *           .setDuration(Duration.newBuilder().build())
+   *           .setDryRun(true)
+   *           .setDisplayName("displayName1714148973")
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.executePatchJobCallable().futureCall(request);
+   *   // Do something.
+   *   PatchJobs.PatchJob response = future.get();
+   * }
+   * }
*/ public final UnaryCallable executePatchJobCallable() { @@ -174,6 +221,15 @@ public final PatchJobs.PatchJob executePatchJob(PatchJobs.ExecutePatchJobRequest * Get the patch job. This can be used to track the progress of an ongoing patch job or review the * details of completed jobs. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobName name = PatchJobName.of("[PROJECT]", "[PATCH_JOB]");
+   *   PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(name);
+   * }
+   * }
+ * * @param name Required. Name of the patch in the form `projects/*/patchJobs/*` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -190,6 +246,15 @@ public final PatchJobs.PatchJob getPatchJob(PatchJobName name) { * Get the patch job. This can be used to track the progress of an ongoing patch job or review the * details of completed jobs. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String name = PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString();
+   *   PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(name);
+   * }
+   * }
+ * * @param name Required. Name of the patch in the form `projects/*/patchJobs/*` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -204,6 +269,18 @@ public final PatchJobs.PatchJob getPatchJob(String name) { * Get the patch job. This can be used to track the progress of an ongoing patch job or review the * details of completed jobs. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.GetPatchJobRequest request =
+   *       PatchJobs.GetPatchJobRequest.newBuilder()
+   *           .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString())
+   *           .build();
+   *   PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(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 */ @@ -217,6 +294,19 @@ public final PatchJobs.PatchJob getPatchJob(PatchJobs.GetPatchJobRequest request * details of completed jobs. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.GetPatchJobRequest request =
+   *       PatchJobs.GetPatchJobRequest.newBuilder()
+   *           .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.getPatchJobCallable().futureCall(request);
+   *   // Do something.
+   *   PatchJobs.PatchJob response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getPatchJobCallable() { @@ -227,6 +317,18 @@ public final PatchJobs.PatchJob getPatchJob(PatchJobs.GetPatchJobRequest request /** * Cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.CancelPatchJobRequest request =
+   *       PatchJobs.CancelPatchJobRequest.newBuilder()
+   *           .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString())
+   *           .build();
+   *   PatchJobs.PatchJob response = osConfigServiceClient.cancelPatchJob(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 */ @@ -239,6 +341,19 @@ public final PatchJobs.PatchJob cancelPatchJob(PatchJobs.CancelPatchJobRequest r * Cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.CancelPatchJobRequest request =
+   *       PatchJobs.CancelPatchJobRequest.newBuilder()
+   *           .setName(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.cancelPatchJobCallable().futureCall(request);
+   *   // Do something.
+   *   PatchJobs.PatchJob response = future.get();
+   * }
+   * }
*/ public final UnaryCallable cancelPatchJobCallable() { @@ -249,6 +364,17 @@ public final PatchJobs.PatchJob cancelPatchJob(PatchJobs.CancelPatchJobRequest r /** * Get a list of patch jobs. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. In the form of `projects/*` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -264,6 +390,17 @@ public final ListPatchJobsPagedResponse listPatchJobs(ProjectName parent) { /** * Get a list of patch jobs. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. In the form of `projects/*` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -277,6 +414,23 @@ public final ListPatchJobsPagedResponse listPatchJobs(String parent) { /** * Get a list of patch jobs. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.ListPatchJobsRequest request =
+   *       PatchJobs.ListPatchJobsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(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 */ @@ -289,6 +443,24 @@ public final ListPatchJobsPagedResponse listPatchJobs(PatchJobs.ListPatchJobsReq * Get a list of patch jobs. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.ListPatchJobsRequest request =
+   *       PatchJobs.ListPatchJobsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.listPatchJobsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (PatchJobs.PatchJob element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listPatchJobsPagedCallable() { @@ -300,6 +472,24 @@ public final ListPatchJobsPagedResponse listPatchJobs(PatchJobs.ListPatchJobsReq * Get a list of patch jobs. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   while (true) {
+   *     PatchJobs.ListPatchJobsResponse response =
+   *         osConfigServiceClient.listPatchJobsCallable().call(request);
+   *     for (PatchJobs.PatchJob element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listPatchJobsCallable() { @@ -310,6 +500,18 @@ public final ListPatchJobsPagedResponse listPatchJobs(PatchJobs.ListPatchJobsReq /** * Get a list of instance details for a given patch job. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobName parent = PatchJobName.of("[PROJECT]", "[PATCH_JOB]");
+   *   for (PatchJobs.PatchJobInstanceDetails element :
+   *       osConfigServiceClient.listPatchJobInstanceDetails(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent for the instances are in the form of * `projects/*/patchJobs/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -327,6 +529,18 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail /** * Get a list of instance details for a given patch job. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String parent = PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString();
+   *   for (PatchJobs.PatchJobInstanceDetails element :
+   *       osConfigServiceClient.listPatchJobInstanceDetails(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The parent for the instances are in the form of * `projects/*/patchJobs/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -341,6 +555,24 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail /** * Get a list of instance details for a given patch job. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.ListPatchJobInstanceDetailsRequest request =
+   *       PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder()
+   *           .setParent(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   for (PatchJobs.PatchJobInstanceDetails element :
+   *       osConfigServiceClient.listPatchJobInstanceDetails(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 */ @@ -354,6 +586,24 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail * Get a list of instance details for a given patch job. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchJobs.ListPatchJobInstanceDetailsRequest request =
+   *       PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder()
+   *           .setParent(PatchJobName.of("[PROJECT]", "[PATCH_JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setFilter("filter-1274492040")
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.listPatchJobInstanceDetailsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (PatchJobs.PatchJobInstanceDetails element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable< PatchJobs.ListPatchJobInstanceDetailsRequest, ListPatchJobInstanceDetailsPagedResponse> @@ -366,6 +616,24 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail * Get a list of instance details for a given patch job. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   while (true) {
+   *     PatchJobs.ListPatchJobInstanceDetailsResponse response =
+   *         osConfigServiceClient.listPatchJobInstanceDetailsCallable().call(request);
+   *     for (PatchJobs.PatchJobInstanceDetails element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable< PatchJobs.ListPatchJobInstanceDetailsRequest, @@ -378,6 +646,19 @@ public final ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetail /** * Create an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   PatchDeployments.PatchDeployment patchDeployment =
+   *       PatchDeployments.PatchDeployment.newBuilder().build();
+   *   String patchDeploymentId = "patchDeploymentId-1180405976";
+   *   PatchDeployments.PatchDeployment response =
+   *       osConfigServiceClient.createPatchDeployment(parent, patchDeployment, patchDeploymentId);
+   * }
+   * }
+ * * @param parent Required. The project to apply this patch deployment to in the form * `projects/*`. * @param patchDeployment Required. The patch deployment to create. @@ -410,6 +691,19 @@ public final PatchDeployments.PatchDeployment createPatchDeployment( /** * Create an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   PatchDeployments.PatchDeployment patchDeployment =
+   *       PatchDeployments.PatchDeployment.newBuilder().build();
+   *   String patchDeploymentId = "patchDeploymentId-1180405976";
+   *   PatchDeployments.PatchDeployment response =
+   *       osConfigServiceClient.createPatchDeployment(parent, patchDeployment, patchDeploymentId);
+   * }
+   * }
+ * * @param parent Required. The project to apply this patch deployment to in the form * `projects/*`. * @param patchDeployment Required. The patch deployment to create. @@ -440,6 +734,20 @@ public final PatchDeployments.PatchDeployment createPatchDeployment( /** * Create an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.CreatePatchDeploymentRequest request =
+   *       PatchDeployments.CreatePatchDeploymentRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPatchDeploymentId("patchDeploymentId-1180405976")
+   *           .build();
+   *   PatchDeployments.PatchDeployment response =
+   *       osConfigServiceClient.createPatchDeployment(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 */ @@ -453,6 +761,20 @@ public final PatchDeployments.PatchDeployment createPatchDeployment( * Create an OS Config patch deployment. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.CreatePatchDeploymentRequest request =
+   *       PatchDeployments.CreatePatchDeploymentRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPatchDeploymentId("patchDeploymentId-1180405976")
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.createPatchDeploymentCallable().futureCall(request);
+   *   // Do something.
+   *   PatchDeployments.PatchDeployment response = future.get();
+   * }
+   * }
*/ public final UnaryCallable< PatchDeployments.CreatePatchDeploymentRequest, PatchDeployments.PatchDeployment> @@ -464,6 +786,15 @@ public final PatchDeployments.PatchDeployment createPatchDeployment( /** * Get an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]");
+   *   PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the patch deployment in the form * `projects/*/patchDeployments/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -480,6 +811,15 @@ public final PatchDeployments.PatchDeployment getPatchDeployment(PatchDeployment /** * Get an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString();
+   *   PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the patch deployment in the form * `projects/*/patchDeployments/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -494,6 +834,18 @@ public final PatchDeployments.PatchDeployment getPatchDeployment(String name) { /** * Get an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.GetPatchDeploymentRequest request =
+   *       PatchDeployments.GetPatchDeploymentRequest.newBuilder()
+   *           .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString())
+   *           .build();
+   *   PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(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 */ @@ -507,6 +859,19 @@ public final PatchDeployments.PatchDeployment getPatchDeployment( * Get an OS Config patch deployment. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.GetPatchDeploymentRequest request =
+   *       PatchDeployments.GetPatchDeploymentRequest.newBuilder()
+   *           .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.getPatchDeploymentCallable().futureCall(request);
+   *   // Do something.
+   *   PatchDeployments.PatchDeployment response = future.get();
+   * }
+   * }
*/ public final UnaryCallable< PatchDeployments.GetPatchDeploymentRequest, PatchDeployments.PatchDeployment> @@ -518,6 +883,18 @@ public final PatchDeployments.PatchDeployment getPatchDeployment( /** * Get a page of OS Config patch deployments. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (PatchDeployments.PatchDeployment element :
+   *       osConfigServiceClient.listPatchDeployments(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name of the parent in the form `projects/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -533,6 +910,18 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments(ProjectName /** * Get a page of OS Config patch deployments. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   for (PatchDeployments.PatchDeployment element :
+   *       osConfigServiceClient.listPatchDeployments(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @param parent Required. The resource name of the parent in the form `projects/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -546,6 +935,23 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments(String paren /** * Get a page of OS Config patch deployments. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.ListPatchDeploymentsRequest request =
+   *       PatchDeployments.ListPatchDeploymentsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (PatchDeployments.PatchDeployment element :
+   *       osConfigServiceClient.listPatchDeployments(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 */ @@ -559,6 +965,23 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments( * Get a page of OS Config patch deployments. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.ListPatchDeploymentsRequest request =
+   *       PatchDeployments.ListPatchDeploymentsRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.listPatchDeploymentsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (PatchDeployments.PatchDeployment element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable< PatchDeployments.ListPatchDeploymentsRequest, ListPatchDeploymentsPagedResponse> @@ -571,6 +994,24 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments( * Get a page of OS Config patch deployments. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   while (true) {
+   *     PatchDeployments.ListPatchDeploymentsResponse response =
+   *         osConfigServiceClient.listPatchDeploymentsCallable().call(request);
+   *     for (PatchDeployments.PatchDeployment element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable< PatchDeployments.ListPatchDeploymentsRequest, @@ -583,6 +1024,15 @@ public final ListPatchDeploymentsPagedResponse listPatchDeployments( /** * Delete an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]");
+   *   osConfigServiceClient.deletePatchDeployment(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the patch deployment in the form * `projects/*/patchDeployments/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -599,6 +1049,15 @@ public final void deletePatchDeployment(PatchDeploymentName name) { /** * Delete an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString();
+   *   osConfigServiceClient.deletePatchDeployment(name);
+   * }
+   * }
+ * * @param name Required. The resource name of the patch deployment in the form * `projects/*/patchDeployments/*`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -613,6 +1072,18 @@ public final void deletePatchDeployment(String name) { /** * Delete an OS Config patch deployment. * + *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.DeletePatchDeploymentRequest request =
+   *       PatchDeployments.DeletePatchDeploymentRequest.newBuilder()
+   *           .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString())
+   *           .build();
+   *   osConfigServiceClient.deletePatchDeployment(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 */ @@ -625,6 +1096,19 @@ public final void deletePatchDeployment(PatchDeployments.DeletePatchDeploymentRe * Delete an OS Config patch deployment. * *

Sample code: + * + *

{@code
+   * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+   *   PatchDeployments.DeletePatchDeploymentRequest request =
+   *       PatchDeployments.DeletePatchDeploymentRequest.newBuilder()
+   *           .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       osConfigServiceClient.deletePatchDeploymentCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
*/ public final UnaryCallable deletePatchDeploymentCallable() { diff --git a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/package-info.java b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/package-info.java index 4547978d..9162d3ca 100644 --- a/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/package-info.java +++ b/google-cloud-os-config/src/main/java/com/google/cloud/osconfig/v1/package-info.java @@ -25,6 +25,20 @@ * installations and patch jobs for virtual machine instances. * *

Sample for OsConfigServiceClient: + * + *

{@code
+ * try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
+ *   PatchJobs.ExecutePatchJobRequest request =
+ *       PatchJobs.ExecutePatchJobRequest.newBuilder()
+ *           .setParent(ProjectName.of("[PROJECT]").toString())
+ *           .setDescription("description-1724546052")
+ *           .setDuration(Duration.newBuilder().build())
+ *           .setDryRun(true)
+ *           .setDisplayName("displayName1714148973")
+ *           .build();
+ *   PatchJobs.PatchJob response = osConfigServiceClient.executePatchJob(request);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.osconfig.v1; diff --git a/synth.metadata b/synth.metadata index a7c0051c..4f18afd9 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-os-config.git", - "sha": "8d7f63c773e4b9154a6352ca90aabee0ff6580f0" + "sha": "b426b1d0dcd65a3643679f270611b71fb1c9d054" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {