- 1.60.0 (latest)
- 1.58.0
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.0
- 1.53.0
- 1.52.0
- 1.51.0
- 1.50.0
- 1.49.0
- 1.47.0
- 1.46.0
- 1.45.0
- 1.44.0
- 1.43.0
- 1.42.0
- 1.41.0
- 1.40.0
- 1.39.0
- 1.38.0
- 1.37.0
- 1.35.0
- 1.34.0
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.0
- 1.29.0
- 1.28.0
- 1.27.0
- 1.26.0
- 1.25.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.7.0
GitHub Repository | Product Reference |
Service Description: An interface for managing Identity and Access Management (IAM) policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
PolicyBindingName name =
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]");
PolicyBinding response = policyBindingsClient.getPolicyBinding(name);
}
Note: close() needs to be called on the PolicyBindingsClient 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 |
---|---|---|
CreatePolicyBinding |
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target. |
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
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetPolicyBinding |
Gets a policy binding. |
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.
|
UpdatePolicyBinding |
Updates a policy binding and returns a long-running operation. Callers will need the IAM permissions on the policy and target in the binding to update, and the IAM permission to remove the existing policy from the binding. Target is immutable and cannot be updated. Once the binding is updated, the new policy is applied to the target. |
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
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeletePolicyBinding |
Deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target. |
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
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListPolicyBindings |
Lists policy bindings. |
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.
|
SearchTargetPolicyBindings |
Search policy bindings by target. Returns all policy binding objects bound directly to target. |
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.
|
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 PolicyBindingsSettings 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
PolicyBindingsSettings policyBindingsSettings =
PolicyBindingsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create(policyBindingsSettings);
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
PolicyBindingsSettings policyBindingsSettings =
PolicyBindingsSettings.newBuilder().setEndpoint(myEndpoint).build();
PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create(policyBindingsSettings);
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
PolicyBindingsSettings policyBindingsSettings =
PolicyBindingsSettings.newHttpJsonBuilder().build();
PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create(policyBindingsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final PolicyBindingsClient create()
Constructs an instance of PolicyBindingsClient with default settings.
Returns | |
---|---|
Type | Description |
PolicyBindingsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(PolicyBindingsSettings settings)
public static final PolicyBindingsClient create(PolicyBindingsSettings settings)
Constructs an instance of PolicyBindingsClient, 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 |
PolicyBindingsSettings |
Returns | |
---|---|
Type | Description |
PolicyBindingsClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(PolicyBindingsStub stub)
public static final PolicyBindingsClient create(PolicyBindingsStub stub)
Constructs an instance of PolicyBindingsClient, using the given stub for making calls. This is for advanced usage - prefer using create(PolicyBindingsSettings).
Parameter | |
---|---|
Name | Description |
stub |
PolicyBindingsStub |
Returns | |
---|---|
Type | Description |
PolicyBindingsClient |
Constructors
PolicyBindingsClient(PolicyBindingsSettings settings)
protected PolicyBindingsClient(PolicyBindingsSettings settings)
Constructs an instance of PolicyBindingsClient, 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 |
PolicyBindingsSettings |
PolicyBindingsClient(PolicyBindingsStub stub)
protected PolicyBindingsClient(PolicyBindingsStub stub)
Parameter | |
---|---|
Name | Description |
stub |
PolicyBindingsStub |
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()
createPolicyBindingAsync(CreatePolicyBindingRequest request)
public final OperationFuture<PolicyBinding,OperationMetadata> createPolicyBindingAsync(CreatePolicyBindingRequest request)
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
CreatePolicyBindingRequest request =
CreatePolicyBindingRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPolicyBindingId("policyBindingId1375821166")
.setPolicyBinding(PolicyBinding.newBuilder().build())
.setValidateOnly(true)
.build();
PolicyBinding response = policyBindingsClient.createPolicyBindingAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
CreatePolicyBindingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
createPolicyBindingAsync(FolderLocationName parent, PolicyBinding policyBinding, String policyBindingId)
public final OperationFuture<PolicyBinding,OperationMetadata> createPolicyBindingAsync(FolderLocationName parent, PolicyBinding policyBinding, String policyBindingId)
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
PolicyBinding policyBinding = PolicyBinding.newBuilder().build();
String policyBindingId = "policyBindingId1375821166";
PolicyBinding response =
policyBindingsClient
.createPolicyBindingAsync(parent, policyBinding, policyBindingId)
.get();
}
Parameters | |
---|---|
Name | Description |
parent |
FolderLocationName Required. The parent resource where this policy binding will be created. The binding parent is the closest Resource Manager resource (project, folder or organization) to the binding target. Format:
|
policyBinding |
PolicyBinding Required. The policy binding to create. |
policyBindingId |
String Required. The ID to use for the policy binding, which will become the final component of the policy binding'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}/. |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
createPolicyBindingAsync(LocationName parent, PolicyBinding policyBinding, String policyBindingId)
public final OperationFuture<PolicyBinding,OperationMetadata> createPolicyBindingAsync(LocationName parent, PolicyBinding policyBinding, String policyBindingId)
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
PolicyBinding policyBinding = PolicyBinding.newBuilder().build();
String policyBindingId = "policyBindingId1375821166";
PolicyBinding response =
policyBindingsClient
.createPolicyBindingAsync(parent, policyBinding, policyBindingId)
.get();
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. The parent resource where this policy binding will be created. The binding parent is the closest Resource Manager resource (project, folder or organization) to the binding target. Format:
|
policyBinding |
PolicyBinding Required. The policy binding to create. |
policyBindingId |
String Required. The ID to use for the policy binding, which will become the final component of the policy binding'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}/. |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
createPolicyBindingAsync(OrganizationLocationName parent, PolicyBinding policyBinding, String policyBindingId)
public final OperationFuture<PolicyBinding,OperationMetadata> createPolicyBindingAsync(OrganizationLocationName parent, PolicyBinding policyBinding, String policyBindingId)
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
PolicyBinding policyBinding = PolicyBinding.newBuilder().build();
String policyBindingId = "policyBindingId1375821166";
PolicyBinding response =
policyBindingsClient
.createPolicyBindingAsync(parent, policyBinding, policyBindingId)
.get();
}
Parameters | |
---|---|
Name | Description |
parent |
OrganizationLocationName Required. The parent resource where this policy binding will be created. The binding parent is the closest Resource Manager resource (project, folder or organization) to the binding target. Format:
|
policyBinding |
PolicyBinding Required. The policy binding to create. |
policyBindingId |
String Required. The ID to use for the policy binding, which will become the final component of the policy binding'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}/. |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
createPolicyBindingAsync(String parent, PolicyBinding policyBinding, String policyBindingId)
public final OperationFuture<PolicyBinding,OperationMetadata> createPolicyBindingAsync(String parent, PolicyBinding policyBinding, String policyBindingId)
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
PolicyBinding policyBinding = PolicyBinding.newBuilder().build();
String policyBindingId = "policyBindingId1375821166";
PolicyBinding response =
policyBindingsClient
.createPolicyBindingAsync(parent, policyBinding, policyBindingId)
.get();
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. The parent resource where this policy binding will be created. The binding parent is the closest Resource Manager resource (project, folder or organization) to the binding target. Format:
|
policyBinding |
PolicyBinding Required. The policy binding to create. |
policyBindingId |
String Required. The ID to use for the policy binding, which will become the final component of the policy binding'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}/. |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
createPolicyBindingCallable()
public final UnaryCallable<CreatePolicyBindingRequest,Operation> createPolicyBindingCallable()
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
CreatePolicyBindingRequest request =
CreatePolicyBindingRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPolicyBindingId("policyBindingId1375821166")
.setPolicyBinding(PolicyBinding.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future =
policyBindingsClient.createPolicyBindingCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreatePolicyBindingRequest,Operation> |
createPolicyBindingOperationCallable()
public final OperationCallable<CreatePolicyBindingRequest,PolicyBinding,OperationMetadata> createPolicyBindingOperationCallable()
Creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
CreatePolicyBindingRequest request =
CreatePolicyBindingRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPolicyBindingId("policyBindingId1375821166")
.setPolicyBinding(PolicyBinding.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<PolicyBinding, OperationMetadata> future =
policyBindingsClient.createPolicyBindingOperationCallable().futureCall(request);
// Do something.
PolicyBinding response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreatePolicyBindingRequest,PolicyBinding,OperationMetadata> |
deletePolicyBindingAsync(DeletePolicyBindingRequest request)
public final OperationFuture<Empty,OperationMetadata> deletePolicyBindingAsync(DeletePolicyBindingRequest request)
Deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
DeletePolicyBindingRequest request =
DeletePolicyBindingRequest.newBuilder()
.setName(
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]")
.toString())
.setEtag("etag3123477")
.setValidateOnly(true)
.build();
policyBindingsClient.deletePolicyBindingAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
DeletePolicyBindingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deletePolicyBindingAsync(PolicyBindingName name)
public final OperationFuture<Empty,OperationMetadata> deletePolicyBindingAsync(PolicyBindingName name)
Deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
PolicyBindingName name =
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]");
policyBindingsClient.deletePolicyBindingAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name |
PolicyBindingName Required. The name of the policy binding to delete. Format:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deletePolicyBindingAsync(String name)
public final OperationFuture<Empty,OperationMetadata> deletePolicyBindingAsync(String name)
Deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
String name =
PolicyBindingName.ofOrganizationLocationPolicyBindingName(
"[ORGANIZATION]", "[LOCATION]", "[POLICY_BINDING]")
.toString();
policyBindingsClient.deletePolicyBindingAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The name of the policy binding to delete. Format:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,OperationMetadata> |
deletePolicyBindingCallable()
public final UnaryCallable<DeletePolicyBindingRequest,Operation> deletePolicyBindingCallable()
Deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
DeletePolicyBindingRequest request =
DeletePolicyBindingRequest.newBuilder()
.setName(
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]")
.toString())
.setEtag("etag3123477")
.setValidateOnly(true)
.build();
ApiFuture<Operation> future =
policyBindingsClient.deletePolicyBindingCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeletePolicyBindingRequest,Operation> |
deletePolicyBindingOperationCallable()
public final OperationCallable<DeletePolicyBindingRequest,Empty,OperationMetadata> deletePolicyBindingOperationCallable()
Deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
DeletePolicyBindingRequest request =
DeletePolicyBindingRequest.newBuilder()
.setName(
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]")
.toString())
.setEtag("etag3123477")
.setValidateOnly(true)
.build();
OperationFuture<Empty, OperationMetadata> future =
policyBindingsClient.deletePolicyBindingOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeletePolicyBindingRequest,Empty,OperationMetadata> |
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 |
getPolicyBinding(GetPolicyBindingRequest request)
public final PolicyBinding getPolicyBinding(GetPolicyBindingRequest request)
Gets a policy binding.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
GetPolicyBindingRequest request =
GetPolicyBindingRequest.newBuilder()
.setName(
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]")
.toString())
.build();
PolicyBinding response = policyBindingsClient.getPolicyBinding(request);
}
Parameter | |
---|---|
Name | Description |
request |
GetPolicyBindingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
PolicyBinding |
getPolicyBinding(PolicyBindingName name)
public final PolicyBinding getPolicyBinding(PolicyBindingName name)
Gets a policy binding.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
PolicyBindingName name =
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]");
PolicyBinding response = policyBindingsClient.getPolicyBinding(name);
}
Parameter | |
---|---|
Name | Description |
name |
PolicyBindingName Required. The name of the policy binding to retrieve. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBinding |
getPolicyBinding(String name)
public final PolicyBinding getPolicyBinding(String name)
Gets a policy binding.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
String name =
PolicyBindingName.ofOrganizationLocationPolicyBindingName(
"[ORGANIZATION]", "[LOCATION]", "[POLICY_BINDING]")
.toString();
PolicyBinding response = policyBindingsClient.getPolicyBinding(name);
}
Parameter | |
---|---|
Name | Description |
name |
String Required. The name of the policy binding to retrieve. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBinding |
getPolicyBindingCallable()
public final UnaryCallable<GetPolicyBindingRequest,PolicyBinding> getPolicyBindingCallable()
Gets a policy binding.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
GetPolicyBindingRequest request =
GetPolicyBindingRequest.newBuilder()
.setName(
PolicyBindingName.ofProjectLocationPolicyBindingName(
"[PROJECT]", "[LOCATION]", "[POLICY_BINDING]")
.toString())
.build();
ApiFuture<PolicyBinding> future =
policyBindingsClient.getPolicyBindingCallable().futureCall(request);
// Do something.
PolicyBinding response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetPolicyBindingRequest,PolicyBinding> |
getSettings()
public final PolicyBindingsSettings getSettings()
Returns | |
---|---|
Type | Description |
PolicyBindingsSettings |
getStub()
public PolicyBindingsStub getStub()
Returns | |
---|---|
Type | Description |
PolicyBindingsStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listPolicyBindings(FolderLocationName parent)
public final PolicyBindingsClient.ListPolicyBindingsPagedResponse listPolicyBindings(FolderLocationName parent)
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
for (PolicyBinding element : policyBindingsClient.listPolicyBindings(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
FolderLocationName Required. The parent resource, which owns the collection of policy bindings. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.ListPolicyBindingsPagedResponse |
listPolicyBindings(ListPolicyBindingsRequest request)
public final PolicyBindingsClient.ListPolicyBindingsPagedResponse listPolicyBindings(ListPolicyBindingsRequest request)
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
ListPolicyBindingsRequest request =
ListPolicyBindingsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (PolicyBinding element : policyBindingsClient.listPolicyBindings(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
ListPolicyBindingsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.ListPolicyBindingsPagedResponse |
listPolicyBindings(LocationName parent)
public final PolicyBindingsClient.ListPolicyBindingsPagedResponse listPolicyBindings(LocationName parent)
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (PolicyBinding element : policyBindingsClient.listPolicyBindings(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
LocationName Required. The parent resource, which owns the collection of policy bindings. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.ListPolicyBindingsPagedResponse |
listPolicyBindings(OrganizationLocationName parent)
public final PolicyBindingsClient.ListPolicyBindingsPagedResponse listPolicyBindings(OrganizationLocationName parent)
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
for (PolicyBinding element : policyBindingsClient.listPolicyBindings(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
OrganizationLocationName Required. The parent resource, which owns the collection of policy bindings. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.ListPolicyBindingsPagedResponse |
listPolicyBindings(String parent)
public final PolicyBindingsClient.ListPolicyBindingsPagedResponse listPolicyBindings(String parent)
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
for (PolicyBinding element : policyBindingsClient.listPolicyBindings(parent).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
parent |
String Required. The parent resource, which owns the collection of policy bindings. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.ListPolicyBindingsPagedResponse |
listPolicyBindingsCallable()
public final UnaryCallable<ListPolicyBindingsRequest,ListPolicyBindingsResponse> listPolicyBindingsCallable()
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
ListPolicyBindingsRequest request =
ListPolicyBindingsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListPolicyBindingsResponse response =
policyBindingsClient.listPolicyBindingsCallable().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<ListPolicyBindingsRequest,ListPolicyBindingsResponse> |
listPolicyBindingsPagedCallable()
public final UnaryCallable<ListPolicyBindingsRequest,PolicyBindingsClient.ListPolicyBindingsPagedResponse> listPolicyBindingsPagedCallable()
Lists policy bindings.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
ListPolicyBindingsRequest request =
ListPolicyBindingsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<PolicyBinding> future =
policyBindingsClient.listPolicyBindingsPagedCallable().futureCall(request);
// Do something.
for (PolicyBinding element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListPolicyBindingsRequest,ListPolicyBindingsPagedResponse> |
searchTargetPolicyBindings(FolderLocationName parent, String target)
public final PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse searchTargetPolicyBindings(FolderLocationName parent, String target)
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
FolderLocationName parent = FolderLocationName.of("[FOLDER]", "[LOCATION]");
String target = "target-880905839";
for (PolicyBinding element :
policyBindingsClient.searchTargetPolicyBindings(parent, target).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
FolderLocationName Required. The parent resource where this search will be performed. This should be the nearest Resource Manager resource (project, folder, or organization) to the target. Format:
|
target |
String Required. The target resource, which is bound to the policy in the binding. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse |
searchTargetPolicyBindings(LocationName parent, String target)
public final PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse searchTargetPolicyBindings(LocationName parent, String target)
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String target = "target-880905839";
for (PolicyBinding element :
policyBindingsClient.searchTargetPolicyBindings(parent, target).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. The parent resource where this search will be performed. This should be the nearest Resource Manager resource (project, folder, or organization) to the target. Format:
|
target |
String Required. The target resource, which is bound to the policy in the binding. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse |
searchTargetPolicyBindings(OrganizationLocationName parent, String target)
public final PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse searchTargetPolicyBindings(OrganizationLocationName parent, String target)
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
String target = "target-880905839";
for (PolicyBinding element :
policyBindingsClient.searchTargetPolicyBindings(parent, target).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
OrganizationLocationName Required. The parent resource where this search will be performed. This should be the nearest Resource Manager resource (project, folder, or organization) to the target. Format:
|
target |
String Required. The target resource, which is bound to the policy in the binding. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse |
searchTargetPolicyBindings(SearchTargetPolicyBindingsRequest request)
public final PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse searchTargetPolicyBindings(SearchTargetPolicyBindingsRequest request)
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
SearchTargetPolicyBindingsRequest request =
SearchTargetPolicyBindingsRequest.newBuilder()
.setTarget("target-880905839")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.build();
for (PolicyBinding element :
policyBindingsClient.searchTargetPolicyBindings(request).iterateAll()) {
// doThingsWith(element);
}
}
Parameter | |
---|---|
Name | Description |
request |
SearchTargetPolicyBindingsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse |
searchTargetPolicyBindings(String parent, String target)
public final PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse searchTargetPolicyBindings(String parent, String target)
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
String target = "target-880905839";
for (PolicyBinding element :
policyBindingsClient.searchTargetPolicyBindings(parent, target).iterateAll()) {
// doThingsWith(element);
}
}
Parameters | |
---|---|
Name | Description |
parent |
String Required. The parent resource where this search will be performed. This should be the nearest Resource Manager resource (project, folder, or organization) to the target. Format:
|
target |
String Required. The target resource, which is bound to the policy in the binding. Format:
|
Returns | |
---|---|
Type | Description |
PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse |
searchTargetPolicyBindingsCallable()
public final UnaryCallable<SearchTargetPolicyBindingsRequest,SearchTargetPolicyBindingsResponse> searchTargetPolicyBindingsCallable()
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
SearchTargetPolicyBindingsRequest request =
SearchTargetPolicyBindingsRequest.newBuilder()
.setTarget("target-880905839")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.build();
while (true) {
SearchTargetPolicyBindingsResponse response =
policyBindingsClient.searchTargetPolicyBindingsCallable().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<SearchTargetPolicyBindingsRequest,SearchTargetPolicyBindingsResponse> |
searchTargetPolicyBindingsPagedCallable()
public final UnaryCallable<SearchTargetPolicyBindingsRequest,PolicyBindingsClient.SearchTargetPolicyBindingsPagedResponse> searchTargetPolicyBindingsPagedCallable()
Search policy bindings by target. Returns all policy binding objects bound directly to target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
SearchTargetPolicyBindingsRequest request =
SearchTargetPolicyBindingsRequest.newBuilder()
.setTarget("target-880905839")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.build();
ApiFuture<PolicyBinding> future =
policyBindingsClient.searchTargetPolicyBindingsPagedCallable().futureCall(request);
// Do something.
for (PolicyBinding element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<SearchTargetPolicyBindingsRequest,SearchTargetPolicyBindingsPagedResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updatePolicyBindingAsync(PolicyBinding policyBinding, FieldMask updateMask)
public final OperationFuture<PolicyBinding,OperationMetadata> updatePolicyBindingAsync(PolicyBinding policyBinding, FieldMask updateMask)
Updates a policy binding and returns a long-running operation. Callers will need the IAM permissions on the policy and target in the binding to update, and the IAM permission to remove the existing policy from the binding. Target is immutable and cannot be updated. Once the binding is updated, the new policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
PolicyBinding policyBinding = PolicyBinding.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
PolicyBinding response =
policyBindingsClient.updatePolicyBindingAsync(policyBinding, updateMask).get();
}
Parameters | |
---|---|
Name | Description |
policyBinding |
PolicyBinding Required. The policy binding to update. The policy binding's |
updateMask |
FieldMask Optional. The list of fields to update |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
updatePolicyBindingAsync(UpdatePolicyBindingRequest request)
public final OperationFuture<PolicyBinding,OperationMetadata> updatePolicyBindingAsync(UpdatePolicyBindingRequest request)
Updates a policy binding and returns a long-running operation. Callers will need the IAM permissions on the policy and target in the binding to update, and the IAM permission to remove the existing policy from the binding. Target is immutable and cannot be updated. Once the binding is updated, the new policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
UpdatePolicyBindingRequest request =
UpdatePolicyBindingRequest.newBuilder()
.setPolicyBinding(PolicyBinding.newBuilder().build())
.setValidateOnly(true)
.setUpdateMask(FieldMask.newBuilder().build())
.build();
PolicyBinding response = policyBindingsClient.updatePolicyBindingAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request |
UpdatePolicyBindingRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<PolicyBinding,OperationMetadata> |
updatePolicyBindingCallable()
public final UnaryCallable<UpdatePolicyBindingRequest,Operation> updatePolicyBindingCallable()
Updates a policy binding and returns a long-running operation. Callers will need the IAM permissions on the policy and target in the binding to update, and the IAM permission to remove the existing policy from the binding. Target is immutable and cannot be updated. Once the binding is updated, the new policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
UpdatePolicyBindingRequest request =
UpdatePolicyBindingRequest.newBuilder()
.setPolicyBinding(PolicyBinding.newBuilder().build())
.setValidateOnly(true)
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
policyBindingsClient.updatePolicyBindingCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdatePolicyBindingRequest,Operation> |
updatePolicyBindingOperationCallable()
public final OperationCallable<UpdatePolicyBindingRequest,PolicyBinding,OperationMetadata> updatePolicyBindingOperationCallable()
Updates a policy binding and returns a long-running operation. Callers will need the IAM permissions on the policy and target in the binding to update, and the IAM permission to remove the existing policy from the binding. Target is immutable and cannot be updated. Once the binding is updated, the new policy is applied to the target.
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 (PolicyBindingsClient policyBindingsClient = PolicyBindingsClient.create()) {
UpdatePolicyBindingRequest request =
UpdatePolicyBindingRequest.newBuilder()
.setPolicyBinding(PolicyBinding.newBuilder().build())
.setValidateOnly(true)
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<PolicyBinding, OperationMetadata> future =
policyBindingsClient.updatePolicyBindingOperationCallable().futureCall(request);
// Do something.
PolicyBinding response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdatePolicyBindingRequest,PolicyBinding,OperationMetadata> |