Manages external cryptographic keys and operations using those keys. Implements a REST model + * with the following objects: + * + *
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
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]");
+ * EkmConnection response = ekmServiceClient.getEkmConnection(name);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the EkmServiceClient 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 EkmServiceSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@code
+ * EkmServiceSettings ekmServiceSettings =
+ * EkmServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * EkmServiceClient ekmServiceClient = EkmServiceClient.create(ekmServiceSettings);
+ * }
+ *
+ * To customize the endpoint: + * + *
{@code
+ * EkmServiceSettings ekmServiceSettings =
+ * EkmServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * EkmServiceClient ekmServiceClient = EkmServiceClient.create(ekmServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class EkmServiceClient implements BackgroundResource { + private final EkmServiceSettings settings; + private final EkmServiceStub stub; + + /** Constructs an instance of EkmServiceClient with default settings. */ + public static final EkmServiceClient create() throws IOException { + return create(EkmServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of EkmServiceClient, 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 EkmServiceClient create(EkmServiceSettings settings) throws IOException { + return new EkmServiceClient(settings); + } + + /** + * Constructs an instance of EkmServiceClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(EkmServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final EkmServiceClient create(EkmServiceStub stub) { + return new EkmServiceClient(stub); + } + + /** + * Constructs an instance of EkmServiceClient, 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 EkmServiceClient(EkmServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((EkmServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected EkmServiceClient(EkmServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final EkmServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public EkmServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists [EkmConnections][google.cloud.kms.v1.EkmConnection]. + * + *
Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (EkmConnection element : ekmServiceClient.listEkmConnections(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location associated with the
+ * [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
+ * `projects/*/locations/*`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEkmConnectionsPagedResponse listEkmConnections(LocationName parent) {
+ ListEkmConnectionsRequest request =
+ ListEkmConnectionsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listEkmConnections(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * for (EkmConnection element : ekmServiceClient.listEkmConnections(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location associated with the
+ * [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
+ * `projects/*/locations/*`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEkmConnectionsPagedResponse listEkmConnections(String parent) {
+ ListEkmConnectionsRequest request =
+ ListEkmConnectionsRequest.newBuilder().setParent(parent).build();
+ return listEkmConnections(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * ListEkmConnectionsRequest request =
+ * ListEkmConnectionsRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * for (EkmConnection element : ekmServiceClient.listEkmConnections(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 ListEkmConnectionsPagedResponse listEkmConnections(
+ ListEkmConnectionsRequest request) {
+ return listEkmConnectionsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists [EkmConnections][google.cloud.kms.v1.EkmConnection].
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * ListEkmConnectionsRequest request =
+ * ListEkmConnectionsRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * ApiFuture future =
+ * ekmServiceClient.listEkmConnectionsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (EkmConnection element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * ListEkmConnectionsRequest request =
+ * ListEkmConnectionsRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setFilter("filter-1274492040")
+ * .setOrderBy("orderBy-1207110587")
+ * .build();
+ * while (true) {
+ * ListEkmConnectionsResponse response =
+ * ekmServiceClient.listEkmConnectionsCallable().call(request);
+ * for (EkmConnection element : response.getResponsesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]");
+ * EkmConnection response = ekmServiceClient.getEkmConnection(name);
+ * }
+ * }
+ *
+ * @param name Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
+ * [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EkmConnection getEkmConnection(EkmConnectionName name) {
+ GetEkmConnectionRequest request =
+ GetEkmConnectionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getEkmConnection(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * String name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString();
+ * EkmConnection response = ekmServiceClient.getEkmConnection(name);
+ * }
+ * }
+ *
+ * @param name Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
+ * [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EkmConnection getEkmConnection(String name) {
+ GetEkmConnectionRequest request = GetEkmConnectionRequest.newBuilder().setName(name).build();
+ return getEkmConnection(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * GetEkmConnectionRequest request =
+ * GetEkmConnectionRequest.newBuilder()
+ * .setName(
+ * EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString())
+ * .build();
+ * EkmConnection response = ekmServiceClient.getEkmConnection(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 EkmConnection getEkmConnection(GetEkmConnectionRequest request) {
+ return getEkmConnectionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns metadata for a given [EkmConnection][google.cloud.kms.v1.EkmConnection].
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * GetEkmConnectionRequest request =
+ * GetEkmConnectionRequest.newBuilder()
+ * .setName(
+ * EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString())
+ * .build();
+ * ApiFuture future =
+ * ekmServiceClient.getEkmConnectionCallable().futureCall(request);
+ * // Do something.
+ * EkmConnection response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * String ekmConnectionId = "ekmConnectionId-445017408";
+ * EkmConnection ekmConnection = EkmConnection.newBuilder().build();
+ * EkmConnection response =
+ * ekmServiceClient.createEkmConnection(parent, ekmConnectionId, ekmConnection);
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location associated with the
+ * [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
+ * `projects/*/locations/*`.
+ * @param ekmConnectionId Required. It must be unique within a location and match the regular
+ * expression `[a-zA-Z0-9_-]{1,63}`.
+ * @param ekmConnection Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
+ * initial field values.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EkmConnection createEkmConnection(
+ LocationName parent, String ekmConnectionId, EkmConnection ekmConnection) {
+ CreateEkmConnectionRequest request =
+ CreateEkmConnectionRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setEkmConnectionId(ekmConnectionId)
+ .setEkmConnection(ekmConnection)
+ .build();
+ return createEkmConnection(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and
+ * Location.
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * String ekmConnectionId = "ekmConnectionId-445017408";
+ * EkmConnection ekmConnection = EkmConnection.newBuilder().build();
+ * EkmConnection response =
+ * ekmServiceClient.createEkmConnection(parent, ekmConnectionId, ekmConnection);
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the location associated with the
+ * [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
+ * `projects/*/locations/*`.
+ * @param ekmConnectionId Required. It must be unique within a location and match the regular
+ * expression `[a-zA-Z0-9_-]{1,63}`.
+ * @param ekmConnection Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
+ * initial field values.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EkmConnection createEkmConnection(
+ String parent, String ekmConnectionId, EkmConnection ekmConnection) {
+ CreateEkmConnectionRequest request =
+ CreateEkmConnectionRequest.newBuilder()
+ .setParent(parent)
+ .setEkmConnectionId(ekmConnectionId)
+ .setEkmConnection(ekmConnection)
+ .build();
+ return createEkmConnection(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and
+ * Location.
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * CreateEkmConnectionRequest request =
+ * CreateEkmConnectionRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setEkmConnectionId("ekmConnectionId-445017408")
+ * .setEkmConnection(EkmConnection.newBuilder().build())
+ * .build();
+ * EkmConnection response = ekmServiceClient.createEkmConnection(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 EkmConnection createEkmConnection(CreateEkmConnectionRequest request) {
+ return createEkmConnectionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] in a given Project and
+ * Location.
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * CreateEkmConnectionRequest request =
+ * CreateEkmConnectionRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setEkmConnectionId("ekmConnectionId-445017408")
+ * .setEkmConnection(EkmConnection.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * ekmServiceClient.createEkmConnectionCallable().futureCall(request);
+ * // Do something.
+ * EkmConnection response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * EkmConnection ekmConnection = EkmConnection.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * EkmConnection response = ekmServiceClient.updateEkmConnection(ekmConnection, updateMask);
+ * }
+ * }
+ *
+ * @param ekmConnection Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
+ * values.
+ * @param updateMask Required. List of fields to be updated in this request.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final EkmConnection updateEkmConnection(
+ EkmConnection ekmConnection, FieldMask updateMask) {
+ UpdateEkmConnectionRequest request =
+ UpdateEkmConnectionRequest.newBuilder()
+ .setEkmConnection(ekmConnection)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateEkmConnection(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * UpdateEkmConnectionRequest request =
+ * UpdateEkmConnectionRequest.newBuilder()
+ * .setEkmConnection(EkmConnection.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * EkmConnection response = ekmServiceClient.updateEkmConnection(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 EkmConnection updateEkmConnection(UpdateEkmConnectionRequest request) {
+ return updateEkmConnectionCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s metadata.
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * UpdateEkmConnectionRequest request =
+ * UpdateEkmConnectionRequest.newBuilder()
+ * .setEkmConnection(EkmConnection.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * ekmServiceClient.updateEkmConnectionCallable().futureCall(request);
+ * // Do something.
+ * EkmConnection response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableCan return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+ * .toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .build();
+ * Policy response = ekmServiceClient.setIamPolicy(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 Policy setIamPolicy(SetIamPolicyRequest request) {
+ return setIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Sets the access control policy on the specified resource. Replacesany existing policy.
+ *
+ * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+ * .toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .build();
+ * ApiFuture future = ekmServiceClient.setIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+ * .toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * Policy response = ekmServiceClient.getIamPolicy(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 Policy getIamPolicy(GetIamPolicyRequest request) {
+ return getIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the access control policy for a resource. Returns an empty policyif the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(
+ * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+ * .toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * ApiFuture future = ekmServiceClient.getIamPolicyCallable().futureCall(request);
+ * // Do something.
+ * Policy response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableNote: 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: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(
+ * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+ * .toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * TestIamPermissionsResponse response = ekmServiceClient.testIamPermissions(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 TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
+ return testIamPermissionsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * 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: + * + *
{@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(
+ * CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]")
+ * .toString())
+ * .addAllPermissions(new ArrayList())
+ * .build();
+ * ApiFuture future =
+ * ekmServiceClient.testIamPermissionsCallable().futureCall(request);
+ * // Do something.
+ * TestIamPermissionsResponse response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableThe 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 getEkmConnection to 30 seconds: + * + *
{@code
+ * EkmServiceSettings.Builder ekmServiceSettingsBuilder = EkmServiceSettings.newBuilder();
+ * ekmServiceSettingsBuilder
+ * .getEkmConnectionSettings()
+ * .setRetrySettings(
+ * ekmServiceSettingsBuilder
+ * .getEkmConnectionSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * EkmServiceSettings ekmServiceSettings = ekmServiceSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class EkmServiceSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This field may not be supplied if
+ * [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Digest digest) {
@@ -2983,6 +2985,8 @@ public final AsymmetricSignResponse asymmetricSign(CryptoKeyVersionName name, Di
* @param digest Optional. The digest of the data to sign. The digest must be produced with the
* same digest algorithm as specified by the key version's
* [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
+ * This field may not be supplied if
+ * [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AsymmetricSignResponse asymmetricSign(String name, Digest digest) {
@@ -3515,8 +3519,8 @@ public final UnaryCallable The interfaces provided are listed below, along with usage samples.
*
+ * ======================= EkmServiceClient =======================
+ *
+ * Service Description: Google Cloud Key Management EKM Service
+ *
+ * Manages external cryptographic keys and operations using those keys. Implements a REST model
+ * with the following objects:
+ *
+ * Sample for EkmServiceClient:
+ *
+ * ======================= KeyManagementServiceClient =======================
*
* Service Description: Google Cloud Key Management Service
diff --git a/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java b/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java
new file mode 100644
index 00000000..83e1f143
--- /dev/null
+++ b/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2021 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.kms.v1.stub;
+
+import static com.google.cloud.kms.v1.EkmServiceClient.ListEkmConnectionsPagedResponse;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.kms.v1.CreateEkmConnectionRequest;
+import com.google.cloud.kms.v1.EkmConnection;
+import com.google.cloud.kms.v1.GetEkmConnectionRequest;
+import com.google.cloud.kms.v1.ListEkmConnectionsRequest;
+import com.google.cloud.kms.v1.ListEkmConnectionsResponse;
+import com.google.cloud.kms.v1.UpdateEkmConnectionRequest;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the EkmService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class EkmServiceStub implements BackgroundResource {
+
+ public UnaryCallable 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 getEkmConnection to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcEkmServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcEkmServiceStub extends EkmServiceStub {
+ private static final MethodDescriptor
+ *
+ *
+ * {@code
+ * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+ * EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]");
+ * EkmConnection response = ekmServiceClient.getEkmConnection(name);
+ * }
+ * }
+ *
*
+ *
+ *
+ * {@code
+ * EkmServiceStubSettings.Builder ekmServiceSettingsBuilder = EkmServiceStubSettings.newBuilder();
+ * ekmServiceSettingsBuilder
+ * .getEkmConnectionSettings()
+ * .setRetrySettings(
+ * ekmServiceSettingsBuilder
+ * .getEkmConnectionSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * EkmServiceStubSettings ekmServiceSettings = ekmServiceSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class EkmServiceStubSettings extends StubSettings