Class NetworkFirewallPoliciesClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class NetworkFirewallPoliciesClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: The NetworkFirewallPolicies 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
         NetworkFirewallPoliciesClient.create()) {
       String project = "project-309310695";
       String firewallPolicy = "firewallPolicy1819692626";
       FirewallPolicy response = networkFirewallPoliciesClient.get(project, firewallPolicy);
     }
     

    Note: close() needs to be called on the NetworkFirewallPoliciesClient 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 NetworkFirewallPoliciesSettings 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
     NetworkFirewallPoliciesSettings networkFirewallPoliciesSettings =
         NetworkFirewallPoliciesSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
         NetworkFirewallPoliciesClient.create(networkFirewallPoliciesSettings);
     

    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
     NetworkFirewallPoliciesSettings networkFirewallPoliciesSettings =
         NetworkFirewallPoliciesSettings.newBuilder().setEndpoint(myEndpoint).build();
     NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
         NetworkFirewallPoliciesClient.create(networkFirewallPoliciesSettings);
     

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

    • Constructor Detail

      • NetworkFirewallPoliciesClient

        protected NetworkFirewallPoliciesClient​(NetworkFirewallPoliciesSettings settings)
                                         throws IOException
        Constructs an instance of NetworkFirewallPoliciesClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
        Throws:
        IOException
    • Method Detail

      • create

        public static final NetworkFirewallPoliciesClient create​(NetworkFirewallPoliciesStub stub)
        Constructs an instance of NetworkFirewallPoliciesClient, using the given stub for making calls. This is for advanced usage - prefer using create(NetworkFirewallPoliciesSettings).
      • addAssociationAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> addAssociationAsync​(String project,
                                                                                                                   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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicyAssociation firewallPolicyAssociationResource =
               FirewallPolicyAssociation.newBuilder().build();
           Operation response =
               networkFirewallPoliciesClient
                   .addAssociationAsync(project, firewallPolicy, firewallPolicyAssociationResource)
                   .get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        firewallPolicyAssociationResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addAssociationAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> addAssociationAsync​(AddAssociationNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           AddAssociationNetworkFirewallPolicyRequest request =
               AddAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyAssociationResource(FirewallPolicyAssociation.newBuilder().build())
                   .setProject("project-309310695")
                   .setReplaceExistingAssociation(true)
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.addAssociationAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addAssociationOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<AddAssociationNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           AddAssociationNetworkFirewallPolicyRequest request =
               AddAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyAssociationResource(FirewallPolicyAssociation.newBuilder().build())
                   .setProject("project-309310695")
                   .setReplaceExistingAssociation(true)
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.addAssociationOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • addAssociationCallable

        public final com.google.api.gax.rpc.UnaryCallable<AddAssociationNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           AddAssociationNetworkFirewallPolicyRequest request =
               AddAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyAssociationResource(FirewallPolicyAssociation.newBuilder().build())
                   .setProject("project-309310695")
                   .setReplaceExistingAssociation(true)
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.addAssociationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • addRuleAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> addRuleAsync​(String project,
                                                                                                            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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicyRule firewallPolicyRuleResource = FirewallPolicyRule.newBuilder().build();
           Operation response =
               networkFirewallPoliciesClient
                   .addRuleAsync(project, firewallPolicy, firewallPolicyRuleResource)
                   .get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        firewallPolicyRuleResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addRuleAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> addRuleAsync​(AddRuleNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           AddRuleNetworkFirewallPolicyRequest request =
               AddRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
                   .setMaxPriority(-207235553)
                   .setMinPriority(267190513)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.addRuleAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addRuleOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<AddRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           AddRuleNetworkFirewallPolicyRequest request =
               AddRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
                   .setMaxPriority(-207235553)
                   .setMinPriority(267190513)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.addRuleOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • addRuleCallable

        public final com.google.api.gax.rpc.UnaryCallable<AddRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           AddRuleNetworkFirewallPolicyRequest request =
               AddRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
                   .setMaxPriority(-207235553)
                   .setMinPriority(267190513)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.addRuleCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • cloneRulesAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> cloneRulesAsync​(String project,
                                                                                                               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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           Operation response =
               networkFirewallPoliciesClient.cloneRulesAsync(project, firewallPolicy).get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • cloneRulesAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> cloneRulesAsync​(CloneRulesNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           CloneRulesNetworkFirewallPolicyRequest request =
               CloneRulesNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .setSourceFirewallPolicy("sourceFirewallPolicy-593774771")
                   .build();
           Operation response = networkFirewallPoliciesClient.cloneRulesAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • cloneRulesOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CloneRulesNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           CloneRulesNetworkFirewallPolicyRequest request =
               CloneRulesNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .setSourceFirewallPolicy("sourceFirewallPolicy-593774771")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.cloneRulesOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • cloneRulesCallable

        public final com.google.api.gax.rpc.UnaryCallable<CloneRulesNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           CloneRulesNetworkFirewallPolicyRequest request =
               CloneRulesNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .setSourceFirewallPolicy("sourceFirewallPolicy-593774771")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.cloneRulesCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • deleteAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> deleteAsync​(String project,
                                                                                                           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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           Operation response = networkFirewallPoliciesClient.deleteAsync(project, firewallPolicy).get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to delete.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> deleteAsync​(DeleteNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           DeleteNetworkFirewallPolicyRequest request =
               DeleteNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.deleteAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           DeleteNetworkFirewallPolicyRequest request =
               DeleteNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.deleteOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • deleteCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           DeleteNetworkFirewallPolicyRequest request =
               DeleteNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.deleteCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • get

        public final FirewallPolicy get​(String project,
                                        String firewallPolicy)
        Returns the specified network 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicy response = networkFirewallPoliciesClient.get(project, firewallPolicy);
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to get.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • get

        public final FirewallPolicy get​(GetNetworkFirewallPolicyRequest request)
        Returns the specified network 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetNetworkFirewallPolicyRequest request =
               GetNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .build();
           FirewallPolicy response = networkFirewallPoliciesClient.get(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetNetworkFirewallPolicyRequest,​FirewallPolicy> getCallable()
        Returns the specified network 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetNetworkFirewallPolicyRequest request =
               GetNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setProject("project-309310695")
                   .build();
           ApiFuture<FirewallPolicy> future =
               networkFirewallPoliciesClient.getCallable().futureCall(request);
           // Do something.
           FirewallPolicy response = future.get();
         }
         
      • getAssociation

        public final FirewallPolicyAssociation getAssociation​(String project,
                                                              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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicyAssociation response =
               networkFirewallPoliciesClient.getAssociation(project, firewallPolicy);
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to which the queried association belongs.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAssociation

        public final FirewallPolicyAssociation getAssociation​(GetAssociationNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetAssociationNetworkFirewallPolicyRequest request =
               GetAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setName("name3373707")
                   .setProject("project-309310695")
                   .build();
           FirewallPolicyAssociation response = networkFirewallPoliciesClient.getAssociation(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAssociationCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetAssociationNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetAssociationNetworkFirewallPolicyRequest request =
               GetAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setName("name3373707")
                   .setProject("project-309310695")
                   .build();
           ApiFuture<FirewallPolicyAssociation> future =
               networkFirewallPoliciesClient.getAssociationCallable().futureCall(request);
           // Do something.
           FirewallPolicyAssociation response = future.get();
         }
         
      • getIamPolicy

        public final Policy getIamPolicy​(String project,
                                         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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String resource = "resource-341064690";
           Policy response = networkFirewallPoliciesClient.getIamPolicy(project, resource);
         }
         
        Parameters:
        project - Project ID for this request.
        resource - Name or id of the resource for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicy

        public final Policy getIamPolicy​(GetIamPolicyNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetIamPolicyNetworkFirewallPolicyRequest request =
               GetIamPolicyNetworkFirewallPolicyRequest.newBuilder()
                   .setOptionsRequestedPolicyVersion(-574521795)
                   .setProject("project-309310695")
                   .setResource("resource-341064690")
                   .build();
           Policy response = networkFirewallPoliciesClient.getIamPolicy(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetIamPolicyNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetIamPolicyNetworkFirewallPolicyRequest request =
               GetIamPolicyNetworkFirewallPolicyRequest.newBuilder()
                   .setOptionsRequestedPolicyVersion(-574521795)
                   .setProject("project-309310695")
                   .setResource("resource-341064690")
                   .build();
           ApiFuture<Policy> future =
               networkFirewallPoliciesClient.getIamPolicyCallable().futureCall(request);
           // Do something.
           Policy response = future.get();
         }
         
      • getRule

        public final FirewallPolicyRule getRule​(String project,
                                                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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicyRule response = networkFirewallPoliciesClient.getRule(project, firewallPolicy);
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to which the queried rule belongs.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getRule

        public final FirewallPolicyRule getRule​(GetRuleNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetRuleNetworkFirewallPolicyRequest request =
               GetRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .build();
           FirewallPolicyRule response = networkFirewallPoliciesClient.getRule(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getRuleCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           GetRuleNetworkFirewallPolicyRequest request =
               GetRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .build();
           ApiFuture<FirewallPolicyRule> future =
               networkFirewallPoliciesClient.getRuleCallable().futureCall(request);
           // Do something.
           FirewallPolicyRule response = future.get();
         }
         
      • insertAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> insertAsync​(String project,
                                                                                                           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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           FirewallPolicy firewallPolicyResource = FirewallPolicy.newBuilder().build();
           Operation response =
               networkFirewallPoliciesClient.insertAsync(project, firewallPolicyResource).get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicyResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • insertAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> insertAsync​(InsertNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           InsertNetworkFirewallPolicyRequest request =
               InsertNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.insertAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • insertOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<InsertNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           InsertNetworkFirewallPolicyRequest request =
               InsertNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.insertOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • insertCallable

        public final com.google.api.gax.rpc.UnaryCallable<InsertNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           InsertNetworkFirewallPolicyRequest request =
               InsertNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.insertCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • list

        public final NetworkFirewallPoliciesClient.ListPagedResponse list​(String project)
        Lists all the policies that have been configured for the specified project.

        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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           for (FirewallPolicy element : networkFirewallPoliciesClient.list(project).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • list

        public final NetworkFirewallPoliciesClient.ListPagedResponse list​(ListNetworkFirewallPoliciesRequest request)
        Lists all the policies that have been configured for the specified project.

        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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           ListNetworkFirewallPoliciesRequest request =
               ListNetworkFirewallPoliciesRequest.newBuilder()
                   .setFilter("filter-1274492040")
                   .setMaxResults(1128457243)
                   .setOrderBy("orderBy-1207110587")
                   .setPageToken("pageToken873572522")
                   .setProject("project-309310695")
                   .setReturnPartialSuccess(true)
                   .build();
           for (FirewallPolicy element : networkFirewallPoliciesClient.list(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListNetworkFirewallPoliciesRequest,​NetworkFirewallPoliciesClient.ListPagedResponse> listPagedCallable()
        Lists all the policies that have been configured for the specified project.

        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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           ListNetworkFirewallPoliciesRequest request =
               ListNetworkFirewallPoliciesRequest.newBuilder()
                   .setFilter("filter-1274492040")
                   .setMaxResults(1128457243)
                   .setOrderBy("orderBy-1207110587")
                   .setPageToken("pageToken873572522")
                   .setProject("project-309310695")
                   .setReturnPartialSuccess(true)
                   .build();
           ApiFuture<FirewallPolicy> future =
               networkFirewallPoliciesClient.listPagedCallable().futureCall(request);
           // Do something.
           for (FirewallPolicy element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListNetworkFirewallPoliciesRequest,​FirewallPolicyList> listCallable()
        Lists all the policies that have been configured for the specified project.

        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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           ListNetworkFirewallPoliciesRequest request =
               ListNetworkFirewallPoliciesRequest.newBuilder()
                   .setFilter("filter-1274492040")
                   .setMaxResults(1128457243)
                   .setOrderBy("orderBy-1207110587")
                   .setPageToken("pageToken873572522")
                   .setProject("project-309310695")
                   .setReturnPartialSuccess(true)
                   .build();
           while (true) {
             FirewallPolicyList response = networkFirewallPoliciesClient.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;
             }
           }
         }
         
      • patchAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> patchAsync​(String project,
                                                                                                          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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicy firewallPolicyResource = FirewallPolicy.newBuilder().build();
           Operation response =
               networkFirewallPoliciesClient
                   .patchAsync(project, firewallPolicy, firewallPolicyResource)
                   .get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        firewallPolicyResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • patchAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> patchAsync​(PatchNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           PatchNetworkFirewallPolicyRequest request =
               PatchNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.patchAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • patchOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<PatchNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           PatchNetworkFirewallPolicyRequest request =
               PatchNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.patchOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • patchCallable

        public final com.google.api.gax.rpc.UnaryCallable<PatchNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           PatchNetworkFirewallPolicyRequest request =
               PatchNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyResource(FirewallPolicy.newBuilder().build())
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.patchCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • patchRuleAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> patchRuleAsync​(String project,
                                                                                                              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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           FirewallPolicyRule firewallPolicyRuleResource = FirewallPolicyRule.newBuilder().build();
           Operation response =
               networkFirewallPoliciesClient
                   .patchRuleAsync(project, firewallPolicy, firewallPolicyRuleResource)
                   .get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        firewallPolicyRuleResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • patchRuleAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> patchRuleAsync​(PatchRuleNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           PatchRuleNetworkFirewallPolicyRequest request =
               PatchRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.patchRuleAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • patchRuleOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<PatchRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           PatchRuleNetworkFirewallPolicyRequest request =
               PatchRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.patchRuleOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • patchRuleCallable

        public final com.google.api.gax.rpc.UnaryCallable<PatchRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           PatchRuleNetworkFirewallPolicyRequest request =
               PatchRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setFirewallPolicyRuleResource(FirewallPolicyRule.newBuilder().build())
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.patchRuleCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • removeAssociationAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> removeAssociationAsync​(String project,
                                                                                                                      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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           Operation response =
               networkFirewallPoliciesClient.removeAssociationAsync(project, firewallPolicy).get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeAssociationAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> removeAssociationAsync​(RemoveAssociationNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           RemoveAssociationNetworkFirewallPolicyRequest request =
               RemoveAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setName("name3373707")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.removeAssociationAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeAssociationOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<RemoveAssociationNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           RemoveAssociationNetworkFirewallPolicyRequest request =
               RemoveAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setName("name3373707")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.removeAssociationOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • removeAssociationCallable

        public final com.google.api.gax.rpc.UnaryCallable<RemoveAssociationNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           RemoveAssociationNetworkFirewallPolicyRequest request =
               RemoveAssociationNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setName("name3373707")
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.removeAssociationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • removeRuleAsync

        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> removeRuleAsync​(String project,
                                                                                                               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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String firewallPolicy = "firewallPolicy1819692626";
           Operation response =
               networkFirewallPoliciesClient.removeRuleAsync(project, firewallPolicy).get();
         }
         
        Parameters:
        project - Project ID for this request.
        firewallPolicy - Name of the firewall policy to update.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeRuleAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.OperationFuture<Operation,​Operation> removeRuleAsync​(RemoveRuleNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           RemoveRuleNetworkFirewallPolicyRequest request =
               RemoveRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           Operation response = networkFirewallPoliciesClient.removeRuleAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeRuleOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<RemoveRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           RemoveRuleNetworkFirewallPolicyRequest request =
               RemoveRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           OperationFuture<Operation, Operation> future =
               networkFirewallPoliciesClient.removeRuleOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • removeRuleCallable

        public final com.google.api.gax.rpc.UnaryCallable<RemoveRuleNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           RemoveRuleNetworkFirewallPolicyRequest request =
               RemoveRuleNetworkFirewallPolicyRequest.newBuilder()
                   .setFirewallPolicy("firewallPolicy1819692626")
                   .setPriority(-1165461084)
                   .setProject("project-309310695")
                   .setRequestId("requestId693933066")
                   .build();
           ApiFuture<Operation> future =
               networkFirewallPoliciesClient.removeRuleCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • setIamPolicy

        public final Policy setIamPolicy​(String project,
                                         String resource,
                                         GlobalSetPolicyRequest globalSetPolicyRequestResource)
        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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String resource = "resource-341064690";
           GlobalSetPolicyRequest globalSetPolicyRequestResource =
               GlobalSetPolicyRequest.newBuilder().build();
           Policy response =
               networkFirewallPoliciesClient.setIamPolicy(
                   project, resource, globalSetPolicyRequestResource);
         }
         
        Parameters:
        project - Project ID for this request.
        resource - Name or id of the resource for this request.
        globalSetPolicyRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicy

        public final Policy setIamPolicy​(SetIamPolicyNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           SetIamPolicyNetworkFirewallPolicyRequest request =
               SetIamPolicyNetworkFirewallPolicyRequest.newBuilder()
                   .setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
                   .setProject("project-309310695")
                   .setResource("resource-341064690")
                   .build();
           Policy response = networkFirewallPoliciesClient.setIamPolicy(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<SetIamPolicyNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           SetIamPolicyNetworkFirewallPolicyRequest request =
               SetIamPolicyNetworkFirewallPolicyRequest.newBuilder()
                   .setGlobalSetPolicyRequestResource(GlobalSetPolicyRequest.newBuilder().build())
                   .setProject("project-309310695")
                   .setResource("resource-341064690")
                   .build();
           ApiFuture<Policy> future =
               networkFirewallPoliciesClient.setIamPolicyCallable().futureCall(request);
           // Do something.
           Policy response = future.get();
         }
         
      • testIamPermissions

        public final TestPermissionsResponse testIamPermissions​(String project,
                                                                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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           String project = "project-309310695";
           String resource = "resource-341064690";
           TestPermissionsRequest testPermissionsRequestResource =
               TestPermissionsRequest.newBuilder().build();
           TestPermissionsResponse response =
               networkFirewallPoliciesClient.testIamPermissions(
                   project, resource, testPermissionsRequestResource);
         }
         
        Parameters:
        project - Project ID for this request.
        resource - Name or id of the resource for this request.
        testPermissionsRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissions

        public final TestPermissionsResponse testIamPermissions​(TestIamPermissionsNetworkFirewallPolicyRequest 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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           TestIamPermissionsNetworkFirewallPolicyRequest request =
               TestIamPermissionsNetworkFirewallPolicyRequest.newBuilder()
                   .setProject("project-309310695")
                   .setResource("resource-341064690")
                   .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
                   .build();
           TestPermissionsResponse response = networkFirewallPoliciesClient.testIamPermissions(request);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissionsCallable

        public final com.google.api.gax.rpc.UnaryCallable<TestIamPermissionsNetworkFirewallPolicyRequest,​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 (NetworkFirewallPoliciesClient networkFirewallPoliciesClient =
             NetworkFirewallPoliciesClient.create()) {
           TestIamPermissionsNetworkFirewallPolicyRequest request =
               TestIamPermissionsNetworkFirewallPolicyRequest.newBuilder()
                   .setProject("project-309310695")
                   .setResource("resource-341064690")
                   .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
                   .build();
           ApiFuture<TestPermissionsResponse> future =
               networkFirewallPoliciesClient.testIamPermissionsCallable().futureCall(request);
           // Do something.
           TestPermissionsResponse response = future.get();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource