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: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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: + * + *
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: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * NetworkSecuritySettings networkSecuritySettings = + * NetworkSecuritySettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * NetworkSecurityClient networkSecurityClient = + * NetworkSecurityClient.create(networkSecuritySettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * NetworkSecuritySettings networkSecuritySettings = + * NetworkSecuritySettings.newBuilder().setEndpoint(myEndpoint).build(); + * NetworkSecurityClient networkSecurityClient = + * NetworkSecurityClient.create(networkSecuritySettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class NetworkSecurityClient implements BackgroundResource { + private final NetworkSecuritySettings settings; + private final NetworkSecurityStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of NetworkSecurityClient with default settings. */ + public static final NetworkSecurityClient create() throws IOException { + return create(NetworkSecuritySettings.newBuilder().build()); + } + + /** + * Constructs an instance of NetworkSecurityClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final NetworkSecurityClient create(NetworkSecuritySettings settings) + throws IOException { + return new NetworkSecurityClient(settings); + } + + /** + * Constructs an instance of NetworkSecurityClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(NetworkSecuritySettings). + */ + public static final NetworkSecurityClient create(NetworkSecurityStub stub) { + return new NetworkSecurityClient(stub); + } + + /** + * 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. + */ + protected NetworkSecurityClient(NetworkSecuritySettings settings) throws IOException { + this.settings = settings; + this.stub = ((NetworkSecurityStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + protected NetworkSecurityClient(NetworkSecurityStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final NetworkSecuritySettings getSettings() { + return settings; + } + + public NetworkSecurityStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists AuthorizationPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (AuthorizationPolicy element : + * networkSecurityClient.listAuthorizationPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListAuthorizationPoliciesPagedResponse listAuthorizationPolicies( + LocationName parent) { + ListAuthorizationPoliciesRequest request = + ListAuthorizationPoliciesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listAuthorizationPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists AuthorizationPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (AuthorizationPolicy element : + * networkSecurityClient.listAuthorizationPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListAuthorizationPoliciesPagedResponse listAuthorizationPolicies(String parent) { + ListAuthorizationPoliciesRequest request = + ListAuthorizationPoliciesRequest.newBuilder().setParent(parent).build(); + return listAuthorizationPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists AuthorizationPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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); + * } + * } + * }+ * + * @param 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 + */ + public final ListAuthorizationPoliciesPagedResponse listAuthorizationPolicies( + ListAuthorizationPoliciesRequest request) { + return listAuthorizationPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists AuthorizationPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ListAuthorizationPoliciesRequest request = + * ListAuthorizationPoliciesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallable< + ListAuthorizationPoliciesRequest, ListAuthorizationPoliciesPagedResponse> + listAuthorizationPoliciesPagedCallable() { + return stub.listAuthorizationPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists AuthorizationPolicies in a given project and location. + * + *future = + * networkSecurityClient.listAuthorizationPoliciesPagedCallable().futureCall(request); + * // Do something. + * for (AuthorizationPolicy element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * AuthorizationPolicyName name = + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]"); + * AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(name); + * } + * }+ * + * @param 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 + */ + public final AuthorizationPolicy getAuthorizationPolicy(AuthorizationPolicyName name) { + GetAuthorizationPolicyRequest request = + GetAuthorizationPolicyRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getAuthorizationPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single AuthorizationPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String name = + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString(); + * AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(name); + * } + * }+ * + * @param 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 + */ + public final AuthorizationPolicy getAuthorizationPolicy(String name) { + GetAuthorizationPolicyRequest request = + GetAuthorizationPolicyRequest.newBuilder().setName(name).build(); + return getAuthorizationPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single AuthorizationPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * GetAuthorizationPolicyRequest request = + * GetAuthorizationPolicyRequest.newBuilder() + * .setName( + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString()) + * .build(); + * AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(request); + * } + * }+ * + * @param 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 + */ + public final AuthorizationPolicy getAuthorizationPolicy(GetAuthorizationPolicyRequest request) { + return getAuthorizationPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single AuthorizationPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * GetAuthorizationPolicyRequest request = + * GetAuthorizationPolicyRequest.newBuilder() + * .setName( + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.getAuthorizationPolicyCallable().futureCall(request); + * // Do something. + * AuthorizationPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param parent Required. The parent resource of the AuthorizationPolicy. Must be in the format + * `projects/{project}/locations/{location}`. + * @param authorizationPolicy Required. AuthorizationPolicy resource to be created. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param parent Required. The parent resource of the AuthorizationPolicy. Must be in the format + * `projects/{project}/locations/{location}`. + * @param authorizationPolicy Required. AuthorizationPolicy resource to be created. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * CreateAuthorizationPolicyRequest request = + * CreateAuthorizationPolicyRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setAuthorizationPolicyId("authorizationPolicyId1314252166") + * .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build()) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + CreateAuthorizationPolicyRequest, AuthorizationPolicy, OperationMetadata> + createAuthorizationPolicyOperationCallable() { + return stub.createAuthorizationPolicyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new AuthorizationPolicy in a given project and location. + * + *future = + * networkSecurityClient.createAuthorizationPolicyOperationCallable().futureCall(request); + * // Do something. + * AuthorizationPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * CreateAuthorizationPolicyRequest request = + * CreateAuthorizationPolicyRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setAuthorizationPolicyId("authorizationPolicyId1314252166") + * .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.createAuthorizationPolicyCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * AuthorizationPolicy authorizationPolicy = AuthorizationPolicy.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * AuthorizationPolicy response = + * networkSecurityClient + * .updateAuthorizationPolicyAsync(authorizationPolicy, updateMask) + * .get(); + * } + * }+ * + * @param authorizationPolicy Required. Updated AuthorizationPolicy resource. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateAuthorizationPolicyRequest request = + * UpdateAuthorizationPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build()) + * .build(); + * AuthorizationPolicy response = + * networkSecurityClient.updateAuthorizationPolicyAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateAuthorizationPolicyRequest request = + * UpdateAuthorizationPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build()) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + UpdateAuthorizationPolicyRequest, AuthorizationPolicy, OperationMetadata> + updateAuthorizationPolicyOperationCallable() { + return stub.updateAuthorizationPolicyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the parameters of a single AuthorizationPolicy. + * + *future = + * networkSecurityClient.updateAuthorizationPolicyOperationCallable().futureCall(request); + * // Do something. + * AuthorizationPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateAuthorizationPolicyRequest request = + * UpdateAuthorizationPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setAuthorizationPolicy(AuthorizationPolicy.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.updateAuthorizationPolicyCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * AuthorizationPolicyName name = + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]"); + * networkSecurityClient.deleteAuthorizationPolicyAsync(name).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String name = + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString(); + * networkSecurityClient.deleteAuthorizationPolicyAsync(name).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteAuthorizationPolicyRequest request = + * DeleteAuthorizationPolicyRequest.newBuilder() + * .setName( + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString()) + * .build(); + * networkSecurityClient.deleteAuthorizationPolicyAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteAuthorizationPolicyRequest request = + * DeleteAuthorizationPolicyRequest.newBuilder() + * .setName( + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.deleteAuthorizationPolicyOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteAuthorizationPolicyRequest request = + * DeleteAuthorizationPolicyRequest.newBuilder() + * .setName( + * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.deleteAuthorizationPolicyCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (ServerTlsPolicy element : + * networkSecurityClient.listServerTlsPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListServerTlsPoliciesPagedResponse listServerTlsPolicies(LocationName parent) { + ListServerTlsPoliciesRequest request = + ListServerTlsPoliciesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listServerTlsPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ServerTlsPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (ServerTlsPolicy element : + * networkSecurityClient.listServerTlsPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListServerTlsPoliciesPagedResponse listServerTlsPolicies(String parent) { + ListServerTlsPoliciesRequest request = + ListServerTlsPoliciesRequest.newBuilder().setParent(parent).build(); + return listServerTlsPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ServerTlsPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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); + * } + * } + * }+ * + * @param 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 + */ + public final ListServerTlsPoliciesPagedResponse listServerTlsPolicies( + ListServerTlsPoliciesRequest request) { + return listServerTlsPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ServerTlsPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ListServerTlsPoliciesRequest request = + * ListServerTlsPoliciesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.listServerTlsPoliciesPagedCallable().futureCall(request); + * // Do something. + * for (ServerTlsPolicy element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ServerTlsPolicyName name = + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]"); + * ServerTlsPolicy response = networkSecurityClient.getServerTlsPolicy(name); + * } + * }+ * + * @param 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 + */ + public final ServerTlsPolicy getServerTlsPolicy(ServerTlsPolicyName name) { + GetServerTlsPolicyRequest request = + GetServerTlsPolicyRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getServerTlsPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ServerTlsPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String name = + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]").toString(); + * ServerTlsPolicy response = networkSecurityClient.getServerTlsPolicy(name); + * } + * }+ * + * @param 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 + */ + public final ServerTlsPolicy getServerTlsPolicy(String name) { + GetServerTlsPolicyRequest request = + GetServerTlsPolicyRequest.newBuilder().setName(name).build(); + return getServerTlsPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ServerTlsPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * GetServerTlsPolicyRequest request = + * GetServerTlsPolicyRequest.newBuilder() + * .setName( + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]") + * .toString()) + * .build(); + * ServerTlsPolicy response = networkSecurityClient.getServerTlsPolicy(request); + * } + * }+ * + * @param 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 + */ + public final ServerTlsPolicy getServerTlsPolicy(GetServerTlsPolicyRequest request) { + return getServerTlsPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ServerTlsPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * GetServerTlsPolicyRequest request = + * GetServerTlsPolicyRequest.newBuilder() + * .setName( + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.getServerTlsPolicyCallable().futureCall(request); + * // Do something. + * ServerTlsPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param parent Required. The parent resource of the ServerTlsPolicy. Must be in the format + * `projects/*/locations/{location}`. + * @param serverTlsPolicy Required. ServerTlsPolicy resource to be created. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param parent Required. The parent resource of the ServerTlsPolicy. Must be in the format + * `projects/*/locations/{location}`. + * @param serverTlsPolicy Required. ServerTlsPolicy resource to be created. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * CreateServerTlsPolicyRequest request = + * CreateServerTlsPolicyRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setServerTlsPolicyId("serverTlsPolicyId-1966046011") + * .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.createServerTlsPolicyOperationCallable().futureCall(request); + * // Do something. + * ServerTlsPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * CreateServerTlsPolicyRequest request = + * CreateServerTlsPolicyRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setServerTlsPolicyId("serverTlsPolicyId-1966046011") + * .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.createServerTlsPolicyCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ServerTlsPolicy serverTlsPolicy = ServerTlsPolicy.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * ServerTlsPolicy response = + * networkSecurityClient.updateServerTlsPolicyAsync(serverTlsPolicy, updateMask).get(); + * } + * }+ * + * @param serverTlsPolicy Required. Updated ServerTlsPolicy resource. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateServerTlsPolicyRequest request = + * UpdateServerTlsPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build()) + * .build(); + * ServerTlsPolicy response = networkSecurityClient.updateServerTlsPolicyAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateServerTlsPolicyRequest request = + * UpdateServerTlsPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.updateServerTlsPolicyOperationCallable().futureCall(request); + * // Do something. + * ServerTlsPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateServerTlsPolicyRequest request = + * UpdateServerTlsPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setServerTlsPolicy(ServerTlsPolicy.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.updateServerTlsPolicyCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ServerTlsPolicyName name = + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]"); + * networkSecurityClient.deleteServerTlsPolicyAsync(name).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String name = + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]").toString(); + * networkSecurityClient.deleteServerTlsPolicyAsync(name).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteServerTlsPolicyRequest request = + * DeleteServerTlsPolicyRequest.newBuilder() + * .setName( + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]") + * .toString()) + * .build(); + * networkSecurityClient.deleteServerTlsPolicyAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteServerTlsPolicyRequest request = + * DeleteServerTlsPolicyRequest.newBuilder() + * .setName( + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]") + * .toString()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.deleteServerTlsPolicyOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteServerTlsPolicyRequest request = + * DeleteServerTlsPolicyRequest.newBuilder() + * .setName( + * ServerTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[SERVER_TLS_POLICY]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.deleteServerTlsPolicyCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (ClientTlsPolicy element : + * networkSecurityClient.listClientTlsPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListClientTlsPoliciesPagedResponse listClientTlsPolicies(LocationName parent) { + ListClientTlsPoliciesRequest request = + ListClientTlsPoliciesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listClientTlsPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ClientTlsPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (ClientTlsPolicy element : + * networkSecurityClient.listClientTlsPolicies(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListClientTlsPoliciesPagedResponse listClientTlsPolicies(String parent) { + ListClientTlsPoliciesRequest request = + ListClientTlsPoliciesRequest.newBuilder().setParent(parent).build(); + return listClientTlsPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ClientTlsPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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); + * } + * } + * }+ * + * @param 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 + */ + public final ListClientTlsPoliciesPagedResponse listClientTlsPolicies( + ListClientTlsPoliciesRequest request) { + return listClientTlsPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists ClientTlsPolicies in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ListClientTlsPoliciesRequest request = + * ListClientTlsPoliciesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.listClientTlsPoliciesPagedCallable().futureCall(request); + * // Do something. + * for (ClientTlsPolicy element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ClientTlsPolicyName name = + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]"); + * ClientTlsPolicy response = networkSecurityClient.getClientTlsPolicy(name); + * } + * }+ * + * @param 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 + */ + public final ClientTlsPolicy getClientTlsPolicy(ClientTlsPolicyName name) { + GetClientTlsPolicyRequest request = + GetClientTlsPolicyRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getClientTlsPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ClientTlsPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String name = + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]").toString(); + * ClientTlsPolicy response = networkSecurityClient.getClientTlsPolicy(name); + * } + * }+ * + * @param 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 + */ + public final ClientTlsPolicy getClientTlsPolicy(String name) { + GetClientTlsPolicyRequest request = + GetClientTlsPolicyRequest.newBuilder().setName(name).build(); + return getClientTlsPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ClientTlsPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * GetClientTlsPolicyRequest request = + * GetClientTlsPolicyRequest.newBuilder() + * .setName( + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]") + * .toString()) + * .build(); + * ClientTlsPolicy response = networkSecurityClient.getClientTlsPolicy(request); + * } + * }+ * + * @param 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 + */ + public final ClientTlsPolicy getClientTlsPolicy(GetClientTlsPolicyRequest request) { + return getClientTlsPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single ClientTlsPolicy. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * GetClientTlsPolicyRequest request = + * GetClientTlsPolicyRequest.newBuilder() + * .setName( + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.getClientTlsPolicyCallable().futureCall(request); + * // Do something. + * ClientTlsPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param parent Required. The parent resource of the ClientTlsPolicy. Must be in the format + * `projects/*/locations/{location}`. + * @param clientTlsPolicy Required. ClientTlsPolicy resource to be created. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param parent Required. The parent resource of the ClientTlsPolicy. Must be in the format + * `projects/*/locations/{location}`. + * @param clientTlsPolicy Required. ClientTlsPolicy resource to be created. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * 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(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * CreateClientTlsPolicyRequest request = + * CreateClientTlsPolicyRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClientTlsPolicyId("clientTlsPolicyId-188933315") + * .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.createClientTlsPolicyOperationCallable().futureCall(request); + * // Do something. + * ClientTlsPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * CreateClientTlsPolicyRequest request = + * CreateClientTlsPolicyRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClientTlsPolicyId("clientTlsPolicyId-188933315") + * .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.createClientTlsPolicyCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ClientTlsPolicy clientTlsPolicy = ClientTlsPolicy.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * ClientTlsPolicy response = + * networkSecurityClient.updateClientTlsPolicyAsync(clientTlsPolicy, updateMask).get(); + * } + * }+ * + * @param clientTlsPolicy Required. Updated ClientTlsPolicy resource. + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateClientTlsPolicyRequest request = + * UpdateClientTlsPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build()) + * .build(); + * ClientTlsPolicy response = networkSecurityClient.updateClientTlsPolicyAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateClientTlsPolicyRequest request = + * UpdateClientTlsPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.updateClientTlsPolicyOperationCallable().futureCall(request); + * // Do something. + * ClientTlsPolicy response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * UpdateClientTlsPolicyRequest request = + * UpdateClientTlsPolicyRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setClientTlsPolicy(ClientTlsPolicy.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.updateClientTlsPolicyCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * ClientTlsPolicyName name = + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]"); + * networkSecurityClient.deleteClientTlsPolicyAsync(name).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * String name = + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]").toString(); + * networkSecurityClient.deleteClientTlsPolicyAsync(name).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteClientTlsPolicyRequest request = + * DeleteClientTlsPolicyRequest.newBuilder() + * .setName( + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]") + * .toString()) + * .build(); + * networkSecurityClient.deleteClientTlsPolicyAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteClientTlsPolicyRequest request = + * DeleteClientTlsPolicyRequest.newBuilder() + * .setName( + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]") + * .toString()) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * networkSecurityClient.deleteClientTlsPolicyOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) { + * DeleteClientTlsPolicyRequest request = + * DeleteClientTlsPolicyRequest.newBuilder() + * .setName( + * ClientTlsPolicyName.of("[PROJECT]", "[LOCATION]", "[CLIENT_TLS_POLICY]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * networkSecurityClient.deleteClientTlsPolicyCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of getAuthorizationPolicy to 30 seconds: + * + *
{@code + * // This snippet has been automatically generated for illustrative purposes only. + * // It may require modifications to work in your environment. + * NetworkSecuritySettings.Builder networkSecuritySettingsBuilder = + * NetworkSecuritySettings.newBuilder(); + * networkSecuritySettingsBuilder + * .getAuthorizationPolicySettings() + * .setRetrySettings( + * networkSecuritySettingsBuilder + * .getAuthorizationPolicySettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * NetworkSecuritySettings networkSecuritySettings = networkSecuritySettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class NetworkSecuritySettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction ======================= NetworkSecurityClient =======================
+ *
+ * Service Description: Network Security API provides resources to configure authentication and
+ * authorization policies. Refer to per API resource documentation for more information.
+ *
+ * Sample for NetworkSecurityClient:
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcNetworkSecurityCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcNetworkSecurityStub extends NetworkSecurityStub {
+ private static final MethodDescriptor<
+ ListAuthorizationPoliciesRequest, ListAuthorizationPoliciesResponse>
+ listAuthorizationPoliciesMethodDescriptor =
+ MethodDescriptor
+ .{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
+ * AuthorizationPolicyName name =
+ * AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]");
+ * AuthorizationPolicy response = networkSecurityClient.getAuthorizationPolicy(name);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.networksecurity.v1;
+
+import javax.annotation.Generated;
diff --git a/java-network-security/google-cloud-network-security/src/main/java/com/google/cloud/networksecurity/v1/stub/GrpcNetworkSecurityCallableFactory.java b/java-network-security/google-cloud-network-security/src/main/java/com/google/cloud/networksecurity/v1/stub/GrpcNetworkSecurityCallableFactory.java
new file mode 100644
index 000000000000..1b22552fec65
--- /dev/null
+++ b/java-network-security/google-cloud-network-security/src/main/java/com/google/cloud/networksecurity/v1/stub/GrpcNetworkSecurityCallableFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.networksecurity.v1.stub;
+
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the NetworkSecurity service API.
+ *
+ *