Class OsConfigServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
The OS Config service is a server-side component that you can use to manage package installations and patch jobs for virtual machine instances.
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) {
PatchJobs.ExecutePatchJobRequest request =
PatchJobs.ExecutePatchJobRequest.newBuilder()
.setParent("parent-995424086")
.setDescription("description-1724546052")
.setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build())
.setPatchConfig(PatchJobs.PatchConfig.newBuilder().build())
.setDuration(Duration.newBuilder().build())
.setDryRun(true)
.setDisplayName("displayName1714148973")
.setRollout(PatchJobs.PatchRollout.newBuilder().build())
.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().
| Method | Description | Method Variants |
|---|---|---|
ExecutePatchJob |
Patch VM instances by creating and running a patch job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetPatchJob |
Get the patch job. This can be used to track the progress of an ongoing patch job or review the details of completed jobs. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CancelPatchJob |
Cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPatchJobs |
Get a list of patch jobs. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPatchJobInstanceDetails |
Get a list of instance details for a given patch job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreatePatchDeployment |
Create an OS Config patch deployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetPatchDeployment |
Get an OS Config patch deployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPatchDeployments |
Get a page of OS Config patch deployments. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeletePatchDeployment |
Delete an OS Config patch deployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdatePatchDeployment |
Update an OS Config patch deployment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
PausePatchDeployment |
Change state of patch deployment to "PAUSED". Patch deployment in paused state doesn't generate patch jobs. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ResumePatchDeployment |
Change state of patch deployment back to "ACTIVE". Patch deployment in active state continues to generate patch jobs. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateGuestPolicy |
Create an OS Config guest policy. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetGuestPolicy |
Get an OS Config guest policy. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListGuestPolicies |
Get a page of OS Config guest policies. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateGuestPolicy |
Update an OS Config guest policy. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteGuestPolicy |
Delete an OS Config guest policy. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
LookupEffectiveGuestPolicy |
Lookup the effective guest policy that applies to a VM instance. This lookup merges all policies that are assigned to the instance ancestry. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of OsConfigServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
OsConfigServiceSettings osConfigServiceSettings =
OsConfigServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
OsConfigServiceClient osConfigServiceClient =
OsConfigServiceClient.create(osConfigServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
OsConfigServiceSettings osConfigServiceSettings =
OsConfigServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
OsConfigServiceClient osConfigServiceClient =
OsConfigServiceClient.create(osConfigServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
OsConfigServiceSettings osConfigServiceSettings =
OsConfigServiceSettings.newHttpJsonBuilder().build();
OsConfigServiceClient osConfigServiceClient =
OsConfigServiceClient.create(osConfigServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOsConfigServiceClient(OsConfigServiceSettings settings) Constructs an instance of OsConfigServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final PatchJobs.PatchJobCancel a patch job.Cancel a patch job.final voidclose()static final OsConfigServiceClientcreate()Constructs an instance of OsConfigServiceClient with default settings.static final OsConfigServiceClientcreate(OsConfigServiceSettings settings) Constructs an instance of OsConfigServiceClient, using the given settings.static final OsConfigServiceClientcreate(OsConfigServiceStub stub) Constructs an instance of OsConfigServiceClient, using the given stub for making calls.Create an OS Config guest policy.createGuestPolicy(ProjectName parent, GuestPolicies.GuestPolicy guestPolicy) Create an OS Config guest policy.createGuestPolicy(String parent, GuestPolicies.GuestPolicy guestPolicy) Create an OS Config guest policy.Create an OS Config guest policy.Create an OS Config patch deployment.Create an OS Config patch deployment.final voidDelete an OS Config guest policy.final voidDelete an OS Config guest policy.final voiddeleteGuestPolicy(String name) Delete an OS Config guest policy.final UnaryCallable<GuestPolicies.DeleteGuestPolicyRequest,com.google.protobuf.Empty> Delete an OS Config guest policy.final voidDelete an OS Config patch deployment.final UnaryCallable<PatchDeployments.DeletePatchDeploymentRequest,com.google.protobuf.Empty> Delete an OS Config patch deployment.final PatchJobs.PatchJobPatch VM instances by creating and running a patch job.Patch VM instances by creating and running a patch job.Get an OS Config guest policy.Get an OS Config guest policy.getGuestPolicy(String name) Get an OS Config guest policy.Get an OS Config guest policy.Get an OS Config patch deployment.Get an OS Config patch deployment.final PatchJobs.PatchJobgetPatchJob(PatchJobs.GetPatchJobRequest request) Get the patch job.Get the patch job.final OsConfigServiceSettingsgetStub()booleanbooleanGet a page of OS Config guest policies.listGuestPolicies(ProjectName parent) Get a page of OS Config guest policies.listGuestPolicies(String parent) Get a page of OS Config guest policies.Get a page of OS Config guest policies.final UnaryCallable<GuestPolicies.ListGuestPoliciesRequest,OsConfigServiceClient.ListGuestPoliciesPagedResponse> Get a page of OS Config guest policies.Get a page of OS Config patch deployments.final UnaryCallable<PatchDeployments.ListPatchDeploymentsRequest,PatchDeployments.ListPatchDeploymentsResponse> Get a page of OS Config patch deployments.final UnaryCallable<PatchDeployments.ListPatchDeploymentsRequest,OsConfigServiceClient.ListPatchDeploymentsPagedResponse> Get a page of OS Config patch deployments.Get a list of instance details for a given patch job.listPatchJobInstanceDetails(String parent) Get a list of instance details for a given patch job.final UnaryCallable<PatchJobs.ListPatchJobInstanceDetailsRequest,PatchJobs.ListPatchJobInstanceDetailsResponse> Get a list of instance details for a given patch job.final UnaryCallable<PatchJobs.ListPatchJobInstanceDetailsRequest,OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse> Get a list of instance details for a given patch job.Get a list of patch jobs.Get a list of patch jobs.final UnaryCallable<PatchJobs.ListPatchJobsRequest,OsConfigServiceClient.ListPatchJobsPagedResponse> Get a list of patch jobs.Lookup the effective guest policy that applies to a VM instance.final UnaryCallable<GuestPolicies.LookupEffectiveGuestPolicyRequest,GuestPolicies.EffectiveGuestPolicy> Lookup the effective guest policy that applies to a VM instance.Change state of patch deployment to "PAUSED".Change state of patch deployment to "PAUSED".pausePatchDeployment(String name) Change state of patch deployment to "PAUSED".Change state of patch deployment to "PAUSED".Change state of patch deployment back to "ACTIVE".Change state of patch deployment back to "ACTIVE".resumePatchDeployment(String name) Change state of patch deployment back to "ACTIVE".Change state of patch deployment back to "ACTIVE".voidshutdown()voidupdateGuestPolicy(GuestPolicies.GuestPolicy guestPolicy, com.google.protobuf.FieldMask updateMask) Update an OS Config guest policy.Update an OS Config guest policy.Update an OS Config guest policy.updatePatchDeployment(PatchDeployments.PatchDeployment patchDeployment, com.google.protobuf.FieldMask updateMask) Update an OS Config patch deployment.Update an OS Config patch deployment.Update an OS Config patch deployment.
-
Constructor Details
-
OsConfigServiceClient
Constructs an instance of OsConfigServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
OsConfigServiceClient
-
-
Method Details
-
create
Constructs an instance of OsConfigServiceClient with default settings.- Throws:
IOException
-
create
public static final OsConfigServiceClient create(OsConfigServiceSettings settings) throws IOException Constructs an instance of OsConfigServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of OsConfigServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(OsConfigServiceSettings). -
getSettings
-
getStub
-
executePatchJob
Patch VM instances by creating and running a patch job.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ExecutePatchJobRequest request = PatchJobs.ExecutePatchJobRequest.newBuilder() .setParent("parent-995424086") .setDescription("description-1724546052") .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) .setDuration(Duration.newBuilder().build()) .setDryRun(true) .setDisplayName("displayName1714148973") .setRollout(PatchJobs.PatchRollout.newBuilder().build()) .build(); PatchJobs.PatchJob response = osConfigServiceClient.executePatchJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
executePatchJobCallable
public final UnaryCallable<PatchJobs.ExecutePatchJobRequest,PatchJobs.PatchJob> executePatchJobCallable()Patch VM instances by creating and running a patch job.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ExecutePatchJobRequest request = PatchJobs.ExecutePatchJobRequest.newBuilder() .setParent("parent-995424086") .setDescription("description-1724546052") .setInstanceFilter(PatchJobs.PatchInstanceFilter.newBuilder().build()) .setPatchConfig(PatchJobs.PatchConfig.newBuilder().build()) .setDuration(Duration.newBuilder().build()) .setDryRun(true) .setDisplayName("displayName1714148973") .setRollout(PatchJobs.PatchRollout.newBuilder().build()) .build(); ApiFuture<PatchJobs.PatchJob> future = osConfigServiceClient.executePatchJobCallable().futureCall(request); // Do something. PatchJobs.PatchJob response = future.get(); } -
getPatchJob
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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.GetPatchJobRequest request = PatchJobs.GetPatchJobRequest.newBuilder().setName("name3373707").build(); PatchJobs.PatchJob response = osConfigServiceClient.getPatchJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getPatchJobCallable
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:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.GetPatchJobRequest request = PatchJobs.GetPatchJobRequest.newBuilder().setName("name3373707").build(); ApiFuture<PatchJobs.PatchJob> future = osConfigServiceClient.getPatchJobCallable().futureCall(request); // Do something. PatchJobs.PatchJob response = future.get(); } -
cancelPatchJob
Cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.CancelPatchJobRequest request = PatchJobs.CancelPatchJobRequest.newBuilder().setName("name3373707").build(); PatchJobs.PatchJob response = osConfigServiceClient.cancelPatchJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
cancelPatchJobCallable
public final UnaryCallable<PatchJobs.CancelPatchJobRequest,PatchJobs.PatchJob> cancelPatchJobCallable()Cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.CancelPatchJobRequest request = PatchJobs.CancelPatchJobRequest.newBuilder().setName("name3373707").build(); ApiFuture<PatchJobs.PatchJob> future = osConfigServiceClient.cancelPatchJobCallable().futureCall(request); // Do something. PatchJobs.PatchJob response = future.get(); } -
listPatchJobs
public final OsConfigServiceClient.ListPatchJobsPagedResponse listPatchJobs(PatchJobs.ListPatchJobsRequest request) Get a list of patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ListPatchJobsRequest request = PatchJobs.ListPatchJobsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (PatchJobs.PatchJob element : osConfigServiceClient.listPatchJobs(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPatchJobsPagedCallable
public final UnaryCallable<PatchJobs.ListPatchJobsRequest,OsConfigServiceClient.ListPatchJobsPagedResponse> listPatchJobsPagedCallable()Get a list of patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ListPatchJobsRequest request = PatchJobs.ListPatchJobsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<PatchJobs.PatchJob> future = osConfigServiceClient.listPatchJobsPagedCallable().futureCall(request); // Do something. for (PatchJobs.PatchJob element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPatchJobsCallable
public final UnaryCallable<PatchJobs.ListPatchJobsRequest,PatchJobs.ListPatchJobsResponse> listPatchJobsCallable()Get a list of patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ListPatchJobsRequest request = PatchJobs.ListPatchJobsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { PatchJobs.ListPatchJobsResponse response = osConfigServiceClient.listPatchJobsCallable().call(request); for (PatchJobs.PatchJob element : response.getPatchJobsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
listPatchJobInstanceDetails
public final OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetails(String parent) Get a list of instance details for a given patch job.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String parent = "parent-995424086"; for (PatchJobs.PatchJobInstanceDetails element : osConfigServiceClient.listPatchJobInstanceDetails(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent for the instances are in the form of `projects/*/patchJobs/*`.- Throws:
ApiException- if the remote call fails
-
listPatchJobInstanceDetails
public final OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse listPatchJobInstanceDetails(PatchJobs.ListPatchJobInstanceDetailsRequest request) Get a list of instance details for a given patch job.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ListPatchJobInstanceDetailsRequest request = PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (PatchJobs.PatchJobInstanceDetails element : osConfigServiceClient.listPatchJobInstanceDetails(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPatchJobInstanceDetailsPagedCallable
public final UnaryCallable<PatchJobs.ListPatchJobInstanceDetailsRequest,OsConfigServiceClient.ListPatchJobInstanceDetailsPagedResponse> listPatchJobInstanceDetailsPagedCallable()Get a list of instance details for a given patch job.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ListPatchJobInstanceDetailsRequest request = PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<PatchJobs.PatchJobInstanceDetails> future = osConfigServiceClient.listPatchJobInstanceDetailsPagedCallable().futureCall(request); // Do something. for (PatchJobs.PatchJobInstanceDetails element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPatchJobInstanceDetailsCallable
public final UnaryCallable<PatchJobs.ListPatchJobInstanceDetailsRequest,PatchJobs.ListPatchJobInstanceDetailsResponse> listPatchJobInstanceDetailsCallable()Get a list of instance details for a given patch job.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchJobs.ListPatchJobInstanceDetailsRequest request = PatchJobs.ListPatchJobInstanceDetailsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { PatchJobs.ListPatchJobInstanceDetailsResponse response = osConfigServiceClient.listPatchJobInstanceDetailsCallable().call(request); for (PatchJobs.PatchJobInstanceDetails element : response.getPatchJobInstanceDetailsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
createPatchDeployment
public final PatchDeployments.PatchDeployment createPatchDeployment(PatchDeployments.CreatePatchDeploymentRequest request) Create an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.CreatePatchDeploymentRequest request = PatchDeployments.CreatePatchDeploymentRequest.newBuilder() .setParent("parent-995424086") .setPatchDeploymentId("patchDeploymentId-1180405976") .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) .build(); PatchDeployments.PatchDeployment response = osConfigServiceClient.createPatchDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createPatchDeploymentCallable
public final UnaryCallable<PatchDeployments.CreatePatchDeploymentRequest,PatchDeployments.PatchDeployment> createPatchDeploymentCallable()Create an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.CreatePatchDeploymentRequest request = PatchDeployments.CreatePatchDeploymentRequest.newBuilder() .setParent("parent-995424086") .setPatchDeploymentId("patchDeploymentId-1180405976") .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) .build(); ApiFuture<PatchDeployments.PatchDeployment> future = osConfigServiceClient.createPatchDeploymentCallable().futureCall(request); // Do something. PatchDeployments.PatchDeployment response = future.get(); } -
getPatchDeployment
public final PatchDeployments.PatchDeployment getPatchDeployment(PatchDeployments.GetPatchDeploymentRequest request) Get an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.GetPatchDeploymentRequest request = PatchDeployments.GetPatchDeploymentRequest.newBuilder().setName("name3373707").build(); PatchDeployments.PatchDeployment response = osConfigServiceClient.getPatchDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getPatchDeploymentCallable
public final UnaryCallable<PatchDeployments.GetPatchDeploymentRequest,PatchDeployments.PatchDeployment> getPatchDeploymentCallable()Get an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.GetPatchDeploymentRequest request = PatchDeployments.GetPatchDeploymentRequest.newBuilder().setName("name3373707").build(); ApiFuture<PatchDeployments.PatchDeployment> future = osConfigServiceClient.getPatchDeploymentCallable().futureCall(request); // Do something. PatchDeployments.PatchDeployment response = future.get(); } -
listPatchDeployments
public final OsConfigServiceClient.ListPatchDeploymentsPagedResponse listPatchDeployments(PatchDeployments.ListPatchDeploymentsRequest request) Get a page of OS Config patch deployments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.ListPatchDeploymentsRequest request = PatchDeployments.ListPatchDeploymentsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (PatchDeployments.PatchDeployment element : osConfigServiceClient.listPatchDeployments(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listPatchDeploymentsPagedCallable
public final UnaryCallable<PatchDeployments.ListPatchDeploymentsRequest,OsConfigServiceClient.ListPatchDeploymentsPagedResponse> listPatchDeploymentsPagedCallable()Get a page of OS Config patch deployments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.ListPatchDeploymentsRequest request = PatchDeployments.ListPatchDeploymentsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<PatchDeployments.PatchDeployment> future = osConfigServiceClient.listPatchDeploymentsPagedCallable().futureCall(request); // Do something. for (PatchDeployments.PatchDeployment element : future.get().iterateAll()) { // doThingsWith(element); } } -
listPatchDeploymentsCallable
public final UnaryCallable<PatchDeployments.ListPatchDeploymentsRequest,PatchDeployments.ListPatchDeploymentsResponse> listPatchDeploymentsCallable()Get a page of OS Config patch deployments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.ListPatchDeploymentsRequest request = PatchDeployments.ListPatchDeploymentsRequest.newBuilder() .setParent("parent-995424086") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { PatchDeployments.ListPatchDeploymentsResponse response = osConfigServiceClient.listPatchDeploymentsCallable().call(request); for (PatchDeployments.PatchDeployment element : response.getPatchDeploymentsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
deletePatchDeployment
Delete an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.DeletePatchDeploymentRequest request = PatchDeployments.DeletePatchDeploymentRequest.newBuilder().setName("name3373707").build(); osConfigServiceClient.deletePatchDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deletePatchDeploymentCallable
public final UnaryCallable<PatchDeployments.DeletePatchDeploymentRequest,com.google.protobuf.Empty> deletePatchDeploymentCallable()Delete an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.DeletePatchDeploymentRequest request = PatchDeployments.DeletePatchDeploymentRequest.newBuilder().setName("name3373707").build(); ApiFuture<Empty> future = osConfigServiceClient.deletePatchDeploymentCallable().futureCall(request); // Do something. future.get(); } -
updatePatchDeployment
public final PatchDeployments.PatchDeployment updatePatchDeployment(PatchDeployments.PatchDeployment patchDeployment, com.google.protobuf.FieldMask updateMask) Update an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.PatchDeployment patchDeployment = PatchDeployments.PatchDeployment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); PatchDeployments.PatchDeployment response = osConfigServiceClient.updatePatchDeployment(patchDeployment, updateMask); }- Parameters:
patchDeployment- Required. The patch deployment to Update.updateMask- Optional. Field mask that controls which fields of the patch deployment should be updated.- Throws:
ApiException- if the remote call fails
-
updatePatchDeployment
public final PatchDeployments.PatchDeployment updatePatchDeployment(PatchDeployments.UpdatePatchDeploymentRequest request) Update an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.UpdatePatchDeploymentRequest request = PatchDeployments.UpdatePatchDeploymentRequest.newBuilder() .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); PatchDeployments.PatchDeployment response = osConfigServiceClient.updatePatchDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updatePatchDeploymentCallable
public final UnaryCallable<PatchDeployments.UpdatePatchDeploymentRequest,PatchDeployments.PatchDeployment> updatePatchDeploymentCallable()Update an OS Config patch deployment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.UpdatePatchDeploymentRequest request = PatchDeployments.UpdatePatchDeploymentRequest.newBuilder() .setPatchDeployment(PatchDeployments.PatchDeployment.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<PatchDeployments.PatchDeployment> future = osConfigServiceClient.updatePatchDeploymentCallable().futureCall(request); // Do something. PatchDeployments.PatchDeployment response = future.get(); } -
pausePatchDeployment
Change state of patch deployment to "PAUSED". Patch deployment in paused state doesn't generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(name); }- Parameters:
name- Required. The resource name of the patch deployment in the form `projects/*/patchDeployments/*`.- Throws:
ApiException- if the remote call fails
-
pausePatchDeployment
Change state of patch deployment to "PAUSED". Patch deployment in paused state doesn't generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(name); }- Parameters:
name- Required. The resource name of the patch deployment in the form `projects/*/patchDeployments/*`.- Throws:
ApiException- if the remote call fails
-
pausePatchDeployment
public final PatchDeployments.PatchDeployment pausePatchDeployment(PatchDeployments.PausePatchDeploymentRequest request) Change state of patch deployment to "PAUSED". Patch deployment in paused state doesn't generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.PausePatchDeploymentRequest request = PatchDeployments.PausePatchDeploymentRequest.newBuilder() .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) .build(); PatchDeployments.PatchDeployment response = osConfigServiceClient.pausePatchDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
pausePatchDeploymentCallable
public final UnaryCallable<PatchDeployments.PausePatchDeploymentRequest,PatchDeployments.PatchDeployment> pausePatchDeploymentCallable()Change state of patch deployment to "PAUSED". Patch deployment in paused state doesn't generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.PausePatchDeploymentRequest request = PatchDeployments.PausePatchDeploymentRequest.newBuilder() .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) .build(); ApiFuture<PatchDeployments.PatchDeployment> future = osConfigServiceClient.pausePatchDeploymentCallable().futureCall(request); // Do something. PatchDeployments.PatchDeployment response = future.get(); } -
resumePatchDeployment
Change state of patch deployment back to "ACTIVE". Patch deployment in active state continues to generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeploymentName name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]"); PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(name); }- Parameters:
name- Required. The resource name of the patch deployment in the form `projects/*/patchDeployments/*`.- Throws:
ApiException- if the remote call fails
-
resumePatchDeployment
Change state of patch deployment back to "ACTIVE". Patch deployment in active state continues to generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String name = PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString(); PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(name); }- Parameters:
name- Required. The resource name of the patch deployment in the form `projects/*/patchDeployments/*`.- Throws:
ApiException- if the remote call fails
-
resumePatchDeployment
public final PatchDeployments.PatchDeployment resumePatchDeployment(PatchDeployments.ResumePatchDeploymentRequest request) Change state of patch deployment back to "ACTIVE". Patch deployment in active state continues to generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.ResumePatchDeploymentRequest request = PatchDeployments.ResumePatchDeploymentRequest.newBuilder() .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) .build(); PatchDeployments.PatchDeployment response = osConfigServiceClient.resumePatchDeployment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
resumePatchDeploymentCallable
public final UnaryCallable<PatchDeployments.ResumePatchDeploymentRequest,PatchDeployments.PatchDeployment> resumePatchDeploymentCallable()Change state of patch deployment back to "ACTIVE". Patch deployment in active state continues to generate patch jobs.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { PatchDeployments.ResumePatchDeploymentRequest request = PatchDeployments.ResumePatchDeploymentRequest.newBuilder() .setName(PatchDeploymentName.of("[PROJECT]", "[PATCH_DEPLOYMENT]").toString()) .build(); ApiFuture<PatchDeployments.PatchDeployment> future = osConfigServiceClient.resumePatchDeploymentCallable().futureCall(request); // Do something. PatchDeployments.PatchDeployment response = future.get(); } -
createGuestPolicy
public final GuestPolicies.GuestPolicy createGuestPolicy(ProjectName parent, GuestPolicies.GuestPolicy guestPolicy) Create an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); GuestPolicies.GuestPolicy response = osConfigServiceClient.createGuestPolicy(parent, guestPolicy); }- Parameters:
parent- Required. The resource name of the parent using one of the following forms: `projects/{project_number}`.guestPolicy- Required. The GuestPolicy to create.- Throws:
ApiException- if the remote call fails
-
createGuestPolicy
public final GuestPolicies.GuestPolicy createGuestPolicy(String parent, GuestPolicies.GuestPolicy guestPolicy) Create an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String parent = ProjectName.of("[PROJECT]").toString(); GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); GuestPolicies.GuestPolicy response = osConfigServiceClient.createGuestPolicy(parent, guestPolicy); }- Parameters:
parent- Required. The resource name of the parent using one of the following forms: `projects/{project_number}`.guestPolicy- Required. The GuestPolicy to create.- Throws:
ApiException- if the remote call fails
-
createGuestPolicy
public final GuestPolicies.GuestPolicy createGuestPolicy(GuestPolicies.CreateGuestPolicyRequest request) Create an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.CreateGuestPolicyRequest request = GuestPolicies.CreateGuestPolicyRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setGuestPolicyId("guestPolicyId1234592741") .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) .build(); GuestPolicies.GuestPolicy response = osConfigServiceClient.createGuestPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createGuestPolicyCallable
public final UnaryCallable<GuestPolicies.CreateGuestPolicyRequest,GuestPolicies.GuestPolicy> createGuestPolicyCallable()Create an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.CreateGuestPolicyRequest request = GuestPolicies.CreateGuestPolicyRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setGuestPolicyId("guestPolicyId1234592741") .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) .build(); ApiFuture<GuestPolicies.GuestPolicy> future = osConfigServiceClient.createGuestPolicyCallable().futureCall(request); // Do something. GuestPolicies.GuestPolicy response = future.get(); } -
getGuestPolicy
Get an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); GuestPolicies.GuestPolicy response = osConfigServiceClient.getGuestPolicy(name); }- Parameters:
name- Required. The resource name of the guest policy using one of the following forms: `projects/{project_number}/guestPolicies/{guest_policy_id}`.- Throws:
ApiException- if the remote call fails
-
getGuestPolicy
Get an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString(); GuestPolicies.GuestPolicy response = osConfigServiceClient.getGuestPolicy(name); }- Parameters:
name- Required. The resource name of the guest policy using one of the following forms: `projects/{project_number}/guestPolicies/{guest_policy_id}`.- Throws:
ApiException- if the remote call fails
-
getGuestPolicy
Get an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.GetGuestPolicyRequest request = GuestPolicies.GetGuestPolicyRequest.newBuilder() .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) .build(); GuestPolicies.GuestPolicy response = osConfigServiceClient.getGuestPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getGuestPolicyCallable
public final UnaryCallable<GuestPolicies.GetGuestPolicyRequest,GuestPolicies.GuestPolicy> getGuestPolicyCallable()Get an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.GetGuestPolicyRequest request = GuestPolicies.GetGuestPolicyRequest.newBuilder() .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) .build(); ApiFuture<GuestPolicies.GuestPolicy> future = osConfigServiceClient.getGuestPolicyCallable().futureCall(request); // Do something. GuestPolicies.GuestPolicy response = future.get(); } -
listGuestPolicies
public final OsConfigServiceClient.ListGuestPoliciesPagedResponse listGuestPolicies(ProjectName parent) Get a page of OS Config guest policies.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); for (GuestPolicies.GuestPolicy element : osConfigServiceClient.listGuestPolicies(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the parent using one of the following forms: `projects/{project_number}`.- Throws:
ApiException- if the remote call fails
-
listGuestPolicies
Get a page of OS Config guest policies.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String parent = ProjectName.of("[PROJECT]").toString(); for (GuestPolicies.GuestPolicy element : osConfigServiceClient.listGuestPolicies(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the parent using one of the following forms: `projects/{project_number}`.- Throws:
ApiException- if the remote call fails
-
listGuestPolicies
public final OsConfigServiceClient.ListGuestPoliciesPagedResponse listGuestPolicies(GuestPolicies.ListGuestPoliciesRequest request) Get a page of OS Config guest policies.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.ListGuestPoliciesRequest request = GuestPolicies.ListGuestPoliciesRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (GuestPolicies.GuestPolicy element : osConfigServiceClient.listGuestPolicies(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listGuestPoliciesPagedCallable
public final UnaryCallable<GuestPolicies.ListGuestPoliciesRequest,OsConfigServiceClient.ListGuestPoliciesPagedResponse> listGuestPoliciesPagedCallable()Get a page of OS Config guest policies.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.ListGuestPoliciesRequest request = GuestPolicies.ListGuestPoliciesRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<GuestPolicies.GuestPolicy> future = osConfigServiceClient.listGuestPoliciesPagedCallable().futureCall(request); // Do something. for (GuestPolicies.GuestPolicy element : future.get().iterateAll()) { // doThingsWith(element); } } -
listGuestPoliciesCallable
public final UnaryCallable<GuestPolicies.ListGuestPoliciesRequest,GuestPolicies.ListGuestPoliciesResponse> listGuestPoliciesCallable()Get a page of OS Config guest policies.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.ListGuestPoliciesRequest request = GuestPolicies.ListGuestPoliciesRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { GuestPolicies.ListGuestPoliciesResponse response = osConfigServiceClient.listGuestPoliciesCallable().call(request); for (GuestPolicies.GuestPolicy element : response.getGuestPoliciesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
updateGuestPolicy
public final GuestPolicies.GuestPolicy updateGuestPolicy(GuestPolicies.GuestPolicy guestPolicy, com.google.protobuf.FieldMask updateMask) Update an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.GuestPolicy guestPolicy = GuestPolicies.GuestPolicy.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); GuestPolicies.GuestPolicy response = osConfigServiceClient.updateGuestPolicy(guestPolicy, updateMask); }- Parameters:
guestPolicy- Required. The updated GuestPolicy.updateMask- Field mask that controls which fields of the guest policy should be updated.- Throws:
ApiException- if the remote call fails
-
updateGuestPolicy
public final GuestPolicies.GuestPolicy updateGuestPolicy(GuestPolicies.UpdateGuestPolicyRequest request) Update an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.UpdateGuestPolicyRequest request = GuestPolicies.UpdateGuestPolicyRequest.newBuilder() .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); GuestPolicies.GuestPolicy response = osConfigServiceClient.updateGuestPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateGuestPolicyCallable
public final UnaryCallable<GuestPolicies.UpdateGuestPolicyRequest,GuestPolicies.GuestPolicy> updateGuestPolicyCallable()Update an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.UpdateGuestPolicyRequest request = GuestPolicies.UpdateGuestPolicyRequest.newBuilder() .setGuestPolicy(GuestPolicies.GuestPolicy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<GuestPolicies.GuestPolicy> future = osConfigServiceClient.updateGuestPolicyCallable().futureCall(request); // Do something. GuestPolicies.GuestPolicy response = future.get(); } -
deleteGuestPolicy
Delete an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicyName name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]"); osConfigServiceClient.deleteGuestPolicy(name); }- Parameters:
name- Required. The resource name of the guest policy using one of the following forms: `projects/{project_number}/guestPolicies/{guest_policy_id}`.- Throws:
ApiException- if the remote call fails
-
deleteGuestPolicy
Delete an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { String name = GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString(); osConfigServiceClient.deleteGuestPolicy(name); }- Parameters:
name- Required. The resource name of the guest policy using one of the following forms: `projects/{project_number}/guestPolicies/{guest_policy_id}`.- Throws:
ApiException- if the remote call fails
-
deleteGuestPolicy
Delete an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.DeleteGuestPolicyRequest request = GuestPolicies.DeleteGuestPolicyRequest.newBuilder() .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) .build(); osConfigServiceClient.deleteGuestPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteGuestPolicyCallable
public final UnaryCallable<GuestPolicies.DeleteGuestPolicyRequest,com.google.protobuf.Empty> deleteGuestPolicyCallable()Delete an OS Config guest policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.DeleteGuestPolicyRequest request = GuestPolicies.DeleteGuestPolicyRequest.newBuilder() .setName(GuestPolicyName.of("[PROJECT]", "[GUEST_POLICY]").toString()) .build(); ApiFuture<Empty> future = osConfigServiceClient.deleteGuestPolicyCallable().futureCall(request); // Do something. future.get(); } -
lookupEffectiveGuestPolicy
public final GuestPolicies.EffectiveGuestPolicy lookupEffectiveGuestPolicy(GuestPolicies.LookupEffectiveGuestPolicyRequest request) Lookup the effective guest policy that applies to a VM instance. This lookup merges all policies that are assigned to the instance ancestry.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.LookupEffectiveGuestPolicyRequest request = GuestPolicies.LookupEffectiveGuestPolicyRequest.newBuilder() .setInstance("instance555127957") .setOsShortName("osShortName1253394339") .setOsVersion("osVersion1812004436") .setOsArchitecture("osArchitecture1339954519") .build(); GuestPolicies.EffectiveGuestPolicy response = osConfigServiceClient.lookupEffectiveGuestPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
lookupEffectiveGuestPolicyCallable
public final UnaryCallable<GuestPolicies.LookupEffectiveGuestPolicyRequest,GuestPolicies.EffectiveGuestPolicy> lookupEffectiveGuestPolicyCallable()Lookup the effective guest policy that applies to a VM instance. This lookup merges all policies that are assigned to the instance ancestry.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (OsConfigServiceClient osConfigServiceClient = OsConfigServiceClient.create()) { GuestPolicies.LookupEffectiveGuestPolicyRequest request = GuestPolicies.LookupEffectiveGuestPolicyRequest.newBuilder() .setInstance("instance555127957") .setOsShortName("osShortName1253394339") .setOsVersion("osVersion1812004436") .setOsArchitecture("osArchitecture1339954519") .build(); ApiFuture<GuestPolicies.EffectiveGuestPolicy> future = osConfigServiceClient.lookupEffectiveGuestPolicyCallable().futureCall(request); // Do something. GuestPolicies.EffectiveGuestPolicy response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-