Class FirewallPoliciesClient (1.40.0)

GitHub RepositoryProduct Reference

Service Description: The FirewallPolicies API.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicy response = firewallPoliciesClient.get(firewallPolicy);
 }
 

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

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns 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 FirewallPoliciesSettings 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
 FirewallPoliciesSettings firewallPoliciesSettings =
     FirewallPoliciesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 FirewallPoliciesClient firewallPoliciesClient =
     FirewallPoliciesClient.create(firewallPoliciesSettings);
 

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
 FirewallPoliciesSettings firewallPoliciesSettings =
     FirewallPoliciesSettings.newBuilder().setEndpoint(myEndpoint).build();
 FirewallPoliciesClient firewallPoliciesClient =
     FirewallPoliciesClient.create(firewallPoliciesSettings);
 

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

Inheritance

java.lang.Object > FirewallPoliciesClient

Static Methods

create()

public static final FirewallPoliciesClient create()

Constructs an instance of FirewallPoliciesClient with default settings.

Returns
TypeDescription
FirewallPoliciesClient
Exceptions
TypeDescription
IOException

create(FirewallPoliciesSettings settings)

public static final FirewallPoliciesClient create(FirewallPoliciesSettings settings)

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

Parameter
NameDescription
settingsFirewallPoliciesSettings
Returns
TypeDescription
FirewallPoliciesClient
Exceptions
TypeDescription
IOException

create(FirewallPoliciesStub stub)

public static final FirewallPoliciesClient create(FirewallPoliciesStub stub)

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

Parameter
NameDescription
stubFirewallPoliciesStub
Returns
TypeDescription
FirewallPoliciesClient

Constructors

FirewallPoliciesClient(FirewallPoliciesSettings settings)

protected FirewallPoliciesClient(FirewallPoliciesSettings settings)

Constructs an instance of FirewallPoliciesClient, 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
NameDescription
settingsFirewallPoliciesSettings

FirewallPoliciesClient(FirewallPoliciesStub stub)

protected FirewallPoliciesClient(FirewallPoliciesStub stub)
Parameter
NameDescription
stubFirewallPoliciesStub

Methods

addAssociationAsync(AddAssociationFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> addAssociationAsync(AddAssociationFirewallPolicyRequest request)

Inserts an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   AddAssociationFirewallPolicyRequest request =
       AddAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyAssociationResource(FirewallPolicyAssociation.newBuilder().build())
           .setReplaceExistingAssociation(true)
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.addAssociationAsync(request).get();
 }
 
Parameter
NameDescription
requestAddAssociationFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

addAssociationAsync(String firewallPolicy, FirewallPolicyAssociation firewallPolicyAssociationResource)

public final OperationFuture<Operation,Operation> addAssociationAsync(String firewallPolicy, FirewallPolicyAssociation firewallPolicyAssociationResource)

Inserts an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicyAssociation firewallPolicyAssociationResource =
       FirewallPolicyAssociation.newBuilder().build();
   Operation response =
       firewallPoliciesClient
           .addAssociationAsync(firewallPolicy, firewallPolicyAssociationResource)
           .get();
 }
 
Parameters
NameDescription
firewallPolicyString

Name of the firewall policy to update.

firewallPolicyAssociationResourceFirewallPolicyAssociation

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addAssociationCallable()

public final UnaryCallable<AddAssociationFirewallPolicyRequest,Operation> addAssociationCallable()

Inserts an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   AddAssociationFirewallPolicyRequest request =
       AddAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyAssociationResource(FirewallPolicyAssociation.newBuilder().build())
           .setReplaceExistingAssociation(true)
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       firewallPoliciesClient.addAssociationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AddAssociationFirewallPolicyRequest,Operation>

addAssociationOperationCallable()

public final OperationCallable<AddAssociationFirewallPolicyRequest,Operation,Operation> addAssociationOperationCallable()

Inserts an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   AddAssociationFirewallPolicyRequest request =
       AddAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyAssociationResource(FirewallPolicyAssociation.newBuilder().build())
           .setReplaceExistingAssociation(true)
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.addAssociationOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AddAssociationFirewallPolicyRequest,Operation,Operation>

addRuleAsync(AddRuleFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> addRuleAsync(AddRuleFirewallPolicyRequest request)

Inserts a rule into a firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   AddRuleFirewallPolicyRequest request =
       AddRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.addRuleAsync(request).get();
 }
 
Parameter
NameDescription
requestAddRuleFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

addRuleAsync(String firewallPolicy, FirewallPolicyRule firewallPolicyRuleResource)

public final OperationFuture<Operation,Operation> addRuleAsync(String firewallPolicy, FirewallPolicyRule firewallPolicyRuleResource)

Inserts a rule into a firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicyRule firewallPolicyRuleResource = FirewallPolicyRule.newBuilder().build();
   Operation response =
       firewallPoliciesClient.addRuleAsync(firewallPolicy, firewallPolicyRuleResource).get();
 }
 
Parameters
NameDescription
firewallPolicyString

Name of the firewall policy to update.

firewallPolicyRuleResourceFirewallPolicyRule

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addRuleCallable()

public final UnaryCallable<AddRuleFirewallPolicyRequest,Operation> addRuleCallable()

Inserts a rule into a firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   AddRuleFirewallPolicyRequest request =
       AddRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.addRuleCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AddRuleFirewallPolicyRequest,Operation>

addRuleOperationCallable()

public final OperationCallable<AddRuleFirewallPolicyRequest,Operation,Operation> addRuleOperationCallable()

Inserts a rule into a firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   AddRuleFirewallPolicyRequest request =
       AddRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.addRuleOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AddRuleFirewallPolicyRequest,Operation,Operation>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

cloneRulesAsync(CloneRulesFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> cloneRulesAsync(CloneRulesFirewallPolicyRequest request)

Copies rules to the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   CloneRulesFirewallPolicyRequest request =
       CloneRulesFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setRequestId("requestId693933066")
           .setSourceFirewallPolicy("sourceFirewallPolicy-593774771")
           .build();
   Operation response = firewallPoliciesClient.cloneRulesAsync(request).get();
 }
 
Parameter
NameDescription
requestCloneRulesFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

cloneRulesAsync(String firewallPolicy)

public final OperationFuture<Operation,Operation> cloneRulesAsync(String firewallPolicy)

Copies rules to the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   Operation response = firewallPoliciesClient.cloneRulesAsync(firewallPolicy).get();
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to update.

Returns
TypeDescription
OperationFuture<Operation,Operation>

cloneRulesCallable()

public final UnaryCallable<CloneRulesFirewallPolicyRequest,Operation> cloneRulesCallable()

Copies rules to the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   CloneRulesFirewallPolicyRequest request =
       CloneRulesFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setRequestId("requestId693933066")
           .setSourceFirewallPolicy("sourceFirewallPolicy-593774771")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.cloneRulesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CloneRulesFirewallPolicyRequest,Operation>

cloneRulesOperationCallable()

public final OperationCallable<CloneRulesFirewallPolicyRequest,Operation,Operation> cloneRulesOperationCallable()

Copies rules to the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   CloneRulesFirewallPolicyRequest request =
       CloneRulesFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setRequestId("requestId693933066")
           .setSourceFirewallPolicy("sourceFirewallPolicy-593774771")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.cloneRulesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CloneRulesFirewallPolicyRequest,Operation,Operation>

close()

public final void close()

deleteAsync(DeleteFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteFirewallPolicyRequest request)

Deletes the specified 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   DeleteFirewallPolicyRequest request =
       DeleteFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String firewallPolicy)

public final OperationFuture<Operation,Operation> deleteAsync(String firewallPolicy)

Deletes the specified 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   Operation response = firewallPoliciesClient.deleteAsync(firewallPolicy).get();
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteFirewallPolicyRequest,Operation> deleteCallable()

Deletes the specified 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   DeleteFirewallPolicyRequest request =
       DeleteFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteFirewallPolicyRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteFirewallPolicyRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   DeleteFirewallPolicyRequest request =
       DeleteFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.deleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteFirewallPolicyRequest,Operation,Operation>

get(GetFirewallPolicyRequest request)

public final FirewallPolicy get(GetFirewallPolicyRequest request)

