Class AuditManagerClient

java.lang.Object
com.google.cloud.auditmanager.v1.AuditManagerClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class AuditManagerClient extends Object implements BackgroundResource
Service Description: Service describing handlers for resources

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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
   String scope = "scope109264468";
   List<EnrollResourceRequest.EligibleDestination> destinations = new ArrayList<>();
   Enrollment response = auditManagerClient.enrollResource(scope, destinations);
 }
 

Note: close() needs to be called on the AuditManagerClient 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

EnrollResource

Enrolls the customer resource(folder/project/organization) to the audit manager service by creating the audit managers Service Agent in customers workload and granting required permissions to the Service Agent. Please note that if enrollment request is made on the already enrolled workload then enrollment is executed overriding the existing set of destinations.

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

  • enrollResource(EnrollResourceRequest request)

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

  • enrollResource(String scope, List<EnrollResourceRequest.EligibleDestination> destinations)

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

  • enrollResourceCallable()

GenerateAuditScopeReport

Generates a demo report highlighting different responsibilities (Google/Customer/ shared) required to be fulfilled for the customer's workload to be compliant with the given standard.

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

  • generateAuditScopeReport(GenerateAuditScopeReportRequest request)

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

  • generateAuditScopeReport(String scope, String complianceStandard, GenerateAuditScopeReportRequest.AuditScopeReportFormat reportFormat)

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

  • generateAuditScopeReportCallable()

GenerateAuditReport

Register the Audit Report generation requests and returns the OperationId using which the customer can track the report generation progress.

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

  • generateAuditReportAsync(GenerateAuditReportRequest request)

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

  • generateAuditReportAsync(String scope, String gcsUri, String complianceStandard, GenerateAuditReportRequest.AuditReportFormat reportFormat)

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

  • generateAuditReportOperationCallable()

  • generateAuditReportCallable()

ListAuditReports

Lists audit reports in the selected parent scope

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

  • listAuditReports(ListAuditReportsRequest request)

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

  • listAuditReports(EnrollmentStatusScopeName parent)

  • listAuditReports(LocationName parent)

  • listAuditReports(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.

  • listAuditReportsPagedCallable()

  • listAuditReportsCallable()

GetAuditReport

Get the overall audit report

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

  • getAuditReport(GetAuditReportRequest request)

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

  • getAuditReport(AuditReportName name)

  • getAuditReport(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.

  • getAuditReportCallable()

GetResourceEnrollmentStatus

Get a resource along with its enrollment status.

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

  • getResourceEnrollmentStatus(GetResourceEnrollmentStatusRequest request)

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

  • getResourceEnrollmentStatus(ResourceEnrollmentStatusName name)

  • getResourceEnrollmentStatus(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.

  • getResourceEnrollmentStatusCallable()

ListResourceEnrollmentStatuses

Fetches all resources under the parent along with their enrollment.

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

  • listResourceEnrollmentStatuses(ListResourceEnrollmentStatusesRequest request)

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

  • listResourceEnrollmentStatuses(EnrollmentStatusScopeName parent)

  • listResourceEnrollmentStatuses(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.

  • listResourceEnrollmentStatusesPagedCallable()

  • listResourceEnrollmentStatusesCallable()

ListControls

Gets controls needed to be implemented to be compliant to a standard.

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

  • listControls(ListControlsRequest request)

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

  • listControls(StandardName parent)

  • listControls(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.

  • listControlsPagedCallable()

  • listControlsCallable()

ListLocations

Lists information about the supported locations for this service.This method can be called in two ways:

* **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

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

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

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 AuditManagerSettings 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
 AuditManagerSettings auditManagerSettings =
     AuditManagerSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AuditManagerClient auditManagerClient = AuditManagerClient.create(auditManagerSettings);
 

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
 AuditManagerSettings auditManagerSettings =
     AuditManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
 AuditManagerClient auditManagerClient = AuditManagerClient.create(auditManagerSettings);
 

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
 AuditManagerSettings auditManagerSettings = AuditManagerSettings.newHttpJsonBuilder().build();
 AuditManagerClient auditManagerClient = AuditManagerClient.create(auditManagerSettings);
 

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

  • Constructor Details

    • AuditManagerClient

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

      protected AuditManagerClient(AuditManagerStub stub)
  • Method Details

    • create

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

      public static final AuditManagerClient create(AuditManagerSettings settings) throws IOException
      Constructs an instance of AuditManagerClient, 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 AuditManagerClient create(AuditManagerStub stub)
      Constructs an instance of AuditManagerClient, using the given stub for making calls. This is for advanced usage - prefer using create(AuditManagerSettings).
    • getSettings

      public final AuditManagerSettings getSettings()
    • getStub

      public AuditManagerStub 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.
    • enrollResource

      public final Enrollment enrollResource(String scope, List<EnrollResourceRequest.EligibleDestination> destinations)
      Enrolls the customer resource(folder/project/organization) to the audit manager service by creating the audit managers Service Agent in customers workload and granting required permissions to the Service Agent. Please note that if enrollment request is made on the already enrolled workload then enrollment is executed overriding the existing set of destinations.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String scope = "scope109264468";
         List<EnrollResourceRequest.EligibleDestination> destinations = new ArrayList<>();
         Enrollment response = auditManagerClient.enrollResource(scope, destinations);
       }
       
      Parameters:
      scope - Required. The resource to be enrolled to the audit manager. Scope format should be resource_type/resource_identifier Eg: projects/{project}/locations/{location}, folders/{folder}/locations/{location} organizations/{organization}/locations/{location}
      destinations - Required. List of destination among which customer can choose to upload their reports during the audit process. While enrolling at a organization/folder level, customer can choose Cloud storage bucket in any project. If the audit is triggered at project level using the service agent at organization/folder level, all the destination options associated with respective organization/folder level service agent will be available to auditing projects.
      Throws:
      ApiException - if the remote call fails
    • enrollResource

      public final Enrollment enrollResource(EnrollResourceRequest request)
      Enrolls the customer resource(folder/project/organization) to the audit manager service by creating the audit managers Service Agent in customers workload and granting required permissions to the Service Agent. Please note that if enrollment request is made on the already enrolled workload then enrollment is executed overriding the existing set of destinations.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         EnrollResourceRequest request =
             EnrollResourceRequest.newBuilder()
                 .setScope("scope109264468")
                 .addAllDestinations(new ArrayList<EnrollResourceRequest.EligibleDestination>())
                 .build();
         Enrollment response = auditManagerClient.enrollResource(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • enrollResourceCallable

      public final UnaryCallable<EnrollResourceRequest,Enrollment> enrollResourceCallable()
      Enrolls the customer resource(folder/project/organization) to the audit manager service by creating the audit managers Service Agent in customers workload and granting required permissions to the Service Agent. Please note that if enrollment request is made on the already enrolled workload then enrollment is executed overriding the existing set of destinations.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         EnrollResourceRequest request =
             EnrollResourceRequest.newBuilder()
                 .setScope("scope109264468")
                 .addAllDestinations(new ArrayList<EnrollResourceRequest.EligibleDestination>())
                 .build();
         ApiFuture<Enrollment> future =
             auditManagerClient.enrollResourceCallable().futureCall(request);
         // Do something.
         Enrollment response = future.get();
       }
       
    • generateAuditScopeReport

      public final AuditScopeReport generateAuditScopeReport(String scope, String complianceStandard, GenerateAuditScopeReportRequest.AuditScopeReportFormat reportFormat)
      Generates a demo report highlighting different responsibilities (Google/Customer/ shared) required to be fulfilled for the customer's workload to be compliant with the given standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String scope = "scope109264468";
         String complianceStandard = "complianceStandard-1534269448";
         GenerateAuditScopeReportRequest.AuditScopeReportFormat reportFormat =
             GenerateAuditScopeReportRequest.AuditScopeReportFormat.forNumber(0);
         AuditScopeReport response =
             auditManagerClient.generateAuditScopeReport(scope, complianceStandard, reportFormat);
       }
       
      Parameters:
      scope - Required. Scope for which the AuditScopeReport is required. Must be of format resource_type/resource_identifier Eg: projects/{project}/locations/{location}, folders/{folder}/locations/{location}
      complianceStandard - Required. Compliance Standard against which the Scope Report must be generated. Eg: FEDRAMP_MODERATE
      reportFormat - Required. The format in which the Scope report bytes should be returned.
      Throws:
      ApiException - if the remote call fails
    • generateAuditScopeReport

      public final AuditScopeReport generateAuditScopeReport(GenerateAuditScopeReportRequest request)
      Generates a demo report highlighting different responsibilities (Google/Customer/ shared) required to be fulfilled for the customer's workload to be compliant with the given standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GenerateAuditScopeReportRequest request =
             GenerateAuditScopeReportRequest.newBuilder()
                 .setScope("scope109264468")
                 .setComplianceStandard("complianceStandard-1534269448")
                 .setComplianceFramework("complianceFramework-1808314333")
                 .build();
         AuditScopeReport response = auditManagerClient.generateAuditScopeReport(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • generateAuditScopeReportCallable

      public final UnaryCallable<GenerateAuditScopeReportRequest,AuditScopeReport> generateAuditScopeReportCallable()
      Generates a demo report highlighting different responsibilities (Google/Customer/ shared) required to be fulfilled for the customer's workload to be compliant with the given standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GenerateAuditScopeReportRequest request =
             GenerateAuditScopeReportRequest.newBuilder()
                 .setScope("scope109264468")
                 .setComplianceStandard("complianceStandard-1534269448")
                 .setComplianceFramework("complianceFramework-1808314333")
                 .build();
         ApiFuture<AuditScopeReport> future =
             auditManagerClient.generateAuditScopeReportCallable().futureCall(request);
         // Do something.
         AuditScopeReport response = future.get();
       }
       
    • generateAuditReportAsync

      public final OperationFuture<AuditReport,OperationMetadata> generateAuditReportAsync(String scope, String gcsUri, String complianceStandard, GenerateAuditReportRequest.AuditReportFormat reportFormat)
      Register the Audit Report generation requests and returns the OperationId using which the customer can track the report generation progress.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String scope = "scope109264468";
         String gcsUri = "gcsUri-1251224875";
         String complianceStandard = "complianceStandard-1534269448";
         GenerateAuditReportRequest.AuditReportFormat reportFormat =
             GenerateAuditReportRequest.AuditReportFormat.forNumber(0);
         AuditReport response =
             auditManagerClient
                 .generateAuditReportAsync(scope, gcsUri, complianceStandard, reportFormat)
                 .get();
       }
       
      Parameters:
      scope - Required. Scope for which the AuditScopeReport is required. Must be of format resource_type/resource_identifier Eg: projects/{project}/locations/{location}, folders/{folder}/locations/{location}
      gcsUri - Destination Cloud storage bucket where report and evidence must be uploaded. The Cloud storage bucket provided here must be selected among the buckets entered during the enrollment process.
      complianceStandard - Required. Compliance Standard against which the Scope Report must be generated. Eg: FEDRAMP_MODERATE
      reportFormat - Required. The format in which the audit report should be created.
      Throws:
      ApiException - if the remote call fails
    • generateAuditReportAsync

      public final OperationFuture<AuditReport,OperationMetadata> generateAuditReportAsync(GenerateAuditReportRequest request)
      Register the Audit Report generation requests and returns the OperationId using which the customer can track the report generation progress.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GenerateAuditReportRequest request =
             GenerateAuditReportRequest.newBuilder()
                 .setScope("scope109264468")
                 .setComplianceStandard("complianceStandard-1534269448")
                 .setComplianceFramework("complianceFramework-1808314333")
                 .build();
         AuditReport response = auditManagerClient.generateAuditReportAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • generateAuditReportOperationCallable

      public final OperationCallable<GenerateAuditReportRequest,AuditReport,OperationMetadata> generateAuditReportOperationCallable()
      Register the Audit Report generation requests and returns the OperationId using which the customer can track the report generation progress.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GenerateAuditReportRequest request =
             GenerateAuditReportRequest.newBuilder()
                 .setScope("scope109264468")
                 .setComplianceStandard("complianceStandard-1534269448")
                 .setComplianceFramework("complianceFramework-1808314333")
                 .build();
         OperationFuture<AuditReport, OperationMetadata> future =
             auditManagerClient.generateAuditReportOperationCallable().futureCall(request);
         // Do something.
         AuditReport response = future.get();
       }
       
    • generateAuditReportCallable

      public final UnaryCallable<GenerateAuditReportRequest,Operation> generateAuditReportCallable()
      Register the Audit Report generation requests and returns the OperationId using which the customer can track the report generation progress.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GenerateAuditReportRequest request =
             GenerateAuditReportRequest.newBuilder()
                 .setScope("scope109264468")
                 .setComplianceStandard("complianceStandard-1534269448")
                 .setComplianceFramework("complianceFramework-1808314333")
                 .build();
         ApiFuture<Operation> future =
             auditManagerClient.generateAuditReportCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • listAuditReports

      Lists audit reports in the selected parent scope

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         EnrollmentStatusScopeName parent =
             EnrollmentStatusScopeName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
         for (AuditReport element : auditManagerClient.listAuditReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent scope for which to list the reports.
      Throws:
      ApiException - if the remote call fails
    • listAuditReports

      public final AuditManagerClient.ListAuditReportsPagedResponse listAuditReports(LocationName parent)
      Lists audit reports in the selected parent scope

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (AuditReport element : auditManagerClient.listAuditReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent scope for which to list the reports.
      Throws:
      ApiException - if the remote call fails
    • listAuditReports

      public final AuditManagerClient.ListAuditReportsPagedResponse listAuditReports(String parent)
      Lists audit reports in the selected parent scope

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (AuditReport element : auditManagerClient.listAuditReports(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent scope for which to list the reports.
      Throws:
      ApiException - if the remote call fails
    • listAuditReports

      Lists audit reports in the selected parent scope

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListAuditReportsRequest request =
             ListAuditReportsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (AuditReport element : auditManagerClient.listAuditReports(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
    • listAuditReportsPagedCallable

      Lists audit reports in the selected parent scope

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListAuditReportsRequest request =
             ListAuditReportsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<AuditReport> future =
             auditManagerClient.listAuditReportsPagedCallable().futureCall(request);
         // Do something.
         for (AuditReport element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listAuditReportsCallable

      public final UnaryCallable<ListAuditReportsRequest,ListAuditReportsResponse> listAuditReportsCallable()
      Lists audit reports in the selected parent scope

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListAuditReportsRequest request =
             ListAuditReportsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListAuditReportsResponse response =
               auditManagerClient.listAuditReportsCallable().call(request);
           for (AuditReport element : response.getAuditReportsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getAuditReport

      public final AuditReport getAuditReport(AuditReportName name)
      Get the overall audit report

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         AuditReportName name =
             AuditReportName.ofFolderLocationAuditReportName(
                 "[FOLDER]", "[LOCATION]", "[AUDIT_REPORT]");
         AuditReport response = auditManagerClient.getAuditReport(name);
       }
       
      Parameters:
      name - Required. Format projects/{project}/locations/{location}/auditReports/{audit_report}, folders/{folder}/locations/{location}/auditReports/{audit_report}
      Throws:
      ApiException - if the remote call fails
    • getAuditReport

      public final AuditReport getAuditReport(String name)
      Get the overall audit report

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String name =
             AuditReportName.ofProjectLocationAuditReportName(
                     "[PROJECT]", "[LOCATION]", "[AUDIT_REPORT]")
                 .toString();
         AuditReport response = auditManagerClient.getAuditReport(name);
       }
       
      Parameters:
      name - Required. Format projects/{project}/locations/{location}/auditReports/{audit_report}, folders/{folder}/locations/{location}/auditReports/{audit_report}
      Throws:
      ApiException - if the remote call fails
    • getAuditReport

      public final AuditReport getAuditReport(GetAuditReportRequest request)
      Get the overall audit report

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GetAuditReportRequest request =
             GetAuditReportRequest.newBuilder()
                 .setName(
                     AuditReportName.ofFolderLocationAuditReportName(
                             "[FOLDER]", "[LOCATION]", "[AUDIT_REPORT]")
                         .toString())
                 .build();
         AuditReport response = auditManagerClient.getAuditReport(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getAuditReportCallable

      public final UnaryCallable<GetAuditReportRequest,AuditReport> getAuditReportCallable()
      Get the overall audit report

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GetAuditReportRequest request =
             GetAuditReportRequest.newBuilder()
                 .setName(
                     AuditReportName.ofFolderLocationAuditReportName(
                             "[FOLDER]", "[LOCATION]", "[AUDIT_REPORT]")
                         .toString())
                 .build();
         ApiFuture<AuditReport> future =
             auditManagerClient.getAuditReportCallable().futureCall(request);
         // Do something.
         AuditReport response = future.get();
       }
       
    • getResourceEnrollmentStatus

      public final ResourceEnrollmentStatus getResourceEnrollmentStatus(ResourceEnrollmentStatusName name)
      Get a resource along with its enrollment status.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ResourceEnrollmentStatusName name =
             ResourceEnrollmentStatusName.ofProjectLocationResourceEnrollmentStatusName(
                 "[PROJECT]", "[LOCATION]", "[RESOURCE_ENROLLMENT_STATUS]");
         ResourceEnrollmentStatus response = auditManagerClient.getResourceEnrollmentStatus(name);
       }
       
      Parameters:
      name - Required. Format folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
      Throws:
      ApiException - if the remote call fails
    • getResourceEnrollmentStatus

      public final ResourceEnrollmentStatus getResourceEnrollmentStatus(String name)
      Get a resource along with its enrollment status.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String name =
             ResourceEnrollmentStatusName.ofFolderLocationResourceEnrollmentStatusName(
                     "[FOLDER]", "[LOCATION]", "[RESOURCE_ENROLLMENT_STATUS]")
                 .toString();
         ResourceEnrollmentStatus response = auditManagerClient.getResourceEnrollmentStatus(name);
       }
       
      Parameters:
      name - Required. Format folders/{folder}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, projects/{project}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}, organizations/{organization}/locations/{location}/resourceEnrollmentStatuses/{resource_enrollment_status}
      Throws:
      ApiException - if the remote call fails
    • getResourceEnrollmentStatus

      public final ResourceEnrollmentStatus getResourceEnrollmentStatus(GetResourceEnrollmentStatusRequest request)
      Get a resource along with its enrollment status.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GetResourceEnrollmentStatusRequest request =
             GetResourceEnrollmentStatusRequest.newBuilder()
                 .setName(
                     ResourceEnrollmentStatusName.ofProjectLocationResourceEnrollmentStatusName(
                             "[PROJECT]", "[LOCATION]", "[RESOURCE_ENROLLMENT_STATUS]")
                         .toString())
                 .build();
         ResourceEnrollmentStatus response = auditManagerClient.getResourceEnrollmentStatus(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getResourceEnrollmentStatusCallable

      public final UnaryCallable<GetResourceEnrollmentStatusRequest,ResourceEnrollmentStatus> getResourceEnrollmentStatusCallable()
      Get a resource along with its enrollment status.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GetResourceEnrollmentStatusRequest request =
             GetResourceEnrollmentStatusRequest.newBuilder()
                 .setName(
                     ResourceEnrollmentStatusName.ofProjectLocationResourceEnrollmentStatusName(
                             "[PROJECT]", "[LOCATION]", "[RESOURCE_ENROLLMENT_STATUS]")
                         .toString())
                 .build();
         ApiFuture<ResourceEnrollmentStatus> future =
             auditManagerClient.getResourceEnrollmentStatusCallable().futureCall(request);
         // Do something.
         ResourceEnrollmentStatus response = future.get();
       }
       
    • listResourceEnrollmentStatuses

      Fetches all resources under the parent along with their enrollment.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         EnrollmentStatusScopeName parent =
             EnrollmentStatusScopeName.ofOrganizationLocationName("[ORGANIZATION]", "[LOCATION]");
         for (ResourceEnrollmentStatus element :
             auditManagerClient.listResourceEnrollmentStatuses(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent scope for which the list of resources with enrollments are required.
      Throws:
      ApiException - if the remote call fails
    • listResourceEnrollmentStatuses

      public final AuditManagerClient.ListResourceEnrollmentStatusesPagedResponse listResourceEnrollmentStatuses(String parent)
      Fetches all resources under the parent along with their enrollment.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String parent =
             EnrollmentStatusScopeName.ofFolderLocationName("[FOLDER]", "[LOCATION]").toString();
         for (ResourceEnrollmentStatus element :
             auditManagerClient.listResourceEnrollmentStatuses(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent scope for which the list of resources with enrollments are required.
      Throws:
      ApiException - if the remote call fails
    • listResourceEnrollmentStatuses

      Fetches all resources under the parent along with their enrollment.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListResourceEnrollmentStatusesRequest request =
             ListResourceEnrollmentStatusesRequest.newBuilder()
                 .setParent(
                     EnrollmentStatusScopeName.ofOrganizationLocationName(
                             "[ORGANIZATION]", "[LOCATION]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (ResourceEnrollmentStatus element :
             auditManagerClient.listResourceEnrollmentStatuses(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
    • listResourceEnrollmentStatusesPagedCallable

      Fetches all resources under the parent along with their enrollment.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListResourceEnrollmentStatusesRequest request =
             ListResourceEnrollmentStatusesRequest.newBuilder()
                 .setParent(
                     EnrollmentStatusScopeName.ofOrganizationLocationName(
                             "[ORGANIZATION]", "[LOCATION]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<ResourceEnrollmentStatus> future =
             auditManagerClient.listResourceEnrollmentStatusesPagedCallable().futureCall(request);
         // Do something.
         for (ResourceEnrollmentStatus element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listResourceEnrollmentStatusesCallable

      public final UnaryCallable<ListResourceEnrollmentStatusesRequest,ListResourceEnrollmentStatusesResponse> listResourceEnrollmentStatusesCallable()
      Fetches all resources under the parent along with their enrollment.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListResourceEnrollmentStatusesRequest request =
             ListResourceEnrollmentStatusesRequest.newBuilder()
                 .setParent(
                     EnrollmentStatusScopeName.ofOrganizationLocationName(
                             "[ORGANIZATION]", "[LOCATION]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListResourceEnrollmentStatusesResponse response =
               auditManagerClient.listResourceEnrollmentStatusesCallable().call(request);
           for (ResourceEnrollmentStatus element : response.getResourceEnrollmentStatusesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listControls

      public final AuditManagerClient.ListControlsPagedResponse listControls(StandardName parent)
      Gets controls needed to be implemented to be compliant to a standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         StandardName parent =
             StandardName.ofOrganizationLocationStandardName(
                 "[ORGANIZATION]", "[LOCATION]", "[STANDARD]");
         for (Control element : auditManagerClient.listControls(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Format projects/{project}/locations/{location}/standards/{standard}, folders/{folder}/locations/{location}/standards/{standard}
      Throws:
      ApiException - if the remote call fails
    • listControls

      public final AuditManagerClient.ListControlsPagedResponse listControls(String parent)
      Gets controls needed to be implemented to be compliant to a standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         String parent =
             StandardName.ofProjectLocationStandardName("[PROJECT]", "[LOCATION]", "[STANDARD]")
                 .toString();
         for (Control element : auditManagerClient.listControls(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Format projects/{project}/locations/{location}/standards/{standard}, folders/{folder}/locations/{location}/standards/{standard}
      Throws:
      ApiException - if the remote call fails
    • listControls

      Gets controls needed to be implemented to be compliant to a standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListControlsRequest request =
             ListControlsRequest.newBuilder()
                 .setParent(
                     StandardName.ofOrganizationLocationStandardName(
                             "[ORGANIZATION]", "[LOCATION]", "[STANDARD]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Control element : auditManagerClient.listControls(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
    • listControlsPagedCallable

      Gets controls needed to be implemented to be compliant to a standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListControlsRequest request =
             ListControlsRequest.newBuilder()
                 .setParent(
                     StandardName.ofOrganizationLocationStandardName(
                             "[ORGANIZATION]", "[LOCATION]", "[STANDARD]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Control> future =
             auditManagerClient.listControlsPagedCallable().futureCall(request);
         // Do something.
         for (Control element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listControlsCallable

      public final UnaryCallable<ListControlsRequest,ListControlsResponse> listControlsCallable()
      Gets controls needed to be implemented to be compliant to a standard.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListControlsRequest request =
             ListControlsRequest.newBuilder()
                 .setParent(
                     StandardName.ofOrganizationLocationStandardName(
                             "[ORGANIZATION]", "[LOCATION]", "[STANDARD]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListControlsResponse response = auditManagerClient.listControlsCallable().call(request);
           for (Control element : response.getControlsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listLocations

      Lists information about the supported locations for this service.This method can be called in two ways:

      * **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element : auditManagerClient.listLocations(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
    • listLocationsPagedCallable

      Lists information about the supported locations for this service.This method can be called in two ways:

      * **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             auditManagerClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listLocationsCallable

      public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
      Lists information about the supported locations for this service.This method can be called in two ways:

      * **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response = auditManagerClient.listLocationsCallable().call(request);
           for (Location element : response.getLocationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getLocation

      public final Location getLocation(GetLocationRequest request)
      Gets information about a location.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = auditManagerClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
      Gets information about a location.

      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 (AuditManagerClient auditManagerClient = AuditManagerClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future = auditManagerClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • 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