Class PrivilegedAccessManagerClient

java.lang.Object
com.google.cloud.privilegedaccessmanager.v1.PrivilegedAccessManagerClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class PrivilegedAccessManagerClient extends Object implements BackgroundResource
Service Description: This API allows customers to manage temporary, request based privileged access to their resources.

It defines the following resource model:

  • A collection of `Entitlement` resources. An entitlement allows configuring (among other things):

* Some kind of privileged access that users can request. * A set of users called _requesters_ who can request this access. * A maximum duration for which the access can be requested. * An optional approval workflow which must be satisfied before access is granted.

  • A collection of `Grant` resources. A grant is a request by a requester to get the privileged access specified in an entitlement for some duration.

After the approval workflow as specified in the entitlement is satisfied, the specified access is given to the requester. The access is automatically taken back after the requested duration is over.

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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
     PrivilegedAccessManagerClient.create()) {
   CheckOnboardingStatusRequest request =
       CheckOnboardingStatusRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .build();
   CheckOnboardingStatusResponse response =
       privilegedAccessManagerClient.checkOnboardingStatus(request);
 }
 

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

CheckOnboardingStatus

`CheckOnboardingStatus` reports the onboarding status for a project/folder/organization. Any findings reported by this API need to be fixed before PAM can be used on the resource.

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

  • checkOnboardingStatus(CheckOnboardingStatusRequest request)

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

  • checkOnboardingStatusCallable()

ListEntitlements

Lists entitlements in a given project/folder/organization and location.

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

  • listEntitlements(ListEntitlementsRequest request)

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

  • listEntitlements(FolderLocationName parent)

  • listEntitlements(LocationName parent)

  • listEntitlements(OrganizationLocationName parent)

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

  • listEntitlementsPagedCallable()

  • listEntitlementsCallable()

SearchEntitlements

`SearchEntitlements` returns entitlements on which the caller has the specified access.

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

  • searchEntitlements(SearchEntitlementsRequest request)

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

  • searchEntitlementsPagedCallable()

  • searchEntitlementsCallable()

GetEntitlement

Gets details of a single entitlement.

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

  • getEntitlement(GetEntitlementRequest request)

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

  • getEntitlement(EntitlementName name)

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

  • getEntitlementCallable()

CreateEntitlement

Creates a new entitlement in a given project/folder/organization and location.

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

  • createEntitlementAsync(CreateEntitlementRequest request)

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

  • createEntitlementAsync(FolderLocationName parent, Entitlement entitlement, String entitlementId)

  • createEntitlementAsync(LocationName parent, Entitlement entitlement, String entitlementId)

  • createEntitlementAsync(OrganizationLocationName parent, Entitlement entitlement, String entitlementId)

  • createEntitlementAsync(String parent, Entitlement entitlement, String entitlementId)

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

  • createEntitlementOperationCallable()

  • createEntitlementCallable()

DeleteEntitlement

Deletes a single entitlement. This method can only be called when there are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the entitlement.

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

  • deleteEntitlementAsync(DeleteEntitlementRequest request)

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

  • deleteEntitlementAsync(EntitlementName name)

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

  • deleteEntitlementOperationCallable()

  • deleteEntitlementCallable()

UpdateEntitlement

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

* All immutable fields * Entitlement name * Resource name * Resource type * Adding an approval workflow in an entitlement which previously had no approval workflow. * Deleting the approval workflow from an entitlement. * Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

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

  • updateEntitlementAsync(UpdateEntitlementRequest request)

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

  • updateEntitlementAsync(Entitlement entitlement, 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.

  • updateEntitlementOperationCallable()

  • updateEntitlementCallable()

ListGrants

Lists grants for a given entitlement.

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

  • listGrants(ListGrantsRequest request)

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

  • listGrants(EntitlementName parent)

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

  • listGrantsPagedCallable()

  • listGrantsCallable()

SearchGrants

`SearchGrants` returns grants that are related to the calling user in the specified way.

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

  • searchGrants(SearchGrantsRequest request)

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

  • searchGrantsPagedCallable()

  • searchGrantsCallable()

GetGrant

Get details of a single grant.

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

  • getGrant(GetGrantRequest request)

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

  • getGrant(GrantName name)

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

  • getGrantCallable()

CreateGrant

Creates a new grant in a given project/folder/organization and location.

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

  • createGrant(CreateGrantRequest request)

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

  • createGrant(EntitlementName parent, Grant grant)

  • createGrant(String parent, Grant grant)

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

  • createGrantCallable()

ApproveGrant

`ApproveGrant` is used to approve a grant. This method can only be called on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't be undone.

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

  • approveGrant(ApproveGrantRequest request)

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

  • approveGrantCallable()

DenyGrant

`DenyGrant` is used to deny a grant. This method can only be called on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't be undone.

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

  • denyGrant(DenyGrantRequest request)

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

  • denyGrantCallable()

RevokeGrant

`RevokeGrant` is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal state.

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

  • revokeGrantAsync(RevokeGrantRequest request)

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

  • revokeGrantOperationCallable()

  • revokeGrantCallable()

ListLocations

Lists information about the supported locations for this service.

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 PrivilegedAccessManagerSettings 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
 PrivilegedAccessManagerSettings privilegedAccessManagerSettings =
     PrivilegedAccessManagerSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 PrivilegedAccessManagerClient privilegedAccessManagerClient =
     PrivilegedAccessManagerClient.create(privilegedAccessManagerSettings);
 

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
 PrivilegedAccessManagerSettings privilegedAccessManagerSettings =
     PrivilegedAccessManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
 PrivilegedAccessManagerClient privilegedAccessManagerClient =
     PrivilegedAccessManagerClient.create(privilegedAccessManagerSettings);
 

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
 PrivilegedAccessManagerSettings privilegedAccessManagerSettings =
     PrivilegedAccessManagerSettings.newHttpJsonBuilder().build();
 PrivilegedAccessManagerClient privilegedAccessManagerClient =
     PrivilegedAccessManagerClient.create(privilegedAccessManagerSettings);
 

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

  • Constructor Details

    • PrivilegedAccessManagerClient

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

      protected PrivilegedAccessManagerClient(PrivilegedAccessManagerStub stub)
  • Method Details

    • create

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

      public static final PrivilegedAccessManagerClient create(PrivilegedAccessManagerSettings settings) throws IOException
      Constructs an instance of PrivilegedAccessManagerClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      Constructs an instance of PrivilegedAccessManagerClient, using the given stub for making calls. This is for advanced usage - prefer using create(PrivilegedAccessManagerSettings).
    • getSettings

      public final PrivilegedAccessManagerSettings getSettings()
    • getStub

      public PrivilegedAccessManagerStub 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.
    • checkOnboardingStatus

      public final CheckOnboardingStatusResponse checkOnboardingStatus(CheckOnboardingStatusRequest request)
      `CheckOnboardingStatus` reports the onboarding status for a project/folder/organization. Any findings reported by this API need to be fixed before PAM can be used on the resource.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CheckOnboardingStatusRequest request =
             CheckOnboardingStatusRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .build();
         CheckOnboardingStatusResponse response =
             privilegedAccessManagerClient.checkOnboardingStatus(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • checkOnboardingStatusCallable

      public final UnaryCallable<CheckOnboardingStatusRequest,CheckOnboardingStatusResponse> checkOnboardingStatusCallable()
      `CheckOnboardingStatus` reports the onboarding status for a project/folder/organization. Any findings reported by this API need to be fixed before PAM can be used on the resource.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CheckOnboardingStatusRequest request =
             CheckOnboardingStatusRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .build();
         ApiFuture<CheckOnboardingStatusResponse> future =
             privilegedAccessManagerClient.checkOnboardingStatusCallable().futureCall(request);
         // Do something.
         CheckOnboardingStatusResponse response = future.get();
       }
       
    • listEntitlements

      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
         for (Entitlement element :
             privilegedAccessManagerClient.listEntitlements(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent which owns the entitlement resources.
      Throws:
      ApiException - if the remote call fails
    • listEntitlements

      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (Entitlement element :
             privilegedAccessManagerClient.listEntitlements(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent which owns the entitlement resources.
      Throws:
      ApiException - if the remote call fails
    • listEntitlements

      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
         for (Entitlement element :
             privilegedAccessManagerClient.listEntitlements(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent which owns the entitlement resources.
      Throws:
      ApiException - if the remote call fails
    • listEntitlements

      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (Entitlement element :
             privilegedAccessManagerClient.listEntitlements(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent which owns the entitlement resources.
      Throws:
      ApiException - if the remote call fails
    • listEntitlements

      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListEntitlementsRequest request =
             ListEntitlementsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         for (Entitlement element :
             privilegedAccessManagerClient.listEntitlements(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
    • listEntitlementsPagedCallable

      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListEntitlementsRequest request =
             ListEntitlementsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         ApiFuture<Entitlement> future =
             privilegedAccessManagerClient.listEntitlementsPagedCallable().futureCall(request);
         // Do something.
         for (Entitlement element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listEntitlementsCallable

      public final UnaryCallable<ListEntitlementsRequest,ListEntitlementsResponse> listEntitlementsCallable()
      Lists entitlements in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListEntitlementsRequest request =
             ListEntitlementsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         while (true) {
           ListEntitlementsResponse response =
               privilegedAccessManagerClient.listEntitlementsCallable().call(request);
           for (Entitlement element : response.getEntitlementsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • searchEntitlements

      `SearchEntitlements` returns entitlements on which the caller has the specified access.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         SearchEntitlementsRequest request =
             SearchEntitlementsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Entitlement element :
             privilegedAccessManagerClient.searchEntitlements(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
    • searchEntitlementsPagedCallable

      `SearchEntitlements` returns entitlements on which the caller has the specified access.

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

      public final UnaryCallable<SearchEntitlementsRequest,SearchEntitlementsResponse> searchEntitlementsCallable()
      `SearchEntitlements` returns entitlements on which the caller has the specified access.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         SearchEntitlementsRequest request =
             SearchEntitlementsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           SearchEntitlementsResponse response =
               privilegedAccessManagerClient.searchEntitlementsCallable().call(request);
           for (Entitlement element : response.getEntitlementsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getEntitlement

      public final Entitlement getEntitlement(EntitlementName name)
      Gets details of a single entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         EntitlementName name =
             EntitlementName.ofProjectLocationEntitlementName(
                 "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
         Entitlement response = privilegedAccessManagerClient.getEntitlement(name);
       }
       
      Parameters:
      name - Required. Name of the resource.
      Throws:
      ApiException - if the remote call fails
    • getEntitlement

      public final Entitlement getEntitlement(String name)
      Gets details of a single entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String name =
             EntitlementName.ofProjectLocationEntitlementName(
                     "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                 .toString();
         Entitlement response = privilegedAccessManagerClient.getEntitlement(name);
       }
       
      Parameters:
      name - Required. Name of the resource.
      Throws:
      ApiException - if the remote call fails
    • getEntitlement

      public final Entitlement getEntitlement(GetEntitlementRequest request)
      Gets details of a single entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GetEntitlementRequest request =
             GetEntitlementRequest.newBuilder()
                 .setName(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .build();
         Entitlement response = privilegedAccessManagerClient.getEntitlement(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getEntitlementCallable

      public final UnaryCallable<GetEntitlementRequest,Entitlement> getEntitlementCallable()
      Gets details of a single entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GetEntitlementRequest request =
             GetEntitlementRequest.newBuilder()
                 .setName(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .build();
         ApiFuture<Entitlement> future =
             privilegedAccessManagerClient.getEntitlementCallable().futureCall(request);
         // Do something.
         Entitlement response = future.get();
       }
       
    • createEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> createEntitlementAsync(FolderLocationName parent, Entitlement entitlement, String entitlementId)
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
         Entitlement entitlement = Entitlement.newBuilder().build();
         String entitlementId = "entitlementId-1302274264";
         Entitlement response =
             privilegedAccessManagerClient
                 .createEntitlementAsync(parent, entitlement, entitlementId)
                 .get();
       }
       
      Parameters:
      parent - Required. Name of the parent resource for the entitlement. Possible formats:
      • `organizations/{organization-number}/locations/{region}`
      • `folders/{folder-number}/locations/{region}`
      • `projects/{project-id|project-number}/locations/{region}`
      entitlement - Required. The resource being created
      entitlementId - Required. The ID to use for this entitlement. This becomes the last part of the resource name.

      This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

      This value should be unique among all other entitlements under the specified `parent`.

      Throws:
      ApiException - if the remote call fails
    • createEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> createEntitlementAsync(LocationName parent, Entitlement entitlement, String entitlementId)
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         Entitlement entitlement = Entitlement.newBuilder().build();
         String entitlementId = "entitlementId-1302274264";
         Entitlement response =
             privilegedAccessManagerClient
                 .createEntitlementAsync(parent, entitlement, entitlementId)
                 .get();
       }
       
      Parameters:
      parent - Required. Name of the parent resource for the entitlement. Possible formats:
      • `organizations/{organization-number}/locations/{region}`
      • `folders/{folder-number}/locations/{region}`
      • `projects/{project-id|project-number}/locations/{region}`
      entitlement - Required. The resource being created
      entitlementId - Required. The ID to use for this entitlement. This becomes the last part of the resource name.

      This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

      This value should be unique among all other entitlements under the specified `parent`.

      Throws:
      ApiException - if the remote call fails
    • createEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> createEntitlementAsync(OrganizationLocationName parent, Entitlement entitlement, String entitlementId)
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
         Entitlement entitlement = Entitlement.newBuilder().build();
         String entitlementId = "entitlementId-1302274264";
         Entitlement response =
             privilegedAccessManagerClient
                 .createEntitlementAsync(parent, entitlement, entitlementId)
                 .get();
       }
       
      Parameters:
      parent - Required. Name of the parent resource for the entitlement. Possible formats:
      • `organizations/{organization-number}/locations/{region}`
      • `folders/{folder-number}/locations/{region}`
      • `projects/{project-id|project-number}/locations/{region}`
      entitlement - Required. The resource being created
      entitlementId - Required. The ID to use for this entitlement. This becomes the last part of the resource name.

      This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

      This value should be unique among all other entitlements under the specified `parent`.

      Throws:
      ApiException - if the remote call fails
    • createEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> createEntitlementAsync(String parent, Entitlement entitlement, String entitlementId)
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         Entitlement entitlement = Entitlement.newBuilder().build();
         String entitlementId = "entitlementId-1302274264";
         Entitlement response =
             privilegedAccessManagerClient
                 .createEntitlementAsync(parent, entitlement, entitlementId)
                 .get();
       }
       
      Parameters:
      parent - Required. Name of the parent resource for the entitlement. Possible formats:
      • `organizations/{organization-number}/locations/{region}`
      • `folders/{folder-number}/locations/{region}`
      • `projects/{project-id|project-number}/locations/{region}`
      entitlement - Required. The resource being created
      entitlementId - Required. The ID to use for this entitlement. This becomes the last part of the resource name.

      This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

      This value should be unique among all other entitlements under the specified `parent`.

      Throws:
      ApiException - if the remote call fails
    • createEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> createEntitlementAsync(CreateEntitlementRequest request)
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CreateEntitlementRequest request =
             CreateEntitlementRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setEntitlementId("entitlementId-1302274264")
                 .setEntitlement(Entitlement.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         Entitlement response = privilegedAccessManagerClient.createEntitlementAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createEntitlementOperationCallable

      public final OperationCallable<CreateEntitlementRequest,Entitlement,OperationMetadata> createEntitlementOperationCallable()
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CreateEntitlementRequest request =
             CreateEntitlementRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setEntitlementId("entitlementId-1302274264")
                 .setEntitlement(Entitlement.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         OperationFuture<Entitlement, OperationMetadata> future =
             privilegedAccessManagerClient.createEntitlementOperationCallable().futureCall(request);
         // Do something.
         Entitlement response = future.get();
       }
       
    • createEntitlementCallable

      public final UnaryCallable<CreateEntitlementRequest,Operation> createEntitlementCallable()
      Creates a new entitlement in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CreateEntitlementRequest request =
             CreateEntitlementRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setEntitlementId("entitlementId-1302274264")
                 .setEntitlement(Entitlement.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ApiFuture<Operation> future =
             privilegedAccessManagerClient.createEntitlementCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • deleteEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> deleteEntitlementAsync(EntitlementName name)
      Deletes a single entitlement. This method can only be called when there are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         EntitlementName name =
             EntitlementName.ofProjectLocationEntitlementName(
                 "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
         Entitlement response = privilegedAccessManagerClient.deleteEntitlementAsync(name).get();
       }
       
      Parameters:
      name - Required. Name of the resource.
      Throws:
      ApiException - if the remote call fails
    • deleteEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> deleteEntitlementAsync(String name)
      Deletes a single entitlement. This method can only be called when there are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String name =
             EntitlementName.ofProjectLocationEntitlementName(
                     "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                 .toString();
         Entitlement response = privilegedAccessManagerClient.deleteEntitlementAsync(name).get();
       }
       
      Parameters:
      name - Required. Name of the resource.
      Throws:
      ApiException - if the remote call fails
    • deleteEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> deleteEntitlementAsync(DeleteEntitlementRequest request)
      Deletes a single entitlement. This method can only be called when there are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         DeleteEntitlementRequest request =
             DeleteEntitlementRequest.newBuilder()
                 .setName(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setRequestId("requestId693933066")
                 .setForce(true)
                 .build();
         Entitlement response = privilegedAccessManagerClient.deleteEntitlementAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteEntitlementOperationCallable

      public final OperationCallable<DeleteEntitlementRequest,Entitlement,OperationMetadata> deleteEntitlementOperationCallable()
      Deletes a single entitlement. This method can only be called when there are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         DeleteEntitlementRequest request =
             DeleteEntitlementRequest.newBuilder()
                 .setName(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setRequestId("requestId693933066")
                 .setForce(true)
                 .build();
         OperationFuture<Entitlement, OperationMetadata> future =
             privilegedAccessManagerClient.deleteEntitlementOperationCallable().futureCall(request);
         // Do something.
         Entitlement response = future.get();
       }
       
    • deleteEntitlementCallable

      public final UnaryCallable<DeleteEntitlementRequest,Operation> deleteEntitlementCallable()
      Deletes a single entitlement. This method can only be called when there are no in-progress (`ACTIVE`/`ACTIVATING`/`REVOKING`) grants under the entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         DeleteEntitlementRequest request =
             DeleteEntitlementRequest.newBuilder()
                 .setName(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setRequestId("requestId693933066")
                 .setForce(true)
                 .build();
         ApiFuture<Operation> future =
             privilegedAccessManagerClient.deleteEntitlementCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • updateEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> updateEntitlementAsync(Entitlement entitlement, com.google.protobuf.FieldMask updateMask)
      Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

      The following fields are not supported for updates:

      * All immutable fields * Entitlement name * Resource name * Resource type * Adding an approval workflow in an entitlement which previously had no approval workflow. * Deleting the approval workflow from an entitlement. * Adding or deleting a step in the approval workflow (only one step is supported)

      Note that updates are allowed on the list of approvers in an approval workflow step.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         Entitlement entitlement = Entitlement.newBuilder().build();
         FieldMask updateMask = FieldMask.newBuilder().build();
         Entitlement response =
             privilegedAccessManagerClient.updateEntitlementAsync(entitlement, updateMask).get();
       }
       
      Parameters:
      entitlement - Required. The entitlement resource that is updated.
      updateMask - Required. The list of fields to update. A field is overwritten if, and only if, it is in the mask. Any immutable fields set in the mask are ignored by the server. Repeated fields and map fields are only allowed in the last position of a `paths` string and overwrite the existing values. Hence an update to a repeated field or a map should contain the entire list of values. The fields specified in the update_mask are relative to the resource and not to the request. (e.g. `MaxRequestDuration`; *not* `entitlement.MaxRequestDuration`) A value of '*' for this field refers to full replacement of the resource.
      Throws:
      ApiException - if the remote call fails
    • updateEntitlementAsync

      public final OperationFuture<Entitlement,OperationMetadata> updateEntitlementAsync(UpdateEntitlementRequest request)
      Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

      The following fields are not supported for updates:

      * All immutable fields * Entitlement name * Resource name * Resource type * Adding an approval workflow in an entitlement which previously had no approval workflow. * Deleting the approval workflow from an entitlement. * Adding or deleting a step in the approval workflow (only one step is supported)

      Note that updates are allowed on the list of approvers in an approval workflow step.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         UpdateEntitlementRequest request =
             UpdateEntitlementRequest.newBuilder()
                 .setEntitlement(Entitlement.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Entitlement response = privilegedAccessManagerClient.updateEntitlementAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateEntitlementOperationCallable

      public final OperationCallable<UpdateEntitlementRequest,Entitlement,OperationMetadata> updateEntitlementOperationCallable()
      Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

      The following fields are not supported for updates:

      * All immutable fields * Entitlement name * Resource name * Resource type * Adding an approval workflow in an entitlement which previously had no approval workflow. * Deleting the approval workflow from an entitlement. * Adding or deleting a step in the approval workflow (only one step is supported)

      Note that updates are allowed on the list of approvers in an approval workflow step.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         UpdateEntitlementRequest request =
             UpdateEntitlementRequest.newBuilder()
                 .setEntitlement(Entitlement.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         OperationFuture<Entitlement, OperationMetadata> future =
             privilegedAccessManagerClient.updateEntitlementOperationCallable().futureCall(request);
         // Do something.
         Entitlement response = future.get();
       }
       
    • updateEntitlementCallable

      public final UnaryCallable<UpdateEntitlementRequest,Operation> updateEntitlementCallable()
      Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

      The following fields are not supported for updates:

      * All immutable fields * Entitlement name * Resource name * Resource type * Adding an approval workflow in an entitlement which previously had no approval workflow. * Deleting the approval workflow from an entitlement. * Adding or deleting a step in the approval workflow (only one step is supported)

      Note that updates are allowed on the list of approvers in an approval workflow step.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         UpdateEntitlementRequest request =
             UpdateEntitlementRequest.newBuilder()
                 .setEntitlement(Entitlement.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Operation> future =
             privilegedAccessManagerClient.updateEntitlementCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • listGrants

      Lists grants for a given entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         EntitlementName parent =
             EntitlementName.ofProjectLocationEntitlementName(
                 "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
         for (Grant element : privilegedAccessManagerClient.listGrants(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource which owns the grants.
      Throws:
      ApiException - if the remote call fails
    • listGrants

      Lists grants for a given entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String parent =
             EntitlementName.ofProjectLocationEntitlementName(
                     "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                 .toString();
         for (Grant element : privilegedAccessManagerClient.listGrants(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource which owns the grants.
      Throws:
      ApiException - if the remote call fails
    • listGrants

      Lists grants for a given entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListGrantsRequest request =
             ListGrantsRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         for (Grant element : privilegedAccessManagerClient.listGrants(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
    • listGrantsPagedCallable

      Lists grants for a given entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListGrantsRequest request =
             ListGrantsRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         ApiFuture<Grant> future =
             privilegedAccessManagerClient.listGrantsPagedCallable().futureCall(request);
         // Do something.
         for (Grant element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listGrantsCallable

      public final UnaryCallable<ListGrantsRequest,ListGrantsResponse> listGrantsCallable()
      Lists grants for a given entitlement.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListGrantsRequest request =
             ListGrantsRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .setOrderBy("orderBy-1207110587")
                 .build();
         while (true) {
           ListGrantsResponse response =
               privilegedAccessManagerClient.listGrantsCallable().call(request);
           for (Grant element : response.getGrantsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • searchGrants

      `SearchGrants` returns grants that are related to the calling user in the specified way.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         SearchGrantsRequest request =
             SearchGrantsRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Grant element : privilegedAccessManagerClient.searchGrants(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
    • searchGrantsPagedCallable

      `SearchGrants` returns grants that are related to the calling user in the specified way.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         SearchGrantsRequest request =
             SearchGrantsRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Grant> future =
             privilegedAccessManagerClient.searchGrantsPagedCallable().futureCall(request);
         // Do something.
         for (Grant element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • searchGrantsCallable

      public final UnaryCallable<SearchGrantsRequest,SearchGrantsResponse> searchGrantsCallable()
      `SearchGrants` returns grants that are related to the calling user in the specified way.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         SearchGrantsRequest request =
             SearchGrantsRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           SearchGrantsResponse response =
               privilegedAccessManagerClient.searchGrantsCallable().call(request);
           for (Grant element : response.getGrantsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • getGrant

      public final Grant getGrant(GrantName name)
      Get details of a single grant.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GrantName name =
             GrantName.ofProjectLocationEntitlementGrantName(
                 "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]");
         Grant response = privilegedAccessManagerClient.getGrant(name);
       }
       
      Parameters:
      name - Required. Name of the resource.
      Throws:
      ApiException - if the remote call fails
    • getGrant

      public final Grant getGrant(String name)
      Get details of a single grant.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String name =
             GrantName.ofProjectLocationEntitlementGrantName(
                     "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                 .toString();
         Grant response = privilegedAccessManagerClient.getGrant(name);
       }
       
      Parameters:
      name - Required. Name of the resource.
      Throws:
      ApiException - if the remote call fails
    • getGrant

      public final Grant getGrant(GetGrantRequest request)
      Get details of a single grant.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GetGrantRequest request =
             GetGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .build();
         Grant response = privilegedAccessManagerClient.getGrant(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getGrantCallable

      public final UnaryCallable<GetGrantRequest,Grant> getGrantCallable()
      Get details of a single grant.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GetGrantRequest request =
             GetGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .build();
         ApiFuture<Grant> future =
             privilegedAccessManagerClient.getGrantCallable().futureCall(request);
         // Do something.
         Grant response = future.get();
       }
       
    • createGrant

      public final Grant createGrant(EntitlementName parent, Grant grant)
      Creates a new grant in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         EntitlementName parent =
             EntitlementName.ofProjectLocationEntitlementName(
                 "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
         Grant grant = Grant.newBuilder().build();
         Grant response = privilegedAccessManagerClient.createGrant(parent, grant);
       }
       
      Parameters:
      parent - Required. Name of the parent entitlement for which this grant is being requested.
      grant - Required. The resource being created.
      Throws:
      ApiException - if the remote call fails
    • createGrant

      public final Grant createGrant(String parent, Grant grant)
      Creates a new grant in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         String parent =
             EntitlementName.ofProjectLocationEntitlementName(
                     "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                 .toString();
         Grant grant = Grant.newBuilder().build();
         Grant response = privilegedAccessManagerClient.createGrant(parent, grant);
       }
       
      Parameters:
      parent - Required. Name of the parent entitlement for which this grant is being requested.
      grant - Required. The resource being created.
      Throws:
      ApiException - if the remote call fails
    • createGrant

      public final Grant createGrant(CreateGrantRequest request)
      Creates a new grant in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CreateGrantRequest request =
             CreateGrantRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setGrant(Grant.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         Grant response = privilegedAccessManagerClient.createGrant(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createGrantCallable

      public final UnaryCallable<CreateGrantRequest,Grant> createGrantCallable()
      Creates a new grant in a given project/folder/organization and 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         CreateGrantRequest request =
             CreateGrantRequest.newBuilder()
                 .setParent(
                     EntitlementName.ofProjectLocationEntitlementName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]")
                         .toString())
                 .setGrant(Grant.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ApiFuture<Grant> future =
             privilegedAccessManagerClient.createGrantCallable().futureCall(request);
         // Do something.
         Grant response = future.get();
       }
       
    • approveGrant

      public final Grant approveGrant(ApproveGrantRequest request)
      `ApproveGrant` is used to approve a grant. This method can only be called on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't be undone.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ApproveGrantRequest request =
             ApproveGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         Grant response = privilegedAccessManagerClient.approveGrant(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • approveGrantCallable

      public final UnaryCallable<ApproveGrantRequest,Grant> approveGrantCallable()
      `ApproveGrant` is used to approve a grant. This method can only be called on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't be undone.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ApproveGrantRequest request =
             ApproveGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         ApiFuture<Grant> future =
             privilegedAccessManagerClient.approveGrantCallable().futureCall(request);
         // Do something.
         Grant response = future.get();
       }
       
    • denyGrant

      public final Grant denyGrant(DenyGrantRequest request)
      `DenyGrant` is used to deny a grant. This method can only be called on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't be undone.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         DenyGrantRequest request =
             DenyGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         Grant response = privilegedAccessManagerClient.denyGrant(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • denyGrantCallable

      public final UnaryCallable<DenyGrantRequest,Grant> denyGrantCallable()
      `DenyGrant` is used to deny a grant. This method can only be called on a grant when it's in the `APPROVAL_AWAITED` state. This operation can't be undone.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         DenyGrantRequest request =
             DenyGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         ApiFuture<Grant> future =
             privilegedAccessManagerClient.denyGrantCallable().futureCall(request);
         // Do something.
         Grant response = future.get();
       }
       
    • revokeGrantAsync

      public final OperationFuture<Grant,OperationMetadata> revokeGrantAsync(RevokeGrantRequest request)
      `RevokeGrant` is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         RevokeGrantRequest request =
             RevokeGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         Grant response = privilegedAccessManagerClient.revokeGrantAsync(request).get();
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • revokeGrantOperationCallable

      public final OperationCallable<RevokeGrantRequest,Grant,OperationMetadata> revokeGrantOperationCallable()
      `RevokeGrant` is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         RevokeGrantRequest request =
             RevokeGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         OperationFuture<Grant, OperationMetadata> future =
             privilegedAccessManagerClient.revokeGrantOperationCallable().futureCall(request);
         // Do something.
         Grant response = future.get();
       }
       
    • revokeGrantCallable

      public final UnaryCallable<RevokeGrantRequest,Operation> revokeGrantCallable()
      `RevokeGrant` is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal 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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         RevokeGrantRequest request =
             RevokeGrantRequest.newBuilder()
                 .setName(
                     GrantName.ofProjectLocationEntitlementGrantName(
                             "[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]")
                         .toString())
                 .setReason("reason-934964668")
                 .build();
         ApiFuture<Operation> future =
             privilegedAccessManagerClient.revokeGrantCallable().futureCall(request);
         // Do something.
         Operation response = future.get();
       }
       
    • listLocations

      Lists information about the supported locations for this service.

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

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             privilegedAccessManagerClient.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.

      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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response =
               privilegedAccessManagerClient.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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = privilegedAccessManagerClient.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 (PrivilegedAccessManagerClient privilegedAccessManagerClient =
           PrivilegedAccessManagerClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future =
             privilegedAccessManagerClient.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