Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [cloudkms] added VerifyConnectivity RPC #9429

Merged
merged 2 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions java-kms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.11.0</version>
<version>26.14.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-kms.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-kms/2.17.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-kms/2.20.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,135 @@ public final UnaryCallable<UpdateEkmConfigRequest, EkmConfig> updateEkmConfigCal
return stub.updateEkmConfigCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Verifies that Cloud KMS can successfully connect to the external key manager specified by an
* [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM,
* this method returns a FAILED_PRECONDITION status containing structured information as described
* at https://cloud.google.com/kms/docs/reference/ekm_errors.
*
* <p>Sample code:
*
* <pre>{@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()) {
* EkmConnectionName name = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]");
* VerifyConnectivityResponse response = ekmServiceClient.verifyConnectivity(name);
* }
* }</pre>
*
* @param name Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
* [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final VerifyConnectivityResponse verifyConnectivity(EkmConnectionName name) {
VerifyConnectivityRequest request =
VerifyConnectivityRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return verifyConnectivity(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Verifies that Cloud KMS can successfully connect to the external key manager specified by an
* [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM,
* this method returns a FAILED_PRECONDITION status containing structured information as described
* at https://cloud.google.com/kms/docs/reference/ekm_errors.
*
* <p>Sample code:
*
* <pre>{@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 = EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString();
* VerifyConnectivityResponse response = ekmServiceClient.verifyConnectivity(name);
* }
* }</pre>
*
* @param name Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
* [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final VerifyConnectivityResponse verifyConnectivity(String name) {
VerifyConnectivityRequest request =
VerifyConnectivityRequest.newBuilder().setName(name).build();
return verifyConnectivity(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Verifies that Cloud KMS can successfully connect to the external key manager specified by an
* [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM,
* this method returns a FAILED_PRECONDITION status containing structured information as described
* at https://cloud.google.com/kms/docs/reference/ekm_errors.
*
* <p>Sample code:
*
* <pre>{@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()) {
* VerifyConnectivityRequest request =
* VerifyConnectivityRequest.newBuilder()
* .setName(
* EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString())
* .build();
* VerifyConnectivityResponse response = ekmServiceClient.verifyConnectivity(request);
* }
* }</pre>
*
* @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 VerifyConnectivityResponse verifyConnectivity(VerifyConnectivityRequest request) {
return verifyConnectivityCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Verifies that Cloud KMS can successfully connect to the external key manager specified by an
* [EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is an error connecting to the EKM,
* this method returns a FAILED_PRECONDITION status containing structured information as described
* at https://cloud.google.com/kms/docs/reference/ekm_errors.
*
* <p>Sample code:
*
* <pre>{@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()) {
* VerifyConnectivityRequest request =
* VerifyConnectivityRequest.newBuilder()
* .setName(
* EkmConnectionName.of("[PROJECT]", "[LOCATION]", "[EKM_CONNECTION]").toString())
* .build();
* ApiFuture<VerifyConnectivityResponse> future =
* ekmServiceClient.verifyConnectivityCallable().futureCall(request);
* // Do something.
* VerifyConnectivityResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivityCallable() {
return stub.verifyConnectivityCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public UnaryCallSettings<UpdateEkmConfigRequest, EkmConfig> updateEkmConfigSetti
return ((EkmServiceStubSettings) getStubSettings()).updateEkmConfigSettings();
}

/** Returns the object with the settings used for calls to verifyConnectivity. */
public UnaryCallSettings<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivitySettings() {
return ((EkmServiceStubSettings) getStubSettings()).verifyConnectivitySettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -294,6 +300,12 @@ public UnaryCallSettings.Builder<UpdateEkmConfigRequest, EkmConfig> updateEkmCon
return getStubSettingsBuilder().updateEkmConfigSettings();
}

/** Returns the builder for the settings used for calls to verifyConnectivity. */
public UnaryCallSettings.Builder<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivitySettings() {
return getStubSettingsBuilder().verifyConnectivitySettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
},
"UpdateEkmConnection": {
"methods": ["updateEkmConnection", "updateEkmConnection", "updateEkmConnectionCallable"]
},
"VerifyConnectivity": {
"methods": ["verifyConnectivity", "verifyConnectivity", "verifyConnectivity", "verifyConnectivityCallable"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
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.kms.v1.VerifyConnectivityRequest;
import com.google.cloud.kms.v1.VerifyConnectivityResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -80,6 +82,11 @@ public UnaryCallable<UpdateEkmConfigRequest, EkmConfig> updateEkmConfigCallable(
throw new UnsupportedOperationException("Not implemented: updateEkmConfigCallable()");
}

public UnaryCallable<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivityCallable() {
throw new UnsupportedOperationException("Not implemented: verifyConnectivityCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
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.kms.v1.VerifyConnectivityRequest;
import com.google.cloud.kms.v1.VerifyConnectivityResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
Expand Down Expand Up @@ -126,6 +128,8 @@ public class EkmServiceStubSettings extends StubSettings<EkmServiceStubSettings>
updateEkmConnectionSettings;
private final UnaryCallSettings<GetEkmConfigRequest, EkmConfig> getEkmConfigSettings;
private final UnaryCallSettings<UpdateEkmConfigRequest, EkmConfig> updateEkmConfigSettings;
private final UnaryCallSettings<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivitySettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -283,6 +287,12 @@ public UnaryCallSettings<UpdateEkmConfigRequest, EkmConfig> updateEkmConfigSetti
return updateEkmConfigSettings;
}

/** Returns the object with the settings used for calls to verifyConnectivity. */
public UnaryCallSettings<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivitySettings() {
return verifyConnectivitySettings;
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -422,6 +432,7 @@ protected EkmServiceStubSettings(Builder settingsBuilder) throws IOException {
updateEkmConnectionSettings = settingsBuilder.updateEkmConnectionSettings().build();
getEkmConfigSettings = settingsBuilder.getEkmConfigSettings().build();
updateEkmConfigSettings = settingsBuilder.updateEkmConfigSettings().build();
verifyConnectivitySettings = settingsBuilder.verifyConnectivitySettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
Expand All @@ -444,6 +455,8 @@ public static class Builder extends StubSettings.Builder<EkmServiceStubSettings,
private final UnaryCallSettings.Builder<GetEkmConfigRequest, EkmConfig> getEkmConfigSettings;
private final UnaryCallSettings.Builder<UpdateEkmConfigRequest, EkmConfig>
updateEkmConfigSettings;
private final UnaryCallSettings.Builder<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivitySettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -501,6 +514,7 @@ protected Builder(ClientContext clientContext) {
updateEkmConnectionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getEkmConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateEkmConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
verifyConnectivitySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand All @@ -515,6 +529,7 @@ protected Builder(ClientContext clientContext) {
updateEkmConnectionSettings,
getEkmConfigSettings,
updateEkmConfigSettings,
verifyConnectivitySettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand All @@ -532,6 +547,7 @@ protected Builder(EkmServiceStubSettings settings) {
updateEkmConnectionSettings = settings.updateEkmConnectionSettings.toBuilder();
getEkmConfigSettings = settings.getEkmConfigSettings.toBuilder();
updateEkmConfigSettings = settings.updateEkmConfigSettings.toBuilder();
verifyConnectivitySettings = settings.verifyConnectivitySettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
Expand All @@ -546,6 +562,7 @@ protected Builder(EkmServiceStubSettings settings) {
updateEkmConnectionSettings,
getEkmConfigSettings,
updateEkmConfigSettings,
verifyConnectivitySettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand Down Expand Up @@ -610,6 +627,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.verifyConnectivitySettings()
.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"))
Expand Down Expand Up @@ -688,6 +710,12 @@ public UnaryCallSettings.Builder<UpdateEkmConfigRequest, EkmConfig> updateEkmCon
return updateEkmConfigSettings;
}

/** Returns the builder for the settings used for calls to verifyConnectivity. */
public UnaryCallSettings.Builder<VerifyConnectivityRequest, VerifyConnectivityResponse>
verifyConnectivitySettings() {
return verifyConnectivitySettings;
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Loading