Returns the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetFirewallPolicyRequest request =
       GetFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .build();
   FirewallPolicy response = firewallPoliciesClient.get(request);
 }
 
Parameter
NameDescription
requestGetFirewallPolicyRequest

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

Returns
TypeDescription
FirewallPolicy

get(String firewallPolicy)

public final FirewallPolicy get(String firewallPolicy)

Returns the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicy response = firewallPoliciesClient.get(firewallPolicy);
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to get.

Returns
TypeDescription
FirewallPolicy

getAssociation(GetAssociationFirewallPolicyRequest request)

public final FirewallPolicyAssociation getAssociation(GetAssociationFirewallPolicyRequest request)

Gets an association with the specified name.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetAssociationFirewallPolicyRequest request =
       GetAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setName("name3373707")
           .build();
   FirewallPolicyAssociation response = firewallPoliciesClient.getAssociation(request);
 }
 
Parameter
NameDescription
requestGetAssociationFirewallPolicyRequest

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

Returns
TypeDescription
FirewallPolicyAssociation

getAssociation(String firewallPolicy)

public final FirewallPolicyAssociation getAssociation(String firewallPolicy)

Gets an association with the specified name.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicyAssociation response = firewallPoliciesClient.getAssociation(firewallPolicy);
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to which the queried rule belongs.

Returns
TypeDescription
FirewallPolicyAssociation

getAssociationCallable()

public final UnaryCallable<GetAssociationFirewallPolicyRequest,FirewallPolicyAssociation> getAssociationCallable()

Gets an association with the specified name.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetAssociationFirewallPolicyRequest request =
       GetAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setName("name3373707")
           .build();
   ApiFuture<FirewallPolicyAssociation> future =
       firewallPoliciesClient.getAssociationCallable().futureCall(request);
   // Do something.
   FirewallPolicyAssociation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetAssociationFirewallPolicyRequest,FirewallPolicyAssociation>

getCallable()

public final UnaryCallable<GetFirewallPolicyRequest,FirewallPolicy> getCallable()

Returns the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetFirewallPolicyRequest request =
       GetFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .build();
   ApiFuture<FirewallPolicy> future = firewallPoliciesClient.getCallable().futureCall(request);
   // Do something.
   FirewallPolicy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetFirewallPolicyRequest,FirewallPolicy>

getIamPolicy(GetIamPolicyFirewallPolicyRequest request)

public final Policy getIamPolicy(GetIamPolicyFirewallPolicyRequest request)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetIamPolicyFirewallPolicyRequest request =
       GetIamPolicyFirewallPolicyRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setResource("resource-341064690")
           .build();
   Policy response = firewallPoliciesClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestGetIamPolicyFirewallPolicyRequest

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

Returns
TypeDescription
Policy

getIamPolicy(String resource)

public final Policy getIamPolicy(String resource)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String resource = "resource-341064690";
   Policy response = firewallPoliciesClient.getIamPolicy(resource);
 }
 
Parameter
NameDescription
resourceString

Name or id of the resource for this request.

Returns
TypeDescription
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyFirewallPolicyRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetIamPolicyFirewallPolicyRequest request =
       GetIamPolicyFirewallPolicyRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setResource("resource-341064690")
           .build();
   ApiFuture<Policy> future = firewallPoliciesClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetIamPolicyFirewallPolicyRequest,Policy>

getRule(GetRuleFirewallPolicyRequest request)

public final FirewallPolicyRule getRule(GetRuleFirewallPolicyRequest request)

Gets a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetRuleFirewallPolicyRequest request =
       GetRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setPriority(-1165461084)
           .build();
   FirewallPolicyRule response = firewallPoliciesClient.getRule(request);
 }
 
Parameter
NameDescription
requestGetRuleFirewallPolicyRequest

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

Returns
TypeDescription
FirewallPolicyRule

getRule(String firewallPolicy)

public final FirewallPolicyRule getRule(String firewallPolicy)

Gets a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicyRule response = firewallPoliciesClient.getRule(firewallPolicy);
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to which the queried rule belongs.

Returns
TypeDescription
FirewallPolicyRule

getRuleCallable()

public final UnaryCallable<GetRuleFirewallPolicyRequest,FirewallPolicyRule> getRuleCallable()

