Class PrivilegedAccessManagerClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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().
| 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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of PrivilegedAccessManagerClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionfinal GrantapproveGrant(ApproveGrantRequest request) `ApproveGrant` is used to approve a grant.`ApproveGrant` is used to approve a grant.booleanawaitTermination(long duration, TimeUnit unit) `CheckOnboardingStatus` reports the onboarding status for a project/folder/organization.`CheckOnboardingStatus` reports the onboarding status for a project/folder/organization.final voidclose()static final PrivilegedAccessManagerClientcreate()Constructs an instance of PrivilegedAccessManagerClient with default settings.static final PrivilegedAccessManagerClientcreate(PrivilegedAccessManagerSettings settings) Constructs an instance of PrivilegedAccessManagerClient, using the given settings.static final PrivilegedAccessManagerClientConstructs an instance of PrivilegedAccessManagerClient, using the given stub for making calls.Creates a new entitlement in a given project/folder/organization and location.createEntitlementAsync(FolderLocationName parent, Entitlement entitlement, String entitlementId) Creates a new entitlement in a given project/folder/organization and location.createEntitlementAsync(LocationName parent, Entitlement entitlement, String entitlementId) Creates a new entitlement in a given project/folder/organization and location.createEntitlementAsync(OrganizationLocationName parent, Entitlement entitlement, String entitlementId) Creates a new entitlement in a given project/folder/organization and location.createEntitlementAsync(String parent, Entitlement entitlement, String entitlementId) Creates a new entitlement in a given project/folder/organization and location.Creates a new entitlement in a given project/folder/organization and location.Creates a new entitlement in a given project/folder/organization and location.final GrantcreateGrant(CreateGrantRequest request) Creates a new grant in a given project/folder/organization and location.final GrantcreateGrant(EntitlementName parent, Grant grant) Creates a new grant in a given project/folder/organization and location.final GrantcreateGrant(String parent, Grant grant) Creates a new grant in a given project/folder/organization and location.final UnaryCallable<CreateGrantRequest,Grant> Creates a new grant in a given project/folder/organization and location.Deletes a single entitlement.Deletes a single entitlement.deleteEntitlementAsync(String name) Deletes a single entitlement.Deletes a single entitlement.Deletes a single entitlement.final GrantdenyGrant(DenyGrantRequest request) `DenyGrant` is used to deny a grant.final UnaryCallable<DenyGrantRequest,Grant> `DenyGrant` is used to deny a grant.final EntitlementGets details of a single entitlement.final EntitlementgetEntitlement(GetEntitlementRequest request) Gets details of a single entitlement.final EntitlementgetEntitlement(String name) Gets details of a single entitlement.Gets details of a single entitlement.final GrantgetGrant(GetGrantRequest request) Get details of a single grant.final GrantGet details of a single grant.final GrantGet details of a single grant.final UnaryCallable<GetGrantRequest,Grant> Get details of a single grant.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.getStub()booleanbooleanlistEntitlements(FolderLocationName parent) Lists entitlements in a given project/folder/organization and location.listEntitlements(ListEntitlementsRequest request) Lists entitlements in a given project/folder/organization and location.listEntitlements(LocationName parent) Lists entitlements in a given project/folder/organization and location.Lists entitlements in a given project/folder/organization and location.listEntitlements(String parent) Lists entitlements in a given project/folder/organization and location.Lists entitlements in a given project/folder/organization and location.final UnaryCallable<ListEntitlementsRequest,PrivilegedAccessManagerClient.ListEntitlementsPagedResponse> Lists entitlements in a given project/folder/organization and location.listGrants(EntitlementName parent) Lists grants for a given entitlement.listGrants(ListGrantsRequest request) Lists grants for a given entitlement.listGrants(String parent) Lists grants for a given entitlement.Lists grants for a given entitlement.Lists grants for a given entitlement.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.revokeGrantAsync(RevokeGrantRequest request) `RevokeGrant` is used to immediately revoke access for a grant.`RevokeGrant` is used to immediately revoke access for a grant.`RevokeGrant` is used to immediately revoke access for a grant.`SearchEntitlements` returns entitlements on which the caller has the specified access.`SearchEntitlements` returns entitlements on which the caller has the specified access.final UnaryCallable<SearchEntitlementsRequest,PrivilegedAccessManagerClient.SearchEntitlementsPagedResponse> `SearchEntitlements` returns entitlements on which the caller has the specified access.searchGrants(SearchGrantsRequest request) `SearchGrants` returns grants that are related to the calling user in the specified way.`SearchGrants` returns grants that are related to the calling user in the specified way.`SearchGrants` returns grants that are related to the calling user in the specified way.voidshutdown()voidupdateEntitlementAsync(Entitlement entitlement, com.google.protobuf.FieldMask updateMask) Updates the entitlement specified in the request.Updates the entitlement specified in the request.Updates the entitlement specified in the request.Updates the entitlement specified in the request.
-
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
-
-
Method Details
-
create
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
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
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
public final PrivilegedAccessManagerClient.ListEntitlementsPagedResponse listEntitlements(FolderLocationName parent) 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
public final PrivilegedAccessManagerClient.ListEntitlementsPagedResponse listEntitlements(LocationName parent) 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
public final PrivilegedAccessManagerClient.ListEntitlementsPagedResponse listEntitlements(OrganizationLocationName parent) 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
public final PrivilegedAccessManagerClient.ListEntitlementsPagedResponse listEntitlements(String parent) 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
public final PrivilegedAccessManagerClient.ListEntitlementsPagedResponse listEntitlements(ListEntitlementsRequest request) 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
public final UnaryCallable<ListEntitlementsRequest,PrivilegedAccessManagerClient.ListEntitlementsPagedResponse> 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
public final PrivilegedAccessManagerClient.SearchEntitlementsPagedResponse searchEntitlements(SearchEntitlementsRequest request) `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
public final UnaryCallable<SearchEntitlementsRequest,PrivilegedAccessManagerClient.SearchEntitlementsPagedResponse> 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
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
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
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
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 createdentitlementId- 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 createdentitlementId- 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 createdentitlementId- 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 createdentitlementId- 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, createEntitlementOperationCallable()OperationMetadata> 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
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
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, deleteEntitlementOperationCallable()OperationMetadata> 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
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, updateEntitlementOperationCallable()OperationMetadata> 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
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
public final PrivilegedAccessManagerClient.ListGrantsPagedResponse listGrants(EntitlementName parent) 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
public final PrivilegedAccessManagerClient.ListGrantsPagedResponse listGrants(ListGrantsRequest request) 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
public final UnaryCallable<ListGrantsRequest,PrivilegedAccessManagerClient.ListGrantsPagedResponse> 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
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
public final PrivilegedAccessManagerClient.SearchGrantsPagedResponse searchGrants(SearchGrantsRequest request) `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
public final UnaryCallable<SearchGrantsRequest,PrivilegedAccessManagerClient.SearchGrantsPagedResponse> 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
`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
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
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
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
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
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
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
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
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
`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
`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
`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
`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
`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, revokeGrantOperationCallable()OperationMetadata> `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
`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
public final PrivilegedAccessManagerClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) 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
public final UnaryCallable<ListLocationsRequest,PrivilegedAccessManagerClient.ListLocationsPagedResponse> 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
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
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
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:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-