From 8f2119d35384184b1d3d8de850b195daefcf98a3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 15 Mar 2023 15:40:26 -0400 Subject: [PATCH] feat: [cloudkms] add support for Coordinated External Keys (#9197) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add support for Coordinated External Keys PiperOrigin-RevId: 514450927 Source-Link: https://github.com/googleapis/googleapis/commit/de50ec65ee9961d6ed10becf21f5f1e83d3913c6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8a0f354d4773e369028c8109a0533fc30386844b Copy-Tag: eyJwIjoiamF2YS1rbXMvLk93bEJvdC55YW1sIiwiaCI6IjhhMGYzNTRkNDc3M2UzNjkwMjhjODEwOWEwNTMzZmMzMDM4Njg0NGIifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- java-kms/README.md | 2 - .../google/cloud/kms/v1/EkmServiceClient.java | 206 ++++ .../cloud/kms/v1/EkmServiceSettings.java | 20 + .../google/cloud/kms/v1/gapic_metadata.json | 6 + .../cloud/kms/v1/stub/EkmServiceStub.java | 11 + .../kms/v1/stub/EkmServiceStubSettings.java | 48 + .../cloud/kms/v1/stub/GrpcEkmServiceStub.java | 60 + .../kms/v1/stub/HttpJsonEkmServiceStub.java | 106 ++ .../kms/v1/EkmServiceClientHttpJsonTest.java | 157 +++ .../cloud/kms/v1/EkmServiceClientTest.java | 128 +++ ...eyManagementServiceClientHttpJsonTest.java | 24 + .../v1/KeyManagementServiceClientTest.java | 20 + .../cloud/kms/v1/MockEkmServiceImpl.java | 42 + .../google/cloud/kms/v1/EkmServiceGrpc.java | 229 ++++ .../google/cloud/kms/v1/CryptoKeyVersion.java | 532 ++++++++- .../kms/v1/CryptoKeyVersionOrBuilder.java | 66 ++ .../com/google/cloud/kms/v1/EkmConfig.java | 861 ++++++++++++++ .../google/cloud/kms/v1/EkmConfigName.java | 192 ++++ .../cloud/kms/v1/EkmConfigOrBuilder.java | 87 ++ .../google/cloud/kms/v1/EkmConnection.java | 605 ++++++++++ .../cloud/kms/v1/EkmConnectionOrBuilder.java | 66 ++ .../google/cloud/kms/v1/EkmServiceProto.java | 177 ++- .../cloud/kms/v1/GetEkmConfigRequest.java | 651 +++++++++++ .../kms/v1/GetEkmConfigRequestOrBuilder.java | 56 + .../cloud/kms/v1/KmsResourcesProto.java | 177 +-- .../cloud/kms/v1/UpdateEkmConfigRequest.java | 1000 +++++++++++++++++ .../v1/UpdateEkmConfigRequestOrBuilder.java | 101 ++ .../google/cloud/kms/v1/ekm_service.proto | 123 ++ .../proto/google/cloud/kms/v1/resources.proto | 30 + .../getekmconfig/AsyncGetEkmConfig.java | 49 + .../getekmconfig/SyncGetEkmConfig.java | 46 + .../SyncGetEkmConfigEkmconfigname.java | 42 + .../getekmconfig/SyncGetEkmConfigString.java | 42 + .../updateekmconfig/AsyncUpdateEkmConfig.java | 50 + .../updateekmconfig/SyncUpdateEkmConfig.java | 47 + ...SyncUpdateEkmConfigEkmconfigFieldmask.java | 43 + 36 files changed, 5947 insertions(+), 155 deletions(-) create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfig.java create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigName.java create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigOrBuilder.java create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequest.java create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequestOrBuilder.java create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequest.java create mode 100644 java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequestOrBuilder.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/AsyncGetEkmConfig.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfig.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigEkmconfigname.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigString.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/AsyncUpdateEkmConfig.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfig.java create mode 100644 java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfigEkmconfigFieldmask.java diff --git a/java-kms/README.md b/java-kms/README.md index 9a762b7b94e1..96ccdc36e9dd 100644 --- a/java-kms/README.md +++ b/java-kms/README.md @@ -14,7 +14,6 @@ Java idiomatic client for [Cloud Key Management Service][product-docs]. If you are using Maven, add this to your pom.xml file: - ```xml @@ -35,7 +34,6 @@ If you are using SBT, add this to your dependencies: ```Scala libraryDependencies += "com.google.cloud" % "google-cloud-kms" % "2.15.0" ``` - ## Authentication diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceClient.java b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceClient.java index c2631d04eee5..4632fdce1b77 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceClient.java +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceClient.java @@ -714,6 +714,212 @@ public final EkmConnection updateEkmConnection(UpdateEkmConnectionRequest reques return stub.updateEkmConnectionCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]");
+   *   EkmConfig response = ekmServiceClient.getEkmConfig(name);
+   * }
+   * }
+ * + * @param name Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the + * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EkmConfig getEkmConfig(EkmConfigName name) { + GetEkmConfigRequest request = + GetEkmConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getEkmConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   String name = EkmConfigName.of("[PROJECT]", "[LOCATION]").toString();
+   *   EkmConfig response = ekmServiceClient.getEkmConfig(name);
+   * }
+   * }
+ * + * @param name Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the + * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EkmConfig getEkmConfig(String name) { + GetEkmConfigRequest request = GetEkmConfigRequest.newBuilder().setName(name).build(); + return getEkmConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   GetEkmConfigRequest request =
+   *       GetEkmConfigRequest.newBuilder()
+   *           .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   EkmConfig response = ekmServiceClient.getEkmConfig(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 EkmConfig getEkmConfig(GetEkmConfigRequest request) { + return getEkmConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   GetEkmConfigRequest request =
+   *       GetEkmConfigRequest.newBuilder()
+   *           .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .build();
+   *   ApiFuture future = ekmServiceClient.getEkmConfigCallable().futureCall(request);
+   *   // Do something.
+   *   EkmConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getEkmConfigCallable() { + return stub.getEkmConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   EkmConfig ekmConfig = EkmConfig.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   EkmConfig response = ekmServiceClient.updateEkmConfig(ekmConfig, updateMask);
+   * }
+   * }
+ * + * @param ekmConfig Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] 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 EkmConfig updateEkmConfig(EkmConfig ekmConfig, FieldMask updateMask) { + UpdateEkmConfigRequest request = + UpdateEkmConfigRequest.newBuilder() + .setEkmConfig(ekmConfig) + .setUpdateMask(updateMask) + .build(); + return updateEkmConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   UpdateEkmConfigRequest request =
+   *       UpdateEkmConfigRequest.newBuilder()
+   *           .setEkmConfig(EkmConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   EkmConfig response = ekmServiceClient.updateEkmConfig(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 EkmConfig updateEkmConfig(UpdateEkmConfigRequest request) { + return updateEkmConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource for a given project + * and location. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) {
+   *   UpdateEkmConfigRequest request =
+   *       UpdateEkmConfigRequest.newBuilder()
+   *           .setEkmConfig(EkmConfig.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = ekmServiceClient.updateEkmConfigCallable().futureCall(request);
+   *   // Do something.
+   *   EkmConfig response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateEkmConfigCallable() { + return stub.updateEkmConfigCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about the supported locations for this service. diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceSettings.java b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceSettings.java index bb5bf30177e2..d134704b05d5 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceSettings.java +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/EkmServiceSettings.java @@ -108,6 +108,16 @@ public UnaryCallSettings getEkmConnectio return ((EkmServiceStubSettings) getStubSettings()).updateEkmConnectionSettings(); } + /** Returns the object with the settings used for calls to getEkmConfig. */ + public UnaryCallSettings getEkmConfigSettings() { + return ((EkmServiceStubSettings) getStubSettings()).getEkmConfigSettings(); + } + + /** Returns the object with the settings used for calls to updateEkmConfig. */ + public UnaryCallSettings updateEkmConfigSettings() { + return ((EkmServiceStubSettings) getStubSettings()).updateEkmConfigSettings(); + } + /** Returns the object with the settings used for calls to listLocations. */ public PagedCallSettings listLocationsSettings() { @@ -274,6 +284,16 @@ public Builder applyToAllUnaryMethods( return getStubSettingsBuilder().updateEkmConnectionSettings(); } + /** Returns the builder for the settings used for calls to getEkmConfig. */ + public UnaryCallSettings.Builder getEkmConfigSettings() { + return getStubSettingsBuilder().getEkmConfigSettings(); + } + + /** Returns the builder for the settings used for calls to updateEkmConfig. */ + public UnaryCallSettings.Builder updateEkmConfigSettings() { + return getStubSettingsBuilder().updateEkmConfigSettings(); + } + /** Returns the builder for the settings used for calls to listLocations. */ public PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/gapic_metadata.json b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/gapic_metadata.json index 2450beb9566d..f89da1d88dff 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/gapic_metadata.json +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/gapic_metadata.json @@ -13,6 +13,9 @@ "CreateEkmConnection": { "methods": ["createEkmConnection", "createEkmConnection", "createEkmConnection", "createEkmConnectionCallable"] }, + "GetEkmConfig": { + "methods": ["getEkmConfig", "getEkmConfig", "getEkmConfig", "getEkmConfigCallable"] + }, "GetEkmConnection": { "methods": ["getEkmConnection", "getEkmConnection", "getEkmConnection", "getEkmConnectionCallable"] }, @@ -34,6 +37,9 @@ "TestIamPermissions": { "methods": ["testIamPermissions", "testIamPermissionsCallable"] }, + "UpdateEkmConfig": { + "methods": ["updateEkmConfig", "updateEkmConfig", "updateEkmConfigCallable"] + }, "UpdateEkmConnection": { "methods": ["updateEkmConnection", "updateEkmConnection", "updateEkmConnectionCallable"] } diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java index 20ab0ab67635..18b89f31cdd8 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStub.java @@ -22,10 +22,13 @@ 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.EkmConfig; import com.google.cloud.kms.v1.EkmConnection; +import com.google.cloud.kms.v1.GetEkmConfigRequest; 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.UpdateEkmConfigRequest; import com.google.cloud.kms.v1.UpdateEkmConnectionRequest; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; @@ -69,6 +72,14 @@ public UnaryCallable updateEkmConnect throw new UnsupportedOperationException("Not implemented: updateEkmConnectionCallable()"); } + public UnaryCallable getEkmConfigCallable() { + throw new UnsupportedOperationException("Not implemented: getEkmConfigCallable()"); + } + + public UnaryCallable updateEkmConfigCallable() { + throw new UnsupportedOperationException("Not implemented: updateEkmConfigCallable()"); + } + public UnaryCallable listLocationsPagedCallable() { throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStubSettings.java b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStubSettings.java index 7a830174b85a..d93fb193a815 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStubSettings.java +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/EkmServiceStubSettings.java @@ -45,10 +45,13 @@ import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.kms.v1.CreateEkmConnectionRequest; +import com.google.cloud.kms.v1.EkmConfig; import com.google.cloud.kms.v1.EkmConnection; +import com.google.cloud.kms.v1.GetEkmConfigRequest; 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.UpdateEkmConfigRequest; import com.google.cloud.kms.v1.UpdateEkmConnectionRequest; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; @@ -121,6 +124,8 @@ public class EkmServiceStubSettings extends StubSettings createEkmConnectionSettings; private final UnaryCallSettings updateEkmConnectionSettings; + private final UnaryCallSettings getEkmConfigSettings; + private final UnaryCallSettings updateEkmConfigSettings; private final PagedCallSettings< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings; @@ -268,6 +273,16 @@ public UnaryCallSettings getEkmConnectio return updateEkmConnectionSettings; } + /** Returns the object with the settings used for calls to getEkmConfig. */ + public UnaryCallSettings getEkmConfigSettings() { + return getEkmConfigSettings; + } + + /** Returns the object with the settings used for calls to updateEkmConfig. */ + public UnaryCallSettings updateEkmConfigSettings() { + return updateEkmConfigSettings; + } + /** Returns the object with the settings used for calls to listLocations. */ public PagedCallSettings listLocationsSettings() { @@ -405,6 +420,8 @@ protected EkmServiceStubSettings(Builder settingsBuilder) throws IOException { getEkmConnectionSettings = settingsBuilder.getEkmConnectionSettings().build(); createEkmConnectionSettings = settingsBuilder.createEkmConnectionSettings().build(); updateEkmConnectionSettings = settingsBuilder.updateEkmConnectionSettings().build(); + getEkmConfigSettings = settingsBuilder.getEkmConfigSettings().build(); + updateEkmConfigSettings = settingsBuilder.updateEkmConfigSettings().build(); listLocationsSettings = settingsBuilder.listLocationsSettings().build(); getLocationSettings = settingsBuilder.getLocationSettings().build(); setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); @@ -424,6 +441,9 @@ public static class Builder extends StubSettings.Builder updateEkmConnectionSettings; + private final UnaryCallSettings.Builder getEkmConfigSettings; + private final UnaryCallSettings.Builder + updateEkmConfigSettings; private final PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings; @@ -479,6 +499,8 @@ protected Builder(ClientContext clientContext) { getEkmConnectionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); createEkmConnectionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateEkmConnectionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getEkmConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateEkmConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -491,6 +513,8 @@ protected Builder(ClientContext clientContext) { getEkmConnectionSettings, createEkmConnectionSettings, updateEkmConnectionSettings, + getEkmConfigSettings, + updateEkmConfigSettings, listLocationsSettings, getLocationSettings, setIamPolicySettings, @@ -506,6 +530,8 @@ protected Builder(EkmServiceStubSettings settings) { getEkmConnectionSettings = settings.getEkmConnectionSettings.toBuilder(); createEkmConnectionSettings = settings.createEkmConnectionSettings.toBuilder(); updateEkmConnectionSettings = settings.updateEkmConnectionSettings.toBuilder(); + getEkmConfigSettings = settings.getEkmConfigSettings.toBuilder(); + updateEkmConfigSettings = settings.updateEkmConfigSettings.toBuilder(); listLocationsSettings = settings.listLocationsSettings.toBuilder(); getLocationSettings = settings.getLocationSettings.toBuilder(); setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); @@ -518,6 +544,8 @@ protected Builder(EkmServiceStubSettings settings) { getEkmConnectionSettings, createEkmConnectionSettings, updateEkmConnectionSettings, + getEkmConfigSettings, + updateEkmConfigSettings, listLocationsSettings, getLocationSettings, setIamPolicySettings, @@ -572,6 +600,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder + .getEkmConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateEkmConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .listLocationsSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) @@ -640,6 +678,16 @@ public Builder applyToAllUnaryMethods( return updateEkmConnectionSettings; } + /** Returns the builder for the settings used for calls to getEkmConfig. */ + public UnaryCallSettings.Builder getEkmConfigSettings() { + return getEkmConfigSettings; + } + + /** Returns the builder for the settings used for calls to updateEkmConfig. */ + public UnaryCallSettings.Builder updateEkmConfigSettings() { + return updateEkmConfigSettings; + } + /** Returns the builder for the settings used for calls to listLocations. */ public PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcEkmServiceStub.java b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcEkmServiceStub.java index b30b9b1002f1..ca1163b5fbf4 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcEkmServiceStub.java +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcEkmServiceStub.java @@ -26,10 +26,13 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.kms.v1.CreateEkmConnectionRequest; +import com.google.cloud.kms.v1.EkmConfig; import com.google.cloud.kms.v1.EkmConnection; +import com.google.cloud.kms.v1.GetEkmConfigRequest; 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.UpdateEkmConfigRequest; import com.google.cloud.kms.v1.UpdateEkmConnectionRequest; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; @@ -97,6 +100,25 @@ public class GrpcEkmServiceStub extends EkmServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(EkmConnection.getDefaultInstance())) .build(); + private static final MethodDescriptor + getEkmConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.EkmService/GetEkmConfig") + .setRequestMarshaller(ProtoUtils.marshaller(GetEkmConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EkmConfig.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateEkmConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.EkmService/UpdateEkmConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateEkmConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EkmConfig.getDefaultInstance())) + .build(); + private static final MethodDescriptor listLocationsMethodDescriptor = MethodDescriptor.newBuilder() @@ -152,6 +174,8 @@ public class GrpcEkmServiceStub extends EkmServiceStub { createEkmConnectionCallable; private final UnaryCallable updateEkmConnectionCallable; + private final UnaryCallable getEkmConfigCallable; + private final UnaryCallable updateEkmConfigCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; @@ -248,6 +272,26 @@ protected GrpcEkmServiceStub( return params.build(); }) .build(); + GrpcCallSettings getEkmConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getEkmConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updateEkmConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateEkmConfigMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("ekm_config.name", String.valueOf(request.getEkmConfig().getName())); + return params.build(); + }) + .build(); GrpcCallSettings listLocationsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) @@ -323,6 +367,12 @@ protected GrpcEkmServiceStub( updateEkmConnectionTransportSettings, settings.updateEkmConnectionSettings(), clientContext); + this.getEkmConfigCallable = + callableFactory.createUnaryCallable( + getEkmConfigTransportSettings, settings.getEkmConfigSettings(), clientContext); + this.updateEkmConfigCallable = + callableFactory.createUnaryCallable( + updateEkmConfigTransportSettings, settings.updateEkmConfigSettings(), clientContext); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); @@ -379,6 +429,16 @@ public UnaryCallable updateEkmConnect return updateEkmConnectionCallable; } + @Override + public UnaryCallable getEkmConfigCallable() { + return getEkmConfigCallable; + } + + @Override + public UnaryCallable updateEkmConfigCallable() { + return updateEkmConfigCallable; + } + @Override public UnaryCallable listLocationsCallable() { return listLocationsCallable; diff --git a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/HttpJsonEkmServiceStub.java b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/HttpJsonEkmServiceStub.java index 8659b7db0de2..d829409bbc14 100644 --- a/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/HttpJsonEkmServiceStub.java +++ b/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/HttpJsonEkmServiceStub.java @@ -32,10 +32,13 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.kms.v1.CreateEkmConnectionRequest; +import com.google.cloud.kms.v1.EkmConfig; import com.google.cloud.kms.v1.EkmConnection; +import com.google.cloud.kms.v1.GetEkmConfigRequest; 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.UpdateEkmConfigRequest; import com.google.cloud.kms.v1.UpdateEkmConnectionRequest; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; @@ -216,6 +219,79 @@ public class HttpJsonEkmServiceStub extends EkmServiceStub { .build()) .build(); + private static final ApiMethodDescriptor + getEkmConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.kms.v1.EkmService/GetEkmConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/ekmConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(EkmConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateEkmConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.kms.v1.EkmService/UpdateEkmConfig") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{ekmConfig.name=projects/*/locations/*/ekmConfig}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "ekmConfig.name", request.getEkmConfig().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int"); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("ekmConfig", request.getEkmConfig(), true)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(EkmConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + private static final ApiMethodDescriptor listLocationsMethodDescriptor = ApiMethodDescriptor.newBuilder() @@ -416,6 +492,8 @@ public class HttpJsonEkmServiceStub extends EkmServiceStub { createEkmConnectionCallable; private final UnaryCallable updateEkmConnectionCallable; + private final UnaryCallable getEkmConfigCallable; + private final UnaryCallable updateEkmConfigCallable; private final UnaryCallable listLocationsCallable; private final UnaryCallable listLocationsPagedCallable; @@ -490,6 +568,16 @@ protected HttpJsonEkmServiceStub( .setMethodDescriptor(updateEkmConnectionMethodDescriptor) .setTypeRegistry(typeRegistry) .build(); + HttpJsonCallSettings getEkmConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getEkmConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateEkmConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateEkmConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); HttpJsonCallSettings listLocationsTransportSettings = HttpJsonCallSettings.newBuilder() @@ -541,6 +629,12 @@ protected HttpJsonEkmServiceStub( updateEkmConnectionTransportSettings, settings.updateEkmConnectionSettings(), clientContext); + this.getEkmConfigCallable = + callableFactory.createUnaryCallable( + getEkmConfigTransportSettings, settings.getEkmConfigSettings(), clientContext); + this.updateEkmConfigCallable = + callableFactory.createUnaryCallable( + updateEkmConfigTransportSettings, settings.updateEkmConfigSettings(), clientContext); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); @@ -573,6 +667,8 @@ public static List getMethodDescriptors() { methodDescriptors.add(getEkmConnectionMethodDescriptor); methodDescriptors.add(createEkmConnectionMethodDescriptor); methodDescriptors.add(updateEkmConnectionMethodDescriptor); + methodDescriptors.add(getEkmConfigMethodDescriptor); + methodDescriptors.add(updateEkmConfigMethodDescriptor); methodDescriptors.add(listLocationsMethodDescriptor); methodDescriptors.add(getLocationMethodDescriptor); methodDescriptors.add(setIamPolicyMethodDescriptor); @@ -608,6 +704,16 @@ public UnaryCallable updateEkmConnect return updateEkmConnectionCallable; } + @Override + public UnaryCallable getEkmConfigCallable() { + return getEkmConfigCallable; + } + + @Override + public UnaryCallable updateEkmConfigCallable() { + return updateEkmConfigCallable; + } + @Override public UnaryCallable listLocationsCallable() { return listLocationsCallable; diff --git a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientHttpJsonTest.java b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientHttpJsonTest.java index d6e7f111bc7d..7d10fdca3284 100644 --- a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientHttpJsonTest.java +++ b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientHttpJsonTest.java @@ -201,6 +201,7 @@ public void getEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockService.addResponse(expectedResponse); @@ -248,6 +249,7 @@ public void getEkmConnectionTest2() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockService.addResponse(expectedResponse); @@ -296,6 +298,7 @@ public void createEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockService.addResponse(expectedResponse); @@ -348,6 +351,7 @@ public void createEkmConnectionTest2() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockService.addResponse(expectedResponse); @@ -400,6 +404,7 @@ public void updateEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockService.addResponse(expectedResponse); @@ -409,6 +414,7 @@ public void updateEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); FieldMask updateMask = FieldMask.newBuilder().build(); @@ -445,6 +451,7 @@ public void updateEkmConnectionExceptionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); FieldMask updateMask = FieldMask.newBuilder().build(); client.updateEkmConnection(ekmConnection, updateMask); @@ -454,6 +461,156 @@ public void updateEkmConnectionExceptionTest() throws Exception { } } + @Test + public void getEkmConfigTest() throws Exception { + EkmConfig expectedResponse = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]"); + + EkmConfig actualResponse = client.getEkmConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getEkmConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]"); + client.getEkmConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getEkmConfigTest2() throws Exception { + EkmConfig expectedResponse = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4516/locations/location-4516/ekmConfig"; + + EkmConfig actualResponse = client.getEkmConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getEkmConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4516/locations/location-4516/ekmConfig"; + client.getEkmConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateEkmConfigTest() throws Exception { + EkmConfig expectedResponse = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + EkmConfig ekmConfig = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + EkmConfig actualResponse = client.updateEkmConfig(ekmConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateEkmConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + EkmConfig ekmConfig = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateEkmConfig(ekmConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); diff --git a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientTest.java b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientTest.java index b97a2a52504d..3ce05f82a0e1 100644 --- a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientTest.java +++ b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/EkmServiceClientTest.java @@ -198,6 +198,7 @@ public void getEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockEkmService.addResponse(expectedResponse); @@ -239,6 +240,7 @@ public void getEkmConnectionTest2() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockEkmService.addResponse(expectedResponse); @@ -280,6 +282,7 @@ public void createEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockEkmService.addResponse(expectedResponse); @@ -328,6 +331,7 @@ public void createEkmConnectionTest2() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockEkmService.addResponse(expectedResponse); @@ -376,6 +380,7 @@ public void updateEkmConnectionTest() throws Exception { .setCreateTime(Timestamp.newBuilder().build()) .addAllServiceResolvers(new ArrayList()) .setEtag("etag3123477") + .setCryptoSpacePath("cryptoSpacePath273829514") .build(); mockEkmService.addResponse(expectedResponse); @@ -412,6 +417,129 @@ public void updateEkmConnectionExceptionTest() throws Exception { } } + @Test + public void getEkmConfigTest() throws Exception { + EkmConfig expectedResponse = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + mockEkmService.addResponse(expectedResponse); + + EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]"); + + EkmConfig actualResponse = client.getEkmConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEkmService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetEkmConfigRequest actualRequest = ((GetEkmConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getEkmConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEkmService.addException(exception); + + try { + EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]"); + client.getEkmConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getEkmConfigTest2() throws Exception { + EkmConfig expectedResponse = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + mockEkmService.addResponse(expectedResponse); + + String name = "name3373707"; + + EkmConfig actualResponse = client.getEkmConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEkmService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetEkmConfigRequest actualRequest = ((GetEkmConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getEkmConfigExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEkmService.addException(exception); + + try { + String name = "name3373707"; + client.getEkmConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateEkmConfigTest() throws Exception { + EkmConfig expectedResponse = + EkmConfig.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .setDefaultEkmConnection( + EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString()) + .build(); + mockEkmService.addResponse(expectedResponse); + + EkmConfig ekmConfig = EkmConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + EkmConfig actualResponse = client.updateEkmConfig(ekmConfig, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEkmService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateEkmConfigRequest actualRequest = ((UpdateEkmConfigRequest) actualRequests.get(0)); + + Assert.assertEquals(ekmConfig, actualRequest.getEkmConfig()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateEkmConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEkmService.addException(exception); + + try { + EkmConfig ekmConfig = EkmConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateEkmConfig(ekmConfig, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test public void listLocationsTest() throws Exception { Location responsesElement = Location.newBuilder().build(); diff --git a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientHttpJsonTest.java b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientHttpJsonTest.java index b4a0e8964775..f188db01a227 100644 --- a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientHttpJsonTest.java +++ b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientHttpJsonTest.java @@ -730,6 +730,8 @@ public void getCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -796,6 +798,8 @@ public void getCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1283,6 +1287,8 @@ public void createCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1349,6 +1355,8 @@ public void createCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1415,6 +1423,8 @@ public void importCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1709,6 +1719,8 @@ public void updateCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1733,6 +1745,8 @@ public void updateCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1783,6 +1797,8 @@ public void updateCryptoKeyVersionExceptionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions( ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) @@ -1935,6 +1951,8 @@ public void destroyCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -2001,6 +2019,8 @@ public void destroyCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -2065,6 +2085,8 @@ public void restoreCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -2131,6 +2153,8 @@ public void restoreCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); diff --git a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java index 76ae53e3d9ff..4e622e5d015d 100644 --- a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java +++ b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java @@ -664,6 +664,8 @@ public void getCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -724,6 +726,8 @@ public void getCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1159,6 +1163,8 @@ public void createCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1221,6 +1227,8 @@ public void createCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1281,6 +1289,8 @@ public void importCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1532,6 +1542,8 @@ public void updateCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1701,6 +1713,8 @@ public void destroyCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1762,6 +1776,8 @@ public void destroyCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1819,6 +1835,8 @@ public void restoreCryptoKeyVersionTest() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); @@ -1880,6 +1898,8 @@ public void restoreCryptoKeyVersionTest2() throws Exception { .setImportJob("importJob-208547368") .setImportTime(Timestamp.newBuilder().build()) .setImportFailureReason("importFailureReason985493705") + .setGenerationFailureReason("generationFailureReason-1733956042") + .setExternalDestructionFailureReason("externalDestructionFailureReason-914693177") .setExternalProtectionLevelOptions(ExternalProtectionLevelOptions.newBuilder().build()) .setReimportEligible(true) .build(); diff --git a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockEkmServiceImpl.java b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockEkmServiceImpl.java index a6151b971e46..cb95b45f450c 100644 --- a/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockEkmServiceImpl.java +++ b/java-kms/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockEkmServiceImpl.java @@ -142,4 +142,46 @@ public void updateEkmConnection( Exception.class.getName()))); } } + + @Override + public void getEkmConfig( + GetEkmConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof EkmConfig) { + requests.add(request); + responseObserver.onNext(((EkmConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetEkmConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + EkmConfig.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateEkmConfig( + UpdateEkmConfigRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof EkmConfig) { + requests.add(request); + responseObserver.onNext(((EkmConfig) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateEkmConfig, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + EkmConfig.class.getName(), + Exception.class.getName()))); + } + } } diff --git a/java-kms/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceGrpc.java b/java-kms/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceGrpc.java index 10c55e920f57..6f5c92d9b5d2 100644 --- a/java-kms/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceGrpc.java +++ b/java-kms/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceGrpc.java @@ -217,6 +217,89 @@ private EkmServiceGrpc() {} return getUpdateEkmConnectionMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.kms.v1.GetEkmConfigRequest, com.google.cloud.kms.v1.EkmConfig> + getGetEkmConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetEkmConfig", + requestType = com.google.cloud.kms.v1.GetEkmConfigRequest.class, + responseType = com.google.cloud.kms.v1.EkmConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.kms.v1.GetEkmConfigRequest, com.google.cloud.kms.v1.EkmConfig> + getGetEkmConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.kms.v1.GetEkmConfigRequest, com.google.cloud.kms.v1.EkmConfig> + getGetEkmConfigMethod; + if ((getGetEkmConfigMethod = EkmServiceGrpc.getGetEkmConfigMethod) == null) { + synchronized (EkmServiceGrpc.class) { + if ((getGetEkmConfigMethod = EkmServiceGrpc.getGetEkmConfigMethod) == null) { + EkmServiceGrpc.getGetEkmConfigMethod = + getGetEkmConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetEkmConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.GetEkmConfigRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.EkmConfig.getDefaultInstance())) + .setSchemaDescriptor(new EkmServiceMethodDescriptorSupplier("GetEkmConfig")) + .build(); + } + } + } + return getGetEkmConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.kms.v1.UpdateEkmConfigRequest, com.google.cloud.kms.v1.EkmConfig> + getUpdateEkmConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateEkmConfig", + requestType = com.google.cloud.kms.v1.UpdateEkmConfigRequest.class, + responseType = com.google.cloud.kms.v1.EkmConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.kms.v1.UpdateEkmConfigRequest, com.google.cloud.kms.v1.EkmConfig> + getUpdateEkmConfigMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.kms.v1.UpdateEkmConfigRequest, com.google.cloud.kms.v1.EkmConfig> + getUpdateEkmConfigMethod; + if ((getUpdateEkmConfigMethod = EkmServiceGrpc.getUpdateEkmConfigMethod) == null) { + synchronized (EkmServiceGrpc.class) { + if ((getUpdateEkmConfigMethod = EkmServiceGrpc.getUpdateEkmConfigMethod) == null) { + EkmServiceGrpc.getUpdateEkmConfigMethod = + getUpdateEkmConfigMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateEkmConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.UpdateEkmConfigRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.EkmConfig.getDefaultInstance())) + .setSchemaDescriptor( + new EkmServiceMethodDescriptorSupplier("UpdateEkmConfig")) + .build(); + } + } + } + return getUpdateEkmConfigMethod; + } + /** Creates a new async stub that supports all call types for the service */ public static EkmServiceStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -328,6 +411,36 @@ public void updateEkmConnection( getUpdateEkmConnectionMethod(), responseObserver); } + /** + * + * + *
+     * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public void getEkmConfig( + com.google.cloud.kms.v1.GetEkmConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetEkmConfigMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public void updateEkmConfig( + com.google.cloud.kms.v1.UpdateEkmConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateEkmConfigMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) @@ -356,6 +469,18 @@ public final io.grpc.ServerServiceDefinition bindService() { new MethodHandlers< com.google.cloud.kms.v1.UpdateEkmConnectionRequest, com.google.cloud.kms.v1.EkmConnection>(this, METHODID_UPDATE_EKM_CONNECTION))) + .addMethod( + getGetEkmConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.GetEkmConfigRequest, + com.google.cloud.kms.v1.EkmConfig>(this, METHODID_GET_EKM_CONFIG))) + .addMethod( + getUpdateEkmConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.UpdateEkmConfigRequest, + com.google.cloud.kms.v1.EkmConfig>(this, METHODID_UPDATE_EKM_CONFIG))) .build(); } } @@ -446,6 +571,40 @@ public void updateEkmConnection( request, responseObserver); } + + /** + * + * + *
+     * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public void getEkmConfig( + com.google.cloud.kms.v1.GetEkmConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetEkmConfigMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public void updateEkmConfig( + com.google.cloud.kms.v1.UpdateEkmConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateEkmConfigMethod(), getCallOptions()), + request, + responseObserver); + } } /** @@ -523,6 +682,34 @@ public com.google.cloud.kms.v1.EkmConnection updateEkmConnection( return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getUpdateEkmConnectionMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public com.google.cloud.kms.v1.EkmConfig getEkmConfig( + com.google.cloud.kms.v1.GetEkmConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetEkmConfigMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public com.google.cloud.kms.v1.EkmConfig updateEkmConfig( + com.google.cloud.kms.v1.UpdateEkmConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateEkmConfigMethod(), getCallOptions(), request); + } } /** @@ -600,12 +787,42 @@ protected EkmServiceFutureStub build(io.grpc.Channel channel, io.grpc.CallOption return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getUpdateEkmConnectionMethod(), getCallOptions()), request); } + + /** + * + * + *
+     * Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getEkmConfig(com.google.cloud.kms.v1.GetEkmConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetEkmConfigMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource
+     * for a given project and location.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateEkmConfig(com.google.cloud.kms.v1.UpdateEkmConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateEkmConfigMethod(), getCallOptions()), request); + } } private static final int METHODID_LIST_EKM_CONNECTIONS = 0; private static final int METHODID_GET_EKM_CONNECTION = 1; private static final int METHODID_CREATE_EKM_CONNECTION = 2; private static final int METHODID_UPDATE_EKM_CONNECTION = 3; + private static final int METHODID_GET_EKM_CONFIG = 4; + private static final int METHODID_UPDATE_EKM_CONFIG = 5; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -648,6 +865,16 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_EKM_CONFIG: + serviceImpl.getEkmConfig( + (com.google.cloud.kms.v1.GetEkmConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_EKM_CONFIG: + serviceImpl.updateEkmConfig( + (com.google.cloud.kms.v1.UpdateEkmConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -716,6 +943,8 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getGetEkmConnectionMethod()) .addMethod(getCreateEkmConnectionMethod()) .addMethod(getUpdateEkmConnectionMethod()) + .addMethod(getGetEkmConfigMethod()) + .addMethod(getUpdateEkmConfigMethod()) .build(); } } diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java index ce8315ce1a5b..647997346368 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java @@ -52,6 +52,8 @@ private CryptoKeyVersion() { algorithm_ = 0; importJob_ = ""; importFailureReason_ = ""; + generationFailureReason_ = ""; + externalDestructionFailureReason_ = ""; } @java.lang.Override @@ -963,6 +965,44 @@ public enum CryptoKeyVersionState implements com.google.protobuf.ProtocolMessage * IMPORT_FAILED = 7; */ IMPORT_FAILED(7), + /** + * + * + *
+     * This version was not generated successfully. It may not be used, enabled,
+     * disabled, or destroyed. Additional details can be found in
+     * [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
+     * 
+ * + * GENERATION_FAILED = 8; + */ + GENERATION_FAILED(8), + /** + * + * + *
+     * This version was destroyed, and it may not be used or enabled again.
+     * Cloud KMS is waiting for the corresponding key material residing in an
+     * external key manager to be destroyed.
+     * 
+ * + * PENDING_EXTERNAL_DESTRUCTION = 9; + */ + PENDING_EXTERNAL_DESTRUCTION(9), + /** + * + * + *
+     * This version was destroyed, and it may not be used or enabled again.
+     * However, Cloud KMS could not confirm that the corresponding key material
+     * residing in an external key manager was destroyed. Additional details can
+     * be found in
+     * [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
+     * 
+ * + * EXTERNAL_DESTRUCTION_FAILED = 10; + */ + EXTERNAL_DESTRUCTION_FAILED(10), UNRECOGNIZED(-1), ; @@ -1071,6 +1111,44 @@ public enum CryptoKeyVersionState implements com.google.protobuf.ProtocolMessage * IMPORT_FAILED = 7; */ public static final int IMPORT_FAILED_VALUE = 7; + /** + * + * + *
+     * This version was not generated successfully. It may not be used, enabled,
+     * disabled, or destroyed. Additional details can be found in
+     * [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
+     * 
+ * + * GENERATION_FAILED = 8; + */ + public static final int GENERATION_FAILED_VALUE = 8; + /** + * + * + *
+     * This version was destroyed, and it may not be used or enabled again.
+     * Cloud KMS is waiting for the corresponding key material residing in an
+     * external key manager to be destroyed.
+     * 
+ * + * PENDING_EXTERNAL_DESTRUCTION = 9; + */ + public static final int PENDING_EXTERNAL_DESTRUCTION_VALUE = 9; + /** + * + * + *
+     * This version was destroyed, and it may not be used or enabled again.
+     * However, Cloud KMS could not confirm that the corresponding key material
+     * residing in an external key manager was destroyed. Additional details can
+     * be found in
+     * [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
+     * 
+ * + * EXTERNAL_DESTRUCTION_FAILED = 10; + */ + public static final int EXTERNAL_DESTRUCTION_FAILED_VALUE = 10; public final int getNumber() { if (this == UNRECOGNIZED) { @@ -1112,6 +1190,12 @@ public static CryptoKeyVersionState forNumber(int value) { return PENDING_IMPORT; case 7: return IMPORT_FAILED; + case 8: + return GENERATION_FAILED; + case 9: + return PENDING_EXTERNAL_DESTRUCTION; + case 10: + return EXTERNAL_DESTRUCTION_FAILED; default: return null; } @@ -1980,6 +2064,124 @@ public com.google.protobuf.ByteString getImportFailureReasonBytes() { } } + public static final int GENERATION_FAILURE_REASON_FIELD_NUMBER = 19; + + @SuppressWarnings("serial") + private volatile java.lang.Object generationFailureReason_ = ""; + /** + * + * + *
+   * Output only. The root cause of the most recent generation failure. Only
+   * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+   * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The generationFailureReason. + */ + @java.lang.Override + public java.lang.String getGenerationFailureReason() { + java.lang.Object ref = generationFailureReason_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + generationFailureReason_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The root cause of the most recent generation failure. Only
+   * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+   * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for generationFailureReason. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGenerationFailureReasonBytes() { + java.lang.Object ref = generationFailureReason_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + generationFailureReason_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXTERNAL_DESTRUCTION_FAILURE_REASON_FIELD_NUMBER = 20; + + @SuppressWarnings("serial") + private volatile java.lang.Object externalDestructionFailureReason_ = ""; + /** + * + * + *
+   * Output only. The root cause of the most recent external destruction
+   * failure. Only present if
+   * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+   * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The externalDestructionFailureReason. + */ + @java.lang.Override + public java.lang.String getExternalDestructionFailureReason() { + java.lang.Object ref = externalDestructionFailureReason_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + externalDestructionFailureReason_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The root cause of the most recent external destruction
+   * failure. Only present if
+   * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+   * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for externalDestructionFailureReason. + */ + @java.lang.Override + public com.google.protobuf.ByteString getExternalDestructionFailureReasonBytes() { + java.lang.Object ref = externalDestructionFailureReason_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + externalDestructionFailureReason_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + public static final int EXTERNAL_PROTECTION_LEVEL_OPTIONS_FIELD_NUMBER = 17; private com.google.cloud.kms.v1.ExternalProtectionLevelOptions externalProtectionLevelOptions_; /** @@ -2136,6 +2338,13 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (reimportEligible_ != false) { output.writeBool(18, reimportEligible_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(generationFailureReason_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 19, generationFailureReason_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(externalDestructionFailureReason_)) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 20, externalDestructionFailureReason_); + } getUnknownFields().writeTo(output); } @@ -2196,6 +2405,15 @@ public int getSerializedSize() { if (reimportEligible_ != false) { size += com.google.protobuf.CodedOutputStream.computeBoolSize(18, reimportEligible_); } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(generationFailureReason_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize(19, generationFailureReason_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(externalDestructionFailureReason_)) { + size += + com.google.protobuf.GeneratedMessageV3.computeStringSize( + 20, externalDestructionFailureReason_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2241,6 +2459,9 @@ public boolean equals(final java.lang.Object obj) { if (!getImportTime().equals(other.getImportTime())) return false; } if (!getImportFailureReason().equals(other.getImportFailureReason())) return false; + if (!getGenerationFailureReason().equals(other.getGenerationFailureReason())) return false; + if (!getExternalDestructionFailureReason().equals(other.getExternalDestructionFailureReason())) + return false; if (hasExternalProtectionLevelOptions() != other.hasExternalProtectionLevelOptions()) return false; if (hasExternalProtectionLevelOptions()) { @@ -2295,6 +2516,10 @@ public int hashCode() { } hash = (37 * hash) + IMPORT_FAILURE_REASON_FIELD_NUMBER; hash = (53 * hash) + getImportFailureReason().hashCode(); + hash = (37 * hash) + GENERATION_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getGenerationFailureReason().hashCode(); + hash = (37 * hash) + EXTERNAL_DESTRUCTION_FAILURE_REASON_FIELD_NUMBER; + hash = (53 * hash) + getExternalDestructionFailureReason().hashCode(); if (hasExternalProtectionLevelOptions()) { hash = (37 * hash) + EXTERNAL_PROTECTION_LEVEL_OPTIONS_FIELD_NUMBER; hash = (53 * hash) + getExternalProtectionLevelOptions().hashCode(); @@ -2484,6 +2709,8 @@ public Builder clear() { importTimeBuilder_ = null; } importFailureReason_ = ""; + generationFailureReason_ = ""; + externalDestructionFailureReason_ = ""; externalProtectionLevelOptions_ = null; if (externalProtectionLevelOptionsBuilder_ != null) { externalProtectionLevelOptionsBuilder_.dispose(); @@ -2567,12 +2794,18 @@ private void buildPartial0(com.google.cloud.kms.v1.CryptoKeyVersion result) { result.importFailureReason_ = importFailureReason_; } if (((from_bitField0_ & 0x00001000) != 0)) { + result.generationFailureReason_ = generationFailureReason_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + result.externalDestructionFailureReason_ = externalDestructionFailureReason_; + } + if (((from_bitField0_ & 0x00004000) != 0)) { result.externalProtectionLevelOptions_ = externalProtectionLevelOptionsBuilder_ == null ? externalProtectionLevelOptions_ : externalProtectionLevelOptionsBuilder_.build(); } - if (((from_bitField0_ & 0x00002000) != 0)) { + if (((from_bitField0_ & 0x00008000) != 0)) { result.reimportEligible_ = reimportEligible_; } } @@ -2664,6 +2897,16 @@ public Builder mergeFrom(com.google.cloud.kms.v1.CryptoKeyVersion other) { bitField0_ |= 0x00000800; onChanged(); } + if (!other.getGenerationFailureReason().isEmpty()) { + generationFailureReason_ = other.generationFailureReason_; + bitField0_ |= 0x00001000; + onChanged(); + } + if (!other.getExternalDestructionFailureReason().isEmpty()) { + externalDestructionFailureReason_ = other.externalDestructionFailureReason_; + bitField0_ |= 0x00002000; + onChanged(); + } if (other.hasExternalProtectionLevelOptions()) { mergeExternalProtectionLevelOptions(other.getExternalProtectionLevelOptions()); } @@ -2774,15 +3017,27 @@ public Builder mergeFrom( input.readMessage( getExternalProtectionLevelOptionsFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00004000; break; } // case 138 case 144: { reimportEligible_ = input.readBool(); - bitField0_ |= 0x00002000; + bitField0_ |= 0x00008000; break; } // case 144 + case 154: + { + generationFailureReason_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00001000; + break; + } // case 154 + case 162: + { + externalDestructionFailureReason_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00002000; + break; + } // case 162 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -4832,6 +5087,259 @@ public Builder setImportFailureReasonBytes(com.google.protobuf.ByteString value) return this; } + private java.lang.Object generationFailureReason_ = ""; + /** + * + * + *
+     * Output only. The root cause of the most recent generation failure. Only
+     * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+     * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The generationFailureReason. + */ + public java.lang.String getGenerationFailureReason() { + java.lang.Object ref = generationFailureReason_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + generationFailureReason_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The root cause of the most recent generation failure. Only
+     * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+     * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for generationFailureReason. + */ + public com.google.protobuf.ByteString getGenerationFailureReasonBytes() { + java.lang.Object ref = generationFailureReason_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + generationFailureReason_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The root cause of the most recent generation failure. Only
+     * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+     * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The generationFailureReason to set. + * @return This builder for chaining. + */ + public Builder setGenerationFailureReason(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + generationFailureReason_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The root cause of the most recent generation failure. Only
+     * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+     * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearGenerationFailureReason() { + generationFailureReason_ = getDefaultInstance().getGenerationFailureReason(); + bitField0_ = (bitField0_ & ~0x00001000); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The root cause of the most recent generation failure. Only
+     * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+     * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes for generationFailureReason to set. + * @return This builder for chaining. + */ + public Builder setGenerationFailureReasonBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + generationFailureReason_ = value; + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + + private java.lang.Object externalDestructionFailureReason_ = ""; + /** + * + * + *
+     * Output only. The root cause of the most recent external destruction
+     * failure. Only present if
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+     * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The externalDestructionFailureReason. + */ + public java.lang.String getExternalDestructionFailureReason() { + java.lang.Object ref = externalDestructionFailureReason_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + externalDestructionFailureReason_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The root cause of the most recent external destruction
+     * failure. Only present if
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+     * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for externalDestructionFailureReason. + */ + public com.google.protobuf.ByteString getExternalDestructionFailureReasonBytes() { + java.lang.Object ref = externalDestructionFailureReason_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + externalDestructionFailureReason_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The root cause of the most recent external destruction
+     * failure. Only present if
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+     * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The externalDestructionFailureReason to set. + * @return This builder for chaining. + */ + public Builder setExternalDestructionFailureReason(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + externalDestructionFailureReason_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The root cause of the most recent external destruction
+     * failure. Only present if
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+     * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearExternalDestructionFailureReason() { + externalDestructionFailureReason_ = + getDefaultInstance().getExternalDestructionFailureReason(); + bitField0_ = (bitField0_ & ~0x00002000); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The root cause of the most recent external destruction
+     * failure. Only present if
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+     * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The bytes for externalDestructionFailureReason to set. + * @return This builder for chaining. + */ + public Builder setExternalDestructionFailureReasonBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + externalDestructionFailureReason_ = value; + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + private com.google.cloud.kms.v1.ExternalProtectionLevelOptions externalProtectionLevelOptions_; private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.kms.v1.ExternalProtectionLevelOptions, @@ -4857,7 +5365,7 @@ public Builder setImportFailureReasonBytes(com.google.protobuf.ByteString value) * @return Whether the externalProtectionLevelOptions field is set. */ public boolean hasExternalProtectionLevelOptions() { - return ((bitField0_ & 0x00001000) != 0); + return ((bitField0_ & 0x00004000) != 0); } /** * @@ -4913,7 +5421,7 @@ public Builder setExternalProtectionLevelOptions( } else { externalProtectionLevelOptionsBuilder_.setMessage(value); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00004000; onChanged(); return this; } @@ -4940,7 +5448,7 @@ public Builder setExternalProtectionLevelOptions( } else { externalProtectionLevelOptionsBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00004000; onChanged(); return this; } @@ -4963,7 +5471,7 @@ public Builder setExternalProtectionLevelOptions( public Builder mergeExternalProtectionLevelOptions( com.google.cloud.kms.v1.ExternalProtectionLevelOptions value) { if (externalProtectionLevelOptionsBuilder_ == null) { - if (((bitField0_ & 0x00001000) != 0) + if (((bitField0_ & 0x00004000) != 0) && externalProtectionLevelOptions_ != null && externalProtectionLevelOptions_ != com.google.cloud.kms.v1.ExternalProtectionLevelOptions.getDefaultInstance()) { @@ -4974,7 +5482,7 @@ public Builder mergeExternalProtectionLevelOptions( } else { externalProtectionLevelOptionsBuilder_.mergeFrom(value); } - bitField0_ |= 0x00001000; + bitField0_ |= 0x00004000; onChanged(); return this; } @@ -4995,7 +5503,7 @@ public Builder mergeExternalProtectionLevelOptions( * */ public Builder clearExternalProtectionLevelOptions() { - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00004000); externalProtectionLevelOptions_ = null; if (externalProtectionLevelOptionsBuilder_ != null) { externalProtectionLevelOptionsBuilder_.dispose(); @@ -5022,7 +5530,7 @@ public Builder clearExternalProtectionLevelOptions() { */ public com.google.cloud.kms.v1.ExternalProtectionLevelOptions.Builder getExternalProtectionLevelOptionsBuilder() { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00004000; onChanged(); return getExternalProtectionLevelOptionsFieldBuilder().getBuilder(); } @@ -5120,7 +5628,7 @@ public boolean getReimportEligible() { public Builder setReimportEligible(boolean value) { reimportEligible_ = value; - bitField0_ |= 0x00002000; + bitField0_ |= 0x00008000; onChanged(); return this; } @@ -5138,7 +5646,7 @@ public Builder setReimportEligible(boolean value) { * @return This builder for chaining. */ public Builder clearReimportEligible() { - bitField0_ = (bitField0_ & ~0x00002000); + bitField0_ = (bitField0_ & ~0x00008000); reimportEligible_ = false; onChanged(); return this; diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java index 6977a6e51cae..c512a3e02003 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java @@ -492,6 +492,72 @@ public interface CryptoKeyVersionOrBuilder */ com.google.protobuf.ByteString getImportFailureReasonBytes(); + /** + * + * + *
+   * Output only. The root cause of the most recent generation failure. Only
+   * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+   * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The generationFailureReason. + */ + java.lang.String getGenerationFailureReason(); + /** + * + * + *
+   * Output only. The root cause of the most recent generation failure. Only
+   * present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
+   * 
+ * + * string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for generationFailureReason. + */ + com.google.protobuf.ByteString getGenerationFailureReasonBytes(); + + /** + * + * + *
+   * Output only. The root cause of the most recent external destruction
+   * failure. Only present if
+   * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+   * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The externalDestructionFailureReason. + */ + java.lang.String getExternalDestructionFailureReason(); + /** + * + * + *
+   * Output only. The root cause of the most recent external destruction
+   * failure. Only present if
+   * [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
+   * 
+ * + * + * string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The bytes for externalDestructionFailureReason. + */ + com.google.protobuf.ByteString getExternalDestructionFailureReasonBytes(); + /** * * diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfig.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfig.java new file mode 100644 index 000000000000..aac8368557b5 --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfig.java @@ -0,0 +1,861 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/ekm_service.proto + +package com.google.cloud.kms.v1; + +/** + * + * + *
+ * An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
+ * represents configuration parameters that apply to all
+ * [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
+ * [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
+ * [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
+ * [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC] in a given
+ * project and location.
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.EkmConfig} + */ +public final class EkmConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.EkmConfig) + EkmConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use EkmConfig.newBuilder() to construct. + private EkmConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private EkmConfig() { + name_ = ""; + defaultEkmConnection_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new EkmConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_EkmConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_EkmConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.EkmConfig.class, + com.google.cloud.kms.v1.EkmConfig.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Output only. The resource name for the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+   * `projects/*/locations/*/ekmConfig`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name for the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+   * `projects/*/locations/*/ekmConfig`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DEFAULT_EKM_CONNECTION_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object defaultEkmConnection_ = ""; + /** + * + * + *
+   * Optional. Resource name of the default
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+   * the empty string removes the default.
+   * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The defaultEkmConnection. + */ + @java.lang.Override + public java.lang.String getDefaultEkmConnection() { + java.lang.Object ref = defaultEkmConnection_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + defaultEkmConnection_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Resource name of the default
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+   * the empty string removes the default.
+   * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for defaultEkmConnection. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDefaultEkmConnectionBytes() { + java.lang.Object ref = defaultEkmConnection_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + defaultEkmConnection_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultEkmConnection_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, defaultEkmConnection_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultEkmConnection_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, defaultEkmConnection_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.kms.v1.EkmConfig)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.EkmConfig other = (com.google.cloud.kms.v1.EkmConfig) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDefaultEkmConnection().equals(other.getDefaultEkmConnection())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DEFAULT_EKM_CONNECTION_FIELD_NUMBER; + hash = (53 * hash) + getDefaultEkmConnection().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.kms.v1.EkmConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.EkmConfig parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.EkmConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.kms.v1.EkmConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
+   * represents configuration parameters that apply to all
+   * [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
+   * [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
+   * [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
+   * [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC] in a given
+   * project and location.
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.EkmConfig} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.EkmConfig) + com.google.cloud.kms.v1.EkmConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_EkmConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_EkmConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.EkmConfig.class, + com.google.cloud.kms.v1.EkmConfig.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.EkmConfig.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + defaultEkmConnection_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_EkmConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.kms.v1.EkmConfig getDefaultInstanceForType() { + return com.google.cloud.kms.v1.EkmConfig.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.kms.v1.EkmConfig build() { + com.google.cloud.kms.v1.EkmConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.kms.v1.EkmConfig buildPartial() { + com.google.cloud.kms.v1.EkmConfig result = new com.google.cloud.kms.v1.EkmConfig(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.kms.v1.EkmConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.defaultEkmConnection_ = defaultEkmConnection_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.EkmConfig) { + return mergeFrom((com.google.cloud.kms.v1.EkmConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.EkmConfig other) { + if (other == com.google.cloud.kms.v1.EkmConfig.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getDefaultEkmConnection().isEmpty()) { + defaultEkmConnection_ = other.defaultEkmConnection_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + defaultEkmConnection_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name for the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+     * `projects/*/locations/*/ekmConfig`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name for the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+     * `projects/*/locations/*/ekmConfig`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name for the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+     * `projects/*/locations/*/ekmConfig`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name for the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+     * `projects/*/locations/*/ekmConfig`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name for the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+     * `projects/*/locations/*/ekmConfig`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object defaultEkmConnection_ = ""; + /** + * + * + *
+     * Optional. Resource name of the default
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+     * the empty string removes the default.
+     * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The defaultEkmConnection. + */ + public java.lang.String getDefaultEkmConnection() { + java.lang.Object ref = defaultEkmConnection_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + defaultEkmConnection_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Resource name of the default
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+     * the empty string removes the default.
+     * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for defaultEkmConnection. + */ + public com.google.protobuf.ByteString getDefaultEkmConnectionBytes() { + java.lang.Object ref = defaultEkmConnection_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + defaultEkmConnection_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Resource name of the default
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+     * the empty string removes the default.
+     * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The defaultEkmConnection to set. + * @return This builder for chaining. + */ + public Builder setDefaultEkmConnection(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + defaultEkmConnection_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Resource name of the default
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+     * the empty string removes the default.
+     * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearDefaultEkmConnection() { + defaultEkmConnection_ = getDefaultInstance().getDefaultEkmConnection(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Resource name of the default
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+     * the empty string removes the default.
+     * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for defaultEkmConnection to set. + * @return This builder for chaining. + */ + public Builder setDefaultEkmConnectionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + defaultEkmConnection_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.EkmConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.EkmConfig) + private static final com.google.cloud.kms.v1.EkmConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.EkmConfig(); + } + + public static com.google.cloud.kms.v1.EkmConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EkmConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.kms.v1.EkmConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigName.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigName.java new file mode 100644 index 000000000000..bfe2fb2df0ef --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigName.java @@ -0,0 +1,192 @@ +/* + * 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.kms.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class EkmConfigName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/ekmConfig"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + + @Deprecated + protected EkmConfigName() { + project = null; + location = null; + } + + private EkmConfigName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static EkmConfigName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static EkmConfigName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "EkmConfigName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (EkmConfigName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + EkmConfigName that = ((EkmConfigName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}/ekmConfig. */ + public static class Builder { + private String project; + private String location; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(EkmConfigName ekmConfigName) { + this.project = ekmConfigName.project; + this.location = ekmConfigName.location; + } + + public EkmConfigName build() { + return new EkmConfigName(this); + } + } +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigOrBuilder.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigOrBuilder.java new file mode 100644 index 000000000000..c3d3c6cd4be3 --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConfigOrBuilder.java @@ -0,0 +1,87 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/ekm_service.proto + +package com.google.cloud.kms.v1; + +public interface EkmConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.EkmConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The resource name for the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+   * `projects/*/locations/*/ekmConfig`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name for the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
+   * `projects/*/locations/*/ekmConfig`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. Resource name of the default
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+   * the empty string removes the default.
+   * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The defaultEkmConnection. + */ + java.lang.String getDefaultEkmConnection(); + /** + * + * + *
+   * Optional. Resource name of the default
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
+   * the empty string removes the default.
+   * 
+ * + * + * string default_ekm_connection = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for defaultEkmConnection. + */ + com.google.protobuf.ByteString getDefaultEkmConnectionBytes(); +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnection.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnection.java index 6b405fd8d32f..aa1ddd939931 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnection.java +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnection.java @@ -48,6 +48,8 @@ private EkmConnection() { name_ = ""; serviceResolvers_ = java.util.Collections.emptyList(); etag_ = ""; + keyManagementMode_ = 0; + cryptoSpacePath_ = ""; } @java.lang.Override @@ -76,6 +78,216 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { com.google.cloud.kms.v1.EkmConnection.Builder.class); } + /** + * + * + *
+   * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
+   * describes who can perform control plane cryptographic operations using this
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection].
+   * 
+ * + * Protobuf enum {@code google.cloud.kms.v1.EkmConnection.KeyManagementMode} + */ + public enum KeyManagementMode implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Not specified.
+     * 
+ * + * KEY_MANAGEMENT_MODE_UNSPECIFIED = 0; + */ + KEY_MANAGEMENT_MODE_UNSPECIFIED(0), + /** + * + * + *
+     * EKM-side key management operations on
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
+     * the EKM directly and cannot be performed from Cloud KMS. This means that:
+     * * When creating a
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
+     * this
+     *   [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
+     *   supply the key path of pre-existing external key material that will be
+     *   linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * * Destruction of external key material cannot be requested via the
+     *   Cloud KMS API and must be performed directly in the EKM.
+     * * Automatic rotation of key material is not supported.
+     * 
+ * + * MANUAL = 1; + */ + MANUAL(1), + /** + * + * + *
+     * All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
+     * management operations initiated from Cloud KMS. This means that:
+     * * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
+     * is
+     *   created, the EKM automatically generates new key material and a new
+     *   key path. The caller cannot supply the key path of pre-existing
+     *   external key material.
+     * * Destruction of external key material associated with this
+     *   [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
+     *   calling [DestroyCryptoKeyVersion][EkmService.DestroyCryptoKeyVersion].
+     * * Automatic rotation of key material is supported.
+     * 
+ * + * CLOUD_KMS = 2; + */ + CLOUD_KMS(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Not specified.
+     * 
+ * + * KEY_MANAGEMENT_MODE_UNSPECIFIED = 0; + */ + public static final int KEY_MANAGEMENT_MODE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * EKM-side key management operations on
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
+     * the EKM directly and cannot be performed from Cloud KMS. This means that:
+     * * When creating a
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
+     * this
+     *   [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
+     *   supply the key path of pre-existing external key material that will be
+     *   linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * * Destruction of external key material cannot be requested via the
+     *   Cloud KMS API and must be performed directly in the EKM.
+     * * Automatic rotation of key material is not supported.
+     * 
+ * + * MANUAL = 1; + */ + public static final int MANUAL_VALUE = 1; + /** + * + * + *
+     * All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
+     * management operations initiated from Cloud KMS. This means that:
+     * * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
+     * is
+     *   created, the EKM automatically generates new key material and a new
+     *   key path. The caller cannot supply the key path of pre-existing
+     *   external key material.
+     * * Destruction of external key material associated with this
+     *   [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
+     *   calling [DestroyCryptoKeyVersion][EkmService.DestroyCryptoKeyVersion].
+     * * Automatic rotation of key material is supported.
+     * 
+ * + * CLOUD_KMS = 2; + */ + public static final int CLOUD_KMS_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static KeyManagementMode valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static KeyManagementMode forNumber(int value) { + switch (value) { + case 0: + return KEY_MANAGEMENT_MODE_UNSPECIFIED; + case 1: + return MANUAL; + case 2: + return CLOUD_KMS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public KeyManagementMode findValueByNumber(int number) { + return KeyManagementMode.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmConnection.getDescriptor().getEnumTypes().get(0); + } + + private static final KeyManagementMode[] VALUES = values(); + + public static KeyManagementMode valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private KeyManagementMode(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.kms.v1.EkmConnection.KeyManagementMode) + } + public interface ServiceResolverOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.EkmConnection.ServiceResolver) @@ -2136,6 +2348,110 @@ public com.google.protobuf.ByteString getEtagBytes() { } } + public static final int KEY_MANAGEMENT_MODE_FIELD_NUMBER = 6; + private int keyManagementMode_ = 0; + /** + * + * + *
+   * Optional. Describes who can perform control plane operations on the EKM. If
+   * unset, this defaults to
+   * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+   * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for keyManagementMode. + */ + @java.lang.Override + public int getKeyManagementModeValue() { + return keyManagementMode_; + } + /** + * + * + *
+   * Optional. Describes who can perform control plane operations on the EKM. If
+   * unset, this defaults to
+   * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+   * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The keyManagementMode. + */ + @java.lang.Override + public com.google.cloud.kms.v1.EkmConnection.KeyManagementMode getKeyManagementMode() { + com.google.cloud.kms.v1.EkmConnection.KeyManagementMode result = + com.google.cloud.kms.v1.EkmConnection.KeyManagementMode.forNumber(keyManagementMode_); + return result == null + ? com.google.cloud.kms.v1.EkmConnection.KeyManagementMode.UNRECOGNIZED + : result; + } + + public static final int CRYPTO_SPACE_PATH_FIELD_NUMBER = 7; + + @SuppressWarnings("serial") + private volatile java.lang.Object cryptoSpacePath_ = ""; + /** + * + * + *
+   * Optional. Identifies the EKM Crypto Space that this
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+   * field is required if
+   * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+   * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+   * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The cryptoSpacePath. + */ + @java.lang.Override + public java.lang.String getCryptoSpacePath() { + java.lang.Object ref = cryptoSpacePath_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cryptoSpacePath_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Identifies the EKM Crypto Space that this
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+   * field is required if
+   * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+   * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+   * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for cryptoSpacePath. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCryptoSpacePathBytes() { + java.lang.Object ref = cryptoSpacePath_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cryptoSpacePath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -2162,6 +2478,14 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 5, etag_); } + if (keyManagementMode_ + != com.google.cloud.kms.v1.EkmConnection.KeyManagementMode.KEY_MANAGEMENT_MODE_UNSPECIFIED + .getNumber()) { + output.writeEnum(6, keyManagementMode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cryptoSpacePath_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, cryptoSpacePath_); + } getUnknownFields().writeTo(output); } @@ -2183,6 +2507,14 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, etag_); } + if (keyManagementMode_ + != com.google.cloud.kms.v1.EkmConnection.KeyManagementMode.KEY_MANAGEMENT_MODE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, keyManagementMode_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cryptoSpacePath_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, cryptoSpacePath_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -2205,6 +2537,8 @@ public boolean equals(final java.lang.Object obj) { } if (!getServiceResolversList().equals(other.getServiceResolversList())) return false; if (!getEtag().equals(other.getEtag())) return false; + if (keyManagementMode_ != other.keyManagementMode_) return false; + if (!getCryptoSpacePath().equals(other.getCryptoSpacePath())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2228,6 +2562,10 @@ public int hashCode() { } hash = (37 * hash) + ETAG_FIELD_NUMBER; hash = (53 * hash) + getEtag().hashCode(); + hash = (37 * hash) + KEY_MANAGEMENT_MODE_FIELD_NUMBER; + hash = (53 * hash) + keyManagementMode_; + hash = (37 * hash) + CRYPTO_SPACE_PATH_FIELD_NUMBER; + hash = (53 * hash) + getCryptoSpacePath().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -2387,6 +2725,8 @@ public Builder clear() { } bitField0_ = (bitField0_ & ~0x00000004); etag_ = ""; + keyManagementMode_ = 0; + cryptoSpacePath_ = ""; return this; } @@ -2445,6 +2785,12 @@ private void buildPartial0(com.google.cloud.kms.v1.EkmConnection result) { if (((from_bitField0_ & 0x00000008) != 0)) { result.etag_ = etag_; } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.keyManagementMode_ = keyManagementMode_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.cryptoSpacePath_ = cryptoSpacePath_; + } } @java.lang.Override @@ -2532,6 +2878,14 @@ public Builder mergeFrom(com.google.cloud.kms.v1.EkmConnection other) { bitField0_ |= 0x00000008; onChanged(); } + if (other.keyManagementMode_ != 0) { + setKeyManagementModeValue(other.getKeyManagementModeValue()); + } + if (!other.getCryptoSpacePath().isEmpty()) { + cryptoSpacePath_ = other.cryptoSpacePath_; + bitField0_ |= 0x00000020; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -2590,6 +2944,18 @@ public Builder mergeFrom( bitField0_ |= 0x00000008; break; } // case 42 + case 48: + { + keyManagementMode_ = input.readEnum(); + bitField0_ |= 0x00000010; + break; + } // case 48 + case 58: + { + cryptoSpacePath_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000020; + break; + } // case 58 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -3519,6 +3885,245 @@ public Builder setEtagBytes(com.google.protobuf.ByteString value) { return this; } + private int keyManagementMode_ = 0; + /** + * + * + *
+     * Optional. Describes who can perform control plane operations on the EKM. If
+     * unset, this defaults to
+     * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for keyManagementMode. + */ + @java.lang.Override + public int getKeyManagementModeValue() { + return keyManagementMode_; + } + /** + * + * + *
+     * Optional. Describes who can perform control plane operations on the EKM. If
+     * unset, this defaults to
+     * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The enum numeric value on the wire for keyManagementMode to set. + * @return This builder for chaining. + */ + public Builder setKeyManagementModeValue(int value) { + keyManagementMode_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Describes who can perform control plane operations on the EKM. If
+     * unset, this defaults to
+     * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The keyManagementMode. + */ + @java.lang.Override + public com.google.cloud.kms.v1.EkmConnection.KeyManagementMode getKeyManagementMode() { + com.google.cloud.kms.v1.EkmConnection.KeyManagementMode result = + com.google.cloud.kms.v1.EkmConnection.KeyManagementMode.forNumber(keyManagementMode_); + return result == null + ? com.google.cloud.kms.v1.EkmConnection.KeyManagementMode.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Optional. Describes who can perform control plane operations on the EKM. If
+     * unset, this defaults to
+     * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The keyManagementMode to set. + * @return This builder for chaining. + */ + public Builder setKeyManagementMode( + com.google.cloud.kms.v1.EkmConnection.KeyManagementMode value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + keyManagementMode_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Describes who can perform control plane operations on the EKM. If
+     * unset, this defaults to
+     * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearKeyManagementMode() { + bitField0_ = (bitField0_ & ~0x00000010); + keyManagementMode_ = 0; + onChanged(); + return this; + } + + private java.lang.Object cryptoSpacePath_ = ""; + /** + * + * + *
+     * Optional. Identifies the EKM Crypto Space that this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+     * field is required if
+     * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+     * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+     * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The cryptoSpacePath. + */ + public java.lang.String getCryptoSpacePath() { + java.lang.Object ref = cryptoSpacePath_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cryptoSpacePath_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Identifies the EKM Crypto Space that this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+     * field is required if
+     * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+     * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+     * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for cryptoSpacePath. + */ + public com.google.protobuf.ByteString getCryptoSpacePathBytes() { + java.lang.Object ref = cryptoSpacePath_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + cryptoSpacePath_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Identifies the EKM Crypto Space that this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+     * field is required if
+     * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+     * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+     * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The cryptoSpacePath to set. + * @return This builder for chaining. + */ + public Builder setCryptoSpacePath(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + cryptoSpacePath_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Identifies the EKM Crypto Space that this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+     * field is required if
+     * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+     * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+     * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearCryptoSpacePath() { + cryptoSpacePath_ = getDefaultInstance().getCryptoSpacePath(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Identifies the EKM Crypto Space that this
+     * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+     * field is required if
+     * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+     * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+     * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for cryptoSpacePath to set. + * @return This builder for chaining. + */ + public Builder setCryptoSpacePathBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + cryptoSpacePath_ = value; + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnectionOrBuilder.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnectionOrBuilder.java index 07d7492cd9a3..89ae20453711 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnectionOrBuilder.java +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmConnectionOrBuilder.java @@ -197,4 +197,70 @@ com.google.cloud.kms.v1.EkmConnection.ServiceResolverOrBuilder getServiceResolve * @return The bytes for etag. */ com.google.protobuf.ByteString getEtagBytes(); + + /** + * + * + *
+   * Optional. Describes who can perform control plane operations on the EKM. If
+   * unset, this defaults to
+   * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+   * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for keyManagementMode. + */ + int getKeyManagementModeValue(); + /** + * + * + *
+   * Optional. Describes who can perform control plane operations on the EKM. If
+   * unset, this defaults to
+   * [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
+   * 
+ * + * + * .google.cloud.kms.v1.EkmConnection.KeyManagementMode key_management_mode = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The keyManagementMode. + */ + com.google.cloud.kms.v1.EkmConnection.KeyManagementMode getKeyManagementMode(); + + /** + * + * + *
+   * Optional. Identifies the EKM Crypto Space that this
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+   * field is required if
+   * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+   * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+   * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The cryptoSpacePath. + */ + java.lang.String getCryptoSpacePath(); + /** + * + * + *
+   * Optional. Identifies the EKM Crypto Space that this
+   * [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
+   * field is required if
+   * [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
+   * [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
+   * 
+ * + * string crypto_space_path = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for cryptoSpacePath. + */ + com.google.protobuf.ByteString getCryptoSpacePathBytes(); } diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceProto.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceProto.java index 9d5bf3cc43b1..61802501c522 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceProto.java +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EkmServiceProto.java @@ -47,6 +47,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_kms_v1_UpdateEkmConnectionRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_kms_v1_UpdateEkmConnectionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_GetEkmConfigRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_GetEkmConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_kms_v1_Certificate_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -59,6 +67,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_kms_v1_EkmConnection_ServiceResolver_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_kms_v1_EkmConnection_ServiceResolver_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_EkmConfig_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_EkmConfig_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -92,59 +104,83 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\032UpdateEkmConnectionRequest\022?\n\016ekm_conne" + "ction\030\001 \001(\0132\".google.cloud.kms.v1.EkmCon" + "nectionB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.goog" - + "le.protobuf.FieldMaskB\003\340A\002\"\277\002\n\013Certifica" - + "te\022\024\n\007raw_der\030\001 \001(\014B\003\340A\002\022\023\n\006parsed\030\002 \001(\010" - + "B\003\340A\003\022\023\n\006issuer\030\003 \001(\tB\003\340A\003\022\024\n\007subject\030\004 " - + "\001(\tB\003\340A\003\022*\n\035subject_alternative_dns_name" - + "s\030\005 \003(\tB\003\340A\003\0228\n\017not_before_time\030\006 \001(\0132\032." - + "google.protobuf.TimestampB\003\340A\003\0227\n\016not_af" - + "ter_time\030\007 \001(\0132\032.google.protobuf.Timesta" - + "mpB\003\340A\003\022\032\n\rserial_number\030\010 \001(\tB\003\340A\003\022\037\n\022s" - + "ha256_fingerprint\030\t \001(\tB\003\340A\003\"\220\004\n\rEkmConn" - + "ection\022\021\n\004name\030\001 \001(\tB\003\340A\003\0224\n\013create_time" - + "\030\002 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022" - + "M\n\021service_resolvers\030\003 \003(\01322.google.clou" - + "d.kms.v1.EkmConnection.ServiceResolver\022\021" - + "\n\004etag\030\005 \001(\tB\003\340A\001\032\336\001\n\017ServiceResolver\022R\n" - + "\031service_directory_service\030\001 \001(\tB/\340A\002\372A)" - + "\n\'servicedirectory.googleapis.com/Servic" - + "e\022\034\n\017endpoint_filter\030\002 \001(\tB\003\340A\001\022\025\n\010hostn" - + "ame\030\003 \001(\tB\003\340A\002\022B\n\023server_certificates\030\004 " - + "\003(\0132 .google.cloud.kms.v1.CertificateB\003\340" - + "A\002:s\352Ap\n%cloudkms.googleapis.com/EkmConn" - + "ection\022Gprojects/{project}/locations/{lo" - + "cation}/ekmConnections/{ekm_connection}2" - + "\261\007\n\nEkmService\022\272\001\n\022ListEkmConnections\022.." - + "google.cloud.kms.v1.ListEkmConnectionsRe" - + "quest\032/.google.cloud.kms.v1.ListEkmConne" - + "ctionsResponse\"C\202\323\344\223\0024\0222/v1/{parent=proj" - + "ects/*/locations/*}/ekmConnections\332A\006par" - + "ent\022\247\001\n\020GetEkmConnection\022,.google.cloud." - + "kms.v1.GetEkmConnectionRequest\032\".google." - + "cloud.kms.v1.EkmConnection\"A\202\323\344\223\0024\0222/v1/" - + "{name=projects/*/locations/*/ekmConnecti" - + "ons/*}\332A\004name\022\340\001\n\023CreateEkmConnection\022/." - + "google.cloud.kms.v1.CreateEkmConnectionR" - + "equest\032\".google.cloud.kms.v1.EkmConnecti" - + "on\"t\202\323\344\223\002D\"2/v1/{parent=projects/*/locat" - + "ions/*}/ekmConnections:\016ekm_connection\332A" - + "\'parent,ekm_connection_id,ekm_connection" - + "\022\342\001\n\023UpdateEkmConnection\022/.google.cloud." - + "kms.v1.UpdateEkmConnectionRequest\032\".goog" - + "le.cloud.kms.v1.EkmConnection\"v\202\323\344\223\002S2A/" - + "v1/{ekm_connection.name=projects/*/locat" - + "ions/*/ekmConnections/*}:\016ekm_connection" - + "\332A\032ekm_connection,update_mask\032t\312A\027cloudk" - + "ms.googleapis.com\322AWhttps://www.googleap" - + "is.com/auth/cloud-platform,https://www.g" - + "oogleapis.com/auth/cloudkmsB\205\002\n\027com.goog" - + "le.cloud.kms.v1B\017EkmServiceProtoP\001Z)clou" - + "d.google.com/go/kms/apiv1/kmspb;kmspb\370\001\001" - + "\252\002\023Google.Cloud.Kms.V1\312\002\023Google\\Cloud\\Km" - + "s\\V1\352A|\n\'servicedirectory.googleapis.com" - + "/Service\022Qprojects/{project}/locations/{" - + "location}/namespaces/{namespace}/service" - + "s/{service}b\006proto3" + + "le.protobuf.FieldMaskB\003\340A\002\"N\n\023GetEkmConf" + + "igRequest\0227\n\004name\030\001 \001(\tB)\340A\002\372A#\n!cloudkm" + + "s.googleapis.com/EkmConfig\"\207\001\n\026UpdateEkm" + + "ConfigRequest\0227\n\nekm_config\030\001 \001(\0132\036.goog" + + "le.cloud.kms.v1.EkmConfigB\003\340A\002\0224\n\013update" + + "_mask\030\002 \001(\0132\032.google.protobuf.FieldMaskB" + + "\003\340A\002\"\277\002\n\013Certificate\022\024\n\007raw_der\030\001 \001(\014B\003\340" + + "A\002\022\023\n\006parsed\030\002 \001(\010B\003\340A\003\022\023\n\006issuer\030\003 \001(\tB" + + "\003\340A\003\022\024\n\007subject\030\004 \001(\tB\003\340A\003\022*\n\035subject_al" + + "ternative_dns_names\030\005 \003(\tB\003\340A\003\0228\n\017not_be" + + "fore_time\030\006 \001(\0132\032.google.protobuf.Timest" + + "ampB\003\340A\003\0227\n\016not_after_time\030\007 \001(\0132\032.googl" + + "e.protobuf.TimestampB\003\340A\003\022\032\n\rserial_numb" + + "er\030\010 \001(\tB\003\340A\003\022\037\n\022sha256_fingerprint\030\t \001(" + + "\tB\003\340A\003\"\335\005\n\rEkmConnection\022\021\n\004name\030\001 \001(\tB\003" + + "\340A\003\0224\n\013create_time\030\002 \001(\0132\032.google.protob" + + "uf.TimestampB\003\340A\003\022M\n\021service_resolvers\030\003" + + " \003(\01322.google.cloud.kms.v1.EkmConnection" + + ".ServiceResolver\022\021\n\004etag\030\005 \001(\tB\003\340A\001\022V\n\023k" + + "ey_management_mode\030\006 \001(\01624.google.cloud." + + "kms.v1.EkmConnection.KeyManagementModeB\003" + + "\340A\001\022\036\n\021crypto_space_path\030\007 \001(\tB\003\340A\001\032\336\001\n\017" + + "ServiceResolver\022R\n\031service_directory_ser" + + "vice\030\001 \001(\tB/\340A\002\372A)\n\'servicedirectory.goo" + + "gleapis.com/Service\022\034\n\017endpoint_filter\030\002" + + " \001(\tB\003\340A\001\022\025\n\010hostname\030\003 \001(\tB\003\340A\002\022B\n\023serv" + + "er_certificates\030\004 \003(\0132 .google.cloud.kms" + + ".v1.CertificateB\003\340A\002\"S\n\021KeyManagementMod" + + "e\022#\n\037KEY_MANAGEMENT_MODE_UNSPECIFIED\020\000\022\n" + + "\n\006MANUAL\020\001\022\r\n\tCLOUD_KMS\020\002:s\352Ap\n%cloudkms" + + ".googleapis.com/EkmConnection\022Gprojects/" + + "{project}/locations/{location}/ekmConnec" + + "tions/{ekm_connection}\"\310\001\n\tEkmConfig\022\021\n\004" + + "name\030\001 \001(\tB\003\340A\003\022M\n\026default_ekm_connectio" + + "n\030\002 \001(\tB-\340A\001\372A\'\n%cloudkms.googleapis.com" + + "/EkmConnection:Y\352AV\n!cloudkms.googleapis" + + ".com/EkmConfig\0221projects/{project}/locat" + + "ions/{location}/ekmConfig2\216\n\n\nEkmService" + + "\022\272\001\n\022ListEkmConnections\022..google.cloud.k" + + "ms.v1.ListEkmConnectionsRequest\032/.google" + + ".cloud.kms.v1.ListEkmConnectionsResponse" + + "\"C\202\323\344\223\0024\0222/v1/{parent=projects/*/locatio" + + "ns/*}/ekmConnections\332A\006parent\022\247\001\n\020GetEkm" + + "Connection\022,.google.cloud.kms.v1.GetEkmC" + + "onnectionRequest\032\".google.cloud.kms.v1.E" + + "kmConnection\"A\202\323\344\223\0024\0222/v1/{name=projects" + + "/*/locations/*/ekmConnections/*}\332A\004name\022" + + "\340\001\n\023CreateEkmConnection\022/.google.cloud.k" + + "ms.v1.CreateEkmConnectionRequest\032\".googl" + + "e.cloud.kms.v1.EkmConnection\"t\202\323\344\223\002D\"2/v" + + "1/{parent=projects/*/locations/*}/ekmCon" + + "nections:\016ekm_connection\332A\'parent,ekm_co" + + "nnection_id,ekm_connection\022\342\001\n\023UpdateEkm" + + "Connection\022/.google.cloud.kms.v1.UpdateE" + + "kmConnectionRequest\032\".google.cloud.kms.v" + + "1.EkmConnection\"v\202\323\344\223\002S2A/v1/{ekm_connec" + + "tion.name=projects/*/locations/*/ekmConn" + + "ections/*}:\016ekm_connection\332A\032ekm_connect" + + "ion,update_mask\022\224\001\n\014GetEkmConfig\022(.googl" + + "e.cloud.kms.v1.GetEkmConfigRequest\032\036.goo" + + "gle.cloud.kms.v1.EkmConfig\":\202\323\344\223\002-\022+/v1/" + + "{name=projects/*/locations/*/ekmConfig}\332" + + "A\004name\022\303\001\n\017UpdateEkmConfig\022+.google.clou" + + "d.kms.v1.UpdateEkmConfigRequest\032\036.google" + + ".cloud.kms.v1.EkmConfig\"c\202\323\344\223\002D26/v1/{ek" + + "m_config.name=projects/*/locations/*/ekm" + + "Config}:\nekm_config\332A\026ekm_config,update_" + + "mask\032t\312A\027cloudkms.googleapis.com\322AWhttps" + + "://www.googleapis.com/auth/cloud-platfor" + + "m,https://www.googleapis.com/auth/cloudk" + + "msB\205\002\n\027com.google.cloud.kms.v1B\017EkmServi" + + "ceProtoP\001Z)cloud.google.com/go/kms/apiv1" + + "/kmspb;kmspb\370\001\001\252\002\023Google.Cloud.Kms.V1\312\002\023" + + "Google\\Cloud\\Kms\\V1\352A|\n\'servicedirectory" + + ".googleapis.com/Service\022Qprojects/{proje" + + "ct}/locations/{location}/namespaces/{nam" + + "espace}/services/{service}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -197,8 +233,24 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "EkmConnection", "UpdateMask", }); - internal_static_google_cloud_kms_v1_Certificate_descriptor = + internal_static_google_cloud_kms_v1_GetEkmConfigRequest_descriptor = getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_kms_v1_GetEkmConfigRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_GetEkmConfigRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_descriptor, + new java.lang.String[] { + "EkmConfig", "UpdateMask", + }); + internal_static_google_cloud_kms_v1_Certificate_descriptor = + getDescriptor().getMessageTypes().get(7); internal_static_google_cloud_kms_v1_Certificate_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_kms_v1_Certificate_descriptor, @@ -214,12 +266,17 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Sha256Fingerprint", }); internal_static_google_cloud_kms_v1_EkmConnection_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageTypes().get(8); internal_static_google_cloud_kms_v1_EkmConnection_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_kms_v1_EkmConnection_descriptor, new java.lang.String[] { - "Name", "CreateTime", "ServiceResolvers", "Etag", + "Name", + "CreateTime", + "ServiceResolvers", + "Etag", + "KeyManagementMode", + "CryptoSpacePath", }); internal_static_google_cloud_kms_v1_EkmConnection_ServiceResolver_descriptor = internal_static_google_cloud_kms_v1_EkmConnection_descriptor.getNestedTypes().get(0); @@ -229,6 +286,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "ServiceDirectoryService", "EndpointFilter", "Hostname", "ServerCertificates", }); + internal_static_google_cloud_kms_v1_EkmConfig_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_kms_v1_EkmConfig_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_EkmConfig_descriptor, + new java.lang.String[] { + "Name", "DefaultEkmConnection", + }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequest.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequest.java new file mode 100644 index 000000000000..59926e5bb81a --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequest.java @@ -0,0 +1,651 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/ekm_service.proto + +package com.google.cloud.kms.v1; + +/** + * + * + *
+ * Request message for
+ * [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetEkmConfigRequest} + */ +public final class GetEkmConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.GetEkmConfigRequest) + GetEkmConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetEkmConfigRequest.newBuilder() to construct. + private GetEkmConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetEkmConfigRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetEkmConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_GetEkmConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_GetEkmConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetEkmConfigRequest.class, + com.google.cloud.kms.v1.GetEkmConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.kms.v1.GetEkmConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.GetEkmConfigRequest other = + (com.google.cloud.kms.v1.GetEkmConfigRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.kms.v1.GetEkmConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetEkmConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.GetEkmConfigRequest) + com.google.cloud.kms.v1.GetEkmConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_GetEkmConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_GetEkmConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetEkmConfigRequest.class, + com.google.cloud.kms.v1.GetEkmConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.GetEkmConfigRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_GetEkmConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.kms.v1.GetEkmConfigRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.GetEkmConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.kms.v1.GetEkmConfigRequest build() { + com.google.cloud.kms.v1.GetEkmConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.kms.v1.GetEkmConfigRequest buildPartial() { + com.google.cloud.kms.v1.GetEkmConfigRequest result = + new com.google.cloud.kms.v1.GetEkmConfigRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.kms.v1.GetEkmConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.GetEkmConfigRequest) { + return mergeFrom((com.google.cloud.kms.v1.GetEkmConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.GetEkmConfigRequest other) { + if (other == com.google.cloud.kms.v1.GetEkmConfigRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+     * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.GetEkmConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.GetEkmConfigRequest) + private static final com.google.cloud.kms.v1.GetEkmConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.GetEkmConfigRequest(); + } + + public static com.google.cloud.kms.v1.GetEkmConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetEkmConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.kms.v1.GetEkmConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequestOrBuilder.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequestOrBuilder.java new file mode 100644 index 000000000000..4a7f8e8b8892 --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetEkmConfigRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/ekm_service.proto + +package com.google.cloud.kms.v1; + +public interface GetEkmConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.GetEkmConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
+   * [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java index a9da98276584..ee210bb2eef6 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java @@ -128,7 +128,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "google_partition_certs\030\003 \003(\t\"k\n\021Attestat" + "ionFormat\022\"\n\036ATTESTATION_FORMAT_UNSPECIF" + "IED\020\000\022\030\n\024CAVIUM_V1_COMPRESSED\020\003\022\030\n\024CAVIU" - + "M_V2_COMPRESSED\020\004\"\322\020\n\020CryptoKeyVersion\022\021" + + "M_V2_COMPRESSED\020\004\"\206\022\n\020CryptoKeyVersion\022\021" + "\n\004name\030\001 \001(\tB\003\340A\003\022J\n\005state\030\003 \001(\0162;.googl" + "e.cloud.kms.v1.CryptoKeyVersion.CryptoKe" + "yVersionState\022C\n\020protection_level\030\007 \001(\0162" @@ -145,90 +145,95 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "oogle.protobuf.TimestampB\003\340A\003\022\027\n\nimport_" + "job\030\016 \001(\tB\003\340A\003\0224\n\013import_time\030\017 \001(\0132\032.go" + "ogle.protobuf.TimestampB\003\340A\003\022\"\n\025import_f" - + "ailure_reason\030\020 \001(\tB\003\340A\003\022^\n!external_pro" - + "tection_level_options\030\021 \001(\01323.google.clo" - + "ud.kms.v1.ExternalProtectionLevelOptions" - + "\022\036\n\021reimport_eligible\030\022 \001(\010B\003\340A\003\"\347\006\n\031Cry" - + "ptoKeyVersionAlgorithm\022,\n(CRYPTO_KEY_VER" - + "SION_ALGORITHM_UNSPECIFIED\020\000\022\037\n\033GOOGLE_S" - + "YMMETRIC_ENCRYPTION\020\001\022\034\n\030RSA_SIGN_PSS_20" - + "48_SHA256\020\002\022\034\n\030RSA_SIGN_PSS_3072_SHA256\020" - + "\003\022\034\n\030RSA_SIGN_PSS_4096_SHA256\020\004\022\034\n\030RSA_S" - + "IGN_PSS_4096_SHA512\020\017\022\036\n\032RSA_SIGN_PKCS1_" - + "2048_SHA256\020\005\022\036\n\032RSA_SIGN_PKCS1_3072_SHA" - + "256\020\006\022\036\n\032RSA_SIGN_PKCS1_4096_SHA256\020\007\022\036\n" - + "\032RSA_SIGN_PKCS1_4096_SHA512\020\020\022\033\n\027RSA_SIG" - + "N_RAW_PKCS1_2048\020\034\022\033\n\027RSA_SIGN_RAW_PKCS1" - + "_3072\020\035\022\033\n\027RSA_SIGN_RAW_PKCS1_4096\020\036\022 \n\034" - + "RSA_DECRYPT_OAEP_2048_SHA256\020\010\022 \n\034RSA_DE" - + "CRYPT_OAEP_3072_SHA256\020\t\022 \n\034RSA_DECRYPT_" - + "OAEP_4096_SHA256\020\n\022 \n\034RSA_DECRYPT_OAEP_4" - + "096_SHA512\020\021\022\036\n\032RSA_DECRYPT_OAEP_2048_SH" - + "A1\020%\022\036\n\032RSA_DECRYPT_OAEP_3072_SHA1\020&\022\036\n\032" - + "RSA_DECRYPT_OAEP_4096_SHA1\020\'\022\027\n\023EC_SIGN_" - + "P256_SHA256\020\014\022\027\n\023EC_SIGN_P384_SHA384\020\r\022\034" - + "\n\030EC_SIGN_SECP256K1_SHA256\020\037\022\017\n\013HMAC_SHA" - + "256\020 \022\r\n\tHMAC_SHA1\020!\022\017\n\013HMAC_SHA384\020\"\022\017\n" - + "\013HMAC_SHA512\020#\022\017\n\013HMAC_SHA224\020$\022!\n\035EXTER" - + "NAL_SYMMETRIC_ENCRYPTION\020\022\"\301\001\n\025CryptoKey" - + "VersionState\022(\n$CRYPTO_KEY_VERSION_STATE" - + "_UNSPECIFIED\020\000\022\026\n\022PENDING_GENERATION\020\005\022\013" - + "\n\007ENABLED\020\001\022\014\n\010DISABLED\020\002\022\r\n\tDESTROYED\020\003" - + "\022\025\n\021DESTROY_SCHEDULED\020\004\022\022\n\016PENDING_IMPOR" - + "T\020\006\022\021\n\rIMPORT_FAILED\020\007\"I\n\024CryptoKeyVersi" - + "onView\022\'\n#CRYPTO_KEY_VERSION_VIEW_UNSPEC" - + "IFIED\020\000\022\010\n\004FULL\020\001:\252\001\352A\246\001\n(cloudkms.googl" - + "eapis.com/CryptoKeyVersion\022zprojects/{pr" - + "oject}/locations/{location}/keyRings/{ke" - + "y_ring}/cryptoKeys/{crypto_key}/cryptoKe" - + "yVersions/{crypto_key_version}\"\234\003\n\tPubli" - + "cKey\022\013\n\003pem\030\001 \001(\t\022R\n\talgorithm\030\002 \001(\0162?.g" - + "oogle.cloud.kms.v1.CryptoKeyVersion.Cryp" - + "toKeyVersionAlgorithm\022/\n\npem_crc32c\030\003 \001(" - + "\0132\033.google.protobuf.Int64Value\022\014\n\004name\030\004" - + " \001(\t\022>\n\020protection_level\030\005 \001(\0162$.google." - + "cloud.kms.v1.ProtectionLevel:\256\001\352A\252\001\n!clo" - + "udkms.googleapis.com/PublicKey\022\204\001project" - + "s/{project}/locations/{location}/keyRing" - + "s/{key_ring}/cryptoKeys/{crypto_key}/cry" - + "ptoKeyVersions/{crypto_key_version}/publ" - + "icKey\"\324\010\n\tImportJob\022\021\n\004name\030\001 \001(\tB\003\340A\003\022J" - + "\n\rimport_method\030\002 \001(\0162+.google.cloud.kms" - + ".v1.ImportJob.ImportMethodB\006\340A\002\340A\005\022F\n\020pr" - + "otection_level\030\t \001(\0162$.google.cloud.kms." - + "v1.ProtectionLevelB\006\340A\002\340A\005\0224\n\013create_tim" - + "e\030\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\003" - + "\0226\n\rgenerate_time\030\004 \001(\0132\032.google.protobu" - + "f.TimestampB\003\340A\003\0224\n\013expire_time\030\005 \001(\0132\032." - + "google.protobuf.TimestampB\003\340A\003\022:\n\021expire" - + "_event_time\030\n \001(\0132\032.google.protobuf.Time" - + "stampB\003\340A\003\022A\n\005state\030\006 \001(\0162-.google.cloud" - + ".kms.v1.ImportJob.ImportJobStateB\003\340A\003\022I\n" - + "\npublic_key\030\007 \001(\01320.google.cloud.kms.v1." - + "ImportJob.WrappingPublicKeyB\003\340A\003\022F\n\013atte" - + "station\030\010 \001(\0132,.google.cloud.kms.v1.KeyO" - + "perationAttestationB\003\340A\003\032 \n\021WrappingPubl" - + "icKey\022\013\n\003pem\030\001 \001(\t\"\345\001\n\014ImportMethod\022\035\n\031I" - + "MPORT_METHOD_UNSPECIFIED\020\000\022\036\n\032RSA_OAEP_3" - + "072_SHA1_AES_256\020\001\022\036\n\032RSA_OAEP_4096_SHA1" - + "_AES_256\020\002\022 \n\034RSA_OAEP_3072_SHA256_AES_2" - + "56\020\003\022 \n\034RSA_OAEP_4096_SHA256_AES_256\020\004\022\030" - + "\n\024RSA_OAEP_3072_SHA256\020\005\022\030\n\024RSA_OAEP_409" - + "6_SHA256\020\006\"c\n\016ImportJobState\022 \n\034IMPORT_J" - + "OB_STATE_UNSPECIFIED\020\000\022\026\n\022PENDING_GENERA" - + "TION\020\001\022\n\n\006ACTIVE\020\002\022\013\n\007EXPIRED\020\003:{\352Ax\n!cl" - + "oudkms.googleapis.com/ImportJob\022Sproject" - + "s/{project}/locations/{location}/keyRing" - + "s/{key_ring}/importJobs/{import_job}\"[\n\036" - + "ExternalProtectionLevelOptions\022\030\n\020extern" - + "al_key_uri\030\001 \001(\t\022\037\n\027ekm_connection_key_p" - + "ath\030\002 \001(\t*j\n\017ProtectionLevel\022 \n\034PROTECTI" - + "ON_LEVEL_UNSPECIFIED\020\000\022\014\n\010SOFTWARE\020\001\022\007\n\003" - + "HSM\020\002\022\014\n\010EXTERNAL\020\003\022\020\n\014EXTERNAL_VPC\020\004B\210\001" - + "\n\027com.google.cloud.kms.v1B\021KmsResourcesP" - + "rotoP\001Z)cloud.google.com/go/kms/apiv1/km" - + "spb;kmspb\370\001\001\252\002\023Google.Cloud.Kms.V1\312\002\023Goo" - + "gle\\Cloud\\Kms\\V1b\006proto3" + + "ailure_reason\030\020 \001(\tB\003\340A\003\022&\n\031generation_f" + + "ailure_reason\030\023 \001(\tB\003\340A\003\0220\n#external_des" + + "truction_failure_reason\030\024 \001(\tB\003\340A\003\022^\n!ex" + + "ternal_protection_level_options\030\021 \001(\01323." + + "google.cloud.kms.v1.ExternalProtectionLe" + + "velOptions\022\036\n\021reimport_eligible\030\022 \001(\010B\003\340" + + "A\003\"\347\006\n\031CryptoKeyVersionAlgorithm\022,\n(CRYP" + + "TO_KEY_VERSION_ALGORITHM_UNSPECIFIED\020\000\022\037" + + "\n\033GOOGLE_SYMMETRIC_ENCRYPTION\020\001\022\034\n\030RSA_S" + + "IGN_PSS_2048_SHA256\020\002\022\034\n\030RSA_SIGN_PSS_30" + + "72_SHA256\020\003\022\034\n\030RSA_SIGN_PSS_4096_SHA256\020" + + "\004\022\034\n\030RSA_SIGN_PSS_4096_SHA512\020\017\022\036\n\032RSA_S" + + "IGN_PKCS1_2048_SHA256\020\005\022\036\n\032RSA_SIGN_PKCS" + + "1_3072_SHA256\020\006\022\036\n\032RSA_SIGN_PKCS1_4096_S" + + "HA256\020\007\022\036\n\032RSA_SIGN_PKCS1_4096_SHA512\020\020\022" + + "\033\n\027RSA_SIGN_RAW_PKCS1_2048\020\034\022\033\n\027RSA_SIGN" + + "_RAW_PKCS1_3072\020\035\022\033\n\027RSA_SIGN_RAW_PKCS1_" + + "4096\020\036\022 \n\034RSA_DECRYPT_OAEP_2048_SHA256\020\010" + + "\022 \n\034RSA_DECRYPT_OAEP_3072_SHA256\020\t\022 \n\034RS" + + "A_DECRYPT_OAEP_4096_SHA256\020\n\022 \n\034RSA_DECR" + + "YPT_OAEP_4096_SHA512\020\021\022\036\n\032RSA_DECRYPT_OA" + + "EP_2048_SHA1\020%\022\036\n\032RSA_DECRYPT_OAEP_3072_" + + "SHA1\020&\022\036\n\032RSA_DECRYPT_OAEP_4096_SHA1\020\'\022\027" + + "\n\023EC_SIGN_P256_SHA256\020\014\022\027\n\023EC_SIGN_P384_" + + "SHA384\020\r\022\034\n\030EC_SIGN_SECP256K1_SHA256\020\037\022\017" + + "\n\013HMAC_SHA256\020 \022\r\n\tHMAC_SHA1\020!\022\017\n\013HMAC_S" + + "HA384\020\"\022\017\n\013HMAC_SHA512\020#\022\017\n\013HMAC_SHA224\020" + + "$\022!\n\035EXTERNAL_SYMMETRIC_ENCRYPTION\020\022\"\233\002\n" + + "\025CryptoKeyVersionState\022(\n$CRYPTO_KEY_VER" + + "SION_STATE_UNSPECIFIED\020\000\022\026\n\022PENDING_GENE" + + "RATION\020\005\022\013\n\007ENABLED\020\001\022\014\n\010DISABLED\020\002\022\r\n\tD" + + "ESTROYED\020\003\022\025\n\021DESTROY_SCHEDULED\020\004\022\022\n\016PEN" + + "DING_IMPORT\020\006\022\021\n\rIMPORT_FAILED\020\007\022\025\n\021GENE" + + "RATION_FAILED\020\010\022 \n\034PENDING_EXTERNAL_DEST" + + "RUCTION\020\t\022\037\n\033EXTERNAL_DESTRUCTION_FAILED" + + "\020\n\"I\n\024CryptoKeyVersionView\022\'\n#CRYPTO_KEY" + + "_VERSION_VIEW_UNSPECIFIED\020\000\022\010\n\004FULL\020\001:\252\001" + + "\352A\246\001\n(cloudkms.googleapis.com/CryptoKeyV" + + "ersion\022zprojects/{project}/locations/{lo" + + "cation}/keyRings/{key_ring}/cryptoKeys/{" + + "crypto_key}/cryptoKeyVersions/{crypto_ke" + + "y_version}\"\234\003\n\tPublicKey\022\013\n\003pem\030\001 \001(\t\022R\n" + + "\talgorithm\030\002 \001(\0162?.google.cloud.kms.v1.C" + + "ryptoKeyVersion.CryptoKeyVersionAlgorith" + + "m\022/\n\npem_crc32c\030\003 \001(\0132\033.google.protobuf." + + "Int64Value\022\014\n\004name\030\004 \001(\t\022>\n\020protection_l" + + "evel\030\005 \001(\0162$.google.cloud.kms.v1.Protect" + + "ionLevel:\256\001\352A\252\001\n!cloudkms.googleapis.com" + + "/PublicKey\022\204\001projects/{project}/location" + + "s/{location}/keyRings/{key_ring}/cryptoK" + + "eys/{crypto_key}/cryptoKeyVersions/{cryp" + + "to_key_version}/publicKey\"\324\010\n\tImportJob\022" + + "\021\n\004name\030\001 \001(\tB\003\340A\003\022J\n\rimport_method\030\002 \001(" + + "\0162+.google.cloud.kms.v1.ImportJob.Import" + + "MethodB\006\340A\002\340A\005\022F\n\020protection_level\030\t \001(\016" + + "2$.google.cloud.kms.v1.ProtectionLevelB\006" + + "\340A\002\340A\005\0224\n\013create_time\030\003 \001(\0132\032.google.pro" + + "tobuf.TimestampB\003\340A\003\0226\n\rgenerate_time\030\004 " + + "\001(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n\013" + + "expire_time\030\005 \001(\0132\032.google.protobuf.Time" + + "stampB\003\340A\003\022:\n\021expire_event_time\030\n \001(\0132\032." + + "google.protobuf.TimestampB\003\340A\003\022A\n\005state\030" + + "\006 \001(\0162-.google.cloud.kms.v1.ImportJob.Im" + + "portJobStateB\003\340A\003\022I\n\npublic_key\030\007 \001(\01320." + + "google.cloud.kms.v1.ImportJob.WrappingPu" + + "blicKeyB\003\340A\003\022F\n\013attestation\030\010 \001(\0132,.goog" + + "le.cloud.kms.v1.KeyOperationAttestationB" + + "\003\340A\003\032 \n\021WrappingPublicKey\022\013\n\003pem\030\001 \001(\t\"\345" + + "\001\n\014ImportMethod\022\035\n\031IMPORT_METHOD_UNSPECI" + + "FIED\020\000\022\036\n\032RSA_OAEP_3072_SHA1_AES_256\020\001\022\036" + + "\n\032RSA_OAEP_4096_SHA1_AES_256\020\002\022 \n\034RSA_OA" + + "EP_3072_SHA256_AES_256\020\003\022 \n\034RSA_OAEP_409" + + "6_SHA256_AES_256\020\004\022\030\n\024RSA_OAEP_3072_SHA2" + + "56\020\005\022\030\n\024RSA_OAEP_4096_SHA256\020\006\"c\n\016Import" + + "JobState\022 \n\034IMPORT_JOB_STATE_UNSPECIFIED" + + "\020\000\022\026\n\022PENDING_GENERATION\020\001\022\n\n\006ACTIVE\020\002\022\013" + + "\n\007EXPIRED\020\003:{\352Ax\n!cloudkms.googleapis.co" + + "m/ImportJob\022Sprojects/{project}/location" + + "s/{location}/keyRings/{key_ring}/importJ" + + "obs/{import_job}\"[\n\036ExternalProtectionLe" + + "velOptions\022\030\n\020external_key_uri\030\001 \001(\t\022\037\n\027" + + "ekm_connection_key_path\030\002 \001(\t*j\n\017Protect" + + "ionLevel\022 \n\034PROTECTION_LEVEL_UNSPECIFIED" + + "\020\000\022\014\n\010SOFTWARE\020\001\022\007\n\003HSM\020\002\022\014\n\010EXTERNAL\020\003\022" + + "\020\n\014EXTERNAL_VPC\020\004B\210\001\n\027com.google.cloud.k" + + "ms.v1B\021KmsResourcesProtoP\001Z)cloud.google" + + ".com/go/kms/apiv1/kmspb;kmspb\370\001\001\252\002\023Googl" + + "e.Cloud.Kms.V1\312\002\023Google\\Cloud\\Kms\\V1b\006pr" + + "oto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -319,6 +324,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "ImportJob", "ImportTime", "ImportFailureReason", + "GenerationFailureReason", + "ExternalDestructionFailureReason", "ExternalProtectionLevelOptions", "ReimportEligible", }); diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequest.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequest.java new file mode 100644 index 000000000000..64c3c5140bf6 --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequest.java @@ -0,0 +1,1000 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/ekm_service.proto + +package com.google.cloud.kms.v1; + +/** + * + * + *
+ * Request message for
+ * [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateEkmConfigRequest} + */ +public final class UpdateEkmConfigRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.UpdateEkmConfigRequest) + UpdateEkmConfigRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateEkmConfigRequest.newBuilder() to construct. + private UpdateEkmConfigRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateEkmConfigRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateEkmConfigRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateEkmConfigRequest.class, + com.google.cloud.kms.v1.UpdateEkmConfigRequest.Builder.class); + } + + public static final int EKM_CONFIG_FIELD_NUMBER = 1; + private com.google.cloud.kms.v1.EkmConfig ekmConfig_; + /** + * + * + *
+   * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the ekmConfig field is set. + */ + @java.lang.Override + public boolean hasEkmConfig() { + return ekmConfig_ != null; + } + /** + * + * + *
+   * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The ekmConfig. + */ + @java.lang.Override + public com.google.cloud.kms.v1.EkmConfig getEkmConfig() { + return ekmConfig_ == null ? com.google.cloud.kms.v1.EkmConfig.getDefaultInstance() : ekmConfig_; + } + /** + * + * + *
+   * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.kms.v1.EkmConfigOrBuilder getEkmConfigOrBuilder() { + return ekmConfig_ == null ? com.google.cloud.kms.v1.EkmConfig.getDefaultInstance() : ekmConfig_; + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Required. List of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Required. List of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Required. List of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (ekmConfig_ != null) { + output.writeMessage(1, getEkmConfig()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (ekmConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEkmConfig()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.kms.v1.UpdateEkmConfigRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.UpdateEkmConfigRequest other = + (com.google.cloud.kms.v1.UpdateEkmConfigRequest) obj; + + if (hasEkmConfig() != other.hasEkmConfig()) return false; + if (hasEkmConfig()) { + if (!getEkmConfig().equals(other.getEkmConfig())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasEkmConfig()) { + hash = (37 * hash) + EKM_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getEkmConfig().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.kms.v1.UpdateEkmConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateEkmConfigRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.UpdateEkmConfigRequest) + com.google.cloud.kms.v1.UpdateEkmConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateEkmConfigRequest.class, + com.google.cloud.kms.v1.UpdateEkmConfigRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.UpdateEkmConfigRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + ekmConfig_ = null; + if (ekmConfigBuilder_ != null) { + ekmConfigBuilder_.dispose(); + ekmConfigBuilder_ = null; + } + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.kms.v1.EkmServiceProto + .internal_static_google_cloud_kms_v1_UpdateEkmConfigRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.kms.v1.UpdateEkmConfigRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.UpdateEkmConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.kms.v1.UpdateEkmConfigRequest build() { + com.google.cloud.kms.v1.UpdateEkmConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.kms.v1.UpdateEkmConfigRequest buildPartial() { + com.google.cloud.kms.v1.UpdateEkmConfigRequest result = + new com.google.cloud.kms.v1.UpdateEkmConfigRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.kms.v1.UpdateEkmConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.ekmConfig_ = ekmConfigBuilder_ == null ? ekmConfig_ : ekmConfigBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.updateMask_ = updateMaskBuilder_ == null ? updateMask_ : updateMaskBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.UpdateEkmConfigRequest) { + return mergeFrom((com.google.cloud.kms.v1.UpdateEkmConfigRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.UpdateEkmConfigRequest other) { + if (other == com.google.cloud.kms.v1.UpdateEkmConfigRequest.getDefaultInstance()) return this; + if (other.hasEkmConfig()) { + mergeEkmConfig(other.getEkmConfig()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getEkmConfigFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.cloud.kms.v1.EkmConfig ekmConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.EkmConfig, + com.google.cloud.kms.v1.EkmConfig.Builder, + com.google.cloud.kms.v1.EkmConfigOrBuilder> + ekmConfigBuilder_; + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the ekmConfig field is set. + */ + public boolean hasEkmConfig() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The ekmConfig. + */ + public com.google.cloud.kms.v1.EkmConfig getEkmConfig() { + if (ekmConfigBuilder_ == null) { + return ekmConfig_ == null + ? com.google.cloud.kms.v1.EkmConfig.getDefaultInstance() + : ekmConfig_; + } else { + return ekmConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setEkmConfig(com.google.cloud.kms.v1.EkmConfig value) { + if (ekmConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ekmConfig_ = value; + } else { + ekmConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setEkmConfig(com.google.cloud.kms.v1.EkmConfig.Builder builderForValue) { + if (ekmConfigBuilder_ == null) { + ekmConfig_ = builderForValue.build(); + } else { + ekmConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeEkmConfig(com.google.cloud.kms.v1.EkmConfig value) { + if (ekmConfigBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && ekmConfig_ != null + && ekmConfig_ != com.google.cloud.kms.v1.EkmConfig.getDefaultInstance()) { + getEkmConfigBuilder().mergeFrom(value); + } else { + ekmConfig_ = value; + } + } else { + ekmConfigBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearEkmConfig() { + bitField0_ = (bitField0_ & ~0x00000001); + ekmConfig_ = null; + if (ekmConfigBuilder_ != null) { + ekmConfigBuilder_.dispose(); + ekmConfigBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.kms.v1.EkmConfig.Builder getEkmConfigBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getEkmConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.kms.v1.EkmConfigOrBuilder getEkmConfigOrBuilder() { + if (ekmConfigBuilder_ != null) { + return ekmConfigBuilder_.getMessageOrBuilder(); + } else { + return ekmConfig_ == null + ? com.google.cloud.kms.v1.EkmConfig.getDefaultInstance() + : ekmConfig_; + } + } + /** + * + * + *
+     * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+     * 
+ * + * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.EkmConfig, + com.google.cloud.kms.v1.EkmConfig.Builder, + com.google.cloud.kms.v1.EkmConfigOrBuilder> + getEkmConfigFieldBuilder() { + if (ekmConfigBuilder_ == null) { + ekmConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.EkmConfig, + com.google.cloud.kms.v1.EkmConfig.Builder, + com.google.cloud.kms.v1.EkmConfigOrBuilder>( + getEkmConfig(), getParentForChildren(), isClean()); + ekmConfig_ = null; + } + return ekmConfigBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + } else { + updateMaskBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && updateMask_ != null + && updateMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getUpdateMaskBuilder().mergeFrom(value); + } else { + updateMask_ = value; + } + } else { + updateMaskBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUpdateMask() { + bitField0_ = (bitField0_ & ~0x00000002); + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); + updateMaskBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Required. List of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.UpdateEkmConfigRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.UpdateEkmConfigRequest) + private static final com.google.cloud.kms.v1.UpdateEkmConfigRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.UpdateEkmConfigRequest(); + } + + public static com.google.cloud.kms.v1.UpdateEkmConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateEkmConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.kms.v1.UpdateEkmConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequestOrBuilder.java b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequestOrBuilder.java new file mode 100644 index 000000000000..05f0c385ee4c --- /dev/null +++ b/java-kms/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateEkmConfigRequestOrBuilder.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/ekm_service.proto + +package com.google.cloud.kms.v1; + +public interface UpdateEkmConfigRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.UpdateEkmConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the ekmConfig field is set. + */ + boolean hasEkmConfig(); + /** + * + * + *
+   * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The ekmConfig. + */ + com.google.cloud.kms.v1.EkmConfig getEkmConfig(); + /** + * + * + *
+   * Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.EkmConfig ekm_config = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.kms.v1.EkmConfigOrBuilder getEkmConfigOrBuilder(); + + /** + * + * + *
+   * Required. List of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Required. List of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Required. List of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/ekm_service.proto b/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/ekm_service.proto index aea72d681704..e5c05c26fd35 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/ekm_service.proto +++ b/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/ekm_service.proto @@ -83,6 +83,25 @@ service EkmService { }; option (google.api.method_signature) = "ekm_connection,update_mask"; } + + // Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource + // for a given project and location. + rpc GetEkmConfig(GetEkmConfigRequest) returns (EkmConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/ekmConfig}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton resource + // for a given project and location. + rpc UpdateEkmConfig(UpdateEkmConfigRequest) returns (EkmConfig) { + option (google.api.http) = { + patch: "/v1/{ekm_config.name=projects/*/locations/*/ekmConfig}" + body: "ekm_config" + }; + option (google.api.method_signature) = "ekm_config,update_mask"; + } } // Request message for @@ -187,6 +206,30 @@ message UpdateEkmConnectionRequest { [(google.api.field_behavior) = REQUIRED]; } +// Request message for +// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig]. +message GetEkmConfigRequest { + // Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the + // [EkmConfig][google.cloud.kms.v1.EkmConfig] to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConfig" + } + ]; +} + +// Request message for +// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig]. +message UpdateEkmConfigRequest { + // Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values. + EkmConfig ekm_config = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + // A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509 // certificate used to authenticate HTTPS connections to EKM replicas. message Certificate { @@ -274,6 +317,44 @@ message EkmConnection { [(google.api.field_behavior) = REQUIRED]; } + // [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] + // describes who can perform control plane cryptographic operations using this + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. + enum KeyManagementMode { + // Not specified. + KEY_MANAGEMENT_MODE_UNSPECIFIED = 0; + + // EKM-side key management operations on + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from + // the EKM directly and cannot be performed from Cloud KMS. This means that: + // * When creating a + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with + // this + // [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must + // supply the key path of pre-existing external key material that will be + // linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + // * Destruction of external key material cannot be requested via the + // Cloud KMS API and must be performed directly in the EKM. + // * Automatic rotation of key material is not supported. + MANUAL = 1; + + // All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key + // management operations initiated from Cloud KMS. This means that: + // * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection] + // is + // created, the EKM automatically generates new key material and a new + // key path. The caller cannot supply the key path of pre-existing + // external key material. + // * Destruction of external key material associated with this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by + // calling [DestroyCryptoKeyVersion][EkmService.DestroyCryptoKeyVersion]. + // * Automatic rotation of key material is supported. + CLOUD_KMS = 2; + } + // Output only. The resource name for the // [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format // `projects/*/locations/*/ekmConnections/*`. @@ -295,4 +376,46 @@ message EkmConnection { // Optional. Etag of the currently stored // [EkmConnection][google.cloud.kms.v1.EkmConnection]. string etag = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Describes who can perform control plane operations on the EKM. If + // unset, this defaults to + // [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]. + KeyManagementMode key_management_mode = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Identifies the EKM Crypto Space that this + // [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This + // field is required if + // [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is + // [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]. + string crypto_space_path = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that +// represents configuration parameters that apply to all +// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and +// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a +// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of +// [EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC] in a given +// project and location. +message EkmConfig { + option (google.api.resource) = { + type: "cloudkms.googleapis.com/EkmConfig" + pattern: "projects/{project}/locations/{location}/ekmConfig" + }; + + // Output only. The resource name for the + // [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format + // `projects/*/locations/*/ekmConfig`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Resource name of the default + // [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to + // the empty string removes the default. + string default_ekm_connection = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/EkmConnection" + } + ]; } diff --git a/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto b/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto index 23a787295fd3..e4a0ff037b4a 100644 --- a/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto +++ b/java-kms/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto @@ -473,6 +473,23 @@ message CryptoKeyVersion { // Additional details can be found in // [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]. IMPORT_FAILED = 7; + + // This version was not generated successfully. It may not be used, enabled, + // disabled, or destroyed. Additional details can be found in + // [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]. + GENERATION_FAILED = 8; + + // This version was destroyed, and it may not be used or enabled again. + // Cloud KMS is waiting for the corresponding key material residing in an + // external key manager to be destroyed. + PENDING_EXTERNAL_DESTRUCTION = 9; + + // This version was destroyed, and it may not be used or enabled again. + // However, Cloud KMS could not confirm that the corresponding key material + // residing in an external key manager was destroyed. Additional details can + // be found in + // [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]. + EXTERNAL_DESTRUCTION_FAILED = 10; } // A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s. @@ -567,6 +584,19 @@ message CryptoKeyVersion { // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]. string import_failure_reason = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. The root cause of the most recent generation failure. Only + // present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]. + string generation_failure_reason = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The root cause of the most recent external destruction + // failure. Only present if + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]. + string external_destruction_failure_reason = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + // ExternalProtectionLevelOptions stores a group of additional fields for // configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that // are specific to the diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/AsyncGetEkmConfig.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/AsyncGetEkmConfig.java new file mode 100644 index 000000000000..1c94464dd758 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/AsyncGetEkmConfig.java @@ -0,0 +1,49 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_GetEkmConfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmConfigName; +import com.google.cloud.kms.v1.EkmServiceClient; +import com.google.cloud.kms.v1.GetEkmConfigRequest; + +public class AsyncGetEkmConfig { + + public static void main(String[] args) throws Exception { + asyncGetEkmConfig(); + } + + public static void asyncGetEkmConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + GetEkmConfigRequest request = + GetEkmConfigRequest.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = ekmServiceClient.getEkmConfigCallable().futureCall(request); + // Do something. + EkmConfig response = future.get(); + } + } +} +// [END cloudkms_v1_generated_EkmService_GetEkmConfig_async] diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfig.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfig.java new file mode 100644 index 000000000000..5fa19475ccf0 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfig.java @@ -0,0 +1,46 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_GetEkmConfig_sync] +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmConfigName; +import com.google.cloud.kms.v1.EkmServiceClient; +import com.google.cloud.kms.v1.GetEkmConfigRequest; + +public class SyncGetEkmConfig { + + public static void main(String[] args) throws Exception { + syncGetEkmConfig(); + } + + public static void syncGetEkmConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + GetEkmConfigRequest request = + GetEkmConfigRequest.newBuilder() + .setName(EkmConfigName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + EkmConfig response = ekmServiceClient.getEkmConfig(request); + } + } +} +// [END cloudkms_v1_generated_EkmService_GetEkmConfig_sync] diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigEkmconfigname.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigEkmconfigname.java new file mode 100644 index 000000000000..a9306dd38715 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigEkmconfigname.java @@ -0,0 +1,42 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_GetEkmConfig_Ekmconfigname_sync] +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmConfigName; +import com.google.cloud.kms.v1.EkmServiceClient; + +public class SyncGetEkmConfigEkmconfigname { + + public static void main(String[] args) throws Exception { + syncGetEkmConfigEkmconfigname(); + } + + public static void syncGetEkmConfigEkmconfigname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + EkmConfigName name = EkmConfigName.of("[PROJECT]", "[LOCATION]"); + EkmConfig response = ekmServiceClient.getEkmConfig(name); + } + } +} +// [END cloudkms_v1_generated_EkmService_GetEkmConfig_Ekmconfigname_sync] diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigString.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigString.java new file mode 100644 index 000000000000..4c5a92bea463 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/getekmconfig/SyncGetEkmConfigString.java @@ -0,0 +1,42 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_GetEkmConfig_String_sync] +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmConfigName; +import com.google.cloud.kms.v1.EkmServiceClient; + +public class SyncGetEkmConfigString { + + public static void main(String[] args) throws Exception { + syncGetEkmConfigString(); + } + + public static void syncGetEkmConfigString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + String name = EkmConfigName.of("[PROJECT]", "[LOCATION]").toString(); + EkmConfig response = ekmServiceClient.getEkmConfig(name); + } + } +} +// [END cloudkms_v1_generated_EkmService_GetEkmConfig_String_sync] diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/AsyncUpdateEkmConfig.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/AsyncUpdateEkmConfig.java new file mode 100644 index 000000000000..974a682df410 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/AsyncUpdateEkmConfig.java @@ -0,0 +1,50 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_UpdateEkmConfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmServiceClient; +import com.google.cloud.kms.v1.UpdateEkmConfigRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateEkmConfig { + + public static void main(String[] args) throws Exception { + asyncUpdateEkmConfig(); + } + + public static void asyncUpdateEkmConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + UpdateEkmConfigRequest request = + UpdateEkmConfigRequest.newBuilder() + .setEkmConfig(EkmConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = ekmServiceClient.updateEkmConfigCallable().futureCall(request); + // Do something. + EkmConfig response = future.get(); + } + } +} +// [END cloudkms_v1_generated_EkmService_UpdateEkmConfig_async] diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfig.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfig.java new file mode 100644 index 000000000000..4c7cb3b74db7 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfig.java @@ -0,0 +1,47 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_UpdateEkmConfig_sync] +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmServiceClient; +import com.google.cloud.kms.v1.UpdateEkmConfigRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEkmConfig { + + public static void main(String[] args) throws Exception { + syncUpdateEkmConfig(); + } + + public static void syncUpdateEkmConfig() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + UpdateEkmConfigRequest request = + UpdateEkmConfigRequest.newBuilder() + .setEkmConfig(EkmConfig.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + EkmConfig response = ekmServiceClient.updateEkmConfig(request); + } + } +} +// [END cloudkms_v1_generated_EkmService_UpdateEkmConfig_sync] diff --git a/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfigEkmconfigFieldmask.java b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfigEkmconfigFieldmask.java new file mode 100644 index 000000000000..274bddae9d07 --- /dev/null +++ b/java-kms/samples/snippets/generated/com/google/cloud/kms/v1/ekmservice/updateekmconfig/SyncUpdateEkmConfigEkmconfigFieldmask.java @@ -0,0 +1,43 @@ +/* + * 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.kms.v1.samples; + +// [START cloudkms_v1_generated_EkmService_UpdateEkmConfig_EkmconfigFieldmask_sync] +import com.google.cloud.kms.v1.EkmConfig; +import com.google.cloud.kms.v1.EkmServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateEkmConfigEkmconfigFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateEkmConfigEkmconfigFieldmask(); + } + + public static void syncUpdateEkmConfigEkmconfigFieldmask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (EkmServiceClient ekmServiceClient = EkmServiceClient.create()) { + EkmConfig ekmConfig = EkmConfig.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + EkmConfig response = ekmServiceClient.updateEkmConfig(ekmConfig, updateMask); + } + } +} +// [END cloudkms_v1_generated_EkmService_UpdateEkmConfig_EkmconfigFieldmask_sync]