Class AccessApprovalAdminClient

java.lang.Object
com.google.cloud.accessapproval.v1.AccessApprovalAdminClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class AccessApprovalAdminClient extends Object implements BackgroundResource
Service Description: This API allows a customer to manage accesses to cloud resources by Google personnel. It defines the following resource model:

- The API has a collection of [ApprovalRequest][google.cloud.accessapproval.v1.ApprovalRequest] resources, named `approvalRequests/{approval_request}` - The API has top-level settings per Project/Folder/Organization, named `accessApprovalSettings`

The service also periodically emails a list of recipients, defined at the Project/Folder/Organization level in the accessApprovalSettings, when there is a pending ApprovalRequest for them to act on. The ApprovalRequests can also optionally be published to a Pub/Sub topic owned by the customer (contact support if you would like to enable Pub/Sub notifications).

ApprovalRequests can be approved or dismissed. Google personnel can only access the indicated resource or resources if the request is approved (subject to some exclusions: https://cloud.google.com/access-approval/docs/overview#exclusions).

Note: Using Access Approval functionality will mean that Google may not be able to meet the SLAs for your chosen products, as any support response times may be dramatically increased. As such the SLAs do not apply to any service disruption to the extent impacted by Customer's use of Access Approval. Do not enable Access Approval for projects where you may require high service availability and rapid response by Google Cloud Support.

After a request is approved or dismissed, no further action may be taken on it. Requests with the requested_expiration in the past or with no activity for 14 days are considered dismissed. When an approval expires, the request is considered dismissed.

If a request is not approved or dismissed, we call it pending.

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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
   ApprovalRequestName name =
       ApprovalRequestName.ofProjectApprovalRequestName("[PROJECT]", "[APPROVAL_REQUEST]");
   ApprovalRequest response = accessApprovalAdminClient.getApprovalRequest(name);
 }
 

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

ListApprovalRequests

Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

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

  • listApprovalRequests(ListApprovalRequestsMessage request)

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

  • listApprovalRequests(FolderName parent)

  • listApprovalRequests(OrganizationName parent)

  • listApprovalRequests(ProjectName parent)

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

  • listApprovalRequestsPagedCallable()

  • listApprovalRequestsCallable()

GetApprovalRequest

Gets an approval request. Returns NOT_FOUND if the request does not exist.

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

  • getApprovalRequest(GetApprovalRequestMessage request)

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

  • getApprovalRequest(ApprovalRequestName name)

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

  • getApprovalRequestCallable()

ApproveApprovalRequest

Approves a request and returns the updated ApprovalRequest.

Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.

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

  • approveApprovalRequest(ApproveApprovalRequestMessage request)

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

  • approveApprovalRequestCallable()

DismissApprovalRequest

Dismisses a request. Returns the updated ApprovalRequest.

NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether.

Returns NOT_FOUND if the request does not exist.

Returns FAILED_PRECONDITION if the request exists but is not in a pending state.

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

  • dismissApprovalRequest(DismissApprovalRequestMessage request)

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

  • dismissApprovalRequestCallable()

InvalidateApprovalRequest

Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest.

NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval.

Returns FAILED_PRECONDITION if the request exists but is not in an approved state.

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

  • invalidateApprovalRequest(InvalidateApprovalRequestMessage request)

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

  • invalidateApprovalRequestCallable()

GetAccessApprovalSettings

Gets the settings associated with a project, folder, or organization.

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

  • getAccessApprovalSettings(GetAccessApprovalSettingsMessage request)

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

  • getAccessApprovalSettings(AccessApprovalSettingsName name)

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

  • getAccessApprovalSettingsCallable()

