Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

chore: migrate KMS to the Java microgenerator #502

Merged
merged 1 commit into from
May 31, 2021
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/*
* Copyright 2020 Google LLC
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
* 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 static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse;
Expand Down Expand Up @@ -41,7 +42,7 @@
import java.util.List;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link KeyManagementServiceClient}.
*
Expand All @@ -56,50 +57,26 @@
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of createImportJob to 30 seconds:
* <p>For example, to set the total timeout of getKeyRing to 30 seconds:
*
* <pre>
* <code>
* <pre>{@code
* KeyManagementServiceSettings.Builder keyManagementServiceSettingsBuilder =
* KeyManagementServiceSettings.newBuilder();
* keyManagementServiceSettingsBuilder
* .createImportJobSettings()
* .getKeyRingSettings()
* .setRetrySettings(
* keyManagementServiceSettingsBuilder.createImportJobSettings().getRetrySettings().toBuilder()
* keyManagementServiceSettingsBuilder
* .getKeyRingSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* KeyManagementServiceSettings keyManagementServiceSettings = keyManagementServiceSettingsBuilder.build();
* </code>
* </pre>
* KeyManagementServiceSettings keyManagementServiceSettings =
* keyManagementServiceSettingsBuilder.build();
* }</pre>
*/
@Generated("by gapic-generator")
@BetaApi
@Generated("by gapic-generator-java")
public class KeyManagementServiceSettings extends ClientSettings<KeyManagementServiceSettings> {
/** Returns the object with the settings used for calls to createImportJob. */
public UnaryCallSettings<CreateImportJobRequest, ImportJob> createImportJobSettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).createImportJobSettings();
}

/** Returns the object with the settings used for calls to createCryptoKey. */
public UnaryCallSettings<CreateCryptoKeyRequest, CryptoKey> createCryptoKeySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).createCryptoKeySettings();
}

/** Returns the object with the settings used for calls to setIamPolicy. */
public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).setIamPolicySettings();
}

/** Returns the object with the settings used for calls to getIamPolicy. */
public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).getIamPolicySettings();
}

/** Returns the object with the settings used for calls to testIamPermissions. */
public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsSettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).testIamPermissionsSettings();
}

/** Returns the object with the settings used for calls to listKeyRings. */
public PagedCallSettings<ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse>
Expand Down Expand Up @@ -161,6 +138,11 @@ public UnaryCallSettings<CreateKeyRingRequest, KeyRing> createKeyRingSettings()
return ((KeyManagementServiceStubSettings) getStubSettings()).createKeyRingSettings();
}

/** Returns the object with the settings used for calls to createCryptoKey. */
public UnaryCallSettings<CreateCryptoKeyRequest, CryptoKey> createCryptoKeySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).createCryptoKeySettings();
}

/** Returns the object with the settings used for calls to createCryptoKeyVersion. */
public UnaryCallSettings<CreateCryptoKeyVersionRequest, CryptoKeyVersion>
createCryptoKeyVersionSettings() {
Expand All @@ -173,6 +155,11 @@ public UnaryCallSettings<CreateKeyRingRequest, KeyRing> createKeyRingSettings()
return ((KeyManagementServiceStubSettings) getStubSettings()).importCryptoKeyVersionSettings();
}

/** Returns the object with the settings used for calls to createImportJob. */
public UnaryCallSettings<CreateImportJobRequest, ImportJob> createImportJobSettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).createImportJobSettings();
}

/** Returns the object with the settings used for calls to updateCryptoKey. */
public UnaryCallSettings<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).updateCryptoKeySettings();
Expand Down Expand Up @@ -224,6 +211,22 @@ public UnaryCallSettings<AsymmetricSignRequest, AsymmetricSignResponse> asymmetr
return ((KeyManagementServiceStubSettings) getStubSettings()).restoreCryptoKeyVersionSettings();
}

/** Returns the object with the settings used for calls to setIamPolicy. */
public UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).setIamPolicySettings();
}

/** Returns the object with the settings used for calls to getIamPolicy. */
public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).getIamPolicySettings();
}

/** Returns the object with the settings used for calls to testIamPermissions. */
public UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsSettings() {
return ((KeyManagementServiceStubSettings) getStubSettings()).testIamPermissionsSettings();
}

public static final KeyManagementServiceSettings create(KeyManagementServiceStubSettings stub)
throws IOException {
return new KeyManagementServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -285,18 +288,15 @@ protected KeyManagementServiceSettings(Builder settingsBuilder) throws IOExcepti
/** Builder for KeyManagementServiceSettings. */
public static class Builder
extends ClientSettings.Builder<KeyManagementServiceSettings, Builder> {

protected Builder() throws IOException {
this((ClientContext) null);
this(((ClientContext) null));
}

protected Builder(ClientContext clientContext) {
super(KeyManagementServiceStubSettings.newBuilder(clientContext));
}

private static Builder createDefault() {
return new Builder(KeyManagementServiceStubSettings.newBuilder());
}

protected Builder(KeyManagementServiceSettings settings) {
super(settings.getStubSettings().toBuilder());
}
Expand All @@ -305,11 +305,15 @@ protected Builder(KeyManagementServiceStubSettings.Builder stubSettings) {
super(stubSettings);
}

private static Builder createDefault() {
return new Builder(KeyManagementServiceStubSettings.newBuilder());
}

public KeyManagementServiceStubSettings.Builder getStubSettingsBuilder() {
return ((KeyManagementServiceStubSettings.Builder) getStubSettings());
}

// NEXT_MAJOR_VER: remove 'throws Exception'
// NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
Expand All @@ -322,32 +326,6 @@ public Builder applyToAllUnaryMethods(
return this;
}

/** Returns the builder for the settings used for calls to createImportJob. */
public UnaryCallSettings.Builder<CreateImportJobRequest, ImportJob> createImportJobSettings() {
return getStubSettingsBuilder().createImportJobSettings();
}

/** Returns the builder for the settings used for calls to createCryptoKey. */
public UnaryCallSettings.Builder<CreateCryptoKeyRequest, CryptoKey> createCryptoKeySettings() {
return getStubSettingsBuilder().createCryptoKeySettings();
}

/** Returns the builder for the settings used for calls to setIamPolicy. */
public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return getStubSettingsBuilder().setIamPolicySettings();
}

/** Returns the builder for the settings used for calls to getIamPolicy. */
public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return getStubSettingsBuilder().getIamPolicySettings();
}

/** Returns the builder for the settings used for calls to testIamPermissions. */
public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsSettings() {
return getStubSettingsBuilder().testIamPermissionsSettings();
}

/** Returns the builder for the settings used for calls to listKeyRings. */
public PagedCallSettings.Builder<
ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse>
Expand Down Expand Up @@ -409,6 +387,11 @@ public UnaryCallSettings.Builder<CreateKeyRingRequest, KeyRing> createKeyRingSet
return getStubSettingsBuilder().createKeyRingSettings();
}

/** Returns the builder for the settings used for calls to createCryptoKey. */
public UnaryCallSettings.Builder<CreateCryptoKeyRequest, CryptoKey> createCryptoKeySettings() {
return getStubSettingsBuilder().createCryptoKeySettings();
}

/** Returns the builder for the settings used for calls to createCryptoKeyVersion. */
public UnaryCallSettings.Builder<CreateCryptoKeyVersionRequest, CryptoKeyVersion>
createCryptoKeyVersionSettings() {
Expand All @@ -421,6 +404,11 @@ public UnaryCallSettings.Builder<CreateKeyRingRequest, KeyRing> createKeyRingSet
return getStubSettingsBuilder().importCryptoKeyVersionSettings();
}

/** Returns the builder for the settings used for calls to createImportJob. */
public UnaryCallSettings.Builder<CreateImportJobRequest, ImportJob> createImportJobSettings() {
return getStubSettingsBuilder().createImportJobSettings();
}

/** Returns the builder for the settings used for calls to updateCryptoKey. */
public UnaryCallSettings.Builder<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeySettings() {
return getStubSettingsBuilder().updateCryptoKeySettings();
Expand Down Expand Up @@ -472,6 +460,22 @@ public UnaryCallSettings.Builder<DecryptRequest, DecryptResponse> decryptSetting
return getStubSettingsBuilder().restoreCryptoKeyVersionSettings();
}

/** Returns the builder for the settings used for calls to setIamPolicy. */
public UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings() {
return getStubSettingsBuilder().setIamPolicySettings();
}

/** Returns the builder for the settings used for calls to getIamPolicy. */
public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return getStubSettingsBuilder().getIamPolicySettings();
}

/** Returns the builder for the settings used for calls to testIamPermissions. */
public UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsSettings() {
return getStubSettingsBuilder().testIamPermissionsSettings();
}

@Override
public KeyManagementServiceSettings build() throws IOException {
return new KeyManagementServiceSettings(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"schema": "1.0",
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "java",
"protoPackage": "google.cloud.kms.v1",
"libraryPackage": "com.google.cloud.kms.v1",
"services": {
"KeyManagementService": {
"clients": {
"grpc": {
"libraryClient": "KeyManagementServiceClient",
"rpcs": {
"AsymmetricDecrypt": {
"methods": ["asymmetricDecrypt", "asymmetricDecrypt", "asymmetricDecrypt", "asymmetricDecryptCallable"]
},
"AsymmetricSign": {
"methods": ["asymmetricSign", "asymmetricSign", "asymmetricSign", "asymmetricSignCallable"]
},
"CreateCryptoKey": {
"methods": ["createCryptoKey", "createCryptoKey", "createCryptoKey", "createCryptoKeyCallable"]
},
"CreateCryptoKeyVersion": {
"methods": ["createCryptoKeyVersion", "createCryptoKeyVersion", "createCryptoKeyVersion", "createCryptoKeyVersionCallable"]
},
"CreateImportJob": {
"methods": ["createImportJob", "createImportJob", "createImportJob", "createImportJobCallable"]
},
"CreateKeyRing": {
"methods": ["createKeyRing", "createKeyRing", "createKeyRing", "createKeyRingCallable"]
},
"Decrypt": {
"methods": ["decrypt", "decrypt", "decrypt", "decryptCallable"]
},
"DestroyCryptoKeyVersion": {
"methods": ["destroyCryptoKeyVersion", "destroyCryptoKeyVersion", "destroyCryptoKeyVersion", "destroyCryptoKeyVersionCallable"]
},
"Encrypt": {
"methods": ["encrypt", "encrypt", "encrypt", "encryptCallable"]
},
"GetCryptoKey": {
"methods": ["getCryptoKey", "getCryptoKey", "getCryptoKey", "getCryptoKeyCallable"]
},
"GetCryptoKeyVersion": {
"methods": ["getCryptoKeyVersion", "getCryptoKeyVersion", "getCryptoKeyVersion", "getCryptoKeyVersionCallable"]
},
"GetIamPolicy": {
"methods": ["getIamPolicy", "getIamPolicyCallable"]
},
"GetImportJob": {
"methods": ["getImportJob", "getImportJob", "getImportJob", "getImportJobCallable"]
},
"GetKeyRing": {
"methods": ["getKeyRing", "getKeyRing", "getKeyRing", "getKeyRingCallable"]
},
"GetPublicKey": {
"methods": ["getPublicKey", "getPublicKey", "getPublicKey", "getPublicKeyCallable"]
},
"ImportCryptoKeyVersion": {
"methods": ["importCryptoKeyVersion", "importCryptoKeyVersionCallable"]
},
"ListCryptoKeyVersions": {
"methods": ["listCryptoKeyVersions", "listCryptoKeyVersions", "listCryptoKeyVersions", "listCryptoKeyVersionsPagedCallable", "listCryptoKeyVersionsCallable"]
},
"ListCryptoKeys": {
"methods": ["listCryptoKeys", "listCryptoKeys", "listCryptoKeys", "listCryptoKeysPagedCallable", "listCryptoKeysCallable"]
},
"ListImportJobs": {
"methods": ["listImportJobs", "listImportJobs", "listImportJobs", "listImportJobsPagedCallable", "listImportJobsCallable"]
},
"ListKeyRings": {
"methods": ["listKeyRings", "listKeyRings", "listKeyRings", "listKeyRingsPagedCallable", "listKeyRingsCallable"]
},
"RestoreCryptoKeyVersion": {
"methods": ["restoreCryptoKeyVersion", "restoreCryptoKeyVersion", "restoreCryptoKeyVersion", "restoreCryptoKeyVersionCallable"]
},
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
"TestIamPermissions": {
"methods": ["testIamPermissions", "testIamPermissionsCallable"]
},
"UpdateCryptoKey": {
"methods": ["updateCryptoKey", "updateCryptoKey", "updateCryptoKeyCallable"]
},
"UpdateCryptoKeyPrimaryVersion": {
"methods": ["updateCryptoKeyPrimaryVersion", "updateCryptoKeyPrimaryVersion", "updateCryptoKeyPrimaryVersion", "updateCryptoKeyPrimaryVersionCallable"]
},
"UpdateCryptoKeyVersion": {
"methods": ["updateCryptoKeyVersion", "updateCryptoKeyVersion", "updateCryptoKeyVersionCallable"]
}
}
}
}
}
}
}
Loading