Class NetworkSecurityClient

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

    @BetaApi
    @Generated("by gapic-generator-java")
    public class NetworkSecurityClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Network Security API provides resources to configure authentication and authorization policies. Refer to per API resource documentation for more information.

    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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
       AuthorizationPolicyName name =
           AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]");
       AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(name);
     }
     

    Note: close() needs to be called on the NetworkSecurityClient 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 NetworkSecuritySettings 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
     NetworkSecuritySettings networkSecuritySettings =
         NetworkSecuritySettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     NetworkSecurityClient networkSecurityClient =
         NetworkSecurityClient.create(networkSecuritySettings);
     

    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
     NetworkSecuritySettings networkSecuritySettings =
         NetworkSecuritySettings.newBuilder().setEndpoint(myEndpoint).build();
     NetworkSecurityClient networkSecurityClient =
         NetworkSecurityClient.create(networkSecuritySettings);
     

    To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:

    
     // This snippet has been automatically generated and should be regarded as a code template only.
     // It will require modifications to work:
     // - It may require correct/in-range values for request initialization.
     // - It may require specifying regional endpoints when creating the service client as shown in
     // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
     NetworkSecuritySettings networkSecuritySettings =
         NetworkSecuritySettings.newHttpJsonBuilder().build();
     NetworkSecurityClient networkSecurityClient =
         NetworkSecurityClient.create(networkSecuritySettings);
     

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

    • Constructor Detail

      • NetworkSecurityClient

        protected NetworkSecurityClient​(NetworkSecuritySettings settings)
                                 throws IOException
        Constructs an instance of NetworkSecurityClient, 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 NetworkSecurityClient create​(NetworkSecurityStub stub)
        Constructs an instance of NetworkSecurityClient, using the given stub for making calls. This is for advanced usage - prefer using create(NetworkSecuritySettings).
      • getOperationsClient

        public final com.google.longrunning.OperationsClient getOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • getHttpJsonOperationsClient

        @BetaApi
        public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • listAuthorizationPolicies

        public final NetworkSecurityClient.ListAuthorizationPoliciesPagedResponse listAuthorizationPolicies​(LocationName parent)
        Lists AuthorizationPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           for (AuthorizationPolicy element :
               networkSecurityClient.listAuthorizationPolicies(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project and location from which the AuthorizationPolicies should be listed, specified in the format `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listAuthorizationPolicies

        public final NetworkSecurityClient.ListAuthorizationPoliciesPagedResponse listAuthorizationPolicies​(String parent)
        Lists AuthorizationPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           for (AuthorizationPolicy element :
               networkSecurityClient.listAuthorizationPolicies(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project and location from which the AuthorizationPolicies should be listed, specified in the format `projects/{project}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listAuthorizationPolicies

        public final NetworkSecurityClient.ListAuthorizationPoliciesPagedResponse listAuthorizationPolicies​(ListAuthorizationPoliciesRequest request)
        Lists AuthorizationPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListAuthorizationPoliciesRequest request =
               ListAuthorizationPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (AuthorizationPolicy element :
               networkSecurityClient.listAuthorizationPolicies(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
      • listAuthorizationPoliciesPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListAuthorizationPoliciesRequest,​NetworkSecurityClient.ListAuthorizationPoliciesPagedResponse> listAuthorizationPoliciesPagedCallable()
        Lists AuthorizationPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListAuthorizationPoliciesRequest request =
               ListAuthorizationPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<AuthorizationPolicy> future =
               networkSecurityClient.listAuthorizationPoliciesPagedCallable().futureCall(request);
           // Do something.
           for (AuthorizationPolicy element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listAuthorizationPoliciesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListAuthorizationPoliciesRequest,​ListAuthorizationPoliciesResponse> listAuthorizationPoliciesCallable()
        Lists AuthorizationPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListAuthorizationPoliciesRequest request =
               ListAuthorizationPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListAuthorizationPoliciesResponse response =
                 networkSecurityClient.listAuthorizationPoliciesCallable().call(request);
             for (AuthorizationPolicy element : response.getAuthorizationPoliciesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getAuthorizationPolicy

        public final AuthorizationPolicy getAuthorizationPolicy​(AuthorizationPolicyName name)
        Gets details of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           AuthorizationPolicyName name =
               AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]");
           AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(name);
         }
         
        Parameters:
        name - Required. A name of the AuthorizationPolicy to get. Must be in the format `projects/{project}/locations/{location}/authorizationPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAuthorizationPolicy

        public final AuthorizationPolicy getAuthorizationPolicy​(String name)
        Gets details of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String name =
               AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                   .toString();
           AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(name);
         }
         
        Parameters:
        name - Required. A name of the AuthorizationPolicy to get. Must be in the format `projects/{project}/locations/{location}/authorizationPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getAuthorizationPolicy

        public final AuthorizationPolicy getAuthorizationPolicy​(GetAuthorizationPolicyRequest request)
        Gets details of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetAuthorizationPolicyRequest request =
               GetAuthorizationPolicyRequest.newBuilder()
                   .setName(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .build();
           AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(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
      • getAuthorizationPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetAuthorizationPolicyRequest,​AuthorizationPolicy> getAuthorizationPolicyCallable()
        Gets details of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetAuthorizationPolicyRequest request =
               GetAuthorizationPolicyRequest.newBuilder()
                   .setName(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .build();
           ApiFuture<AuthorizationPolicy> future =
               networkSecurityClient.getAuthorizationPolicyCallable().futureCall(request);
           // Do something.
           AuthorizationPolicy response = future.get();
         }
         
      • createAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<AuthorizationPolicy,​OperationMetadata> createAuthorizationPolicyAsync​(LocationName parent,
                                                                                                                                                AuthorizationPolicy authorizationPolicy,
                                                                                                                                                String authorizationPolicyId)
        Creates a new AuthorizationPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           AuthorizationPolicy authorizationPolicy = AuthorizationPolicy.newBuilder().build();
           String authorizationPolicyId = "authorizationPolicyId1314252166";
           AuthorizationPolicy response =
               networkSecurityClient
                   .createAuthorizationPolicyAsync(parent, authorizationPolicy, authorizationPolicyId)
                   .get();
         }
         
        Parameters:
        parent - Required. The parent resource of the AuthorizationPolicy. Must be in the format `projects/{project}/locations/{location}`.
        authorizationPolicy - Required. AuthorizationPolicy resource to be created.
        authorizationPolicyId - Required. Short name of the AuthorizationPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "authz_policy".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<AuthorizationPolicy,​OperationMetadata> createAuthorizationPolicyAsync​(String parent,
                                                                                                                                                AuthorizationPolicy authorizationPolicy,
                                                                                                                                                String authorizationPolicyId)
        Creates a new AuthorizationPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           AuthorizationPolicy authorizationPolicy = AuthorizationPolicy.newBuilder().build();
           String authorizationPolicyId = "authorizationPolicyId1314252166";
           AuthorizationPolicy response =
               networkSecurityClient
                   .createAuthorizationPolicyAsync(parent, authorizationPolicy, authorizationPolicyId)
                   .get();
         }
         
        Parameters:
        parent - Required. The parent resource of the AuthorizationPolicy. Must be in the format `projects/{project}/locations/{location}`.
        authorizationPolicy - Required. AuthorizationPolicy resource to be created.
        authorizationPolicyId - Required. Short name of the AuthorizationPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "authz_policy".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<AuthorizationPolicy,​OperationMetadata> createAuthorizationPolicyAsync​(CreateAuthorizationPolicyRequest request)
        Creates a new AuthorizationPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateAuthorizationPolicyRequest request =
               CreateAuthorizationPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setAuthorizationPolicyId("authorizationPolicyId1314252166")
                   .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
                   .build();
           AuthorizationPolicy response =
               networkSecurityClient.createAuthorizationPolicyAsync(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
      • createAuthorizationPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateAuthorizationPolicyRequest,​AuthorizationPolicy,​OperationMetadata> createAuthorizationPolicyOperationCallable()
        Creates a new AuthorizationPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateAuthorizationPolicyRequest request =
               CreateAuthorizationPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setAuthorizationPolicyId("authorizationPolicyId1314252166")
                   .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
                   .build();
           OperationFuture<AuthorizationPolicy, OperationMetadata> future =
               networkSecurityClient.createAuthorizationPolicyOperationCallable().futureCall(request);
           // Do something.
           AuthorizationPolicy response = future.get();
         }
         
      • createAuthorizationPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateAuthorizationPolicyRequest,​com.google.longrunning.Operation> createAuthorizationPolicyCallable()
        Creates a new AuthorizationPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateAuthorizationPolicyRequest request =
               CreateAuthorizationPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setAuthorizationPolicyId("authorizationPolicyId1314252166")
                   .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.createAuthorizationPolicyCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • updateAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<AuthorizationPolicy,​OperationMetadata> updateAuthorizationPolicyAsync​(AuthorizationPolicy authorizationPolicy,
                                                                                                                                                com.google.protobuf.FieldMask updateMask)
        Updates the parameters of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           AuthorizationPolicy authorizationPolicy = AuthorizationPolicy.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           AuthorizationPolicy response =
               networkSecurityClient
                   .updateAuthorizationPolicyAsync(authorizationPolicy, updateMask)
                   .get();
         }
         
        Parameters:
        authorizationPolicy - Required. Updated AuthorizationPolicy resource.
        updateMask - Optional. Field mask is used to specify the fields to be overwritten in the AuthorizationPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<AuthorizationPolicy,​OperationMetadata> updateAuthorizationPolicyAsync​(UpdateAuthorizationPolicyRequest request)
        Updates the parameters of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateAuthorizationPolicyRequest request =
               UpdateAuthorizationPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
                   .build();
           AuthorizationPolicy response =
               networkSecurityClient.updateAuthorizationPolicyAsync(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
      • updateAuthorizationPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdateAuthorizationPolicyRequest,​AuthorizationPolicy,​OperationMetadata> updateAuthorizationPolicyOperationCallable()
        Updates the parameters of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateAuthorizationPolicyRequest request =
               UpdateAuthorizationPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
                   .build();
           OperationFuture<AuthorizationPolicy, OperationMetadata> future =
               networkSecurityClient.updateAuthorizationPolicyOperationCallable().futureCall(request);
           // Do something.
           AuthorizationPolicy response = future.get();
         }
         
      • updateAuthorizationPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateAuthorizationPolicyRequest,​com.google.longrunning.Operation> updateAuthorizationPolicyCallable()
        Updates the parameters of a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateAuthorizationPolicyRequest request =
               UpdateAuthorizationPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.updateAuthorizationPolicyCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • deleteAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteAuthorizationPolicyAsync​(AuthorizationPolicyName name)
        Deletes a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           AuthorizationPolicyName name =
               AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]");
           networkSecurityClient.deleteAuthorizationPolicyAsync(name).get();
         }
         
        Parameters:
        name - Required. A name of the AuthorizationPolicy to delete. Must be in the format `projects/{project}/locations/{location}/authorizationPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteAuthorizationPolicyAsync​(String name)
        Deletes a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String name =
               AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                   .toString();
           networkSecurityClient.deleteAuthorizationPolicyAsync(name).get();
         }
         
        Parameters:
        name - Required. A name of the AuthorizationPolicy to delete. Must be in the format `projects/{project}/locations/{location}/authorizationPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAuthorizationPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteAuthorizationPolicyAsync​(DeleteAuthorizationPolicyRequest request)
        Deletes a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteAuthorizationPolicyRequest request =
               DeleteAuthorizationPolicyRequest.newBuilder()
                   .setName(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .build();
           networkSecurityClient.deleteAuthorizationPolicyAsync(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
      • deleteAuthorizationPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteAuthorizationPolicyRequest,​com.google.protobuf.Empty,​OperationMetadata> deleteAuthorizationPolicyOperationCallable()
        Deletes a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteAuthorizationPolicyRequest request =
               DeleteAuthorizationPolicyRequest.newBuilder()
                   .setName(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .build();
           OperationFuture<Empty, OperationMetadata> future =
               networkSecurityClient.deleteAuthorizationPolicyOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • deleteAuthorizationPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteAuthorizationPolicyRequest,​com.google.longrunning.Operation> deleteAuthorizationPolicyCallable()
        Deletes a single AuthorizationPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteAuthorizationPolicyRequest request =
               DeleteAuthorizationPolicyRequest.newBuilder()
                   .setName(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.deleteAuthorizationPolicyCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • listServerTlsPolicies

        public final NetworkSecurityClient.ListServerTlsPoliciesPagedResponse listServerTlsPolicies​(LocationName parent)
        Lists ServerTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           for (ServerTlsPolicy element :
               networkSecurityClient.listServerTlsPolicies(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project and location from which the ServerTlsPolicies should be listed, specified in the format `projects/*/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listServerTlsPolicies

        public final NetworkSecurityClient.ListServerTlsPoliciesPagedResponse listServerTlsPolicies​(String parent)
        Lists ServerTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           for (ServerTlsPolicy element :
               networkSecurityClient.listServerTlsPolicies(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project and location from which the ServerTlsPolicies should be listed, specified in the format `projects/*/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listServerTlsPolicies

        public final NetworkSecurityClient.ListServerTlsPoliciesPagedResponse listServerTlsPolicies​(ListServerTlsPoliciesRequest request)
        Lists ServerTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListServerTlsPoliciesRequest request =
               ListServerTlsPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (ServerTlsPolicy element :
               networkSecurityClient.listServerTlsPolicies(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
      • listServerTlsPoliciesPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListServerTlsPoliciesRequest,​NetworkSecurityClient.ListServerTlsPoliciesPagedResponse> listServerTlsPoliciesPagedCallable()
        Lists ServerTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListServerTlsPoliciesRequest request =
               ListServerTlsPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<ServerTlsPolicy> future =
               networkSecurityClient.listServerTlsPoliciesPagedCallable().futureCall(request);
           // Do something.
           for (ServerTlsPolicy element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listServerTlsPoliciesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListServerTlsPoliciesRequest,​ListServerTlsPoliciesResponse> listServerTlsPoliciesCallable()
        Lists ServerTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListServerTlsPoliciesRequest request =
               ListServerTlsPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListServerTlsPoliciesResponse response =
                 networkSecurityClient.listServerTlsPoliciesCallable().call(request);
             for (ServerTlsPolicy element : response.getServerTlsPoliciesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getServerTlsPolicy

        public final ServerTlsPolicy getServerTlsPolicy​(ServerTlsPolicyName name)
        Gets details of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ServerTlsPolicyName name =
               ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]");
           ServerTlsPolicy response = networkSecurityClient.getServerTlsPolicy(name);
         }
         
        Parameters:
        name - Required. A name of the ServerTlsPolicy to get. Must be in the format `projects/*/locations/{location}/serverTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getServerTlsPolicy

        public final ServerTlsPolicy getServerTlsPolicy​(String name)
        Gets details of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String name =
               ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]").toString();
           ServerTlsPolicy response = networkSecurityClient.getServerTlsPolicy(name);
         }
         
        Parameters:
        name - Required. A name of the ServerTlsPolicy to get. Must be in the format `projects/*/locations/{location}/serverTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getServerTlsPolicy

        public final ServerTlsPolicy getServerTlsPolicy​(GetServerTlsPolicyRequest request)
        Gets details of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetServerTlsPolicyRequest request =
               GetServerTlsPolicyRequest.newBuilder()
                   .setName(
                       ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]")
                           .toString())
                   .build();
           ServerTlsPolicy response = networkSecurityClient.getServerTlsPolicy(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
      • getServerTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetServerTlsPolicyRequest,​ServerTlsPolicy> getServerTlsPolicyCallable()
        Gets details of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetServerTlsPolicyRequest request =
               GetServerTlsPolicyRequest.newBuilder()
                   .setName(
                       ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]")
                           .toString())
                   .build();
           ApiFuture<ServerTlsPolicy> future =
               networkSecurityClient.getServerTlsPolicyCallable().futureCall(request);
           // Do something.
           ServerTlsPolicy response = future.get();
         }
         
      • createServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ServerTlsPolicy,​OperationMetadata> createServerTlsPolicyAsync​(LocationName parent,
                                                                                                                                        ServerTlsPolicy serverTlsPolicy,
                                                                                                                                        String serverTlsPolicyId)
        Creates a new ServerTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           ServerTlsPolicy serverTlsPolicy = ServerTlsPolicy.newBuilder().build();
           String serverTlsPolicyId = "serverTlsPolicyId-1966046011";
           ServerTlsPolicy response =
               networkSecurityClient
                   .createServerTlsPolicyAsync(parent, serverTlsPolicy, serverTlsPolicyId)
                   .get();
         }
         
        Parameters:
        parent - Required. The parent resource of the ServerTlsPolicy. Must be in the format `projects/*/locations/{location}`.
        serverTlsPolicy - Required. ServerTlsPolicy resource to be created.
        serverTlsPolicyId - Required. Short name of the ServerTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "server_mtls_policy".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ServerTlsPolicy,​OperationMetadata> createServerTlsPolicyAsync​(String parent,
                                                                                                                                        ServerTlsPolicy serverTlsPolicy,
                                                                                                                                        String serverTlsPolicyId)
        Creates a new ServerTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           ServerTlsPolicy serverTlsPolicy = ServerTlsPolicy.newBuilder().build();
           String serverTlsPolicyId = "serverTlsPolicyId-1966046011";
           ServerTlsPolicy response =
               networkSecurityClient
                   .createServerTlsPolicyAsync(parent, serverTlsPolicy, serverTlsPolicyId)
                   .get();
         }
         
        Parameters:
        parent - Required. The parent resource of the ServerTlsPolicy. Must be in the format `projects/*/locations/{location}`.
        serverTlsPolicy - Required. ServerTlsPolicy resource to be created.
        serverTlsPolicyId - Required. Short name of the ServerTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "server_mtls_policy".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ServerTlsPolicy,​OperationMetadata> createServerTlsPolicyAsync​(CreateServerTlsPolicyRequest request)
        Creates a new ServerTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateServerTlsPolicyRequest request =
               CreateServerTlsPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setServerTlsPolicyId("serverTlsPolicyId-1966046011")
                   .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
                   .build();
           ServerTlsPolicy response = networkSecurityClient.createServerTlsPolicyAsync(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
      • createServerTlsPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateServerTlsPolicyRequest,​ServerTlsPolicy,​OperationMetadata> createServerTlsPolicyOperationCallable()
        Creates a new ServerTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateServerTlsPolicyRequest request =
               CreateServerTlsPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setServerTlsPolicyId("serverTlsPolicyId-1966046011")
                   .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
                   .build();
           OperationFuture<ServerTlsPolicy, OperationMetadata> future =
               networkSecurityClient.createServerTlsPolicyOperationCallable().futureCall(request);
           // Do something.
           ServerTlsPolicy response = future.get();
         }
         
      • createServerTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateServerTlsPolicyRequest,​com.google.longrunning.Operation> createServerTlsPolicyCallable()
        Creates a new ServerTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateServerTlsPolicyRequest request =
               CreateServerTlsPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setServerTlsPolicyId("serverTlsPolicyId-1966046011")
                   .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.createServerTlsPolicyCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • updateServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ServerTlsPolicy,​OperationMetadata> updateServerTlsPolicyAsync​(ServerTlsPolicy serverTlsPolicy,
                                                                                                                                        com.google.protobuf.FieldMask updateMask)
        Updates the parameters of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ServerTlsPolicy serverTlsPolicy = ServerTlsPolicy.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           ServerTlsPolicy response =
               networkSecurityClient.updateServerTlsPolicyAsync(serverTlsPolicy, updateMask).get();
         }
         
        Parameters:
        serverTlsPolicy - Required. Updated ServerTlsPolicy resource.
        updateMask - Optional. Field mask is used to specify the fields to be overwritten in the ServerTlsPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ServerTlsPolicy,​OperationMetadata> updateServerTlsPolicyAsync​(UpdateServerTlsPolicyRequest request)
        Updates the parameters of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateServerTlsPolicyRequest request =
               UpdateServerTlsPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
                   .build();
           ServerTlsPolicy response = networkSecurityClient.updateServerTlsPolicyAsync(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
      • updateServerTlsPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdateServerTlsPolicyRequest,​ServerTlsPolicy,​OperationMetadata> updateServerTlsPolicyOperationCallable()
        Updates the parameters of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateServerTlsPolicyRequest request =
               UpdateServerTlsPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
                   .build();
           OperationFuture<ServerTlsPolicy, OperationMetadata> future =
               networkSecurityClient.updateServerTlsPolicyOperationCallable().futureCall(request);
           // Do something.
           ServerTlsPolicy response = future.get();
         }
         
      • updateServerTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateServerTlsPolicyRequest,​com.google.longrunning.Operation> updateServerTlsPolicyCallable()
        Updates the parameters of a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateServerTlsPolicyRequest request =
               UpdateServerTlsPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.updateServerTlsPolicyCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • deleteServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteServerTlsPolicyAsync​(ServerTlsPolicyName name)
        Deletes a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ServerTlsPolicyName name =
               ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]");
           networkSecurityClient.deleteServerTlsPolicyAsync(name).get();
         }
         
        Parameters:
        name - Required. A name of the ServerTlsPolicy to delete. Must be in the format `projects/*/locations/{location}/serverTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteServerTlsPolicyAsync​(String name)
        Deletes a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String name =
               ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]").toString();
           networkSecurityClient.deleteServerTlsPolicyAsync(name).get();
         }
         
        Parameters:
        name - Required. A name of the ServerTlsPolicy to delete. Must be in the format `projects/*/locations/{location}/serverTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteServerTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteServerTlsPolicyAsync​(DeleteServerTlsPolicyRequest request)
        Deletes a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteServerTlsPolicyRequest request =
               DeleteServerTlsPolicyRequest.newBuilder()
                   .setName(
                       ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]")
                           .toString())
                   .build();
           networkSecurityClient.deleteServerTlsPolicyAsync(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
      • deleteServerTlsPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteServerTlsPolicyRequest,​com.google.protobuf.Empty,​OperationMetadata> deleteServerTlsPolicyOperationCallable()
        Deletes a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteServerTlsPolicyRequest request =
               DeleteServerTlsPolicyRequest.newBuilder()
                   .setName(
                       ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]")
                           .toString())
                   .build();
           OperationFuture<Empty, OperationMetadata> future =
               networkSecurityClient.deleteServerTlsPolicyOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • deleteServerTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteServerTlsPolicyRequest,​com.google.longrunning.Operation> deleteServerTlsPolicyCallable()
        Deletes a single ServerTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteServerTlsPolicyRequest request =
               DeleteServerTlsPolicyRequest.newBuilder()
                   .setName(
                       ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]")
                           .toString())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.deleteServerTlsPolicyCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • listClientTlsPolicies

        public final NetworkSecurityClient.ListClientTlsPoliciesPagedResponse listClientTlsPolicies​(LocationName parent)
        Lists ClientTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           for (ClientTlsPolicy element :
               networkSecurityClient.listClientTlsPolicies(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project and location from which the ClientTlsPolicies should be listed, specified in the format `projects/*/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listClientTlsPolicies

        public final NetworkSecurityClient.ListClientTlsPoliciesPagedResponse listClientTlsPolicies​(String parent)
        Lists ClientTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           for (ClientTlsPolicy element :
               networkSecurityClient.listClientTlsPolicies(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. The project and location from which the ClientTlsPolicies should be listed, specified in the format `projects/*/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listClientTlsPolicies

        public final NetworkSecurityClient.ListClientTlsPoliciesPagedResponse listClientTlsPolicies​(ListClientTlsPoliciesRequest request)
        Lists ClientTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListClientTlsPoliciesRequest request =
               ListClientTlsPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (ClientTlsPolicy element :
               networkSecurityClient.listClientTlsPolicies(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
      • listClientTlsPoliciesPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListClientTlsPoliciesRequest,​NetworkSecurityClient.ListClientTlsPoliciesPagedResponse> listClientTlsPoliciesPagedCallable()
        Lists ClientTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListClientTlsPoliciesRequest request =
               ListClientTlsPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<ClientTlsPolicy> future =
               networkSecurityClient.listClientTlsPoliciesPagedCallable().futureCall(request);
           // Do something.
           for (ClientTlsPolicy element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listClientTlsPoliciesCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListClientTlsPoliciesRequest,​ListClientTlsPoliciesResponse> listClientTlsPoliciesCallable()
        Lists ClientTlsPolicies in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListClientTlsPoliciesRequest request =
               ListClientTlsPoliciesRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListClientTlsPoliciesResponse response =
                 networkSecurityClient.listClientTlsPoliciesCallable().call(request);
             for (ClientTlsPolicy element : response.getClientTlsPoliciesList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getClientTlsPolicy

        public final ClientTlsPolicy getClientTlsPolicy​(ClientTlsPolicyName name)
        Gets details of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ClientTlsPolicyName name =
               ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]");
           ClientTlsPolicy response = networkSecurityClient.getClientTlsPolicy(name);
         }
         
        Parameters:
        name - Required. A name of the ClientTlsPolicy to get. Must be in the format `projects/*/locations/{location}/clientTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getClientTlsPolicy

        public final ClientTlsPolicy getClientTlsPolicy​(String name)
        Gets details of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String name =
               ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]").toString();
           ClientTlsPolicy response = networkSecurityClient.getClientTlsPolicy(name);
         }
         
        Parameters:
        name - Required. A name of the ClientTlsPolicy to get. Must be in the format `projects/*/locations/{location}/clientTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getClientTlsPolicy

        public final ClientTlsPolicy getClientTlsPolicy​(GetClientTlsPolicyRequest request)
        Gets details of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetClientTlsPolicyRequest request =
               GetClientTlsPolicyRequest.newBuilder()
                   .setName(
                       ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]")
                           .toString())
                   .build();
           ClientTlsPolicy response = networkSecurityClient.getClientTlsPolicy(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
      • getClientTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetClientTlsPolicyRequest,​ClientTlsPolicy> getClientTlsPolicyCallable()
        Gets details of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetClientTlsPolicyRequest request =
               GetClientTlsPolicyRequest.newBuilder()
                   .setName(
                       ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]")
                           .toString())
                   .build();
           ApiFuture<ClientTlsPolicy> future =
               networkSecurityClient.getClientTlsPolicyCallable().futureCall(request);
           // Do something.
           ClientTlsPolicy response = future.get();
         }
         
      • createClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ClientTlsPolicy,​OperationMetadata> createClientTlsPolicyAsync​(LocationName parent,
                                                                                                                                        ClientTlsPolicy clientTlsPolicy,
                                                                                                                                        String clientTlsPolicyId)
        Creates a new ClientTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
           ClientTlsPolicy clientTlsPolicy = ClientTlsPolicy.newBuilder().build();
           String clientTlsPolicyId = "clientTlsPolicyId-188933315";
           ClientTlsPolicy response =
               networkSecurityClient
                   .createClientTlsPolicyAsync(parent, clientTlsPolicy, clientTlsPolicyId)
                   .get();
         }
         
        Parameters:
        parent - Required. The parent resource of the ClientTlsPolicy. Must be in the format `projects/*/locations/{location}`.
        clientTlsPolicy - Required. ClientTlsPolicy resource to be created.
        clientTlsPolicyId - Required. Short name of the ClientTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "client_mtls_policy".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ClientTlsPolicy,​OperationMetadata> createClientTlsPolicyAsync​(String parent,
                                                                                                                                        ClientTlsPolicy clientTlsPolicy,
                                                                                                                                        String clientTlsPolicyId)
        Creates a new ClientTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
           ClientTlsPolicy clientTlsPolicy = ClientTlsPolicy.newBuilder().build();
           String clientTlsPolicyId = "clientTlsPolicyId-188933315";
           ClientTlsPolicy response =
               networkSecurityClient
                   .createClientTlsPolicyAsync(parent, clientTlsPolicy, clientTlsPolicyId)
                   .get();
         }
         
        Parameters:
        parent - Required. The parent resource of the ClientTlsPolicy. Must be in the format `projects/*/locations/{location}`.
        clientTlsPolicy - Required. ClientTlsPolicy resource to be created.
        clientTlsPolicyId - Required. Short name of the ClientTlsPolicy resource to be created. This value should be 1-63 characters long, containing only letters, numbers, hyphens, and underscores, and should not start with a number. E.g. "client_mtls_policy".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ClientTlsPolicy,​OperationMetadata> createClientTlsPolicyAsync​(CreateClientTlsPolicyRequest request)
        Creates a new ClientTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateClientTlsPolicyRequest request =
               CreateClientTlsPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setClientTlsPolicyId("clientTlsPolicyId-188933315")
                   .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
                   .build();
           ClientTlsPolicy response = networkSecurityClient.createClientTlsPolicyAsync(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
      • createClientTlsPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateClientTlsPolicyRequest,​ClientTlsPolicy,​OperationMetadata> createClientTlsPolicyOperationCallable()
        Creates a new ClientTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateClientTlsPolicyRequest request =
               CreateClientTlsPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setClientTlsPolicyId("clientTlsPolicyId-188933315")
                   .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
                   .build();
           OperationFuture<ClientTlsPolicy, OperationMetadata> future =
               networkSecurityClient.createClientTlsPolicyOperationCallable().futureCall(request);
           // Do something.
           ClientTlsPolicy response = future.get();
         }
         
      • createClientTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateClientTlsPolicyRequest,​com.google.longrunning.Operation> createClientTlsPolicyCallable()
        Creates a new ClientTlsPolicy in a given project and location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           CreateClientTlsPolicyRequest request =
               CreateClientTlsPolicyRequest.newBuilder()
                   .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                   .setClientTlsPolicyId("clientTlsPolicyId-188933315")
                   .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.createClientTlsPolicyCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • updateClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ClientTlsPolicy,​OperationMetadata> updateClientTlsPolicyAsync​(ClientTlsPolicy clientTlsPolicy,
                                                                                                                                        com.google.protobuf.FieldMask updateMask)
        Updates the parameters of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ClientTlsPolicy clientTlsPolicy = ClientTlsPolicy.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           ClientTlsPolicy response =
               networkSecurityClient.updateClientTlsPolicyAsync(clientTlsPolicy, updateMask).get();
         }
         
        Parameters:
        clientTlsPolicy - Required. Updated ClientTlsPolicy resource.
        updateMask - Optional. Field mask is used to specify the fields to be overwritten in the ClientTlsPolicy resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<ClientTlsPolicy,​OperationMetadata> updateClientTlsPolicyAsync​(UpdateClientTlsPolicyRequest request)
        Updates the parameters of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateClientTlsPolicyRequest request =
               UpdateClientTlsPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
                   .build();
           ClientTlsPolicy response = networkSecurityClient.updateClientTlsPolicyAsync(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
      • updateClientTlsPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<UpdateClientTlsPolicyRequest,​ClientTlsPolicy,​OperationMetadata> updateClientTlsPolicyOperationCallable()
        Updates the parameters of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateClientTlsPolicyRequest request =
               UpdateClientTlsPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
                   .build();
           OperationFuture<ClientTlsPolicy, OperationMetadata> future =
               networkSecurityClient.updateClientTlsPolicyOperationCallable().futureCall(request);
           // Do something.
           ClientTlsPolicy response = future.get();
         }
         
      • updateClientTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateClientTlsPolicyRequest,​com.google.longrunning.Operation> updateClientTlsPolicyCallable()
        Updates the parameters of a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           UpdateClientTlsPolicyRequest request =
               UpdateClientTlsPolicyRequest.newBuilder()
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.updateClientTlsPolicyCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • deleteClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteClientTlsPolicyAsync​(ClientTlsPolicyName name)
        Deletes a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ClientTlsPolicyName name =
               ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]");
           networkSecurityClient.deleteClientTlsPolicyAsync(name).get();
         }
         
        Parameters:
        name - Required. A name of the ClientTlsPolicy to delete. Must be in the format `projects/*/locations/{location}/clientTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteClientTlsPolicyAsync​(String name)
        Deletes a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           String name =
               ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]").toString();
           networkSecurityClient.deleteClientTlsPolicyAsync(name).get();
         }
         
        Parameters:
        name - Required. A name of the ClientTlsPolicy to delete. Must be in the format `projects/*/locations/{location}/clientTlsPolicies/*`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteClientTlsPolicyAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​OperationMetadata> deleteClientTlsPolicyAsync​(DeleteClientTlsPolicyRequest request)
        Deletes a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteClientTlsPolicyRequest request =
               DeleteClientTlsPolicyRequest.newBuilder()
                   .setName(
                       ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]")
                           .toString())
                   .build();
           networkSecurityClient.deleteClientTlsPolicyAsync(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
      • deleteClientTlsPolicyOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<DeleteClientTlsPolicyRequest,​com.google.protobuf.Empty,​OperationMetadata> deleteClientTlsPolicyOperationCallable()
        Deletes a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteClientTlsPolicyRequest request =
               DeleteClientTlsPolicyRequest.newBuilder()
                   .setName(
                       ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]")
                           .toString())
                   .build();
           OperationFuture<Empty, OperationMetadata> future =
               networkSecurityClient.deleteClientTlsPolicyOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • deleteClientTlsPolicyCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteClientTlsPolicyRequest,​com.google.longrunning.Operation> deleteClientTlsPolicyCallable()
        Deletes a single ClientTlsPolicy.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           DeleteClientTlsPolicyRequest request =
               DeleteClientTlsPolicyRequest.newBuilder()
                   .setName(
                       ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]")
                           .toString())
                   .build();
           ApiFuture<Operation> future =
               networkSecurityClient.deleteClientTlsPolicyCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • listLocations

        public final NetworkSecurityClient.ListLocationsPagedResponse listLocations​(com.google.cloud.location.ListLocationsRequest request)
        Lists information about the supported locations for this service.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           for (Location element : networkSecurityClient.listLocations(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
      • listLocationsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​NetworkSecurityClient.ListLocationsPagedResponse> listLocationsPagedCallable()
        Lists information about the supported locations for this service.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           ApiFuture<Location> future =
               networkSecurityClient.listLocationsPagedCallable().futureCall(request);
           // Do something.
           for (Location element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listLocationsCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,​com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
        Lists information about the supported locations for this service.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           ListLocationsRequest request =
               ListLocationsRequest.newBuilder()
                   .setName("name3373707")
                   .setFilter("filter-1274492040")
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .build();
           while (true) {
             ListLocationsResponse response =
                 networkSecurityClient.listLocationsCallable().call(request);
             for (Location element : response.getLocationsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • getLocation

        public final com.google.cloud.location.Location getLocation​(com.google.cloud.location.GetLocationRequest request)
        Gets information about a location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           Location response = networkSecurityClient.getLocation(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
      • getLocationCallable

        public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,​com.google.cloud.location.Location> getLocationCallable()
        Gets information about a location.

        Sample code:

        
         // This snippet has been automatically generated and should be regarded as a code template only.
         // It will require modifications to work:
         // - It may require correct/in-range values for request initialization.
         // - It may require specifying regional endpoints when creating the service client as shown in
         // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
         try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
           ApiFuture<Location> future = networkSecurityClient.getLocationCallable().futureCall(request);
           // Do something.
           Location response = future.get();
         }
         
      • setIamPolicy

        public final com.google.iam.v1.Policy setIamPolicy​(com.google.iam.v1.SetIamPolicyRequest request)
        Sets the access control policy on the specified resource. Replacesany existing policy.

        Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           SetIamPolicyRequest request =
               SetIamPolicyRequest.newBuilder()
                   .setResource(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .setPolicy(Policy.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Policy response = networkSecurityClient.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<com.google.iam.v1.SetIamPolicyRequest,​com.google.iam.v1.Policy> setIamPolicyCallable()
        Sets the access control policy on the specified resource. Replacesany existing policy.

        Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           SetIamPolicyRequest request =
               SetIamPolicyRequest.newBuilder()
                   .setResource(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .setPolicy(Policy.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Policy> future = networkSecurityClient.setIamPolicyCallable().futureCall(request);
           // Do something.
           Policy response = future.get();
         }
         
      • getIamPolicy

        public final com.google.iam.v1.Policy getIamPolicy​(com.google.iam.v1.GetIamPolicyRequest request)
        Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetIamPolicyRequest request =
               GetIamPolicyRequest.newBuilder()
                   .setResource(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .setOptions(GetPolicyOptions.newBuilder().build())
                   .build();
           Policy response = networkSecurityClient.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<com.google.iam.v1.GetIamPolicyRequest,​com.google.iam.v1.Policy> getIamPolicyCallable()
        Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           GetIamPolicyRequest request =
               GetIamPolicyRequest.newBuilder()
                   .setResource(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .setOptions(GetPolicyOptions.newBuilder().build())
                   .build();
           ApiFuture<Policy> future = networkSecurityClient.getIamPolicyCallable().futureCall(request);
           // Do something.
           Policy response = future.get();
         }
         
      • testIamPermissions

        public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions​(com.google.iam.v1.TestIamPermissionsRequest request)
        Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.

        Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           TestIamPermissionsRequest request =
               TestIamPermissionsRequest.newBuilder()
                   .setResource(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .addAllPermissions(new ArrayList<String>())
                   .build();
           TestIamPermissionsResponse response = networkSecurityClient.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<com.google.iam.v1.TestIamPermissionsRequest,​com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
        Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.

        Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.

        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 (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
           TestIamPermissionsRequest request =
               TestIamPermissionsRequest.newBuilder()
                   .setResource(
                       AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                           .toString())
                   .addAllPermissions(new ArrayList<String>())
                   .build();
           ApiFuture<TestIamPermissionsResponse> future =
               networkSecurityClient.testIamPermissionsCallable().futureCall(request);
           // Do something.
           TestIamPermissionsResponse 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