UpdateAccessApprovalSettings

Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.

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

  • updateAccessApprovalSettings(UpdateAccessApprovalSettingsMessage request)

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

  • updateAccessApprovalSettings(AccessApprovalSettings settings, 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.

  • updateAccessApprovalSettingsCallable()

DeleteAccessApprovalSettings

Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.

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

  • deleteAccessApprovalSettings(DeleteAccessApprovalSettingsMessage request)

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

  • deleteAccessApprovalSettings(AccessApprovalSettingsName name)

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

  • deleteAccessApprovalSettingsCallable()

GetAccessApprovalServiceAccount

Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.

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

  • getAccessApprovalServiceAccount(GetAccessApprovalServiceAccountMessage request)

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

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

  • getAccessApprovalServiceAccountCallable()

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 AccessApprovalAdminSettings 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
 AccessApprovalAdminSettings accessApprovalAdminSettings =
     AccessApprovalAdminSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AccessApprovalAdminClient accessApprovalAdminClient =
     AccessApprovalAdminClient.create(accessApprovalAdminSettings);
 

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
 AccessApprovalAdminSettings accessApprovalAdminSettings =
     AccessApprovalAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
 AccessApprovalAdminClient accessApprovalAdminClient =
     AccessApprovalAdminClient.create(accessApprovalAdminSettings);
 

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
 AccessApprovalAdminSettings accessApprovalAdminSettings =
     AccessApprovalAdminSettings.newHttpJsonBuilder().build();
 AccessApprovalAdminClient accessApprovalAdminClient =
     AccessApprovalAdminClient.create(accessApprovalAdminSettings);
 

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

  • Constructor Details

    • AccessApprovalAdminClient

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

      protected AccessApprovalAdminClient(AccessApprovalStub stub)
  • Method Details

    • create

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

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

      public final AccessApprovalAdminSettings getSettings()
    • getStub

      public AccessApprovalStub getStub()
    • listApprovalRequests

      public final AccessApprovalAdminClient.ListApprovalRequestsPagedResponse listApprovalRequests(FolderName parent)
      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         FolderName parent = FolderName.of("[FOLDER]");
         for (ApprovalRequest element :
             accessApprovalAdminClient.listApprovalRequests(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
      Throws:
      ApiException - if the remote call fails
    • listApprovalRequests

      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
         for (ApprovalRequest element :
             accessApprovalAdminClient.listApprovalRequests(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
      Throws:
      ApiException - if the remote call fails
    • listApprovalRequests

      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ProjectName parent = ProjectName.of("[PROJECT]");
         for (ApprovalRequest element :
             accessApprovalAdminClient.listApprovalRequests(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
      Throws:
      ApiException - if the remote call fails
    • listApprovalRequests

      public final AccessApprovalAdminClient.ListApprovalRequestsPagedResponse listApprovalRequests(String parent)
      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         String parent = ProjectName.of("[PROJECT]").toString();
         for (ApprovalRequest element :
             accessApprovalAdminClient.listApprovalRequests(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - The parent resource. This may be "projects/{project}", "folders/{folder}", or "organizations/{organization}".
      Throws:
      ApiException - if the remote call fails
    • listApprovalRequests

      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ListApprovalRequestsMessage request =
             ListApprovalRequestsMessage.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (ApprovalRequest element :
             accessApprovalAdminClient.listApprovalRequests(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
    • listApprovalRequestsPagedCallable

      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ListApprovalRequestsMessage request =
             ListApprovalRequestsMessage.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<ApprovalRequest> future =
             accessApprovalAdminClient.listApprovalRequestsPagedCallable().futureCall(request);
         // Do something.
         for (ApprovalRequest element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listApprovalRequestsCallable

      public final UnaryCallable<ListApprovalRequestsMessage,ListApprovalRequestsResponse> listApprovalRequestsCallable()
      Lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ListApprovalRequestsMessage request =
             ListApprovalRequestsMessage.newBuilder()
                 .setParent(ProjectName.of("[PROJECT]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListApprovalRequestsResponse response =
               accessApprovalAdminClient.listApprovalRequestsCallable().call(request);
           for (ApprovalRequest element : response.getApprovalRequestsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getApprovalRequest

      public final ApprovalRequest getApprovalRequest(ApprovalRequestName name)
      Gets an approval request. Returns NOT_FOUND if the request does not exist.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ApprovalRequestName name =
             ApprovalRequestName.ofProjectApprovalRequestName("[PROJECT]", "[APPROVAL_REQUEST]");
         ApprovalRequest response = accessApprovalAdminClient.getApprovalRequest(name);
       }
       
      Parameters:
      name - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
      Throws:
      ApiException - if the remote call fails
    • getApprovalRequest

      public final ApprovalRequest getApprovalRequest(String name)
      Gets an approval request. Returns NOT_FOUND if the request does not exist.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         String name =
             ApprovalRequestName.ofProjectApprovalRequestName("[PROJECT]", "[APPROVAL_REQUEST]")
                 .toString();
         ApprovalRequest response = accessApprovalAdminClient.getApprovalRequest(name);
       }
       
      Parameters:
      name - The name of the approval request to retrieve. Format: "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
      Throws:
      ApiException - if the remote call fails
    • getApprovalRequest

      public final ApprovalRequest getApprovalRequest(GetApprovalRequestMessage request)
      Gets an approval request. Returns NOT_FOUND if the request does not exist.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         GetApprovalRequestMessage request =
             GetApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .build();
         ApprovalRequest response = accessApprovalAdminClient.getApprovalRequest(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getApprovalRequestCallable

      public final UnaryCallable<GetApprovalRequestMessage,ApprovalRequest> getApprovalRequestCallable()
      Gets an approval request. Returns NOT_FOUND if the request does not exist.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         GetApprovalRequestMessage request =
             GetApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .build();
         ApiFuture<ApprovalRequest> future =
             accessApprovalAdminClient.getApprovalRequestCallable().futureCall(request);
         // Do something.
         ApprovalRequest response = future.get();
       }
       
    • approveApprovalRequest

      public final ApprovalRequest approveApprovalRequest(ApproveApprovalRequestMessage request)
      Approves a request and returns the updated ApprovalRequest.

      Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ApproveApprovalRequestMessage request =
             ApproveApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .setExpireTime(Timestamp.newBuilder().build())
                 .build();
         ApprovalRequest response = accessApprovalAdminClient.approveApprovalRequest(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • approveApprovalRequestCallable

      public final UnaryCallable<ApproveApprovalRequestMessage,ApprovalRequest> approveApprovalRequestCallable()
      Approves a request and returns the updated ApprovalRequest.

      Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         ApproveApprovalRequestMessage request =
             ApproveApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .setExpireTime(Timestamp.newBuilder().build())
                 .build();
         ApiFuture<ApprovalRequest> future =
             accessApprovalAdminClient.approveApprovalRequestCallable().futureCall(request);
         // Do something.
         ApprovalRequest response = future.get();
       }
       
    • dismissApprovalRequest

      public final ApprovalRequest dismissApprovalRequest(DismissApprovalRequestMessage request)
      Dismisses a request. Returns the updated ApprovalRequest.

      NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether.

      Returns NOT_FOUND if the request does not exist.

      Returns FAILED_PRECONDITION if the request exists but is not in a pending state.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         DismissApprovalRequestMessage request =
             DismissApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .build();
         ApprovalRequest response = accessApprovalAdminClient.dismissApprovalRequest(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • dismissApprovalRequestCallable

      public final UnaryCallable<DismissApprovalRequestMessage,ApprovalRequest> dismissApprovalRequestCallable()
      Dismisses a request. Returns the updated ApprovalRequest.

      NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether.

      Returns NOT_FOUND if the request does not exist.

      Returns FAILED_PRECONDITION if the request exists but is not in a pending state.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         DismissApprovalRequestMessage request =
             DismissApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .build();
         ApiFuture<ApprovalRequest> future =
             accessApprovalAdminClient.dismissApprovalRequestCallable().futureCall(request);
         // Do something.
         ApprovalRequest response = future.get();
       }
       
    • invalidateApprovalRequest

      public final ApprovalRequest invalidateApprovalRequest(InvalidateApprovalRequestMessage request)
      Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest.

      NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval.

      Returns FAILED_PRECONDITION if the request exists but is not in an approved state.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         InvalidateApprovalRequestMessage request =
             InvalidateApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .build();
         ApprovalRequest response = accessApprovalAdminClient.invalidateApprovalRequest(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • invalidateApprovalRequestCallable

      public final UnaryCallable<InvalidateApprovalRequestMessage,ApprovalRequest> invalidateApprovalRequestCallable()
      Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest.

      NOTE: This does not deny access to the resource if another request has been made and approved. It only invalidates a single approval.

      Returns FAILED_PRECONDITION if the request exists but is not in an approved state.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         InvalidateApprovalRequestMessage request =
             InvalidateApprovalRequestMessage.newBuilder()
                 .setName(
                     ApprovalRequestName.ofProjectApprovalRequestName(
                             "[PROJECT]", "[APPROVAL_REQUEST]")
                         .toString())
                 .build();
         ApiFuture<ApprovalRequest> future =
             accessApprovalAdminClient.invalidateApprovalRequestCallable().futureCall(request);
         // Do something.
         ApprovalRequest response = future.get();
       }
       
    • getAccessApprovalSettings

      public final AccessApprovalSettings getAccessApprovalSettings(AccessApprovalSettingsName name)
      Gets the settings associated with a project, folder, or organization.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         AccessApprovalSettingsName name = AccessApprovalSettingsName.ofProjectName("[PROJECT]");
         AccessApprovalSettings response = accessApprovalAdminClient.getAccessApprovalSettings(name);
       }
       
      Parameters:
      name - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
      Throws:
      ApiException - if the remote call fails
    • getAccessApprovalSettings

      public final AccessApprovalSettings getAccessApprovalSettings(String name)
      Gets the settings associated with a project, folder, or organization.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         String name = AccessApprovalSettingsName.ofProjectName("[PROJECT]").toString();
         AccessApprovalSettings response = accessApprovalAdminClient.getAccessApprovalSettings(name);
       }
       
      Parameters:
      name - The name of the AccessApprovalSettings to retrieve. Format: "{projects|folders|organizations}/{id}/accessApprovalSettings"
      Throws:
      ApiException - if the remote call fails
    • getAccessApprovalSettings

      public final AccessApprovalSettings getAccessApprovalSettings(GetAccessApprovalSettingsMessage request)
      Gets the settings associated with a project, folder, or organization.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         GetAccessApprovalSettingsMessage request =
             GetAccessApprovalSettingsMessage.newBuilder()
                 .setName(AccessApprovalSettingsName.ofProjectName("[PROJECT]").toString())
                 .build();
         AccessApprovalSettings response =
             accessApprovalAdminClient.getAccessApprovalSettings(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getAccessApprovalSettingsCallable

      public final UnaryCallable<GetAccessApprovalSettingsMessage,AccessApprovalSettings> getAccessApprovalSettingsCallable()
      Gets the settings associated with a project, folder, or organization.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         GetAccessApprovalSettingsMessage request =
             GetAccessApprovalSettingsMessage.newBuilder()
                 .setName(AccessApprovalSettingsName.ofProjectName("[PROJECT]").toString())
                 .build();
         ApiFuture<AccessApprovalSettings> future =
             accessApprovalAdminClient.getAccessApprovalSettingsCallable().futureCall(request);
         // Do something.
         AccessApprovalSettings response = future.get();
       }
       
    • updateAccessApprovalSettings

      public final AccessApprovalSettings updateAccessApprovalSettings(AccessApprovalSettings settings, com.google.protobuf.FieldMask updateMask)
      Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         AccessApprovalSettings settings = AccessApprovalSettings.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         AccessApprovalSettings response =
             accessApprovalAdminClient.updateAccessApprovalSettings(settings, updateMask);
       }
       
      Parameters:
      settings - The new AccessApprovalSettings.
      updateMask - The update mask applies to the settings. Only the top level fields of AccessApprovalSettings (notification_emails & enrolled_services) are supported. For each field, if it is included, the currently stored value will be entirely overwritten with the value of the field passed in this request.

      For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask If this field is left unset, only the notification_emails field will be updated.

      Throws:
      ApiException - if the remote call fails
    • updateAccessApprovalSettings

      public final AccessApprovalSettings updateAccessApprovalSettings(UpdateAccessApprovalSettingsMessage request)
      Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         UpdateAccessApprovalSettingsMessage request =
             UpdateAccessApprovalSettingsMessage.newBuilder()
                 .setSettings(AccessApprovalSettings.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         AccessApprovalSettings response =
             accessApprovalAdminClient.updateAccessApprovalSettings(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateAccessApprovalSettingsCallable

      public final UnaryCallable<UpdateAccessApprovalSettingsMessage,AccessApprovalSettings> updateAccessApprovalSettingsCallable()
      Updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         UpdateAccessApprovalSettingsMessage request =
             UpdateAccessApprovalSettingsMessage.newBuilder()
                 .setSettings(AccessApprovalSettings.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<AccessApprovalSettings> future =
             accessApprovalAdminClient.updateAccessApprovalSettingsCallable().futureCall(request);
         // Do something.
         AccessApprovalSettings response = future.get();
       }
       
    • deleteAccessApprovalSettings

      public final void deleteAccessApprovalSettings(AccessApprovalSettingsName name)
      Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         AccessApprovalSettingsName name = AccessApprovalSettingsName.ofProjectName("[PROJECT]");
         accessApprovalAdminClient.deleteAccessApprovalSettings(name);
       }
       
      Parameters:
      name - Name of the AccessApprovalSettings to delete.
      Throws:
      ApiException - if the remote call fails
    • deleteAccessApprovalSettings

      public final void deleteAccessApprovalSettings(String name)
      Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         String name = AccessApprovalSettingsName.ofProjectName("[PROJECT]").toString();
         accessApprovalAdminClient.deleteAccessApprovalSettings(name);
       }
       
      Parameters:
      name - Name of the AccessApprovalSettings to delete.
      Throws:
      ApiException - if the remote call fails
    • deleteAccessApprovalSettings

      public final void deleteAccessApprovalSettings(DeleteAccessApprovalSettingsMessage request)
      Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         DeleteAccessApprovalSettingsMessage request =
             DeleteAccessApprovalSettingsMessage.newBuilder()
                 .setName(AccessApprovalSettingsName.ofProjectName("[PROJECT]").toString())
                 .build();
         accessApprovalAdminClient.deleteAccessApprovalSettings(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteAccessApprovalSettingsCallable

      public final UnaryCallable<DeleteAccessApprovalSettingsMessage,com.google.protobuf.Empty> deleteAccessApprovalSettingsCallable()
      Deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         DeleteAccessApprovalSettingsMessage request =
             DeleteAccessApprovalSettingsMessage.newBuilder()
                 .setName(AccessApprovalSettingsName.ofProjectName("[PROJECT]").toString())
                 .build();
         ApiFuture<Empty> future =
             accessApprovalAdminClient.deleteAccessApprovalSettingsCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • getAccessApprovalServiceAccount

      public final AccessApprovalServiceAccount getAccessApprovalServiceAccount(String name)
      Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         String name = "name3373707";
         AccessApprovalServiceAccount response =
             accessApprovalAdminClient.getAccessApprovalServiceAccount(name);
       }
       
      Parameters:
      name - Name of the AccessApprovalServiceAccount to retrieve.
      Throws:
      ApiException - if the remote call fails
    • getAccessApprovalServiceAccount

      public final AccessApprovalServiceAccount getAccessApprovalServiceAccount(GetAccessApprovalServiceAccountMessage request)
      Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         GetAccessApprovalServiceAccountMessage request =
             GetAccessApprovalServiceAccountMessage.newBuilder().setName("name3373707").build();
         AccessApprovalServiceAccount response =
             accessApprovalAdminClient.getAccessApprovalServiceAccount(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getAccessApprovalServiceAccountCallable

      public final UnaryCallable<GetAccessApprovalServiceAccountMessage,AccessApprovalServiceAccount> getAccessApprovalServiceAccountCallable()
      Retrieves the service account that is used by Access Approval to access KMS keys for signing approved approval requests.

      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 (AccessApprovalAdminClient accessApprovalAdminClient = AccessApprovalAdminClient.create()) {
         GetAccessApprovalServiceAccountMessage request =
             GetAccessApprovalServiceAccountMessage.newBuilder().setName("name3373707").build();
         ApiFuture<AccessApprovalServiceAccount> future =
             accessApprovalAdminClient.getAccessApprovalServiceAccountCallable().futureCall(request);
         // Do something.
         AccessApprovalServiceAccount 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