Gets a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   GetRuleFirewallPolicyRequest request =
       GetRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setPriority(-1165461084)
           .build();
   ApiFuture<FirewallPolicyRule> future =
       firewallPoliciesClient.getRuleCallable().futureCall(request);
   // Do something.
   FirewallPolicyRule response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetRuleFirewallPolicyRequest,FirewallPolicyRule>

getSettings()

public final FirewallPoliciesSettings getSettings()
Returns
TypeDescription
FirewallPoliciesSettings

getStub()

public FirewallPoliciesStub getStub()
Returns
TypeDescription
FirewallPoliciesStub

insertAsync(InsertFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertFirewallPolicyRequest request)

Creates a new policy in the specified project using the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   InsertFirewallPolicyRequest request =
       InsertFirewallPolicyRequest.newBuilder()
           .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
           .setParentId("parentId1175162725")
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.insertAsync(request).get();
 }
 
Parameter
NameDescription
requestInsertFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String parentId, FirewallPolicy firewallPolicyResource)

public final OperationFuture<Operation,Operation> insertAsync(String parentId, FirewallPolicy firewallPolicyResource)

Creates a new policy in the specified project using the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String parentId = "parentId1175162725";
   FirewallPolicy firewallPolicyResource = FirewallPolicy.newBuilder().build();
   Operation response =
       firewallPoliciesClient.insertAsync(parentId, firewallPolicyResource).get();
 }
 
Parameters
NameDescription
parentIdString

Parent ID for this request. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization.

firewallPolicyResourceFirewallPolicy

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertFirewallPolicyRequest,Operation> insertCallable()

Creates a new policy in the specified project using the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   InsertFirewallPolicyRequest request =
       InsertFirewallPolicyRequest.newBuilder()
           .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
           .setParentId("parentId1175162725")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertFirewallPolicyRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertFirewallPolicyRequest,Operation,Operation> insertOperationCallable()

Creates a new policy in the specified project using the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   InsertFirewallPolicyRequest request =
       InsertFirewallPolicyRequest.newBuilder()
           .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
           .setParentId("parentId1175162725")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertFirewallPolicyRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list()

public final FirewallPoliciesClient.ListPagedResponse list()

Lists all the policies that have been configured for the specified folder or organization.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   for (FirewallPolicy element : firewallPoliciesClient.list().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
FirewallPoliciesClient.ListPagedResponse

list(ListFirewallPoliciesRequest request)

public final FirewallPoliciesClient.ListPagedResponse list(ListFirewallPoliciesRequest request)

Lists all the policies that have been configured for the specified folder or organization.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   ListFirewallPoliciesRequest request =
       ListFirewallPoliciesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setParentId("parentId1175162725")
           .setReturnPartialSuccess(true)
           .build();
   for (FirewallPolicy element : firewallPoliciesClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListFirewallPoliciesRequest

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

Returns
TypeDescription
FirewallPoliciesClient.ListPagedResponse

listAssociations()

public final FirewallPoliciesListAssociationsResponse listAssociations()

Lists associations of a specified target, i.e., organization or folder.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   FirewallPoliciesListAssociationsResponse response = firewallPoliciesClient.listAssociations();
 }
 
Returns
TypeDescription
FirewallPoliciesListAssociationsResponse

listAssociations(ListAssociationsFirewallPolicyRequest request)

public final FirewallPoliciesListAssociationsResponse listAssociations(ListAssociationsFirewallPolicyRequest request)

Lists associations of a specified target, i.e., organization or folder.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   ListAssociationsFirewallPolicyRequest request =
       ListAssociationsFirewallPolicyRequest.newBuilder()
           .setTargetResource("targetResource-1933150017")
           .build();
   FirewallPoliciesListAssociationsResponse response =
       firewallPoliciesClient.listAssociations(request);
 }
 
Parameter
NameDescription
requestListAssociationsFirewallPolicyRequest

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

Returns
TypeDescription
FirewallPoliciesListAssociationsResponse

listAssociationsCallable()

public final UnaryCallable<ListAssociationsFirewallPolicyRequest,FirewallPoliciesListAssociationsResponse> listAssociationsCallable()

Lists associations of a specified target, i.e., organization or folder.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   ListAssociationsFirewallPolicyRequest request =
       ListAssociationsFirewallPolicyRequest.newBuilder()
           .setTargetResource("targetResource-1933150017")
           .build();
   ApiFuture<FirewallPoliciesListAssociationsResponse> future =
       firewallPoliciesClient.listAssociationsCallable().futureCall(request);
   // Do something.
   FirewallPoliciesListAssociationsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ListAssociationsFirewallPolicyRequest,FirewallPoliciesListAssociationsResponse>

listCallable()

public final UnaryCallable<ListFirewallPoliciesRequest,FirewallPolicyList> listCallable()

Lists all the policies that have been configured for the specified folder or organization.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   ListFirewallPoliciesRequest request =
       ListFirewallPoliciesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setParentId("parentId1175162725")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     FirewallPolicyList response = firewallPoliciesClient.listCallable().call(request);
     for (FirewallPolicy element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListFirewallPoliciesRequest,FirewallPolicyList>

listPagedCallable()

public final UnaryCallable<ListFirewallPoliciesRequest,FirewallPoliciesClient.ListPagedResponse> listPagedCallable()

Lists all the policies that have been configured for the specified folder or organization.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   ListFirewallPoliciesRequest request =
       ListFirewallPoliciesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setParentId("parentId1175162725")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<FirewallPolicy> future =
       firewallPoliciesClient.listPagedCallable().futureCall(request);
   // Do something.
   for (FirewallPolicy element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListFirewallPoliciesRequest,ListPagedResponse>

moveAsync(MoveFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> moveAsync(MoveFirewallPolicyRequest request)

Moves the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   MoveFirewallPolicyRequest request =
       MoveFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setParentId("parentId1175162725")
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.moveAsync(request).get();
 }
 
Parameter
NameDescription
requestMoveFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

moveAsync(String firewallPolicy, String parentId)

public final OperationFuture<Operation,Operation> moveAsync(String firewallPolicy, String parentId)

Moves the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   String parentId = "parentId1175162725";
   Operation response = firewallPoliciesClient.moveAsync(firewallPolicy, parentId).get();
 }
 
Parameters
NameDescription
firewallPolicyString

Name of the firewall policy to update.

parentIdString

The new parent of the firewall policy. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization.

Returns
TypeDescription
OperationFuture<Operation,Operation>

moveCallable()

public final UnaryCallable<MoveFirewallPolicyRequest,Operation> moveCallable()

Moves the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   MoveFirewallPolicyRequest request =
       MoveFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setParentId("parentId1175162725")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.moveCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<MoveFirewallPolicyRequest,Operation>

moveOperationCallable()

public final OperationCallable<MoveFirewallPolicyRequest,Operation,Operation> moveOperationCallable()

Moves the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   MoveFirewallPolicyRequest request =
       MoveFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setParentId("parentId1175162725")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.moveOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<MoveFirewallPolicyRequest,Operation,Operation>

patchAsync(PatchFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> patchAsync(PatchFirewallPolicyRequest request)

Patches the specified policy with the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   PatchFirewallPolicyRequest request =
       PatchFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.patchAsync(request).get();
 }
 
Parameter
NameDescription
requestPatchFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchAsync(String firewallPolicy, FirewallPolicy firewallPolicyResource)

public final OperationFuture<Operation,Operation> patchAsync(String firewallPolicy, FirewallPolicy firewallPolicyResource)

Patches the specified policy with the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicy firewallPolicyResource = FirewallPolicy.newBuilder().build();
   Operation response =
       firewallPoliciesClient.patchAsync(firewallPolicy, firewallPolicyResource).get();
 }
 
Parameters
NameDescription
firewallPolicyString

Name of the firewall policy to update.

firewallPolicyResourceFirewallPolicy

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchCallable()

public final UnaryCallable<PatchFirewallPolicyRequest,Operation> patchCallable()

Patches the specified policy with the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   PatchFirewallPolicyRequest request =
       PatchFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.patchCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<PatchFirewallPolicyRequest,Operation>

patchOperationCallable()

public final OperationCallable<PatchFirewallPolicyRequest,Operation,Operation> patchOperationCallable()

Patches the specified policy with the data included in the request.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   PatchFirewallPolicyRequest request =
       PatchFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.patchOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<PatchFirewallPolicyRequest,Operation,Operation>

patchRuleAsync(PatchRuleFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> patchRuleAsync(PatchRuleFirewallPolicyRequest request)

Patches a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   PatchRuleFirewallPolicyRequest request =
       PatchRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
           .setPriority(-1165461084)
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.patchRuleAsync(request).get();
 }
 
Parameter
NameDescription
requestPatchRuleFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchRuleAsync(String firewallPolicy, FirewallPolicyRule firewallPolicyRuleResource)

public final OperationFuture<Operation,Operation> patchRuleAsync(String firewallPolicy, FirewallPolicyRule firewallPolicyRuleResource)

Patches a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   FirewallPolicyRule firewallPolicyRuleResource = FirewallPolicyRule.newBuilder().build();
   Operation response =
       firewallPoliciesClient.patchRuleAsync(firewallPolicy, firewallPolicyRuleResource).get();
 }
 
Parameters
NameDescription
firewallPolicyString

Name of the firewall policy to update.

firewallPolicyRuleResourceFirewallPolicyRule

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

patchRuleCallable()

public final UnaryCallable<PatchRuleFirewallPolicyRequest,Operation> patchRuleCallable()

Patches a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   PatchRuleFirewallPolicyRequest request =
       PatchRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
           .setPriority(-1165461084)
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.patchRuleCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<PatchRuleFirewallPolicyRequest,Operation>

patchRuleOperationCallable()

public final OperationCallable<PatchRuleFirewallPolicyRequest,Operation,Operation> patchRuleOperationCallable()

Patches a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   PatchRuleFirewallPolicyRequest request =
       PatchRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
           .setPriority(-1165461084)
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.patchRuleOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<PatchRuleFirewallPolicyRequest,Operation,Operation>

removeAssociationAsync(RemoveAssociationFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> removeAssociationAsync(RemoveAssociationFirewallPolicyRequest request)

Removes an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   RemoveAssociationFirewallPolicyRequest request =
       RemoveAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.removeAssociationAsync(request).get();
 }
 
Parameter
NameDescription
requestRemoveAssociationFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeAssociationAsync(String firewallPolicy)

public final OperationFuture<Operation,Operation> removeAssociationAsync(String firewallPolicy)

Removes an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   Operation response = firewallPoliciesClient.removeAssociationAsync(firewallPolicy).get();
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to update.

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeAssociationCallable()

public final UnaryCallable<RemoveAssociationFirewallPolicyRequest,Operation> removeAssociationCallable()

Removes an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   RemoveAssociationFirewallPolicyRequest request =
       RemoveAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       firewallPoliciesClient.removeAssociationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveAssociationFirewallPolicyRequest,Operation>

removeAssociationOperationCallable()

public final OperationCallable<RemoveAssociationFirewallPolicyRequest,Operation,Operation> removeAssociationOperationCallable()

Removes an association for the specified firewall 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   RemoveAssociationFirewallPolicyRequest request =
       RemoveAssociationFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setName("name3373707")
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.removeAssociationOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<RemoveAssociationFirewallPolicyRequest,Operation,Operation>

removeRuleAsync(RemoveRuleFirewallPolicyRequest request)

public final OperationFuture<Operation,Operation> removeRuleAsync(RemoveRuleFirewallPolicyRequest request)

Deletes a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   RemoveRuleFirewallPolicyRequest request =
       RemoveRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setPriority(-1165461084)
           .setRequestId("requestId693933066")
           .build();
   Operation response = firewallPoliciesClient.removeRuleAsync(request).get();
 }
 
Parameter
NameDescription
requestRemoveRuleFirewallPolicyRequest

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

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeRuleAsync(String firewallPolicy)

public final OperationFuture<Operation,Operation> removeRuleAsync(String firewallPolicy)

Deletes a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String firewallPolicy = "firewallPolicy1819692626";
   Operation response = firewallPoliciesClient.removeRuleAsync(firewallPolicy).get();
 }
 
Parameter
NameDescription
firewallPolicyString

