Class OsConfigZonalServiceClient

java.lang.Object
com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@BetaApi @Generated("by gapic-generator-java") public class OsConfigZonalServiceClient extends Object implements BackgroundResource
Service Description: Zonal OS Config API

The OS Config service is the server-side component that allows users to manage package installations and patch jobs for Compute Engine VM 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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
     OsConfigZonalServiceClient.create()) {
   OSPolicyAssignmentName name =
       OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
   OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name);
 }
 

Note: close() needs to be called on the OsConfigZonalServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

CreateOSPolicyAssignment

Create an OS policy assignment.

This method also creates the first revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createOSPolicyAssignmentAsync(CreateOSPolicyAssignmentRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • createOSPolicyAssignmentAsync(LocationName parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)

  • createOSPolicyAssignmentAsync(String parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createOSPolicyAssignmentOperationCallable()

  • createOSPolicyAssignmentCallable()

UpdateOSPolicyAssignment

Update an existing OS policy assignment.

This method creates a new revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateOSPolicyAssignmentAsync(UpdateOSPolicyAssignmentRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • updateOSPolicyAssignmentAsync(OSPolicyAssignment osPolicyAssignment, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateOSPolicyAssignmentOperationCallable()

  • updateOSPolicyAssignmentCallable()

GetOSPolicyAssignment

Retrieve an existing OS policy assignment.

This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the `name` parameter.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getOSPolicyAssignment(GetOSPolicyAssignmentRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getOSPolicyAssignment(OSPolicyAssignmentName name)

  • getOSPolicyAssignment(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getOSPolicyAssignmentCallable()

ListOSPolicyAssignments

List the OS policy assignments under the parent resource.

For each OS policy assignment, the latest revision is returned.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listOSPolicyAssignments(ListOSPolicyAssignmentsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listOSPolicyAssignments(LocationName parent)

  • listOSPolicyAssignments(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listOSPolicyAssignmentsPagedCallable()

  • listOSPolicyAssignmentsCallable()

ListOSPolicyAssignmentRevisions

List the OS policy assignment revisions for a given OS policy assignment.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listOSPolicyAssignmentRevisions(ListOSPolicyAssignmentRevisionsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listOSPolicyAssignmentRevisions(OSPolicyAssignmentName name)

  • listOSPolicyAssignmentRevisions(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listOSPolicyAssignmentRevisionsPagedCallable()

  • listOSPolicyAssignmentRevisionsCallable()

DeleteOSPolicyAssignment

Delete the OS policy assignment.

This method creates a new revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteOSPolicyAssignmentAsync(DeleteOSPolicyAssignmentRequest request)

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

  • deleteOSPolicyAssignmentAsync(OSPolicyAssignmentName name)

  • deleteOSPolicyAssignmentAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteOSPolicyAssignmentOperationCallable()

  • deleteOSPolicyAssignmentCallable()

GetInstanceOSPoliciesCompliance

Get OS policies compliance data for the specified Compute Engine VM instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getInstanceOSPoliciesCompliance(GetInstanceOSPoliciesComplianceRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getInstanceOSPoliciesCompliance(InstanceOSPoliciesComplianceName name)

  • getInstanceOSPoliciesCompliance(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getInstanceOSPoliciesComplianceCallable()

ListInstanceOSPoliciesCompliances

List OS policies compliance data for all Compute Engine VM instances in the specified zone.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listInstanceOSPoliciesCompliances(ListInstanceOSPoliciesCompliancesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listInstanceOSPoliciesCompliances(LocationName parent)

  • listInstanceOSPoliciesCompliances(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listInstanceOSPoliciesCompliancesPagedCallable()

  • listInstanceOSPoliciesCompliancesCallable()

GetOSPolicyAssignmentReport

Get the OS policy asssignment report for the specified Compute Engine VM instance.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getOSPolicyAssignmentReport(GetOSPolicyAssignmentReportRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getOSPolicyAssignmentReport(OSPolicyAssignmentReportName name)

  • getOSPolicyAssignmentReport(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getOSPolicyAssignmentReportCallable()

ListOSPolicyAssignmentReports

List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listOSPolicyAssignmentReports(ListOSPolicyAssignmentReportsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listOSPolicyAssignmentReports(InstanceOSPolicyAssignmentName parent)

  • listOSPolicyAssignmentReports(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listOSPolicyAssignmentReportsPagedCallable()

  • listOSPolicyAssignmentReportsCallable()

GetInventory

Get inventory data for the specified VM instance. If the VM has no associated inventory, the message `NOT_FOUND` is returned.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getInventory(GetInventoryRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getInventory(InventoryName name)

  • getInventory(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getInventoryCallable()

ListInventories

List inventory data for all VM instances in the specified zone.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listInventories(ListInventoriesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listInventories(InstanceName parent)

  • listInventories(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listInventoriesPagedCallable()

  • listInventoriesCallable()

GetVulnerabilityReport

Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getVulnerabilityReport(GetVulnerabilityReportRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getVulnerabilityReport(VulnerabilityReportName name)

  • getVulnerabilityReport(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getVulnerabilityReportCallable()

ListVulnerabilityReports

List vulnerability reports for all VM instances in the specified zone.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listVulnerabilityReports(ListVulnerabilityReportsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listVulnerabilityReports(InstanceName parent)

  • listVulnerabilityReports(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listVulnerabilityReportsPagedCallable()

  • listVulnerabilityReportsCallable()

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 OsConfigZonalServiceSettings 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
 OsConfigZonalServiceSettings osConfigZonalServiceSettings =
     OsConfigZonalServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 OsConfigZonalServiceClient osConfigZonalServiceClient =
     OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
 

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
 OsConfigZonalServiceSettings osConfigZonalServiceSettings =
     OsConfigZonalServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 OsConfigZonalServiceClient osConfigZonalServiceClient =
     OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
 

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
 OsConfigZonalServiceSettings osConfigZonalServiceSettings =
     OsConfigZonalServiceSettings.newHttpJsonBuilder().build();
 OsConfigZonalServiceClient osConfigZonalServiceClient =
     OsConfigZonalServiceClient.create(osConfigZonalServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • OsConfigZonalServiceClient

      protected OsConfigZonalServiceClient(OsConfigZonalServiceSettings settings) throws IOException
      Constructs an instance of OsConfigZonalServiceClient, 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
    • OsConfigZonalServiceClient

      protected OsConfigZonalServiceClient(OsConfigZonalServiceStub stub)
  • Method Details

    • create

      public static final OsConfigZonalServiceClient create() throws IOException
      Constructs an instance of OsConfigZonalServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final OsConfigZonalServiceClient create(OsConfigZonalServiceSettings settings) throws IOException
      Constructs an instance of OsConfigZonalServiceClient, 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

      public static final OsConfigZonalServiceClient create(OsConfigZonalServiceStub stub)
      Constructs an instance of OsConfigZonalServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(OsConfigZonalServiceSettings).
    • getSettings

      public final OsConfigZonalServiceSettings getSettings()
    • getStub

      public OsConfigZonalServiceStub getStub()
    • getOperationsClient

      public final OperationsClient getOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • getHttpJsonOperationsClient

      @BetaApi public final OperationsClient getHttpJsonOperationsClient()
      Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
    • createOSPolicyAssignmentAsync

      public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentAsync(LocationName parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)
      Create an OS policy assignment.

      This method also creates the first revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build();
         String osPolicyAssignmentId = "osPolicyAssignmentId-44079074";
         OSPolicyAssignment response =
             osConfigZonalServiceClient
                 .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId)
                 .get();
       }
       
      Parameters:
      parent - Required. The parent resource name in the form: projects/{project}/locations/{location}
      osPolicyAssignment - Required. The OS policy assignment to be created.
      osPolicyAssignmentId - Required. The logical name of the OS policy assignment in the project with the following restrictions:
      • Must contain only lowercase letters, numbers, and hyphens.
      • Must start with a letter.
      • Must be between 1-63 characters.
      • Must end with a number or a letter.
      • Must be unique within the project.
      Throws:
      ApiException - if the remote call fails
    • createOSPolicyAssignmentAsync

      public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> createOSPolicyAssignmentAsync(String parent, OSPolicyAssignment osPolicyAssignment, String osPolicyAssignmentId)
      Create an OS policy assignment.

      This method also creates the first revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build();
         String osPolicyAssignmentId = "osPolicyAssignmentId-44079074";
         OSPolicyAssignment response =
             osConfigZonalServiceClient
                 .createOSPolicyAssignmentAsync(parent, osPolicyAssignment, osPolicyAssignmentId)
                 .get();
       }
       
      Parameters:
      parent - Required. The parent resource name in the form: projects/{project}/locations/{location}
      osPolicyAssignment - Required. The OS policy assignment to be created.
      osPolicyAssignmentId - Required. The logical name of the OS policy assignment in the project with the following restrictions:
      • Must contain only lowercase letters, numbers, and hyphens.
      • Must start with a letter.
      • Must be between 1-63 characters.
      • Must end with a number or a letter.
      • Must be unique within the project.
      Throws:
      ApiException - if the remote call fails
    • createOSPolicyAssignmentAsync

      Create an OS policy assignment.

      This method also creates the first revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         CreateOSPolicyAssignmentRequest request =
             CreateOSPolicyAssignmentRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
                 .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074")
                 .build();
         OSPolicyAssignment response =
             osConfigZonalServiceClient.createOSPolicyAssignmentAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createOSPolicyAssignmentOperationCallable

      Create an OS policy assignment.

      This method also creates the first revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         CreateOSPolicyAssignmentRequest request =
             CreateOSPolicyAssignmentRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
                 .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074")
                 .build();
         OperationFuture<OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> future =
             osConfigZonalServiceClient
                 .createOSPolicyAssignmentOperationCallable()
                 .futureCall(request);
         // Do something.
         OSPolicyAssignment response = future.get();
       }
       
    • createOSPolicyAssignmentCallable

      public final UnaryCallable<CreateOSPolicyAssignmentRequest,Operation> createOSPolicyAssignmentCallable()
      Create an OS policy assignment.

      This method also creates the first revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         CreateOSPolicyAssignmentRequest request =
             CreateOSPolicyAssignmentRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
                 .setOsPolicyAssignmentId("osPolicyAssignmentId-44079074")
                 .build();
         ApiFuture<Operation> future =
             osConfigZonalServiceClient.createOSPolicyAssignmentCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • updateOSPolicyAssignmentAsync

      public final OperationFuture<OSPolicyAssignment,OSPolicyAssignmentOperationMetadata> updateOSPolicyAssignmentAsync(OSPolicyAssignment osPolicyAssignment, com.google.protobuf.FieldMask updateMask)
      Update an existing OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         OSPolicyAssignment osPolicyAssignment = OSPolicyAssignment.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         OSPolicyAssignment response =
             osConfigZonalServiceClient
                 .updateOSPolicyAssignmentAsync(osPolicyAssignment, updateMask)
                 .get();
       }
       
      Parameters:
      osPolicyAssignment - Required. The updated OS policy assignment.
      updateMask - Optional. Field mask that controls which fields of the assignment should be updated.
      Throws:
      ApiException - if the remote call fails
    • updateOSPolicyAssignmentAsync

      Update an existing OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         UpdateOSPolicyAssignmentRequest request =
             UpdateOSPolicyAssignmentRequest.newBuilder()
                 .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         OSPolicyAssignment response =
             osConfigZonalServiceClient.updateOSPolicyAssignmentAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateOSPolicyAssignmentOperationCallable

      Update an existing OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         UpdateOSPolicyAssignmentRequest request =
             UpdateOSPolicyAssignmentRequest.newBuilder()
                 .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         OperationFuture<OSPolicyAssignment, OSPolicyAssignmentOperationMetadata> future =
             osConfigZonalServiceClient
                 .updateOSPolicyAssignmentOperationCallable()
                 .futureCall(request);
         // Do something.
         OSPolicyAssignment response = future.get();
       }
       
    • updateOSPolicyAssignmentCallable

      public final UnaryCallable<UpdateOSPolicyAssignmentRequest,Operation> updateOSPolicyAssignmentCallable()
      Update an existing OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         UpdateOSPolicyAssignmentRequest request =
             UpdateOSPolicyAssignmentRequest.newBuilder()
                 .setOsPolicyAssignment(OSPolicyAssignment.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Operation> future =
             osConfigZonalServiceClient.updateOSPolicyAssignmentCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • getOSPolicyAssignment

      public final OSPolicyAssignment getOSPolicyAssignment(OSPolicyAssignmentName name)
      Retrieve an existing OS policy assignment.

      This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the `name` parameter.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         OSPolicyAssignmentName name =
             OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
         OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name);
       }
       
      Parameters:
      name - Required. The resource name of OS policy assignment.

      Format: `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}`

      Throws:
      ApiException - if the remote call fails
    • getOSPolicyAssignment

      public final OSPolicyAssignment getOSPolicyAssignment(String name)
      Retrieve an existing OS policy assignment.

      This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the `name` parameter.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name =
             OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString();
         OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(name);
       }
       
      Parameters:
      name - Required. The resource name of OS policy assignment.

      Format: `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}`

      Throws:
      ApiException - if the remote call fails
    • getOSPolicyAssignment

      public final OSPolicyAssignment getOSPolicyAssignment(GetOSPolicyAssignmentRequest request)
      Retrieve an existing OS policy assignment.

      This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the `name` parameter.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetOSPolicyAssignmentRequest request =
             GetOSPolicyAssignmentRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .build();
         OSPolicyAssignment response = osConfigZonalServiceClient.getOSPolicyAssignment(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getOSPolicyAssignmentCallable

      public final UnaryCallable<GetOSPolicyAssignmentRequest,OSPolicyAssignment> getOSPolicyAssignmentCallable()
      Retrieve an existing OS policy assignment.

      This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the `name` parameter.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetOSPolicyAssignmentRequest request =
             GetOSPolicyAssignmentRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .build();
         ApiFuture<OSPolicyAssignment> future =
             osConfigZonalServiceClient.getOSPolicyAssignmentCallable().futureCall(request);
         // Do something.
         OSPolicyAssignment response = future.get();
       }
       
    • listOSPolicyAssignments

      List the OS policy assignments under the parent resource.

      For each OS policy assignment, the latest revision is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (OSPolicyAssignment element :
             osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.
      Throws:
      ApiException - if the remote call fails
    • listOSPolicyAssignments

      public final OsConfigZonalServiceClient.ListOSPolicyAssignmentsPagedResponse listOSPolicyAssignments(String parent)
      List the OS policy assignments under the parent resource.

      For each OS policy assignment, the latest revision is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (OSPolicyAssignment element :
             osConfigZonalServiceClient.listOSPolicyAssignments(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.
      Throws:
      ApiException - if the remote call fails
    • listOSPolicyAssignments

      List the OS policy assignments under the parent resource.

      For each OS policy assignment, the latest revision is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentsRequest request =
             ListOSPolicyAssignmentsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (OSPolicyAssignment element :
             osConfigZonalServiceClient.listOSPolicyAssignments(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
    • listOSPolicyAssignmentsPagedCallable

      List the OS policy assignments under the parent resource.

      For each OS policy assignment, the latest revision is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentsRequest request =
             ListOSPolicyAssignmentsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<OSPolicyAssignment> future =
             osConfigZonalServiceClient.listOSPolicyAssignmentsPagedCallable().futureCall(request);
         // Do something.
         for (OSPolicyAssignment element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listOSPolicyAssignmentsCallable

      public final UnaryCallable<ListOSPolicyAssignmentsRequest,ListOSPolicyAssignmentsResponse> listOSPolicyAssignmentsCallable()
      List the OS policy assignments under the parent resource.

      For each OS policy assignment, the latest revision is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentsRequest request =
             ListOSPolicyAssignmentsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListOSPolicyAssignmentsResponse response =
               osConfigZonalServiceClient.listOSPolicyAssignmentsCallable().call(request);
           for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listOSPolicyAssignmentRevisions

      List the OS policy assignment revisions for a given OS policy assignment.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         OSPolicyAssignmentName name =
             OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
         for (OSPolicyAssignment element :
             osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      name - Required. The name of the OS policy assignment to list revisions for.
      Throws:
      ApiException - if the remote call fails
    • listOSPolicyAssignmentRevisions

      public final OsConfigZonalServiceClient.ListOSPolicyAssignmentRevisionsPagedResponse listOSPolicyAssignmentRevisions(String name)
      List the OS policy assignment revisions for a given OS policy assignment.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name =
             OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString();
         for (OSPolicyAssignment element :
             osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(name).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      name - Required. The name of the OS policy assignment to list revisions for.
      Throws:
      ApiException - if the remote call fails
    • listOSPolicyAssignmentRevisions

      List the OS policy assignment revisions for a given OS policy assignment.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentRevisionsRequest request =
             ListOSPolicyAssignmentRevisionsRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (OSPolicyAssignment element :
             osConfigZonalServiceClient.listOSPolicyAssignmentRevisions(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
    • listOSPolicyAssignmentRevisionsPagedCallable

      List the OS policy assignment revisions for a given OS policy assignment.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentRevisionsRequest request =
             ListOSPolicyAssignmentRevisionsRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<OSPolicyAssignment> future =
             osConfigZonalServiceClient
                 .listOSPolicyAssignmentRevisionsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (OSPolicyAssignment element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listOSPolicyAssignmentRevisionsCallable

      public final UnaryCallable<ListOSPolicyAssignmentRevisionsRequest,ListOSPolicyAssignmentRevisionsResponse> listOSPolicyAssignmentRevisionsCallable()
      List the OS policy assignment revisions for a given OS policy assignment.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentRevisionsRequest request =
             ListOSPolicyAssignmentRevisionsRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListOSPolicyAssignmentRevisionsResponse response =
               osConfigZonalServiceClient.listOSPolicyAssignmentRevisionsCallable().call(request);
           for (OSPolicyAssignment element : response.getOsPolicyAssignmentsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • deleteOSPolicyAssignmentAsync

      public final OperationFuture<com.google.protobuf.Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentAsync(OSPolicyAssignmentName name)
      Delete the OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         OSPolicyAssignmentName name =
             OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]");
         osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get();
       }
       
      Parameters:
      name - Required. The name of the OS policy assignment to be deleted
      Throws:
      ApiException - if the remote call fails
    • deleteOSPolicyAssignmentAsync

      public final OperationFuture<com.google.protobuf.Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentAsync(String name)
      Delete the OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name =
             OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]").toString();
         osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(name).get();
       }
       
      Parameters:
      name - Required. The name of the OS policy assignment to be deleted
      Throws:
      ApiException - if the remote call fails
    • deleteOSPolicyAssignmentAsync

      public final OperationFuture<com.google.protobuf.Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentAsync(DeleteOSPolicyAssignmentRequest request)
      Delete the OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         DeleteOSPolicyAssignmentRequest request =
             DeleteOSPolicyAssignmentRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .build();
         osConfigZonalServiceClient.deleteOSPolicyAssignmentAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteOSPolicyAssignmentOperationCallable

      public final OperationCallable<DeleteOSPolicyAssignmentRequest,com.google.protobuf.Empty,OSPolicyAssignmentOperationMetadata> deleteOSPolicyAssignmentOperationCallable()
      Delete the OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         DeleteOSPolicyAssignmentRequest request =
             DeleteOSPolicyAssignmentRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .build();
         OperationFuture<Empty, OSPolicyAssignmentOperationMetadata> future =
             osConfigZonalServiceClient
                 .deleteOSPolicyAssignmentOperationCallable()
                 .futureCall(request);
         // Do something.
         future.get();
       }
       
    • deleteOSPolicyAssignmentCallable

      public final UnaryCallable<DeleteOSPolicyAssignmentRequest,Operation> deleteOSPolicyAssignmentCallable()
      Delete the OS policy assignment.

      This method creates a new revision of the OS policy assignment.

      This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

      If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

      For more information, see [Method: projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1alpha/projects.locations.osPolicyAssignments.operations/cancel).

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         DeleteOSPolicyAssignmentRequest request =
             DeleteOSPolicyAssignmentRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[OS_POLICY_ASSIGNMENT]")
                         .toString())
                 .build();
         ApiFuture<Operation> future =
             osConfigZonalServiceClient.deleteOSPolicyAssignmentCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • getInstanceOSPoliciesCompliance

      @Deprecated public final InstanceOSPoliciesCompliance getInstanceOSPoliciesCompliance(InstanceOSPoliciesComplianceName name)
      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      Get OS policies compliance data for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         InstanceOSPoliciesComplianceName name =
             InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
         InstanceOSPoliciesCompliance response =
             osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(name);
       }
       
      Parameters:
      name - Required. API resource name for instance OS policies compliance resource.

      Format: `projects/{project}/locations/{location}/instanceOSPoliciesCompliances/{instance}`

      For `{project}`, either Compute Engine project-number or project-id can be provided. For `{instance}`, either Compute Engine VM instance-id or instance-name can be provided.

      Throws:
      ApiException - if the remote call fails
    • getInstanceOSPoliciesCompliance

      @Deprecated public final InstanceOSPoliciesCompliance getInstanceOSPoliciesCompliance(String name)
      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      Get OS policies compliance data for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name =
             InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
         InstanceOSPoliciesCompliance response =
             osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(name);
       }
       
      Parameters:
      name - Required. API resource name for instance OS policies compliance resource.

      Format: `projects/{project}/locations/{location}/instanceOSPoliciesCompliances/{instance}`

      For `{project}`, either Compute Engine project-number or project-id can be provided. For `{instance}`, either Compute Engine VM instance-id or instance-name can be provided.

      Throws:
      ApiException - if the remote call fails
    • getInstanceOSPoliciesCompliance

      @Deprecated public final InstanceOSPoliciesCompliance getInstanceOSPoliciesCompliance(GetInstanceOSPoliciesComplianceRequest request)
      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      Get OS policies compliance data for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetInstanceOSPoliciesComplianceRequest request =
             GetInstanceOSPoliciesComplianceRequest.newBuilder()
                 .setName(
                     InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]")
                         .toString())
                 .build();
         InstanceOSPoliciesCompliance response =
             osConfigZonalServiceClient.getInstanceOSPoliciesCompliance(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getInstanceOSPoliciesComplianceCallable

      @Deprecated public final UnaryCallable<GetInstanceOSPoliciesComplianceRequest,InstanceOSPoliciesCompliance> getInstanceOSPoliciesComplianceCallable()
      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      Get OS policies compliance data for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetInstanceOSPoliciesComplianceRequest request =
             GetInstanceOSPoliciesComplianceRequest.newBuilder()
                 .setName(
                     InstanceOSPoliciesComplianceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]")
                         .toString())
                 .build();
         ApiFuture<InstanceOSPoliciesCompliance> future =
             osConfigZonalServiceClient.getInstanceOSPoliciesComplianceCallable().futureCall(request);
         // Do something.
         InstanceOSPoliciesCompliance response = future.get();
       }
       
    • listInstanceOSPoliciesCompliances

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      List OS policies compliance data for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (InstanceOSPoliciesCompliance element :
             osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}`

      For `{project}`, either Compute Engine project-number or project-id can be provided.

      Throws:
      ApiException - if the remote call fails
    • listInstanceOSPoliciesCompliances

      @Deprecated public final OsConfigZonalServiceClient.ListInstanceOSPoliciesCompliancesPagedResponse listInstanceOSPoliciesCompliances(String parent)
      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      List OS policies compliance data for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (InstanceOSPoliciesCompliance element :
             osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}`

      For `{project}`, either Compute Engine project-number or project-id can be provided.

      Throws:
      ApiException - if the remote call fails
    • listInstanceOSPoliciesCompliances

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      List OS policies compliance data for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListInstanceOSPoliciesCompliancesRequest request =
             ListInstanceOSPoliciesCompliancesRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         for (InstanceOSPoliciesCompliance element :
             osConfigZonalServiceClient.listInstanceOSPoliciesCompliances(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
    • listInstanceOSPoliciesCompliancesPagedCallable

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      List OS policies compliance data for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListInstanceOSPoliciesCompliancesRequest request =
             ListInstanceOSPoliciesCompliancesRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         ApiFuture<InstanceOSPoliciesCompliance> future =
             osConfigZonalServiceClient
                 .listInstanceOSPoliciesCompliancesPagedCallable()
                 .futureCall(request);
         // Do something.
         for (InstanceOSPoliciesCompliance element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listInstanceOSPoliciesCompliancesCallable

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      List OS policies compliance data for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListInstanceOSPoliciesCompliancesRequest request =
             ListInstanceOSPoliciesCompliancesRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         while (true) {
           ListInstanceOSPoliciesCompliancesResponse response =
               osConfigZonalServiceClient.listInstanceOSPoliciesCompliancesCallable().call(request);
           for (InstanceOSPoliciesCompliance element :
               response.getInstanceOsPoliciesCompliancesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getOSPolicyAssignmentReport

      public final OSPolicyAssignmentReport getOSPolicyAssignmentReport(OSPolicyAssignmentReportName name)
      Get the OS policy asssignment report for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         OSPolicyAssignmentReportName name =
             OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]");
         OSPolicyAssignmentReport response =
             osConfigZonalServiceClient.getOSPolicyAssignmentReport(name);
       }
       
      Parameters:
      name - Required. API resource name for OS policy assignment report.

      Format: `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance_id}`, either Compute Engine `instance-id` or `instance-name` can be provided. For `{assignment_id}`, the OSPolicyAssignment id must be provided.

      Throws:
      ApiException - if the remote call fails
    • getOSPolicyAssignmentReport

      public final OSPolicyAssignmentReport getOSPolicyAssignmentReport(String name)
      Get the OS policy asssignment report for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name =
             OSPolicyAssignmentReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                 .toString();
         OSPolicyAssignmentReport response =
             osConfigZonalServiceClient.getOSPolicyAssignmentReport(name);
       }
       
      Parameters:
      name - Required. API resource name for OS policy assignment report.

      Format: `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance_id}`, either Compute Engine `instance-id` or `instance-name` can be provided. For `{assignment_id}`, the OSPolicyAssignment id must be provided.

      Throws:
      ApiException - if the remote call fails
    • getOSPolicyAssignmentReport

      public final OSPolicyAssignmentReport getOSPolicyAssignmentReport(GetOSPolicyAssignmentReportRequest request)
      Get the OS policy asssignment report for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetOSPolicyAssignmentReportRequest request =
             GetOSPolicyAssignmentReportRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentReportName.of(
                             "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                         .toString())
                 .build();
         OSPolicyAssignmentReport response =
             osConfigZonalServiceClient.getOSPolicyAssignmentReport(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getOSPolicyAssignmentReportCallable

      public final UnaryCallable<GetOSPolicyAssignmentReportRequest,OSPolicyAssignmentReport> getOSPolicyAssignmentReportCallable()
      Get the OS policy asssignment report for the specified Compute Engine VM instance.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetOSPolicyAssignmentReportRequest request =
             GetOSPolicyAssignmentReportRequest.newBuilder()
                 .setName(
                     OSPolicyAssignmentReportName.of(
                             "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                         .toString())
                 .build();
         ApiFuture<OSPolicyAssignmentReport> future =
             osConfigZonalServiceClient.getOSPolicyAssignmentReportCallable().futureCall(request);
         // Do something.
         OSPolicyAssignmentReport response = future.get();
       }
       
    • listOSPolicyAssignmentReports

      List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         InstanceOSPolicyAssignmentName parent =
             InstanceOSPolicyAssignmentName.of(
                 "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]");
         for (OSPolicyAssignmentReport element :
             osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either `instance-name`, `instance-id`, or `-` can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all instances in the project/location. For `{assignment}`, either `assignment-id` or `-` can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all OSPolicyAssignments in the project/location. Either {instance} or {assignment} must be `-`.

      For example: `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports` returns all reports for the instance `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports` returns all the reports for the given assignment across all instances. `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports` returns all the reports for all assignments across all instances.

      Throws:
      ApiException - if the remote call fails
    • listOSPolicyAssignmentReports

      public final OsConfigZonalServiceClient.ListOSPolicyAssignmentReportsPagedResponse listOSPolicyAssignmentReports(String parent)
      List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String parent =
             InstanceOSPolicyAssignmentName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                 .toString();
         for (OSPolicyAssignmentReport element :
             osConfigZonalServiceClient.listOSPolicyAssignmentReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either `instance-name`, `instance-id`, or `-` can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all instances in the project/location. For `{assignment}`, either `assignment-id` or `-` can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all OSPolicyAssignments in the project/location. Either {instance} or {assignment} must be `-`.

      For example: `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports` returns all reports for the instance `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports` returns all the reports for the given assignment across all instances. `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports` returns all the reports for all assignments across all instances.

      Throws:
      ApiException - if the remote call fails
    • listOSPolicyAssignmentReports

      List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentReportsRequest request =
             ListOSPolicyAssignmentReportsRequest.newBuilder()
                 .setParent(
                     InstanceOSPolicyAssignmentName.of(
                             "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setFilter("filter-1274492040")
                 .setPageToken("pageToken873572522")
                 .build();
         for (OSPolicyAssignmentReport element :
             osConfigZonalServiceClient.listOSPolicyAssignmentReports(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
    • listOSPolicyAssignmentReportsPagedCallable

      List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentReportsRequest request =
             ListOSPolicyAssignmentReportsRequest.newBuilder()
                 .setParent(
                     InstanceOSPolicyAssignmentName.of(
                             "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setFilter("filter-1274492040")
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<OSPolicyAssignmentReport> future =
             osConfigZonalServiceClient
                 .listOSPolicyAssignmentReportsPagedCallable()
                 .futureCall(request);
         // Do something.
         for (OSPolicyAssignmentReport element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listOSPolicyAssignmentReportsCallable

      public final UnaryCallable<ListOSPolicyAssignmentReportsRequest,ListOSPolicyAssignmentReportsResponse> listOSPolicyAssignmentReportsCallable()
      List OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListOSPolicyAssignmentReportsRequest request =
             ListOSPolicyAssignmentReportsRequest.newBuilder()
                 .setParent(
                     InstanceOSPolicyAssignmentName.of(
                             "[PROJECT]", "[LOCATION]", "[INSTANCE]", "[ASSIGNMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setFilter("filter-1274492040")
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListOSPolicyAssignmentReportsResponse response =
               osConfigZonalServiceClient.listOSPolicyAssignmentReportsCallable().call(request);
           for (OSPolicyAssignmentReport element : response.getOsPolicyAssignmentReportsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getInventory

      public final Inventory getInventory(InventoryName name)
      Get inventory data for the specified VM instance. If the VM has no associated inventory, the message `NOT_FOUND` is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         InventoryName name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
         Inventory response = osConfigZonalServiceClient.getInventory(name);
       }
       
      Parameters:
      name - Required. API resource name for inventory resource.

      Format: `projects/{project}/locations/{location}/instances/{instance}/inventory`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either Compute Engine `instance-id` or `instance-name` can be provided.

      Throws:
      ApiException - if the remote call fails
    • getInventory

      public final Inventory getInventory(String name)
      Get inventory data for the specified VM instance. If the VM has no associated inventory, the message `NOT_FOUND` is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name = InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
         Inventory response = osConfigZonalServiceClient.getInventory(name);
       }
       
      Parameters:
      name - Required. API resource name for inventory resource.

      Format: `projects/{project}/locations/{location}/instances/{instance}/inventory`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either Compute Engine `instance-id` or `instance-name` can be provided.

      Throws:
      ApiException - if the remote call fails
    • getInventory

      public final Inventory getInventory(GetInventoryRequest request)
      Get inventory data for the specified VM instance. If the VM has no associated inventory, the message `NOT_FOUND` is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetInventoryRequest request =
             GetInventoryRequest.newBuilder()
                 .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setView(InventoryView.forNumber(0))
                 .build();
         Inventory response = osConfigZonalServiceClient.getInventory(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getInventoryCallable

      public final UnaryCallable<GetInventoryRequest,Inventory> getInventoryCallable()
      Get inventory data for the specified VM instance. If the VM has no associated inventory, the message `NOT_FOUND` is returned.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetInventoryRequest request =
             GetInventoryRequest.newBuilder()
                 .setName(InventoryName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setView(InventoryView.forNumber(0))
                 .build();
         ApiFuture<Inventory> future =
             osConfigZonalServiceClient.getInventoryCallable().futureCall(request);
         // Do something.
         Inventory response = future.get();
       }
       
    • listInventories

      List inventory data for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
         for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}/instances/-`

      For `{project}`, either `project-number` or `project-id` can be provided.

      Throws:
      ApiException - if the remote call fails
    • listInventories

      public final OsConfigZonalServiceClient.ListInventoriesPagedResponse listInventories(String parent)
      List inventory data for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
         for (Inventory element : osConfigZonalServiceClient.listInventories(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}/instances/-`

      For `{project}`, either `project-number` or `project-id` can be provided.

      Throws:
      ApiException - if the remote call fails
    • listInventories

      List inventory data for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListInventoriesRequest request =
             ListInventoriesRequest.newBuilder()
                 .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setView(InventoryView.forNumber(0))
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         for (Inventory element : osConfigZonalServiceClient.listInventories(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
    • listInventoriesPagedCallable

      List inventory data for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListInventoriesRequest request =
             ListInventoriesRequest.newBuilder()
                 .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setView(InventoryView.forNumber(0))
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         ApiFuture<Inventory> future =
             osConfigZonalServiceClient.listInventoriesPagedCallable().futureCall(request);
         // Do something.
         for (Inventory element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listInventoriesCallable

      public final UnaryCallable<ListInventoriesRequest,ListInventoriesResponse> listInventoriesCallable()
      List inventory data for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListInventoriesRequest request =
             ListInventoriesRequest.newBuilder()
                 .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setView(InventoryView.forNumber(0))
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         while (true) {
           ListInventoriesResponse response =
               osConfigZonalServiceClient.listInventoriesCallable().call(request);
           for (Inventory element : response.getInventoriesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getVulnerabilityReport

      public final VulnerabilityReport getVulnerabilityReport(VulnerabilityReportName name)
      Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         VulnerabilityReportName name =
             VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
         VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name);
       }
       
      Parameters:
      name - Required. API resource name for vulnerability resource.

      Format: `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either Compute Engine `instance-id` or `instance-name` can be provided.

      Throws:
      ApiException - if the remote call fails
    • getVulnerabilityReport

      public final VulnerabilityReport getVulnerabilityReport(String name)
      Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String name = VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
         VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(name);
       }
       
      Parameters:
      name - Required. API resource name for vulnerability resource.

      Format: `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport`

      For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either Compute Engine `instance-id` or `instance-name` can be provided.

      Throws:
      ApiException - if the remote call fails
    • getVulnerabilityReport

      public final VulnerabilityReport getVulnerabilityReport(GetVulnerabilityReportRequest request)
      Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetVulnerabilityReportRequest request =
             GetVulnerabilityReportRequest.newBuilder()
                 .setName(
                     VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .build();
         VulnerabilityReport response = osConfigZonalServiceClient.getVulnerabilityReport(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getVulnerabilityReportCallable

      public final UnaryCallable<GetVulnerabilityReportRequest,VulnerabilityReport> getVulnerabilityReportCallable()
      Gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         GetVulnerabilityReportRequest request =
             GetVulnerabilityReportRequest.newBuilder()
                 .setName(
                     VulnerabilityReportName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .build();
         ApiFuture<VulnerabilityReport> future =
             osConfigZonalServiceClient.getVulnerabilityReportCallable().futureCall(request);
         // Do something.
         VulnerabilityReport response = future.get();
       }
       
    • listVulnerabilityReports

      List vulnerability reports for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         InstanceName parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
         for (VulnerabilityReport element :
             osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}/instances/-`

      For `{project}`, either `project-number` or `project-id` can be provided.

      Throws:
      ApiException - if the remote call fails
    • listVulnerabilityReports

      public final OsConfigZonalServiceClient.ListVulnerabilityReportsPagedResponse listVulnerabilityReports(String parent)
      List vulnerability reports for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         String parent = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
         for (VulnerabilityReport element :
             osConfigZonalServiceClient.listVulnerabilityReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name.

      Format: `projects/{project}/locations/{location}/instances/-`

      For `{project}`, either `project-number` or `project-id` can be provided.

      Throws:
      ApiException - if the remote call fails
    • listVulnerabilityReports

      List vulnerability reports for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListVulnerabilityReportsRequest request =
             ListVulnerabilityReportsRequest.newBuilder()
                 .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         for (VulnerabilityReport element :
             osConfigZonalServiceClient.listVulnerabilityReports(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
    • listVulnerabilityReportsPagedCallable

      List vulnerability reports for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListVulnerabilityReportsRequest request =
             ListVulnerabilityReportsRequest.newBuilder()
                 .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         ApiFuture<VulnerabilityReport> future =
             osConfigZonalServiceClient.listVulnerabilityReportsPagedCallable().futureCall(request);
         // Do something.
         for (VulnerabilityReport element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listVulnerabilityReportsCallable

      public final UnaryCallable<ListVulnerabilityReportsRequest,ListVulnerabilityReportsResponse> listVulnerabilityReportsCallable()
      List vulnerability reports for all VM instances in the specified zone.

      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 (OsConfigZonalServiceClient osConfigZonalServiceClient =
           OsConfigZonalServiceClient.create()) {
         ListVulnerabilityReportsRequest request =
             ListVulnerabilityReportsRequest.newBuilder()
                 .setParent(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         while (true) {
           ListVulnerabilityReportsResponse response =
               osConfigZonalServiceClient.listVulnerabilityReportsCallable().call(request);
           for (VulnerabilityReport element : response.getVulnerabilityReportsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException