Class AccessPoliciesClient (1.90.0)

GitHub RepositoryProduct Reference

Service Description: Manages Identity and Access Management (IAM) access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   AccessPolicyName name =
       AccessPolicyName.ofProjectLocationAccessPolicyName(
           "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]");
   AccessPolicy response = accessPoliciesClient.getAccessPolicy(name);
 }
 

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

Methods
Method Description Method Variants

CreateAccessPolicy

Creates an access policy, and returns a long running operation.

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

  • createAccessPolicyAsync(CreateAccessPolicyRequest request)

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

  • createAccessPolicyAsync(FolderLocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

  • createAccessPolicyAsync(LocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

  • createAccessPolicyAsync(OrganizationLocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

  • createAccessPolicyAsync(String parent, AccessPolicy accessPolicy, String accessPolicyId)

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

  • createAccessPolicyOperationCallable()

  • createAccessPolicyCallable()

GetAccessPolicy

Gets an access policy.

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

  • getAccessPolicy(GetAccessPolicyRequest request)

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

  • getAccessPolicy(AccessPolicyName name)

  • getAccessPolicy(String name)

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

  • getAccessPolicyCallable()

UpdateAccessPolicy

Updates an access policy.

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

  • updateAccessPolicyAsync(UpdateAccessPolicyRequest request)

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

  • updateAccessPolicyOperationCallable()

  • updateAccessPolicyCallable()

DeleteAccessPolicy

Deletes an access policy.

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

  • deleteAccessPolicyAsync(DeleteAccessPolicyRequest request)

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

  • deleteAccessPolicyAsync(AccessPolicyName name)

  • deleteAccessPolicyAsync(String name)

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

  • deleteAccessPolicyOperationCallable()

  • deleteAccessPolicyCallable()

ListAccessPolicies

Lists access policies.

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

  • listAccessPolicies(ListAccessPoliciesRequest request)

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

  • listAccessPolicies(FolderLocationName parent)

  • listAccessPolicies(LocationName parent)

  • listAccessPolicies(OrganizationLocationName parent)

  • listAccessPolicies(String parent)

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

  • listAccessPoliciesPagedCallable()

  • listAccessPoliciesCallable()

SearchAccessPolicyBindings

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

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

  • searchAccessPolicyBindings(SearchAccessPolicyBindingsRequest request)

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

  • searchAccessPolicyBindings(AccessPolicyName name)

  • searchAccessPolicyBindings(String name)

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

  • searchAccessPolicyBindingsPagedCallable()

  • searchAccessPolicyBindingsCallable()

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 AccessPoliciesSettings 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
 AccessPoliciesSettings accessPoliciesSettings =
     AccessPoliciesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create(accessPoliciesSettings);
 

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
 AccessPoliciesSettings accessPoliciesSettings =
     AccessPoliciesSettings.newBuilder().setEndpoint(myEndpoint).build();
 AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create(accessPoliciesSettings);
 

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
 AccessPoliciesSettings accessPoliciesSettings =
     AccessPoliciesSettings.newHttpJsonBuilder().build();
 AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create(accessPoliciesSettings);
 

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

Inheritance

java.lang.Object > AccessPoliciesClient

Static Methods

create()

public static final AccessPoliciesClient create()

Constructs an instance of AccessPoliciesClient with default settings.

Returns
Type Description
AccessPoliciesClient
Exceptions
Type Description
IOException

create(AccessPoliciesSettings settings)

public static final AccessPoliciesClient create(AccessPoliciesSettings settings)

Constructs an instance of AccessPoliciesClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings AccessPoliciesSettings
Returns
Type Description
AccessPoliciesClient
Exceptions
Type Description
IOException

create(AccessPoliciesStub stub)

public static final AccessPoliciesClient create(AccessPoliciesStub stub)

Constructs an instance of AccessPoliciesClient, using the given stub for making calls. This is for advanced usage - prefer using create(AccessPoliciesSettings).

Parameter
Name Description
stub AccessPoliciesStub
Returns
Type Description
AccessPoliciesClient

Constructors

AccessPoliciesClient(AccessPoliciesSettings settings)

protected AccessPoliciesClient(AccessPoliciesSettings settings)

Constructs an instance of AccessPoliciesClient, 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.

Parameter
Name Description
settings AccessPoliciesSettings

AccessPoliciesClient(AccessPoliciesStub stub)

protected AccessPoliciesClient(AccessPoliciesStub stub)
Parameter
Name Description
stub AccessPoliciesStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createAccessPolicyAsync(CreateAccessPolicyRequest request)

public final OperationFuture<AccessPolicy,OperationMetadata> createAccessPolicyAsync(CreateAccessPolicyRequest request)

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   CreateAccessPolicyRequest request =
       CreateAccessPolicyRequest.newBuilder()
           .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
           .setAccessPolicyId("accessPolicyId97623921")
           .setAccessPolicy(AccessPolicy.newBuilder().build())
           .setValidateOnly(true)
           .build();
   AccessPolicy response = accessPoliciesClient.createAccessPolicyAsync(request).get();
 }
 
Parameter
Name Description
request CreateAccessPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<AccessPolicy,OperationMetadata>

createAccessPolicyAsync(FolderLocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

public final OperationFuture<AccessPolicy,OperationMetadata> createAccessPolicyAsync(FolderLocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
   AccessPolicy accessPolicy = AccessPolicy.newBuilder().build();
   String accessPolicyId = "accessPolicyId97623921";
   AccessPolicy response =
       accessPoliciesClient.createAccessPolicyAsync(parent, accessPolicy, accessPolicyId).get();
 }
 
Parameters
Name Description
parent FolderLocationName

Required. The parent resource where this access policy will be created.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

accessPolicy AccessPolicy

Required. The access policy to create.

accessPolicyId String

Required. The ID to use for the access policy, which will become the final component of the access policy's resource name.

This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, hyphens, or dots. Pattern, /a-z{2,62}/.

This value must be unique among all access policies with the same parent.

Returns
Type Description
OperationFuture<AccessPolicy,OperationMetadata>

createAccessPolicyAsync(LocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

public final OperationFuture<AccessPolicy,OperationMetadata> createAccessPolicyAsync(LocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   AccessPolicy accessPolicy = AccessPolicy.newBuilder().build();
   String accessPolicyId = "accessPolicyId97623921";
   AccessPolicy response =
       accessPoliciesClient.createAccessPolicyAsync(parent, accessPolicy, accessPolicyId).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The parent resource where this access policy will be created.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

accessPolicy AccessPolicy

Required. The access policy to create.

accessPolicyId String

Required. The ID to use for the access policy, which will become the final component of the access policy's resource name.

This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, hyphens, or dots. Pattern, /a-z{2,62}/.

This value must be unique among all access policies with the same parent.

Returns
Type Description
OperationFuture<AccessPolicy,OperationMetadata>

createAccessPolicyAsync(OrganizationLocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

public final OperationFuture<AccessPolicy,OperationMetadata> createAccessPolicyAsync(OrganizationLocationName parent, AccessPolicy accessPolicy, String accessPolicyId)

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
   AccessPolicy accessPolicy = AccessPolicy.newBuilder().build();
   String accessPolicyId = "accessPolicyId97623921";
   AccessPolicy response =
       accessPoliciesClient.createAccessPolicyAsync(parent, accessPolicy, accessPolicyId).get();
 }
 
Parameters
Name Description
parent OrganizationLocationName

Required. The parent resource where this access policy will be created.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

accessPolicy AccessPolicy

Required. The access policy to create.

accessPolicyId String

Required. The ID to use for the access policy, which will become the final component of the access policy's resource name.

This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, hyphens, or dots. Pattern, /a-z{2,62}/.

This value must be unique among all access policies with the same parent.

Returns
Type Description
OperationFuture<AccessPolicy,OperationMetadata>

createAccessPolicyAsync(String parent, AccessPolicy accessPolicy, String accessPolicyId)

public final OperationFuture<AccessPolicy,OperationMetadata> createAccessPolicyAsync(String parent, AccessPolicy accessPolicy, String accessPolicyId)

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
   AccessPolicy accessPolicy = AccessPolicy.newBuilder().build();
   String accessPolicyId = "accessPolicyId97623921";
   AccessPolicy response =
       accessPoliciesClient.createAccessPolicyAsync(parent, accessPolicy, accessPolicyId).get();
 }
 
Parameters
Name Description
parent String

Required. The parent resource where this access policy will be created.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

accessPolicy AccessPolicy

Required. The access policy to create.

accessPolicyId String

Required. The ID to use for the access policy, which will become the final component of the access policy's resource name.

This value must start with a lowercase letter followed by up to 62 lowercase letters, numbers, hyphens, or dots. Pattern, /a-z{2,62}/.

This value must be unique among all access policies with the same parent.

Returns
Type Description
OperationFuture<AccessPolicy,OperationMetadata>

createAccessPolicyCallable()

public final UnaryCallable<CreateAccessPolicyRequest,Operation> createAccessPolicyCallable()

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   CreateAccessPolicyRequest request =
       CreateAccessPolicyRequest.newBuilder()
           .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
           .setAccessPolicyId("accessPolicyId97623921")
           .setAccessPolicy(AccessPolicy.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future =
       accessPoliciesClient.createAccessPolicyCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateAccessPolicyRequest,Operation>

createAccessPolicyOperationCallable()

public final OperationCallable<CreateAccessPolicyRequest,AccessPolicy,OperationMetadata> createAccessPolicyOperationCallable()

Creates an access policy, and returns a long running operation.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   CreateAccessPolicyRequest request =
       CreateAccessPolicyRequest.newBuilder()
           .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
           .setAccessPolicyId("accessPolicyId97623921")
           .setAccessPolicy(AccessPolicy.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<AccessPolicy, OperationMetadata> future =
       accessPoliciesClient.createAccessPolicyOperationCallable().futureCall(request);
   // Do something.
   AccessPolicy response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateAccessPolicyRequest,AccessPolicy,OperationMetadata>

deleteAccessPolicyAsync(AccessPolicyName name)

public final OperationFuture<Empty,OperationMetadata> deleteAccessPolicyAsync(AccessPolicyName name)

Deletes an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   AccessPolicyName name =
       AccessPolicyName.ofProjectLocationAccessPolicyName(
           "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]");
   accessPoliciesClient.deleteAccessPolicyAsync(name).get();
 }
 
Parameter
Name Description
name AccessPolicyName

Required. The name of the access policy to delete.

Format: projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteAccessPolicyAsync(DeleteAccessPolicyRequest request)

public final OperationFuture<Empty,OperationMetadata> deleteAccessPolicyAsync(DeleteAccessPolicyRequest request)

Deletes an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   DeleteAccessPolicyRequest request =
       DeleteAccessPolicyRequest.newBuilder()
           .setName(
               AccessPolicyName.ofProjectLocationAccessPolicyName(
                       "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .setEtag("etag3123477")
           .setValidateOnly(true)
           .setForce(true)
           .build();
   accessPoliciesClient.deleteAccessPolicyAsync(request).get();
 }
 
Parameter
Name Description
request DeleteAccessPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteAccessPolicyAsync(String name)

public final OperationFuture<Empty,OperationMetadata> deleteAccessPolicyAsync(String name)

Deletes an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   String name =
       AccessPolicyName.ofOrganizationLocationAccessPolicyName(
               "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]")
           .toString();
   accessPoliciesClient.deleteAccessPolicyAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The name of the access policy to delete.

Format: projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteAccessPolicyCallable()

public final UnaryCallable<DeleteAccessPolicyRequest,Operation> deleteAccessPolicyCallable()

Deletes an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   DeleteAccessPolicyRequest request =
       DeleteAccessPolicyRequest.newBuilder()
           .setName(
               AccessPolicyName.ofProjectLocationAccessPolicyName(
                       "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .setEtag("etag3123477")
           .setValidateOnly(true)
           .setForce(true)
           .build();
   ApiFuture<Operation> future =
       accessPoliciesClient.deleteAccessPolicyCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteAccessPolicyRequest,Operation>

deleteAccessPolicyOperationCallable()

public final OperationCallable<DeleteAccessPolicyRequest,Empty,OperationMetadata> deleteAccessPolicyOperationCallable()

Deletes an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   DeleteAccessPolicyRequest request =
       DeleteAccessPolicyRequest.newBuilder()
           .setName(
               AccessPolicyName.ofProjectLocationAccessPolicyName(
                       "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .setEtag("etag3123477")
           .setValidateOnly(true)
           .setForce(true)
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       accessPoliciesClient.deleteAccessPolicyOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteAccessPolicyRequest,Empty,OperationMetadata>

getAccessPolicy(AccessPolicyName name)

public final AccessPolicy getAccessPolicy(AccessPolicyName name)

Gets an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   AccessPolicyName name =
       AccessPolicyName.ofProjectLocationAccessPolicyName(
           "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]");
   AccessPolicy response = accessPoliciesClient.getAccessPolicy(name);
 }
 
Parameter
Name Description
name AccessPolicyName

Required. The name of the access policy to retrieve.

Format: projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}

Returns
Type Description
AccessPolicy

getAccessPolicy(GetAccessPolicyRequest request)

public final AccessPolicy getAccessPolicy(GetAccessPolicyRequest request)

Gets an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   GetAccessPolicyRequest request =
       GetAccessPolicyRequest.newBuilder()
           .setName(
               AccessPolicyName.ofProjectLocationAccessPolicyName(
                       "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .build();
   AccessPolicy response = accessPoliciesClient.getAccessPolicy(request);
 }
 
Parameter
Name Description
request GetAccessPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AccessPolicy

getAccessPolicy(String name)

public final AccessPolicy getAccessPolicy(String name)

Gets an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   String name =
       AccessPolicyName.ofOrganizationLocationAccessPolicyName(
               "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]")
           .toString();
   AccessPolicy response = accessPoliciesClient.getAccessPolicy(name);
 }
 
Parameter
Name Description
name String

Required. The name of the access policy to retrieve.

Format: projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id}

Returns
Type Description
AccessPolicy

getAccessPolicyCallable()

public final UnaryCallable<GetAccessPolicyRequest,AccessPolicy> getAccessPolicyCallable()

Gets an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   GetAccessPolicyRequest request =
       GetAccessPolicyRequest.newBuilder()
           .setName(
               AccessPolicyName.ofProjectLocationAccessPolicyName(
                       "[PROJECT]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .build();
   ApiFuture<AccessPolicy> future =
       accessPoliciesClient.getAccessPolicyCallable().futureCall(request);
   // Do something.
   AccessPolicy response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetAccessPolicyRequest,AccessPolicy>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final AccessPoliciesSettings getSettings()
Returns
Type Description
AccessPoliciesSettings

getStub()

public AccessPoliciesStub getStub()
Returns
Type Description
AccessPoliciesStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listAccessPolicies(FolderLocationName parent)

public final AccessPoliciesClient.ListAccessPoliciesPagedResponse listAccessPolicies(FolderLocationName parent)

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
   for (AccessPolicy element : accessPoliciesClient.listAccessPolicies(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent FolderLocationName

Required. The parent resource, which owns the collection of access policy resources.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

Returns
Type Description
AccessPoliciesClient.ListAccessPoliciesPagedResponse

listAccessPolicies(ListAccessPoliciesRequest request)

public final AccessPoliciesClient.ListAccessPoliciesPagedResponse listAccessPolicies(ListAccessPoliciesRequest request)

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   ListAccessPoliciesRequest request =
       ListAccessPoliciesRequest.newBuilder()
           .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (AccessPolicy element : accessPoliciesClient.listAccessPolicies(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListAccessPoliciesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AccessPoliciesClient.ListAccessPoliciesPagedResponse

listAccessPolicies(LocationName parent)

public final AccessPoliciesClient.ListAccessPoliciesPagedResponse listAccessPolicies(LocationName parent)

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (AccessPolicy element : accessPoliciesClient.listAccessPolicies(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The parent resource, which owns the collection of access policy resources.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

Returns
Type Description
AccessPoliciesClient.ListAccessPoliciesPagedResponse

listAccessPolicies(OrganizationLocationName parent)

public final AccessPoliciesClient.ListAccessPoliciesPagedResponse listAccessPolicies(OrganizationLocationName parent)

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
   for (AccessPolicy element : accessPoliciesClient.listAccessPolicies(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent OrganizationLocationName

Required. The parent resource, which owns the collection of access policy resources.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

Returns
Type Description
AccessPoliciesClient.ListAccessPoliciesPagedResponse

listAccessPolicies(String parent)

public final AccessPoliciesClient.ListAccessPoliciesPagedResponse listAccessPolicies(String parent)

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
   for (AccessPolicy element : accessPoliciesClient.listAccessPolicies(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent resource, which owns the collection of access policy resources.

Format: projects/{project_id}/locations/{location} projects/{project_number}/locations/{location} folders/{folder_id}/locations/{location} organizations/{organization_id}/locations/{location}

Returns
Type Description
AccessPoliciesClient.ListAccessPoliciesPagedResponse

listAccessPoliciesCallable()

public final UnaryCallable<ListAccessPoliciesRequest,ListAccessPoliciesResponse> listAccessPoliciesCallable()

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   ListAccessPoliciesRequest request =
       ListAccessPoliciesRequest.newBuilder()
           .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListAccessPoliciesResponse response =
         accessPoliciesClient.listAccessPoliciesCallable().call(request);
     for (AccessPolicy element : response.getAccessPoliciesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListAccessPoliciesRequest,ListAccessPoliciesResponse>

listAccessPoliciesPagedCallable()

public final UnaryCallable<ListAccessPoliciesRequest,AccessPoliciesClient.ListAccessPoliciesPagedResponse> listAccessPoliciesPagedCallable()

Lists access policies.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   ListAccessPoliciesRequest request =
       ListAccessPoliciesRequest.newBuilder()
           .setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<AccessPolicy> future =
       accessPoliciesClient.listAccessPoliciesPagedCallable().futureCall(request);
   // Do something.
   for (AccessPolicy element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListAccessPoliciesRequest,ListAccessPoliciesPagedResponse>

searchAccessPolicyBindings(AccessPolicyName name)

public final AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse searchAccessPolicyBindings(AccessPolicyName name)

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   AccessPolicyName name =
       AccessPolicyName.ofOrganizationLocationAccessPolicyName(
           "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]");
   for (PolicyBinding element :
       accessPoliciesClient.searchAccessPolicyBindings(name).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
name AccessPolicyName

Required. The name of the access policy. Format: organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id}

Returns
Type Description
AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse

searchAccessPolicyBindings(SearchAccessPolicyBindingsRequest request)

public final AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse searchAccessPolicyBindings(SearchAccessPolicyBindingsRequest request)

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   SearchAccessPolicyBindingsRequest request =
       SearchAccessPolicyBindingsRequest.newBuilder()
           .setName(
               AccessPolicyName.ofOrganizationLocationAccessPolicyName(
                       "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (PolicyBinding element :
       accessPoliciesClient.searchAccessPolicyBindings(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request SearchAccessPolicyBindingsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse

searchAccessPolicyBindings(String name)

public final AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse searchAccessPolicyBindings(String name)

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   String name =
       AccessPolicyName.ofOrganizationLocationAccessPolicyName(
               "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]")
           .toString();
   for (PolicyBinding element :
       accessPoliciesClient.searchAccessPolicyBindings(name).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
name String

Required. The name of the access policy. Format: organizations/{organization_id}/locations/{location}/accessPolicies/{access_policy_id} folders/{folder_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_id}/locations/{location}/accessPolicies/{access_policy_id} projects/{project_number}/locations/{location}/accessPolicies/{access_policy_id}

Returns
Type Description
AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse

searchAccessPolicyBindingsCallable()

public final UnaryCallable<SearchAccessPolicyBindingsRequest,SearchAccessPolicyBindingsResponse> searchAccessPolicyBindingsCallable()

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   SearchAccessPolicyBindingsRequest request =
       SearchAccessPolicyBindingsRequest.newBuilder()
           .setName(
               AccessPolicyName.ofOrganizationLocationAccessPolicyName(
                       "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     SearchAccessPolicyBindingsResponse response =
         accessPoliciesClient.searchAccessPolicyBindingsCallable().call(request);
     for (PolicyBinding element : response.getPolicyBindingsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<SearchAccessPolicyBindingsRequest,SearchAccessPolicyBindingsResponse>

searchAccessPolicyBindingsPagedCallable()

public final UnaryCallable<SearchAccessPolicyBindingsRequest,AccessPoliciesClient.SearchAccessPolicyBindingsPagedResponse> searchAccessPolicyBindingsPagedCallable()

Returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   SearchAccessPolicyBindingsRequest request =
       SearchAccessPolicyBindingsRequest.newBuilder()
           .setName(
               AccessPolicyName.ofOrganizationLocationAccessPolicyName(
                       "[ORGANIZATION]", "[LOCATION]", "[ACCESS_POLICY]")
                   .toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<PolicyBinding> future =
       accessPoliciesClient.searchAccessPolicyBindingsPagedCallable().futureCall(request);
   // Do something.
   for (PolicyBinding element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<SearchAccessPolicyBindingsRequest,SearchAccessPolicyBindingsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateAccessPolicyAsync(UpdateAccessPolicyRequest request)

public final OperationFuture<AccessPolicy,OperationMetadata> updateAccessPolicyAsync(UpdateAccessPolicyRequest request)

Updates an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   UpdateAccessPolicyRequest request =
       UpdateAccessPolicyRequest.newBuilder()
           .setAccessPolicy(AccessPolicy.newBuilder().build())
           .setValidateOnly(true)
           .build();
   AccessPolicy response = accessPoliciesClient.updateAccessPolicyAsync(request).get();
 }
 
Parameter
Name Description
request UpdateAccessPolicyRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<AccessPolicy,OperationMetadata>

updateAccessPolicyCallable()

public final UnaryCallable<UpdateAccessPolicyRequest,Operation> updateAccessPolicyCallable()

Updates an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   UpdateAccessPolicyRequest request =
       UpdateAccessPolicyRequest.newBuilder()
           .setAccessPolicy(AccessPolicy.newBuilder().build())
           .setValidateOnly(true)
           .build();
   ApiFuture<Operation> future =
       accessPoliciesClient.updateAccessPolicyCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateAccessPolicyRequest,Operation>

updateAccessPolicyOperationCallable()

public final OperationCallable<UpdateAccessPolicyRequest,AccessPolicy,OperationMetadata> updateAccessPolicyOperationCallable()

Updates an access policy.

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 (AccessPoliciesClient accessPoliciesClient = AccessPoliciesClient.create()) {
   UpdateAccessPolicyRequest request =
       UpdateAccessPolicyRequest.newBuilder()
           .setAccessPolicy(AccessPolicy.newBuilder().build())
           .setValidateOnly(true)
           .build();
   OperationFuture<AccessPolicy, OperationMetadata> future =
       accessPoliciesClient.updateAccessPolicyOperationCallable().futureCall(request);
   // Do something.
   AccessPolicy response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateAccessPolicyRequest,AccessPolicy,OperationMetadata>