Name of the firewall policy to update.

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeRuleCallable()

public final UnaryCallable<RemoveRuleFirewallPolicyRequest,Operation> removeRuleCallable()

Deletes a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   RemoveRuleFirewallPolicyRequest request =
       RemoveRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setPriority(-1165461084)
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future = firewallPoliciesClient.removeRuleCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveRuleFirewallPolicyRequest,Operation>

removeRuleOperationCallable()

public final OperationCallable<RemoveRuleFirewallPolicyRequest,Operation,Operation> removeRuleOperationCallable()

Deletes a rule of the specified priority.

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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   RemoveRuleFirewallPolicyRequest request =
       RemoveRuleFirewallPolicyRequest.newBuilder()
           .setFirewallPolicy("firewallPolicy1819692626")
           .setPriority(-1165461084)
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Operation, Operation> future =
       firewallPoliciesClient.removeRuleOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<RemoveRuleFirewallPolicyRequest,Operation,Operation>

setIamPolicy(SetIamPolicyFirewallPolicyRequest request)

public final Policy setIamPolicy(SetIamPolicyFirewallPolicyRequest request)

Sets the access control policy on the specified resource. Replaces any existing 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   SetIamPolicyFirewallPolicyRequest request =
       SetIamPolicyFirewallPolicyRequest.newBuilder()
           .setGlobalOrganizationSetPolicyRequestResource(
               GlobalOrganizationSetPolicyRequest.newBuilder().build())
           .setResource("resource-341064690")
           .build();
   Policy response = firewallPoliciesClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestSetIamPolicyFirewallPolicyRequest

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

Returns
TypeDescription
Policy

setIamPolicy(String resource, GlobalOrganizationSetPolicyRequest globalOrganizationSetPolicyRequestResource)

public final Policy setIamPolicy(String resource, GlobalOrganizationSetPolicyRequest globalOrganizationSetPolicyRequestResource)

Sets the access control policy on the specified resource. Replaces any existing 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String resource = "resource-341064690";
   GlobalOrganizationSetPolicyRequest globalOrganizationSetPolicyRequestResource =
       GlobalOrganizationSetPolicyRequest.newBuilder().build();
   Policy response =
       firewallPoliciesClient.setIamPolicy(resource, globalOrganizationSetPolicyRequestResource);
 }
 
Parameters
NameDescription
resourceString

Name or id of the resource for this request.

globalOrganizationSetPolicyRequestResourceGlobalOrganizationSetPolicyRequest

The body resource for this request

Returns
TypeDescription
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyFirewallPolicyRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replaces any existing 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 (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   SetIamPolicyFirewallPolicyRequest request =
       SetIamPolicyFirewallPolicyRequest.newBuilder()
           .setGlobalOrganizationSetPolicyRequestResource(
               GlobalOrganizationSetPolicyRequest.newBuilder().build())
           .setResource("resource-341064690")
           .build();
   ApiFuture<Policy> future = firewallPoliciesClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetIamPolicyFirewallPolicyRequest,Policy>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

testIamPermissions(TestIamPermissionsFirewallPolicyRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsFirewallPolicyRequest request)

Returns permissions that a caller has on the specified resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   TestIamPermissionsFirewallPolicyRequest request =
       TestIamPermissionsFirewallPolicyRequest.newBuilder()
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   TestPermissionsResponse response = firewallPoliciesClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestTestIamPermissionsFirewallPolicyRequest

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

Returns
TypeDescription
TestPermissionsResponse

testIamPermissions(String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   String resource = "resource-341064690";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       firewallPoliciesClient.testIamPermissions(resource, testPermissionsRequestResource);
 }
 
Parameters
NameDescription
resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

Returns
TypeDescription
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsFirewallPolicyRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (FirewallPoliciesClient firewallPoliciesClient = FirewallPoliciesClient.create()) {
   TestIamPermissionsFirewallPolicyRequest request =
       TestIamPermissionsFirewallPolicyRequest.newBuilder()
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .build();
   ApiFuture<TestPermissionsResponse> future =
       firewallPoliciesClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<TestIamPermissionsFirewallPolicyRequest,TestPermissionsResponse>