diff --git a/google-api-grpc/grpc-google-cloud-kms-v1/pom.xml b/google-api-grpc/grpc-google-cloud-kms-v1/pom.xml new file mode 100644 index 000000000000..85a99078d4e9 --- /dev/null +++ b/google-api-grpc/grpc-google-cloud-kms-v1/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + grpc-google-cloud-kms-v1 + 0.18.1-SNAPSHOT + grpc-google-cloud-kms-v1 + GRPC library for grpc-google-cloud-kms-v1 + + com.google.api.grpc + google-api-grpc + 0.18.1-SNAPSHOT + + + + io.grpc + grpc-stub + compile + + + io.grpc + grpc-protobuf + compile + + + com.google.api.grpc + proto-google-cloud-kms-v1 + compile + + + \ No newline at end of file diff --git a/google-api-grpc/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceGrpc.java b/google-api-grpc/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceGrpc.java new file mode 100644 index 000000000000..6b603439de11 --- /dev/null +++ b/google-api-grpc/grpc-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceGrpc.java @@ -0,0 +1,1814 @@ +package com.google.cloud.kms.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; +import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; +import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; +import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; +import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + *
+ * Google Cloud Key Management Service
+ * Manages cryptographic keys and operations using those keys. Implements a REST
+ * model with the following objects:
+ * * [KeyRing][google.cloud.kms.v1.KeyRing]
+ * * [CryptoKey][google.cloud.kms.v1.CryptoKey]
+ * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.10.0)", + comments = "Source: google/cloud/kms/v1/service.proto") +public final class KeyManagementServiceGrpc { + + private KeyManagementServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.kms.v1.KeyManagementService"; + + // Static method descriptors that strictly reflect the proto. + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getListKeyRingsMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_LIST_KEY_RINGS = getListKeyRingsMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getListKeyRingsMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getListKeyRingsMethod() { + return getListKeyRingsMethodHelper(); + } + + private static io.grpc.MethodDescriptor getListKeyRingsMethodHelper() { + io.grpc.MethodDescriptor getListKeyRingsMethod; + if ((getListKeyRingsMethod = KeyManagementServiceGrpc.getListKeyRingsMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getListKeyRingsMethod = KeyManagementServiceGrpc.getListKeyRingsMethod) == null) { + KeyManagementServiceGrpc.getListKeyRingsMethod = getListKeyRingsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "ListKeyRings")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.ListKeyRingsRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.ListKeyRingsResponse.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("ListKeyRings")) + .build(); + } + } + } + return getListKeyRingsMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getListCryptoKeysMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_LIST_CRYPTO_KEYS = getListCryptoKeysMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getListCryptoKeysMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getListCryptoKeysMethod() { + return getListCryptoKeysMethodHelper(); + } + + private static io.grpc.MethodDescriptor getListCryptoKeysMethodHelper() { + io.grpc.MethodDescriptor getListCryptoKeysMethod; + if ((getListCryptoKeysMethod = KeyManagementServiceGrpc.getListCryptoKeysMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getListCryptoKeysMethod = KeyManagementServiceGrpc.getListCryptoKeysMethod) == null) { + KeyManagementServiceGrpc.getListCryptoKeysMethod = getListCryptoKeysMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "ListCryptoKeys")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.ListCryptoKeysRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.ListCryptoKeysResponse.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("ListCryptoKeys")) + .build(); + } + } + } + return getListCryptoKeysMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getListCryptoKeyVersionsMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_LIST_CRYPTO_KEY_VERSIONS = getListCryptoKeyVersionsMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getListCryptoKeyVersionsMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getListCryptoKeyVersionsMethod() { + return getListCryptoKeyVersionsMethodHelper(); + } + + private static io.grpc.MethodDescriptor getListCryptoKeyVersionsMethodHelper() { + io.grpc.MethodDescriptor getListCryptoKeyVersionsMethod; + if ((getListCryptoKeyVersionsMethod = KeyManagementServiceGrpc.getListCryptoKeyVersionsMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getListCryptoKeyVersionsMethod = KeyManagementServiceGrpc.getListCryptoKeyVersionsMethod) == null) { + KeyManagementServiceGrpc.getListCryptoKeyVersionsMethod = getListCryptoKeyVersionsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "ListCryptoKeyVersions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("ListCryptoKeyVersions")) + .build(); + } + } + } + return getListCryptoKeyVersionsMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getGetKeyRingMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_GET_KEY_RING = getGetKeyRingMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getGetKeyRingMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getGetKeyRingMethod() { + return getGetKeyRingMethodHelper(); + } + + private static io.grpc.MethodDescriptor getGetKeyRingMethodHelper() { + io.grpc.MethodDescriptor getGetKeyRingMethod; + if ((getGetKeyRingMethod = KeyManagementServiceGrpc.getGetKeyRingMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getGetKeyRingMethod = KeyManagementServiceGrpc.getGetKeyRingMethod) == null) { + KeyManagementServiceGrpc.getGetKeyRingMethod = getGetKeyRingMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "GetKeyRing")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.GetKeyRingRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.KeyRing.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("GetKeyRing")) + .build(); + } + } + } + return getGetKeyRingMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getGetCryptoKeyMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_GET_CRYPTO_KEY = getGetCryptoKeyMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getGetCryptoKeyMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getGetCryptoKeyMethod() { + return getGetCryptoKeyMethodHelper(); + } + + private static io.grpc.MethodDescriptor getGetCryptoKeyMethodHelper() { + io.grpc.MethodDescriptor getGetCryptoKeyMethod; + if ((getGetCryptoKeyMethod = KeyManagementServiceGrpc.getGetCryptoKeyMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getGetCryptoKeyMethod = KeyManagementServiceGrpc.getGetCryptoKeyMethod) == null) { + KeyManagementServiceGrpc.getGetCryptoKeyMethod = getGetCryptoKeyMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "GetCryptoKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.GetCryptoKeyRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("GetCryptoKey")) + .build(); + } + } + } + return getGetCryptoKeyMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getGetCryptoKeyVersionMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_GET_CRYPTO_KEY_VERSION = getGetCryptoKeyVersionMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getGetCryptoKeyVersionMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getGetCryptoKeyVersionMethod() { + return getGetCryptoKeyVersionMethodHelper(); + } + + private static io.grpc.MethodDescriptor getGetCryptoKeyVersionMethodHelper() { + io.grpc.MethodDescriptor getGetCryptoKeyVersionMethod; + if ((getGetCryptoKeyVersionMethod = KeyManagementServiceGrpc.getGetCryptoKeyVersionMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getGetCryptoKeyVersionMethod = KeyManagementServiceGrpc.getGetCryptoKeyVersionMethod) == null) { + KeyManagementServiceGrpc.getGetCryptoKeyVersionMethod = getGetCryptoKeyVersionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "GetCryptoKeyVersion")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("GetCryptoKeyVersion")) + .build(); + } + } + } + return getGetCryptoKeyVersionMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getCreateKeyRingMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_CREATE_KEY_RING = getCreateKeyRingMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getCreateKeyRingMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getCreateKeyRingMethod() { + return getCreateKeyRingMethodHelper(); + } + + private static io.grpc.MethodDescriptor getCreateKeyRingMethodHelper() { + io.grpc.MethodDescriptor getCreateKeyRingMethod; + if ((getCreateKeyRingMethod = KeyManagementServiceGrpc.getCreateKeyRingMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getCreateKeyRingMethod = KeyManagementServiceGrpc.getCreateKeyRingMethod) == null) { + KeyManagementServiceGrpc.getCreateKeyRingMethod = getCreateKeyRingMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "CreateKeyRing")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CreateKeyRingRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.KeyRing.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("CreateKeyRing")) + .build(); + } + } + } + return getCreateKeyRingMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getCreateCryptoKeyMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_CREATE_CRYPTO_KEY = getCreateCryptoKeyMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getCreateCryptoKeyMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getCreateCryptoKeyMethod() { + return getCreateCryptoKeyMethodHelper(); + } + + private static io.grpc.MethodDescriptor getCreateCryptoKeyMethodHelper() { + io.grpc.MethodDescriptor getCreateCryptoKeyMethod; + if ((getCreateCryptoKeyMethod = KeyManagementServiceGrpc.getCreateCryptoKeyMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getCreateCryptoKeyMethod = KeyManagementServiceGrpc.getCreateCryptoKeyMethod) == null) { + KeyManagementServiceGrpc.getCreateCryptoKeyMethod = getCreateCryptoKeyMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "CreateCryptoKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CreateCryptoKeyRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("CreateCryptoKey")) + .build(); + } + } + } + return getCreateCryptoKeyMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getCreateCryptoKeyVersionMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_CREATE_CRYPTO_KEY_VERSION = getCreateCryptoKeyVersionMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getCreateCryptoKeyVersionMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getCreateCryptoKeyVersionMethod() { + return getCreateCryptoKeyVersionMethodHelper(); + } + + private static io.grpc.MethodDescriptor getCreateCryptoKeyVersionMethodHelper() { + io.grpc.MethodDescriptor getCreateCryptoKeyVersionMethod; + if ((getCreateCryptoKeyVersionMethod = KeyManagementServiceGrpc.getCreateCryptoKeyVersionMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getCreateCryptoKeyVersionMethod = KeyManagementServiceGrpc.getCreateCryptoKeyVersionMethod) == null) { + KeyManagementServiceGrpc.getCreateCryptoKeyVersionMethod = getCreateCryptoKeyVersionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "CreateCryptoKeyVersion")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("CreateCryptoKeyVersion")) + .build(); + } + } + } + return getCreateCryptoKeyVersionMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getUpdateCryptoKeyMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_UPDATE_CRYPTO_KEY = getUpdateCryptoKeyMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getUpdateCryptoKeyMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getUpdateCryptoKeyMethod() { + return getUpdateCryptoKeyMethodHelper(); + } + + private static io.grpc.MethodDescriptor getUpdateCryptoKeyMethodHelper() { + io.grpc.MethodDescriptor getUpdateCryptoKeyMethod; + if ((getUpdateCryptoKeyMethod = KeyManagementServiceGrpc.getUpdateCryptoKeyMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getUpdateCryptoKeyMethod = KeyManagementServiceGrpc.getUpdateCryptoKeyMethod) == null) { + KeyManagementServiceGrpc.getUpdateCryptoKeyMethod = getUpdateCryptoKeyMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "UpdateCryptoKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.UpdateCryptoKeyRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("UpdateCryptoKey")) + .build(); + } + } + } + return getUpdateCryptoKeyMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getUpdateCryptoKeyVersionMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_UPDATE_CRYPTO_KEY_VERSION = getUpdateCryptoKeyVersionMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getUpdateCryptoKeyVersionMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getUpdateCryptoKeyVersionMethod() { + return getUpdateCryptoKeyVersionMethodHelper(); + } + + private static io.grpc.MethodDescriptor getUpdateCryptoKeyVersionMethodHelper() { + io.grpc.MethodDescriptor getUpdateCryptoKeyVersionMethod; + if ((getUpdateCryptoKeyVersionMethod = KeyManagementServiceGrpc.getUpdateCryptoKeyVersionMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getUpdateCryptoKeyVersionMethod = KeyManagementServiceGrpc.getUpdateCryptoKeyVersionMethod) == null) { + KeyManagementServiceGrpc.getUpdateCryptoKeyVersionMethod = getUpdateCryptoKeyVersionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "UpdateCryptoKeyVersion")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("UpdateCryptoKeyVersion")) + .build(); + } + } + } + return getUpdateCryptoKeyVersionMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getEncryptMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_ENCRYPT = getEncryptMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getEncryptMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getEncryptMethod() { + return getEncryptMethodHelper(); + } + + private static io.grpc.MethodDescriptor getEncryptMethodHelper() { + io.grpc.MethodDescriptor getEncryptMethod; + if ((getEncryptMethod = KeyManagementServiceGrpc.getEncryptMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getEncryptMethod = KeyManagementServiceGrpc.getEncryptMethod) == null) { + KeyManagementServiceGrpc.getEncryptMethod = getEncryptMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "Encrypt")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.EncryptRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.EncryptResponse.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("Encrypt")) + .build(); + } + } + } + return getEncryptMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getDecryptMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_DECRYPT = getDecryptMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getDecryptMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getDecryptMethod() { + return getDecryptMethodHelper(); + } + + private static io.grpc.MethodDescriptor getDecryptMethodHelper() { + io.grpc.MethodDescriptor getDecryptMethod; + if ((getDecryptMethod = KeyManagementServiceGrpc.getDecryptMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getDecryptMethod = KeyManagementServiceGrpc.getDecryptMethod) == null) { + KeyManagementServiceGrpc.getDecryptMethod = getDecryptMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "Decrypt")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.DecryptResponse.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("Decrypt")) + .build(); + } + } + } + return getDecryptMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getUpdateCryptoKeyPrimaryVersionMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_UPDATE_CRYPTO_KEY_PRIMARY_VERSION = getUpdateCryptoKeyPrimaryVersionMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getUpdateCryptoKeyPrimaryVersionMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getUpdateCryptoKeyPrimaryVersionMethod() { + return getUpdateCryptoKeyPrimaryVersionMethodHelper(); + } + + private static io.grpc.MethodDescriptor getUpdateCryptoKeyPrimaryVersionMethodHelper() { + io.grpc.MethodDescriptor getUpdateCryptoKeyPrimaryVersionMethod; + if ((getUpdateCryptoKeyPrimaryVersionMethod = KeyManagementServiceGrpc.getUpdateCryptoKeyPrimaryVersionMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getUpdateCryptoKeyPrimaryVersionMethod = KeyManagementServiceGrpc.getUpdateCryptoKeyPrimaryVersionMethod) == null) { + KeyManagementServiceGrpc.getUpdateCryptoKeyPrimaryVersionMethod = getUpdateCryptoKeyPrimaryVersionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "UpdateCryptoKeyPrimaryVersion")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("UpdateCryptoKeyPrimaryVersion")) + .build(); + } + } + } + return getUpdateCryptoKeyPrimaryVersionMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getDestroyCryptoKeyVersionMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_DESTROY_CRYPTO_KEY_VERSION = getDestroyCryptoKeyVersionMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getDestroyCryptoKeyVersionMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getDestroyCryptoKeyVersionMethod() { + return getDestroyCryptoKeyVersionMethodHelper(); + } + + private static io.grpc.MethodDescriptor getDestroyCryptoKeyVersionMethodHelper() { + io.grpc.MethodDescriptor getDestroyCryptoKeyVersionMethod; + if ((getDestroyCryptoKeyVersionMethod = KeyManagementServiceGrpc.getDestroyCryptoKeyVersionMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getDestroyCryptoKeyVersionMethod = KeyManagementServiceGrpc.getDestroyCryptoKeyVersionMethod) == null) { + KeyManagementServiceGrpc.getDestroyCryptoKeyVersionMethod = getDestroyCryptoKeyVersionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "DestroyCryptoKeyVersion")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("DestroyCryptoKeyVersion")) + .build(); + } + } + } + return getDestroyCryptoKeyVersionMethod; + } + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getRestoreCryptoKeyVersionMethod()} instead. + public static final io.grpc.MethodDescriptor METHOD_RESTORE_CRYPTO_KEY_VERSION = getRestoreCryptoKeyVersionMethodHelper(); + + private static volatile io.grpc.MethodDescriptor getRestoreCryptoKeyVersionMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor getRestoreCryptoKeyVersionMethod() { + return getRestoreCryptoKeyVersionMethodHelper(); + } + + private static io.grpc.MethodDescriptor getRestoreCryptoKeyVersionMethodHelper() { + io.grpc.MethodDescriptor getRestoreCryptoKeyVersionMethod; + if ((getRestoreCryptoKeyVersionMethod = KeyManagementServiceGrpc.getRestoreCryptoKeyVersionMethod) == null) { + synchronized (KeyManagementServiceGrpc.class) { + if ((getRestoreCryptoKeyVersionMethod = KeyManagementServiceGrpc.getRestoreCryptoKeyVersionMethod) == null) { + KeyManagementServiceGrpc.getRestoreCryptoKeyVersionMethod = getRestoreCryptoKeyVersionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName( + "google.cloud.kms.v1.KeyManagementService", "RestoreCryptoKeyVersion")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance())) + .setSchemaDescriptor(new KeyManagementServiceMethodDescriptorSupplier("RestoreCryptoKeyVersion")) + .build(); + } + } + } + return getRestoreCryptoKeyVersionMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static KeyManagementServiceStub newStub(io.grpc.Channel channel) { + return new KeyManagementServiceStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static KeyManagementServiceBlockingStub newBlockingStub( + io.grpc.Channel channel) { + return new KeyManagementServiceBlockingStub(channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static KeyManagementServiceFutureStub newFutureStub( + io.grpc.Channel channel) { + return new KeyManagementServiceFutureStub(channel); + } + + /** + *
+   * Google Cloud Key Management Service
+   * Manages cryptographic keys and operations using those keys. Implements a REST
+   * model with the following objects:
+   * * [KeyRing][google.cloud.kms.v1.KeyRing]
+   * * [CryptoKey][google.cloud.kms.v1.CryptoKey]
+   * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * 
+ */ + public static abstract class KeyManagementServiceImplBase implements io.grpc.BindableService { + + /** + *
+     * Lists [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public void listKeyRings(com.google.cloud.kms.v1.ListKeyRingsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getListKeyRingsMethodHelper(), responseObserver); + } + + /** + *
+     * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public void listCryptoKeys(com.google.cloud.kms.v1.ListCryptoKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getListCryptoKeysMethodHelper(), responseObserver); + } + + /** + *
+     * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public void listCryptoKeyVersions(com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getListCryptoKeyVersionsMethodHelper(), responseObserver); + } + + /** + *
+     * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public void getKeyRing(com.google.cloud.kms.v1.GetKeyRingRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetKeyRingMethodHelper(), responseObserver); + } + + /** + *
+     * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its
+     * [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public void getCryptoKey(com.google.cloud.kms.v1.GetCryptoKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetCryptoKeyMethodHelper(), responseObserver); + } + + /** + *
+     * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public void getCryptoKeyVersion(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetCryptoKeyVersionMethodHelper(), responseObserver); + } + + /** + *
+     * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.
+     * 
+ */ + public void createKeyRing(com.google.cloud.kms.v1.CreateKeyRingRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateKeyRingMethodHelper(), responseObserver); + } + + /** + *
+     * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].
+     * [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required.
+     * 
+ */ + public void createCryptoKey(com.google.cloud.kms.v1.CreateCryptoKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateCryptoKeyMethodHelper(), responseObserver); + } + + /** + *
+     * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * The server will assign the next sequential id. If unset,
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].
+     * 
+ */ + public void createCryptoKeyVersion(com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateCryptoKeyVersionMethodHelper(), responseObserver); + } + + /** + *
+     * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public void updateCryptoKey(com.google.cloud.kms.v1.UpdateCryptoKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateCryptoKeyMethodHelper(), responseObserver); + } + + /** + *
+     * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and
+     * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this
+     * method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to
+     * move between other states.
+     * 
+ */ + public void updateCryptoKeyVersion(com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateCryptoKeyVersionMethodHelper(), responseObserver); + } + + /** + *
+     * Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+     * 
+ */ + public void encrypt(com.google.cloud.kms.v1.EncryptRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getEncryptMethodHelper(), responseObserver); + } + + /** + *
+     * Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+     * 
+ */ + public void decrypt(com.google.cloud.kms.v1.DecryptRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getDecryptMethodHelper(), responseObserver); + } + + /** + *
+     * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]
+     * 
+ */ + public void updateCryptoKeyPrimaryVersion(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateCryptoKeyPrimaryVersionMethodHelper(), responseObserver); + } + + /** + *
+     * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
+     * Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
+     * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be changed to
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
+     * material will be irrevocably destroyed.
+     * Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached,
+     * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.
+     * 
+ */ + public void destroyCryptoKeyVersion(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getDestroyCryptoKeyVersionMethodHelper(), responseObserver); + } + + /** + *
+     * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
+     * state.
+     * Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED],
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.
+     * 
+ */ + public void restoreCryptoKeyVersion(com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getRestoreCryptoKeyVersionMethodHelper(), responseObserver); + } + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getListKeyRingsMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.ListKeyRingsRequest, + com.google.cloud.kms.v1.ListKeyRingsResponse>( + this, METHODID_LIST_KEY_RINGS))) + .addMethod( + getListCryptoKeysMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.ListCryptoKeysRequest, + com.google.cloud.kms.v1.ListCryptoKeysResponse>( + this, METHODID_LIST_CRYPTO_KEYS))) + .addMethod( + getListCryptoKeyVersionsMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest, + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse>( + this, METHODID_LIST_CRYPTO_KEY_VERSIONS))) + .addMethod( + getGetKeyRingMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.GetKeyRingRequest, + com.google.cloud.kms.v1.KeyRing>( + this, METHODID_GET_KEY_RING))) + .addMethod( + getGetCryptoKeyMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.GetCryptoKeyRequest, + com.google.cloud.kms.v1.CryptoKey>( + this, METHODID_GET_CRYPTO_KEY))) + .addMethod( + getGetCryptoKeyVersionMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest, + com.google.cloud.kms.v1.CryptoKeyVersion>( + this, METHODID_GET_CRYPTO_KEY_VERSION))) + .addMethod( + getCreateKeyRingMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.CreateKeyRingRequest, + com.google.cloud.kms.v1.KeyRing>( + this, METHODID_CREATE_KEY_RING))) + .addMethod( + getCreateCryptoKeyMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.CreateCryptoKeyRequest, + com.google.cloud.kms.v1.CryptoKey>( + this, METHODID_CREATE_CRYPTO_KEY))) + .addMethod( + getCreateCryptoKeyVersionMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest, + com.google.cloud.kms.v1.CryptoKeyVersion>( + this, METHODID_CREATE_CRYPTO_KEY_VERSION))) + .addMethod( + getUpdateCryptoKeyMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.UpdateCryptoKeyRequest, + com.google.cloud.kms.v1.CryptoKey>( + this, METHODID_UPDATE_CRYPTO_KEY))) + .addMethod( + getUpdateCryptoKeyVersionMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest, + com.google.cloud.kms.v1.CryptoKeyVersion>( + this, METHODID_UPDATE_CRYPTO_KEY_VERSION))) + .addMethod( + getEncryptMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.EncryptRequest, + com.google.cloud.kms.v1.EncryptResponse>( + this, METHODID_ENCRYPT))) + .addMethod( + getDecryptMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.DecryptRequest, + com.google.cloud.kms.v1.DecryptResponse>( + this, METHODID_DECRYPT))) + .addMethod( + getUpdateCryptoKeyPrimaryVersionMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest, + com.google.cloud.kms.v1.CryptoKey>( + this, METHODID_UPDATE_CRYPTO_KEY_PRIMARY_VERSION))) + .addMethod( + getDestroyCryptoKeyVersionMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest, + com.google.cloud.kms.v1.CryptoKeyVersion>( + this, METHODID_DESTROY_CRYPTO_KEY_VERSION))) + .addMethod( + getRestoreCryptoKeyVersionMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest, + com.google.cloud.kms.v1.CryptoKeyVersion>( + this, METHODID_RESTORE_CRYPTO_KEY_VERSION))) + .build(); + } + } + + /** + *
+   * Google Cloud Key Management Service
+   * Manages cryptographic keys and operations using those keys. Implements a REST
+   * model with the following objects:
+   * * [KeyRing][google.cloud.kms.v1.KeyRing]
+   * * [CryptoKey][google.cloud.kms.v1.CryptoKey]
+   * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * 
+ */ + public static final class KeyManagementServiceStub extends io.grpc.stub.AbstractStub { + private KeyManagementServiceStub(io.grpc.Channel channel) { + super(channel); + } + + private KeyManagementServiceStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected KeyManagementServiceStub build(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new KeyManagementServiceStub(channel, callOptions); + } + + /** + *
+     * Lists [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public void listKeyRings(com.google.cloud.kms.v1.ListKeyRingsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListKeyRingsMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public void listCryptoKeys(com.google.cloud.kms.v1.ListCryptoKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListCryptoKeysMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public void listCryptoKeyVersions(com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListCryptoKeyVersionsMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public void getKeyRing(com.google.cloud.kms.v1.GetKeyRingRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetKeyRingMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its
+     * [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public void getCryptoKey(com.google.cloud.kms.v1.GetCryptoKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetCryptoKeyMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public void getCryptoKeyVersion(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetCryptoKeyVersionMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.
+     * 
+ */ + public void createKeyRing(com.google.cloud.kms.v1.CreateKeyRingRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateKeyRingMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].
+     * [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required.
+     * 
+ */ + public void createCryptoKey(com.google.cloud.kms.v1.CreateCryptoKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateCryptoKeyMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * The server will assign the next sequential id. If unset,
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].
+     * 
+ */ + public void createCryptoKeyVersion(com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateCryptoKeyVersionMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public void updateCryptoKey(com.google.cloud.kms.v1.UpdateCryptoKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateCryptoKeyMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and
+     * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this
+     * method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to
+     * move between other states.
+     * 
+ */ + public void updateCryptoKeyVersion(com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateCryptoKeyVersionMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+     * 
+ */ + public void encrypt(com.google.cloud.kms.v1.EncryptRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getEncryptMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+     * 
+ */ + public void decrypt(com.google.cloud.kms.v1.DecryptRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDecryptMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]
+     * 
+ */ + public void updateCryptoKeyPrimaryVersion(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateCryptoKeyPrimaryVersionMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
+     * Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
+     * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be changed to
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
+     * material will be irrevocably destroyed.
+     * Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached,
+     * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.
+     * 
+ */ + public void destroyCryptoKeyVersion(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDestroyCryptoKeyVersionMethodHelper(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
+     * state.
+     * Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED],
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.
+     * 
+ */ + public void restoreCryptoKeyVersion(com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getRestoreCryptoKeyVersionMethodHelper(), getCallOptions()), request, responseObserver); + } + } + + /** + *
+   * Google Cloud Key Management Service
+   * Manages cryptographic keys and operations using those keys. Implements a REST
+   * model with the following objects:
+   * * [KeyRing][google.cloud.kms.v1.KeyRing]
+   * * [CryptoKey][google.cloud.kms.v1.CryptoKey]
+   * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * 
+ */ + public static final class KeyManagementServiceBlockingStub extends io.grpc.stub.AbstractStub { + private KeyManagementServiceBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private KeyManagementServiceBlockingStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected KeyManagementServiceBlockingStub build(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new KeyManagementServiceBlockingStub(channel, callOptions); + } + + /** + *
+     * Lists [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public com.google.cloud.kms.v1.ListKeyRingsResponse listKeyRings(com.google.cloud.kms.v1.ListKeyRingsRequest request) { + return blockingUnaryCall( + getChannel(), getListKeyRingsMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public com.google.cloud.kms.v1.ListCryptoKeysResponse listCryptoKeys(com.google.cloud.kms.v1.ListCryptoKeysRequest request) { + return blockingUnaryCall( + getChannel(), getListCryptoKeysMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse listCryptoKeyVersions(com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest request) { + return blockingUnaryCall( + getChannel(), getListCryptoKeyVersionsMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public com.google.cloud.kms.v1.KeyRing getKeyRing(com.google.cloud.kms.v1.GetKeyRingRequest request) { + return blockingUnaryCall( + getChannel(), getGetKeyRingMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its
+     * [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKey(com.google.cloud.kms.v1.GetCryptoKeyRequest request) { + return blockingUnaryCall( + getChannel(), getGetCryptoKeyMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest request) { + return blockingUnaryCall( + getChannel(), getGetCryptoKeyVersionMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.
+     * 
+ */ + public com.google.cloud.kms.v1.KeyRing createKeyRing(com.google.cloud.kms.v1.CreateKeyRingRequest request) { + return blockingUnaryCall( + getChannel(), getCreateKeyRingMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].
+     * [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required.
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKey createCryptoKey(com.google.cloud.kms.v1.CreateCryptoKeyRequest request) { + return blockingUnaryCall( + getChannel(), getCreateCryptoKeyMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * The server will assign the next sequential id. If unset,
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKeyVersion createCryptoKeyVersion(com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest request) { + return blockingUnaryCall( + getChannel(), getCreateCryptoKeyVersionMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKey updateCryptoKey(com.google.cloud.kms.v1.UpdateCryptoKeyRequest request) { + return blockingUnaryCall( + getChannel(), getUpdateCryptoKeyMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and
+     * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this
+     * method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to
+     * move between other states.
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKeyVersion updateCryptoKeyVersion(com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest request) { + return blockingUnaryCall( + getChannel(), getUpdateCryptoKeyVersionMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+     * 
+ */ + public com.google.cloud.kms.v1.EncryptResponse encrypt(com.google.cloud.kms.v1.EncryptRequest request) { + return blockingUnaryCall( + getChannel(), getEncryptMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+     * 
+ */ + public com.google.cloud.kms.v1.DecryptResponse decrypt(com.google.cloud.kms.v1.DecryptRequest request) { + return blockingUnaryCall( + getChannel(), getDecryptMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKey updateCryptoKeyPrimaryVersion(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest request) { + return blockingUnaryCall( + getChannel(), getUpdateCryptoKeyPrimaryVersionMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
+     * Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
+     * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be changed to
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
+     * material will be irrevocably destroyed.
+     * Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached,
+     * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKeyVersion destroyCryptoKeyVersion(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest request) { + return blockingUnaryCall( + getChannel(), getDestroyCryptoKeyVersionMethodHelper(), getCallOptions(), request); + } + + /** + *
+     * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
+     * state.
+     * Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED],
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.
+     * 
+ */ + public com.google.cloud.kms.v1.CryptoKeyVersion restoreCryptoKeyVersion(com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest request) { + return blockingUnaryCall( + getChannel(), getRestoreCryptoKeyVersionMethodHelper(), getCallOptions(), request); + } + } + + /** + *
+   * Google Cloud Key Management Service
+   * Manages cryptographic keys and operations using those keys. Implements a REST
+   * model with the following objects:
+   * * [KeyRing][google.cloud.kms.v1.KeyRing]
+   * * [CryptoKey][google.cloud.kms.v1.CryptoKey]
+   * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * 
+ */ + public static final class KeyManagementServiceFutureStub extends io.grpc.stub.AbstractStub { + private KeyManagementServiceFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private KeyManagementServiceFutureStub(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected KeyManagementServiceFutureStub build(io.grpc.Channel channel, + io.grpc.CallOptions callOptions) { + return new KeyManagementServiceFutureStub(channel, callOptions); + } + + /** + *
+     * Lists [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture listKeyRings( + com.google.cloud.kms.v1.ListKeyRingsRequest request) { + return futureUnaryCall( + getChannel().newCall(getListKeyRingsMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture listCryptoKeys( + com.google.cloud.kms.v1.ListCryptoKeysRequest request) { + return futureUnaryCall( + getChannel().newCall(getListCryptoKeysMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture listCryptoKeyVersions( + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest request) { + return futureUnaryCall( + getChannel().newCall(getListCryptoKeyVersionsMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getKeyRing( + com.google.cloud.kms.v1.GetKeyRingRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetKeyRingMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its
+     * [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getCryptoKey( + com.google.cloud.kms.v1.GetCryptoKeyRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetCryptoKeyMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getCryptoKeyVersion( + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetCryptoKeyVersionMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture createKeyRing( + com.google.cloud.kms.v1.CreateKeyRingRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateKeyRingMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].
+     * [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture createCryptoKey( + com.google.cloud.kms.v1.CreateCryptoKeyRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateCryptoKeyMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * The server will assign the next sequential id. If unset,
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture createCryptoKeyVersion( + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateCryptoKeyVersionMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture updateCryptoKey( + com.google.cloud.kms.v1.UpdateCryptoKeyRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateCryptoKeyMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.
+     * [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between
+     * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and
+     * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this
+     * method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to
+     * move between other states.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture updateCryptoKeyVersion( + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateCryptoKeyVersionMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture encrypt( + com.google.cloud.kms.v1.EncryptRequest request) { + return futureUnaryCall( + getChannel().newCall(getEncryptMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture decrypt( + com.google.cloud.kms.v1.DecryptRequest request) { + return futureUnaryCall( + getChannel().newCall(getDecryptMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture updateCryptoKeyPrimaryVersion( + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateCryptoKeyPrimaryVersionMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.
+     * Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24
+     * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be changed to
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key
+     * material will be irrevocably destroyed.
+     * Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached,
+     * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture destroyCryptoKeyVersion( + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest request) { + return futureUnaryCall( + getChannel().newCall(getDestroyCryptoKeyVersionMethodHelper(), getCallOptions()), request); + } + + /** + *
+     * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED],
+     * state.
+     * Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state]
+     * will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED],
+     * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture restoreCryptoKeyVersion( + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest request) { + return futureUnaryCall( + getChannel().newCall(getRestoreCryptoKeyVersionMethodHelper(), getCallOptions()), request); + } + } + + private static final int METHODID_LIST_KEY_RINGS = 0; + private static final int METHODID_LIST_CRYPTO_KEYS = 1; + private static final int METHODID_LIST_CRYPTO_KEY_VERSIONS = 2; + private static final int METHODID_GET_KEY_RING = 3; + private static final int METHODID_GET_CRYPTO_KEY = 4; + private static final int METHODID_GET_CRYPTO_KEY_VERSION = 5; + private static final int METHODID_CREATE_KEY_RING = 6; + private static final int METHODID_CREATE_CRYPTO_KEY = 7; + private static final int METHODID_CREATE_CRYPTO_KEY_VERSION = 8; + private static final int METHODID_UPDATE_CRYPTO_KEY = 9; + private static final int METHODID_UPDATE_CRYPTO_KEY_VERSION = 10; + private static final int METHODID_ENCRYPT = 11; + private static final int METHODID_DECRYPT = 12; + private static final int METHODID_UPDATE_CRYPTO_KEY_PRIMARY_VERSION = 13; + private static final int METHODID_DESTROY_CRYPTO_KEY_VERSION = 14; + private static final int METHODID_RESTORE_CRYPTO_KEY_VERSION = 15; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final KeyManagementServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(KeyManagementServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_LIST_KEY_RINGS: + serviceImpl.listKeyRings((com.google.cloud.kms.v1.ListKeyRingsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_CRYPTO_KEYS: + serviceImpl.listCryptoKeys((com.google.cloud.kms.v1.ListCryptoKeysRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_CRYPTO_KEY_VERSIONS: + serviceImpl.listCryptoKeyVersions((com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_KEY_RING: + serviceImpl.getKeyRing((com.google.cloud.kms.v1.GetKeyRingRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CRYPTO_KEY: + serviceImpl.getCryptoKey((com.google.cloud.kms.v1.GetCryptoKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_CRYPTO_KEY_VERSION: + serviceImpl.getCryptoKeyVersion((com.google.cloud.kms.v1.GetCryptoKeyVersionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_KEY_RING: + serviceImpl.createKeyRing((com.google.cloud.kms.v1.CreateKeyRingRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_CRYPTO_KEY: + serviceImpl.createCryptoKey((com.google.cloud.kms.v1.CreateCryptoKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_CRYPTO_KEY_VERSION: + serviceImpl.createCryptoKeyVersion((com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_CRYPTO_KEY: + serviceImpl.updateCryptoKey((com.google.cloud.kms.v1.UpdateCryptoKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_CRYPTO_KEY_VERSION: + serviceImpl.updateCryptoKeyVersion((com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_ENCRYPT: + serviceImpl.encrypt((com.google.cloud.kms.v1.EncryptRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DECRYPT: + serviceImpl.decrypt((com.google.cloud.kms.v1.DecryptRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_CRYPTO_KEY_PRIMARY_VERSION: + serviceImpl.updateCryptoKeyPrimaryVersion((com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DESTROY_CRYPTO_KEY_VERSION: + serviceImpl.destroyCryptoKeyVersion((com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_RESTORE_CRYPTO_KEY_VERSION: + serviceImpl.restoreCryptoKeyVersion((com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private static abstract class KeyManagementServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + KeyManagementServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.kms.v1.KmsProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("KeyManagementService"); + } + } + + private static final class KeyManagementServiceFileDescriptorSupplier + extends KeyManagementServiceBaseDescriptorSupplier { + KeyManagementServiceFileDescriptorSupplier() {} + } + + private static final class KeyManagementServiceMethodDescriptorSupplier + extends KeyManagementServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + KeyManagementServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (KeyManagementServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new KeyManagementServiceFileDescriptorSupplier()) + .addMethod(getListKeyRingsMethodHelper()) + .addMethod(getListCryptoKeysMethodHelper()) + .addMethod(getListCryptoKeyVersionsMethodHelper()) + .addMethod(getGetKeyRingMethodHelper()) + .addMethod(getGetCryptoKeyMethodHelper()) + .addMethod(getGetCryptoKeyVersionMethodHelper()) + .addMethod(getCreateKeyRingMethodHelper()) + .addMethod(getCreateCryptoKeyMethodHelper()) + .addMethod(getCreateCryptoKeyVersionMethodHelper()) + .addMethod(getUpdateCryptoKeyMethodHelper()) + .addMethod(getUpdateCryptoKeyVersionMethodHelper()) + .addMethod(getEncryptMethodHelper()) + .addMethod(getDecryptMethodHelper()) + .addMethod(getUpdateCryptoKeyPrimaryVersionMethodHelper()) + .addMethod(getDestroyCryptoKeyVersionMethodHelper()) + .addMethod(getRestoreCryptoKeyVersionMethodHelper()) + .build(); + } + } + } + return result; + } +} diff --git a/google-api-grpc/pom.xml b/google-api-grpc/pom.xml index 612615e9d6af..478f6b554611 100644 --- a/google-api-grpc/pom.xml +++ b/google-api-grpc/pom.xml @@ -236,6 +236,16 @@ grpc-google-cloud-firestore-v1beta1 0.18.1-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-kms-v1 + 0.18.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-kms-v1 + 0.18.1-SNAPSHOT + com.google.api.grpc proto-google-cloud-language-v1 @@ -520,6 +530,7 @@ grpc-google-cloud-dlp-v2 grpc-google-cloud-error-reporting-v1beta1 grpc-google-cloud-firestore-v1beta1 + grpc-google-cloud-kms-v1 grpc-google-cloud-language-v1 grpc-google-cloud-language-v1beta2 grpc-google-cloud-logging-v2 @@ -558,6 +569,7 @@ proto-google-cloud-dlp-v2 proto-google-cloud-error-reporting-v1beta1 proto-google-cloud-firestore-v1beta1 + proto-google-cloud-kms-v1 proto-google-cloud-language-v1 proto-google-cloud-language-v1beta2 proto-google-cloud-logging-v2 diff --git a/google-api-grpc/proto-google-cloud-kms-v1/pom.xml b/google-api-grpc/proto-google-cloud-kms-v1/pom.xml new file mode 100644 index 000000000000..4f0dbabf0999 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/pom.xml @@ -0,0 +1,36 @@ + + 4.0.0 + proto-google-cloud-kms-v1 + 0.18.1-SNAPSHOT + proto-google-cloud-kms-v1 + PROTO library for proto-google-cloud-kms-v1 + + com.google.api.grpc + google-api-grpc + 0.18.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + compile + + + com.google.api + api-common + compile + + + com.google.api.grpc + proto-google-common-protos + compile + + + com.google.api.grpc + proto-google-iam-v1 + compile + + + \ No newline at end of file diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyRequest.java new file mode 100644 index 000000000000..bb60afafe6f9 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyRequest.java @@ -0,0 +1,950 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CreateCryptoKeyRequest} + */ +public final class CreateCryptoKeyRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.CreateCryptoKeyRequest) + CreateCryptoKeyRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use CreateCryptoKeyRequest.newBuilder() to construct. + private CreateCryptoKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CreateCryptoKeyRequest() { + parent_ = ""; + cryptoKeyId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateCryptoKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + cryptoKeyId_ = s; + break; + } + case 26: { + com.google.cloud.kms.v1.CryptoKey.Builder subBuilder = null; + if (cryptoKey_ != null) { + subBuilder = cryptoKey_.toBuilder(); + } + cryptoKey_ = input.readMessage(com.google.cloud.kms.v1.CryptoKey.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(cryptoKey_); + cryptoKey_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CreateCryptoKeyRequest.class, com.google.cloud.kms.v1.CreateCryptoKeyRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + *
+   * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+   * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + *
+   * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+   * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CRYPTO_KEY_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object cryptoKeyId_; + /** + *
+   * Required. It must be unique within a KeyRing and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string crypto_key_id = 2; + */ + public java.lang.String getCryptoKeyId() { + java.lang.Object ref = cryptoKeyId_; + 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(); + cryptoKeyId_ = s; + return s; + } + } + /** + *
+   * Required. It must be unique within a KeyRing and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string crypto_key_id = 2; + */ + public com.google.protobuf.ByteString + getCryptoKeyIdBytes() { + java.lang.Object ref = cryptoKeyId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + cryptoKeyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CRYPTO_KEY_FIELD_NUMBER = 3; + private com.google.cloud.kms.v1.CryptoKey cryptoKey_; + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public boolean hasCryptoKey() { + return cryptoKey_ != null; + } + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKey() { + return cryptoKey_ == null ? com.google.cloud.kms.v1.CryptoKey.getDefaultInstance() : cryptoKey_; + } + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeyOrBuilder() { + return getCryptoKey(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!getCryptoKeyIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, cryptoKeyId_); + } + if (cryptoKey_ != null) { + output.writeMessage(3, getCryptoKey()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!getCryptoKeyIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, cryptoKeyId_); + } + if (cryptoKey_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getCryptoKey()); + } + size += unknownFields.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.CreateCryptoKeyRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.CreateCryptoKeyRequest other = (com.google.cloud.kms.v1.CreateCryptoKeyRequest) obj; + + boolean result = true; + result = result && getParent() + .equals(other.getParent()); + result = result && getCryptoKeyId() + .equals(other.getCryptoKeyId()); + result = result && (hasCryptoKey() == other.hasCryptoKey()); + if (hasCryptoKey()) { + result = result && getCryptoKey() + .equals(other.getCryptoKey()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + CRYPTO_KEY_ID_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKeyId().hashCode(); + if (hasCryptoKey()) { + hash = (37 * hash) + CRYPTO_KEY_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKey().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest 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.CreateCryptoKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest 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.CreateCryptoKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest 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.CreateCryptoKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest 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.CreateCryptoKeyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest 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.CreateCryptoKeyRequest 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.CreateCryptoKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.CreateCryptoKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CreateCryptoKeyRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.CreateCryptoKeyRequest) + com.google.cloud.kms.v1.CreateCryptoKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CreateCryptoKeyRequest.class, com.google.cloud.kms.v1.CreateCryptoKeyRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.CreateCryptoKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + parent_ = ""; + + cryptoKeyId_ = ""; + + if (cryptoKeyBuilder_ == null) { + cryptoKey_ = null; + } else { + cryptoKey_ = null; + cryptoKeyBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_descriptor; + } + + public com.google.cloud.kms.v1.CreateCryptoKeyRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.CreateCryptoKeyRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.CreateCryptoKeyRequest build() { + com.google.cloud.kms.v1.CreateCryptoKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.CreateCryptoKeyRequest buildPartial() { + com.google.cloud.kms.v1.CreateCryptoKeyRequest result = new com.google.cloud.kms.v1.CreateCryptoKeyRequest(this); + result.parent_ = parent_; + result.cryptoKeyId_ = cryptoKeyId_; + if (cryptoKeyBuilder_ == null) { + result.cryptoKey_ = cryptoKey_; + } else { + result.cryptoKey_ = cryptoKeyBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.CreateCryptoKeyRequest) { + return mergeFrom((com.google.cloud.kms.v1.CreateCryptoKeyRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.CreateCryptoKeyRequest other) { + if (other == com.google.cloud.kms.v1.CreateCryptoKeyRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getCryptoKeyId().isEmpty()) { + cryptoKeyId_ = other.cryptoKeyId_; + onChanged(); + } + if (other.hasCryptoKey()) { + mergeCryptoKey(other.getCryptoKey()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.CreateCryptoKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.CreateCryptoKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + *
+     * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * string parent = 1; + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * string parent = 1; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * string parent = 1; + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object cryptoKeyId_ = ""; + /** + *
+     * Required. It must be unique within a KeyRing and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string crypto_key_id = 2; + */ + public java.lang.String getCryptoKeyId() { + java.lang.Object ref = cryptoKeyId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cryptoKeyId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. It must be unique within a KeyRing and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string crypto_key_id = 2; + */ + public com.google.protobuf.ByteString + getCryptoKeyIdBytes() { + java.lang.Object ref = cryptoKeyId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + cryptoKeyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. It must be unique within a KeyRing and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string crypto_key_id = 2; + */ + public Builder setCryptoKeyId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + cryptoKeyId_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. It must be unique within a KeyRing and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string crypto_key_id = 2; + */ + public Builder clearCryptoKeyId() { + + cryptoKeyId_ = getDefaultInstance().getCryptoKeyId(); + onChanged(); + return this; + } + /** + *
+     * Required. It must be unique within a KeyRing and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string crypto_key_id = 2; + */ + public Builder setCryptoKeyIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + cryptoKeyId_ = value; + onChanged(); + return this; + } + + private com.google.cloud.kms.v1.CryptoKey cryptoKey_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder> cryptoKeyBuilder_; + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public boolean hasCryptoKey() { + return cryptoKeyBuilder_ != null || cryptoKey_ != null; + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKey() { + if (cryptoKeyBuilder_ == null) { + return cryptoKey_ == null ? com.google.cloud.kms.v1.CryptoKey.getDefaultInstance() : cryptoKey_; + } else { + return cryptoKeyBuilder_.getMessage(); + } + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public Builder setCryptoKey(com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cryptoKey_ = value; + onChanged(); + } else { + cryptoKeyBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public Builder setCryptoKey( + com.google.cloud.kms.v1.CryptoKey.Builder builderForValue) { + if (cryptoKeyBuilder_ == null) { + cryptoKey_ = builderForValue.build(); + onChanged(); + } else { + cryptoKeyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public Builder mergeCryptoKey(com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeyBuilder_ == null) { + if (cryptoKey_ != null) { + cryptoKey_ = + com.google.cloud.kms.v1.CryptoKey.newBuilder(cryptoKey_).mergeFrom(value).buildPartial(); + } else { + cryptoKey_ = value; + } + onChanged(); + } else { + cryptoKeyBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public Builder clearCryptoKey() { + if (cryptoKeyBuilder_ == null) { + cryptoKey_ = null; + onChanged(); + } else { + cryptoKey_ = null; + cryptoKeyBuilder_ = null; + } + + return this; + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public com.google.cloud.kms.v1.CryptoKey.Builder getCryptoKeyBuilder() { + + onChanged(); + return getCryptoKeyFieldBuilder().getBuilder(); + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + public com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeyOrBuilder() { + if (cryptoKeyBuilder_ != null) { + return cryptoKeyBuilder_.getMessageOrBuilder(); + } else { + return cryptoKey_ == null ? + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance() : cryptoKey_; + } + } + /** + *
+     * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder> + getCryptoKeyFieldBuilder() { + if (cryptoKeyBuilder_ == null) { + cryptoKeyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder>( + getCryptoKey(), + getParentForChildren(), + isClean()); + cryptoKey_ = null; + } + return cryptoKeyBuilder_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.CreateCryptoKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.CreateCryptoKeyRequest) + private static final com.google.cloud.kms.v1.CreateCryptoKeyRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.CreateCryptoKeyRequest(); + } + + public static com.google.cloud.kms.v1.CreateCryptoKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public CreateCryptoKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateCryptoKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.CreateCryptoKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyRequestOrBuilder.java new file mode 100644 index 000000000000..acd94c8e0c4c --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyRequestOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface CreateCryptoKeyRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.CreateCryptoKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+   * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * string parent = 1; + */ + java.lang.String getParent(); + /** + *
+   * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the
+   * [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * string parent = 1; + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * Required. It must be unique within a KeyRing and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string crypto_key_id = 2; + */ + java.lang.String getCryptoKeyId(); + /** + *
+   * Required. It must be unique within a KeyRing and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string crypto_key_id = 2; + */ + com.google.protobuf.ByteString + getCryptoKeyIdBytes(); + + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + boolean hasCryptoKey(); + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + com.google.cloud.kms.v1.CryptoKey getCryptoKey(); + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 3; + */ + com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeyOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyVersionRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyVersionRequest.java new file mode 100644 index 000000000000..e1856e62ba56 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyVersionRequest.java @@ -0,0 +1,788 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CreateCryptoKeyVersionRequest} + */ +public final class CreateCryptoKeyVersionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.CreateCryptoKeyVersionRequest) + CreateCryptoKeyVersionRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use CreateCryptoKeyVersionRequest.newBuilder() to construct. + private CreateCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CreateCryptoKeyVersionRequest() { + parent_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateCryptoKeyVersionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: { + com.google.cloud.kms.v1.CryptoKeyVersion.Builder subBuilder = null; + if (cryptoKeyVersion_ != null) { + subBuilder = cryptoKeyVersion_.toBuilder(); + } + cryptoKeyVersion_ = input.readMessage(com.google.cloud.kms.v1.CryptoKeyVersion.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(cryptoKeyVersion_); + cryptoKeyVersion_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + *
+   * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+   * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + *
+   * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+   * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CRYPTO_KEY_VERSION_FIELD_NUMBER = 2; + private com.google.cloud.kms.v1.CryptoKeyVersion cryptoKeyVersion_; + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public boolean hasCryptoKeyVersion() { + return cryptoKeyVersion_ != null; + } + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion() { + return cryptoKeyVersion_ == null ? com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : cryptoKeyVersion_; + } + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionOrBuilder() { + return getCryptoKeyVersion(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (cryptoKeyVersion_ != null) { + output.writeMessage(2, getCryptoKeyVersion()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (cryptoKeyVersion_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getCryptoKeyVersion()); + } + size += unknownFields.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.CreateCryptoKeyVersionRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest other = (com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest) obj; + + boolean result = true; + result = result && getParent() + .equals(other.getParent()); + result = result && (hasCryptoKeyVersion() == other.hasCryptoKeyVersion()); + if (hasCryptoKeyVersion()) { + result = result && getCryptoKeyVersion() + .equals(other.getCryptoKeyVersion()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasCryptoKeyVersion()) { + hash = (37 * hash) + CRYPTO_KEY_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKeyVersion().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest 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.CreateCryptoKeyVersionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest 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.CreateCryptoKeyVersionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest 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.CreateCryptoKeyVersionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest 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.CreateCryptoKeyVersionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest 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.CreateCryptoKeyVersionRequest 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.CreateCryptoKeyVersionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CreateCryptoKeyVersionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.CreateCryptoKeyVersionRequest) + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + parent_ = ""; + + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersion_ = null; + } else { + cryptoKeyVersion_ = null; + cryptoKeyVersionBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_descriptor; + } + + public com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest build() { + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest buildPartial() { + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest result = new com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest(this); + result.parent_ = parent_; + if (cryptoKeyVersionBuilder_ == null) { + result.cryptoKeyVersion_ = cryptoKeyVersion_; + } else { + result.cryptoKeyVersion_ = cryptoKeyVersionBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest) { + return mergeFrom((com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest other) { + if (other == com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasCryptoKeyVersion()) { + mergeCryptoKeyVersion(other.getCryptoKeyVersion()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + *
+     * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+     * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+     * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+     * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * string parent = 1; + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+     * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * string parent = 1; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + *
+     * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+     * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * string parent = 1; + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.kms.v1.CryptoKeyVersion cryptoKeyVersion_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> cryptoKeyVersionBuilder_; + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public boolean hasCryptoKeyVersion() { + return cryptoKeyVersionBuilder_ != null || cryptoKeyVersion_ != null; + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion() { + if (cryptoKeyVersionBuilder_ == null) { + return cryptoKeyVersion_ == null ? com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : cryptoKeyVersion_; + } else { + return cryptoKeyVersionBuilder_.getMessage(); + } + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public Builder setCryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cryptoKeyVersion_ = value; + onChanged(); + } else { + cryptoKeyVersionBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public Builder setCryptoKeyVersion( + com.google.cloud.kms.v1.CryptoKeyVersion.Builder builderForValue) { + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersion_ = builderForValue.build(); + onChanged(); + } else { + cryptoKeyVersionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public Builder mergeCryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionBuilder_ == null) { + if (cryptoKeyVersion_ != null) { + cryptoKeyVersion_ = + com.google.cloud.kms.v1.CryptoKeyVersion.newBuilder(cryptoKeyVersion_).mergeFrom(value).buildPartial(); + } else { + cryptoKeyVersion_ = value; + } + onChanged(); + } else { + cryptoKeyVersionBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public Builder clearCryptoKeyVersion() { + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersion_ = null; + onChanged(); + } else { + cryptoKeyVersion_ = null; + cryptoKeyVersionBuilder_ = null; + } + + return this; + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.Builder getCryptoKeyVersionBuilder() { + + onChanged(); + return getCryptoKeyVersionFieldBuilder().getBuilder(); + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionOrBuilder() { + if (cryptoKeyVersionBuilder_ != null) { + return cryptoKeyVersionBuilder_.getMessageOrBuilder(); + } else { + return cryptoKeyVersion_ == null ? + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : cryptoKeyVersion_; + } + } + /** + *
+     * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> + getCryptoKeyVersionFieldBuilder() { + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder>( + getCryptoKeyVersion(), + getParentForChildren(), + isClean()); + cryptoKeyVersion_ = null; + } + return cryptoKeyVersionBuilder_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.CreateCryptoKeyVersionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.CreateCryptoKeyVersionRequest) + private static final com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest(); + } + + public static com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public CreateCryptoKeyVersionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateCryptoKeyVersionRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyVersionRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyVersionRequestOrBuilder.java new file mode 100644 index 000000000000..6cfea014c776 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateCryptoKeyVersionRequestOrBuilder.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface CreateCryptoKeyVersionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.CreateCryptoKeyVersionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+   * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * string parent = 1; + */ + java.lang.String getParent(); + /** + *
+   * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with
+   * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * string parent = 1; + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + boolean hasCryptoKeyVersion(); + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion(); + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 2; + */ + com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateKeyRingRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateKeyRingRequest.java new file mode 100644 index 000000000000..16a70a04e9bb --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateKeyRingRequest.java @@ -0,0 +1,950 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CreateKeyRingRequest} + */ +public final class CreateKeyRingRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.CreateKeyRingRequest) + CreateKeyRingRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use CreateKeyRingRequest.newBuilder() to construct. + private CreateKeyRingRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CreateKeyRingRequest() { + parent_ = ""; + keyRingId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CreateKeyRingRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + keyRingId_ = s; + break; + } + case 26: { + com.google.cloud.kms.v1.KeyRing.Builder subBuilder = null; + if (keyRing_ != null) { + subBuilder = keyRing_.toBuilder(); + } + keyRing_ = input.readMessage(com.google.cloud.kms.v1.KeyRing.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(keyRing_); + keyRing_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateKeyRingRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateKeyRingRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CreateKeyRingRequest.class, com.google.cloud.kms.v1.CreateKeyRingRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KEY_RING_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object keyRingId_; + /** + *
+   * Required. It must be unique within a location and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string key_ring_id = 2; + */ + public java.lang.String getKeyRingId() { + java.lang.Object ref = keyRingId_; + 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(); + keyRingId_ = s; + return s; + } + } + /** + *
+   * Required. It must be unique within a location and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string key_ring_id = 2; + */ + public com.google.protobuf.ByteString + getKeyRingIdBytes() { + java.lang.Object ref = keyRingId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + keyRingId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KEY_RING_FIELD_NUMBER = 3; + private com.google.cloud.kms.v1.KeyRing keyRing_; + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public boolean hasKeyRing() { + return keyRing_ != null; + } + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public com.google.cloud.kms.v1.KeyRing getKeyRing() { + return keyRing_ == null ? com.google.cloud.kms.v1.KeyRing.getDefaultInstance() : keyRing_; + } + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingOrBuilder() { + return getKeyRing(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!getKeyRingIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, keyRingId_); + } + if (keyRing_ != null) { + output.writeMessage(3, getKeyRing()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!getKeyRingIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, keyRingId_); + } + if (keyRing_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getKeyRing()); + } + size += unknownFields.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.CreateKeyRingRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.CreateKeyRingRequest other = (com.google.cloud.kms.v1.CreateKeyRingRequest) obj; + + boolean result = true; + result = result && getParent() + .equals(other.getParent()); + result = result && getKeyRingId() + .equals(other.getKeyRingId()); + result = result && (hasKeyRing() == other.hasKeyRing()); + if (hasKeyRing()) { + result = result && getKeyRing() + .equals(other.getKeyRing()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + KEY_RING_ID_FIELD_NUMBER; + hash = (53 * hash) + getKeyRingId().hashCode(); + if (hasKeyRing()) { + hash = (37 * hash) + KEY_RING_FIELD_NUMBER; + hash = (53 * hash) + getKeyRing().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.CreateKeyRingRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateKeyRingRequest 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.CreateKeyRingRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateKeyRingRequest 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.CreateKeyRingRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CreateKeyRingRequest 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.CreateKeyRingRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CreateKeyRingRequest 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.CreateKeyRingRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CreateKeyRingRequest 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.CreateKeyRingRequest 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.CreateKeyRingRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.CreateKeyRingRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CreateKeyRingRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.CreateKeyRingRequest) + com.google.cloud.kms.v1.CreateKeyRingRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateKeyRingRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateKeyRingRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CreateKeyRingRequest.class, com.google.cloud.kms.v1.CreateKeyRingRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.CreateKeyRingRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + parent_ = ""; + + keyRingId_ = ""; + + if (keyRingBuilder_ == null) { + keyRing_ = null; + } else { + keyRing_ = null; + keyRingBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_CreateKeyRingRequest_descriptor; + } + + public com.google.cloud.kms.v1.CreateKeyRingRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.CreateKeyRingRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.CreateKeyRingRequest build() { + com.google.cloud.kms.v1.CreateKeyRingRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.CreateKeyRingRequest buildPartial() { + com.google.cloud.kms.v1.CreateKeyRingRequest result = new com.google.cloud.kms.v1.CreateKeyRingRequest(this); + result.parent_ = parent_; + result.keyRingId_ = keyRingId_; + if (keyRingBuilder_ == null) { + result.keyRing_ = keyRing_; + } else { + result.keyRing_ = keyRingBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.CreateKeyRingRequest) { + return mergeFrom((com.google.cloud.kms.v1.CreateKeyRingRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.CreateKeyRingRequest other) { + if (other == com.google.cloud.kms.v1.CreateKeyRingRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getKeyRingId().isEmpty()) { + keyRingId_ = other.keyRingId_; + onChanged(); + } + if (other.hasKeyRing()) { + mergeKeyRing(other.getKeyRing()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.CreateKeyRingRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.CreateKeyRingRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object keyRingId_ = ""; + /** + *
+     * Required. It must be unique within a location and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string key_ring_id = 2; + */ + public java.lang.String getKeyRingId() { + java.lang.Object ref = keyRingId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyRingId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. It must be unique within a location and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string key_ring_id = 2; + */ + public com.google.protobuf.ByteString + getKeyRingIdBytes() { + java.lang.Object ref = keyRingId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + keyRingId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. It must be unique within a location and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string key_ring_id = 2; + */ + public Builder setKeyRingId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + keyRingId_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. It must be unique within a location and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string key_ring_id = 2; + */ + public Builder clearKeyRingId() { + + keyRingId_ = getDefaultInstance().getKeyRingId(); + onChanged(); + return this; + } + /** + *
+     * Required. It must be unique within a location and match the regular
+     * expression `[a-zA-Z0-9_-]{1,63}`
+     * 
+ * + * string key_ring_id = 2; + */ + public Builder setKeyRingIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + keyRingId_ = value; + onChanged(); + return this; + } + + private com.google.cloud.kms.v1.KeyRing keyRing_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.KeyRing, com.google.cloud.kms.v1.KeyRing.Builder, com.google.cloud.kms.v1.KeyRingOrBuilder> keyRingBuilder_; + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public boolean hasKeyRing() { + return keyRingBuilder_ != null || keyRing_ != null; + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public com.google.cloud.kms.v1.KeyRing getKeyRing() { + if (keyRingBuilder_ == null) { + return keyRing_ == null ? com.google.cloud.kms.v1.KeyRing.getDefaultInstance() : keyRing_; + } else { + return keyRingBuilder_.getMessage(); + } + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public Builder setKeyRing(com.google.cloud.kms.v1.KeyRing value) { + if (keyRingBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + keyRing_ = value; + onChanged(); + } else { + keyRingBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public Builder setKeyRing( + com.google.cloud.kms.v1.KeyRing.Builder builderForValue) { + if (keyRingBuilder_ == null) { + keyRing_ = builderForValue.build(); + onChanged(); + } else { + keyRingBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public Builder mergeKeyRing(com.google.cloud.kms.v1.KeyRing value) { + if (keyRingBuilder_ == null) { + if (keyRing_ != null) { + keyRing_ = + com.google.cloud.kms.v1.KeyRing.newBuilder(keyRing_).mergeFrom(value).buildPartial(); + } else { + keyRing_ = value; + } + onChanged(); + } else { + keyRingBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public Builder clearKeyRing() { + if (keyRingBuilder_ == null) { + keyRing_ = null; + onChanged(); + } else { + keyRing_ = null; + keyRingBuilder_ = null; + } + + return this; + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public com.google.cloud.kms.v1.KeyRing.Builder getKeyRingBuilder() { + + onChanged(); + return getKeyRingFieldBuilder().getBuilder(); + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + public com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingOrBuilder() { + if (keyRingBuilder_ != null) { + return keyRingBuilder_.getMessageOrBuilder(); + } else { + return keyRing_ == null ? + com.google.cloud.kms.v1.KeyRing.getDefaultInstance() : keyRing_; + } + } + /** + *
+     * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+     * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.KeyRing, com.google.cloud.kms.v1.KeyRing.Builder, com.google.cloud.kms.v1.KeyRingOrBuilder> + getKeyRingFieldBuilder() { + if (keyRingBuilder_ == null) { + keyRingBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.KeyRing, com.google.cloud.kms.v1.KeyRing.Builder, com.google.cloud.kms.v1.KeyRingOrBuilder>( + getKeyRing(), + getParentForChildren(), + isClean()); + keyRing_ = null; + } + return keyRingBuilder_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.CreateKeyRingRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.CreateKeyRingRequest) + private static final com.google.cloud.kms.v1.CreateKeyRingRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.CreateKeyRingRequest(); + } + + public static com.google.cloud.kms.v1.CreateKeyRingRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public CreateKeyRingRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateKeyRingRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.CreateKeyRingRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateKeyRingRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateKeyRingRequestOrBuilder.java new file mode 100644 index 000000000000..8585834231ae --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CreateKeyRingRequestOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface CreateKeyRingRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.CreateKeyRingRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + java.lang.String getParent(); + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * Required. It must be unique within a location and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string key_ring_id = 2; + */ + java.lang.String getKeyRingId(); + /** + *
+   * Required. It must be unique within a location and match the regular
+   * expression `[a-zA-Z0-9_-]{1,63}`
+   * 
+ * + * string key_ring_id = 2; + */ + com.google.protobuf.ByteString + getKeyRingIdBytes(); + + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + boolean hasKeyRing(); + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + com.google.cloud.kms.v1.KeyRing getKeyRing(); + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.
+   * 
+ * + * .google.cloud.kms.v1.KeyRing key_ring = 3; + */ + com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKey.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKey.java new file mode 100644 index 000000000000..a578652fdb9d --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKey.java @@ -0,0 +1,2290 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that can be used for cryptographic
+ * operations.
+ * A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of one or more [versions][google.cloud.kms.v1.CryptoKeyVersion], which
+ * represent the actual key material used in cryptographic operations.
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CryptoKey} + */ +public final class CryptoKey extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.CryptoKey) + CryptoKeyOrBuilder { +private static final long serialVersionUID = 0L; + // Use CryptoKey.newBuilder() to construct. + private CryptoKey(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CryptoKey() { + name_ = ""; + purpose_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CryptoKey( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: { + com.google.cloud.kms.v1.CryptoKeyVersion.Builder subBuilder = null; + if (primary_ != null) { + subBuilder = primary_.toBuilder(); + } + primary_ = input.readMessage(com.google.cloud.kms.v1.CryptoKeyVersion.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(primary_); + primary_ = subBuilder.buildPartial(); + } + + break; + } + case 24: { + int rawValue = input.readEnum(); + + purpose_ = rawValue; + break; + } + case 42: { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 58: { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (nextRotationTime_ != null) { + subBuilder = nextRotationTime_.toBuilder(); + } + nextRotationTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(nextRotationTime_); + nextRotationTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: { + com.google.protobuf.Duration.Builder subBuilder = null; + if (rotationScheduleCase_ == 8) { + subBuilder = ((com.google.protobuf.Duration) rotationSchedule_).toBuilder(); + } + rotationSchedule_ = + input.readMessage(com.google.protobuf.Duration.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.protobuf.Duration) rotationSchedule_); + rotationSchedule_ = subBuilder.buildPartial(); + } + rotationScheduleCase_ = 8; + break; + } + case 82: { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + labels_ = com.google.protobuf.MapField.newMapField( + LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000040; + } + com.google.protobuf.MapEntry + labels__ = input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put( + labels__.getKey(), labels__.getValue()); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKey_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 10: + return internalGetLabels(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CryptoKey.class, com.google.cloud.kms.v1.CryptoKey.Builder.class); + } + + /** + *
+   * [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] describes the capabilities of a [CryptoKey][google.cloud.kms.v1.CryptoKey]. Two
+   * keys with the same purpose may use different underlying algorithms, but
+   * must support the same set of operations.
+   * 
+ * + * Protobuf enum {@code google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose} + */ + public enum CryptoKeyPurpose + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
+     * Not specified.
+     * 
+ * + * CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + */ + CRYPTO_KEY_PURPOSE_UNSPECIFIED(0), + /** + *
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
+     * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
+     * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+     * 
+ * + * ENCRYPT_DECRYPT = 1; + */ + ENCRYPT_DECRYPT(1), + UNRECOGNIZED(-1), + ; + + /** + *
+     * Not specified.
+     * 
+ * + * CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + */ + public static final int CRYPTO_KEY_PURPOSE_UNSPECIFIED_VALUE = 0; + /** + *
+     * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
+     * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
+     * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+     * 
+ * + * ENCRYPT_DECRYPT = 1; + */ + public static final int ENCRYPT_DECRYPT_VALUE = 1; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CryptoKeyPurpose valueOf(int value) { + return forNumber(value); + } + + public static CryptoKeyPurpose forNumber(int value) { + switch (value) { + case 0: return CRYPTO_KEY_PURPOSE_UNSPECIFIED; + case 1: return ENCRYPT_DECRYPT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + CryptoKeyPurpose> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CryptoKeyPurpose findValueByNumber(int number) { + return CryptoKeyPurpose.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + 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.CryptoKey.getDescriptor().getEnumTypes().get(0); + } + + private static final CryptoKeyPurpose[] VALUES = values(); + + public static CryptoKeyPurpose 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 CryptoKeyPurpose(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose) + } + + private int bitField0_; + private int rotationScheduleCase_ = 0; + private java.lang.Object rotationSchedule_; + public enum RotationScheduleCase + implements com.google.protobuf.Internal.EnumLite { + ROTATION_PERIOD(8), + ROTATIONSCHEDULE_NOT_SET(0); + private final int value; + private RotationScheduleCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RotationScheduleCase valueOf(int value) { + return forNumber(value); + } + + public static RotationScheduleCase forNumber(int value) { + switch (value) { + case 8: return ROTATION_PERIOD; + case 0: return ROTATIONSCHEDULE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public RotationScheduleCase + getRotationScheduleCase() { + return RotationScheduleCase.forNumber( + rotationScheduleCase_); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string name = 1; + */ + 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 this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string name = 1; + */ + 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 PRIMARY_FIELD_NUMBER = 2; + private com.google.cloud.kms.v1.CryptoKeyVersion primary_; + /** + *
+   * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+   * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+   * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+   * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public boolean hasPrimary() { + return primary_ != null; + } + /** + *
+   * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+   * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+   * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+   * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getPrimary() { + return primary_ == null ? com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : primary_; + } + /** + *
+   * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+   * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+   * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+   * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getPrimaryOrBuilder() { + return getPrimary(); + } + + public static final int PURPOSE_FIELD_NUMBER = 3; + private int purpose_; + /** + *
+   * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+   * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public int getPurposeValue() { + return purpose_; + } + /** + *
+   * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+   * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose getPurpose() { + com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose result = com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.valueOf(purpose_); + return result == null ? com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp createTime_; + /** + *
+   * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + *
+   * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + *
+   * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int NEXT_ROTATION_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp nextRotationTime_; + /** + *
+   * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+   * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+   * 2. Mark the new version as primary.
+   * Key rotations performed manually via
+   * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+   * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+   * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public boolean hasNextRotationTime() { + return nextRotationTime_ != null; + } + /** + *
+   * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+   * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+   * 2. Mark the new version as primary.
+   * Key rotations performed manually via
+   * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+   * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+   * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public com.google.protobuf.Timestamp getNextRotationTime() { + return nextRotationTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : nextRotationTime_; + } + /** + *
+   * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+   * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+   * 2. Mark the new version as primary.
+   * Key rotations performed manually via
+   * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+   * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+   * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public com.google.protobuf.TimestampOrBuilder getNextRotationTimeOrBuilder() { + return getNextRotationTime(); + } + + public static final int ROTATION_PERIOD_FIELD_NUMBER = 8; + /** + *
+   * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+   * automatically rotates a key. Must be at least one day.
+   * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+   * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public boolean hasRotationPeriod() { + return rotationScheduleCase_ == 8; + } + /** + *
+   * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+   * automatically rotates a key. Must be at least one day.
+   * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+   * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public com.google.protobuf.Duration getRotationPeriod() { + if (rotationScheduleCase_ == 8) { + return (com.google.protobuf.Duration) rotationSchedule_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + /** + *
+   * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+   * automatically rotates a key. Must be at least one day.
+   * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+   * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public com.google.protobuf.DurationOrBuilder getRotationPeriodOrBuilder() { + if (rotationScheduleCase_ == 8) { + return (com.google.protobuf.Duration) rotationSchedule_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + + public static final int LABELS_FIELD_NUMBER = 10; + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKey_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> labels_; + private com.google.protobuf.MapField + internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField( + LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + + public boolean containsLabels( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetLabels().getMap().containsKey(key); + } + /** + * Use {@link #getLabelsMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + + public java.lang.String getLabelsOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + + public java.lang.String getLabelsOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (primary_ != null) { + output.writeMessage(2, getPrimary()); + } + if (purpose_ != com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.CRYPTO_KEY_PURPOSE_UNSPECIFIED.getNumber()) { + output.writeEnum(3, purpose_); + } + if (createTime_ != null) { + output.writeMessage(5, getCreateTime()); + } + if (nextRotationTime_ != null) { + output.writeMessage(7, getNextRotationTime()); + } + if (rotationScheduleCase_ == 8) { + output.writeMessage(8, (com.google.protobuf.Duration) rotationSchedule_); + } + com.google.protobuf.GeneratedMessageV3 + .serializeStringMapTo( + output, + internalGetLabels(), + LabelsDefaultEntryHolder.defaultEntry, + 10); + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (primary_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getPrimary()); + } + if (purpose_ != com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.CRYPTO_KEY_PURPOSE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, purpose_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getCreateTime()); + } + if (nextRotationTime_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getNextRotationTime()); + } + if (rotationScheduleCase_ == 8) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, (com.google.protobuf.Duration) rotationSchedule_); + } + for (java.util.Map.Entry entry + : internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry + labels__ = LabelsDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(10, labels__); + } + size += unknownFields.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.CryptoKey)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.CryptoKey other = (com.google.cloud.kms.v1.CryptoKey) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && (hasPrimary() == other.hasPrimary()); + if (hasPrimary()) { + result = result && getPrimary() + .equals(other.getPrimary()); + } + result = result && purpose_ == other.purpose_; + result = result && (hasCreateTime() == other.hasCreateTime()); + if (hasCreateTime()) { + result = result && getCreateTime() + .equals(other.getCreateTime()); + } + result = result && (hasNextRotationTime() == other.hasNextRotationTime()); + if (hasNextRotationTime()) { + result = result && getNextRotationTime() + .equals(other.getNextRotationTime()); + } + result = result && internalGetLabels().equals( + other.internalGetLabels()); + result = result && getRotationScheduleCase().equals( + other.getRotationScheduleCase()); + if (!result) return false; + switch (rotationScheduleCase_) { + case 8: + result = result && getRotationPeriod() + .equals(other.getRotationPeriod()); + break; + case 0: + default: + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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(); + if (hasPrimary()) { + hash = (37 * hash) + PRIMARY_FIELD_NUMBER; + hash = (53 * hash) + getPrimary().hashCode(); + } + hash = (37 * hash) + PURPOSE_FIELD_NUMBER; + hash = (53 * hash) + purpose_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasNextRotationTime()) { + hash = (37 * hash) + NEXT_ROTATION_TIME_FIELD_NUMBER; + hash = (53 * hash) + getNextRotationTime().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + switch (rotationScheduleCase_) { + case 8: + hash = (37 * hash) + ROTATION_PERIOD_FIELD_NUMBER; + hash = (53 * hash) + getRotationPeriod().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.CryptoKey parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CryptoKey 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.CryptoKey parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CryptoKey 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.CryptoKey parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CryptoKey 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.CryptoKey parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CryptoKey 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.CryptoKey parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CryptoKey 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.CryptoKey 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.CryptoKey parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.CryptoKey prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that can be used for cryptographic
+   * operations.
+   * A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of one or more [versions][google.cloud.kms.v1.CryptoKeyVersion], which
+   * represent the actual key material used in cryptographic operations.
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CryptoKey} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.CryptoKey) + com.google.cloud.kms.v1.CryptoKeyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKey_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 10: + return internalGetLabels(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 10: + return internalGetMutableLabels(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKey_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CryptoKey.class, com.google.cloud.kms.v1.CryptoKey.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.CryptoKey.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + if (primaryBuilder_ == null) { + primary_ = null; + } else { + primary_ = null; + primaryBuilder_ = null; + } + purpose_ = 0; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (nextRotationTimeBuilder_ == null) { + nextRotationTime_ = null; + } else { + nextRotationTime_ = null; + nextRotationTimeBuilder_ = null; + } + internalGetMutableLabels().clear(); + rotationScheduleCase_ = 0; + rotationSchedule_ = null; + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKey_descriptor; + } + + public com.google.cloud.kms.v1.CryptoKey getDefaultInstanceForType() { + return com.google.cloud.kms.v1.CryptoKey.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.CryptoKey build() { + com.google.cloud.kms.v1.CryptoKey result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.CryptoKey buildPartial() { + com.google.cloud.kms.v1.CryptoKey result = new com.google.cloud.kms.v1.CryptoKey(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.name_ = name_; + if (primaryBuilder_ == null) { + result.primary_ = primary_; + } else { + result.primary_ = primaryBuilder_.build(); + } + result.purpose_ = purpose_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (nextRotationTimeBuilder_ == null) { + result.nextRotationTime_ = nextRotationTime_; + } else { + result.nextRotationTime_ = nextRotationTimeBuilder_.build(); + } + if (rotationScheduleCase_ == 8) { + if (rotationPeriodBuilder_ == null) { + result.rotationSchedule_ = rotationSchedule_; + } else { + result.rotationSchedule_ = rotationPeriodBuilder_.build(); + } + } + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.bitField0_ = to_bitField0_; + result.rotationScheduleCase_ = rotationScheduleCase_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.CryptoKey) { + return mergeFrom((com.google.cloud.kms.v1.CryptoKey)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.CryptoKey other) { + if (other == com.google.cloud.kms.v1.CryptoKey.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasPrimary()) { + mergePrimary(other.getPrimary()); + } + if (other.purpose_ != 0) { + setPurposeValue(other.getPurposeValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasNextRotationTime()) { + mergeNextRotationTime(other.getNextRotationTime()); + } + internalGetMutableLabels().mergeFrom( + other.internalGetLabels()); + switch (other.getRotationScheduleCase()) { + case ROTATION_PERIOD: { + mergeRotationPeriod(other.getRotationPeriod()); + break; + } + case ROTATIONSCHEDULE_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.CryptoKey parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.CryptoKey) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int rotationScheduleCase_ = 0; + private java.lang.Object rotationSchedule_; + public RotationScheduleCase + getRotationScheduleCase() { + return RotationScheduleCase.forNumber( + rotationScheduleCase_); + } + + public Builder clearRotationSchedule() { + rotationScheduleCase_ = 0; + rotationSchedule_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string name = 1; + */ + 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 this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string name = 1; + */ + 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 this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.cloud.kms.v1.CryptoKeyVersion primary_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> primaryBuilder_; + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public boolean hasPrimary() { + return primaryBuilder_ != null || primary_ != null; + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getPrimary() { + if (primaryBuilder_ == null) { + return primary_ == null ? com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : primary_; + } else { + return primaryBuilder_.getMessage(); + } + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public Builder setPrimary(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (primaryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + primary_ = value; + onChanged(); + } else { + primaryBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public Builder setPrimary( + com.google.cloud.kms.v1.CryptoKeyVersion.Builder builderForValue) { + if (primaryBuilder_ == null) { + primary_ = builderForValue.build(); + onChanged(); + } else { + primaryBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public Builder mergePrimary(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (primaryBuilder_ == null) { + if (primary_ != null) { + primary_ = + com.google.cloud.kms.v1.CryptoKeyVersion.newBuilder(primary_).mergeFrom(value).buildPartial(); + } else { + primary_ = value; + } + onChanged(); + } else { + primaryBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public Builder clearPrimary() { + if (primaryBuilder_ == null) { + primary_ = null; + onChanged(); + } else { + primary_ = null; + primaryBuilder_ = null; + } + + return this; + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.Builder getPrimaryBuilder() { + + onChanged(); + return getPrimaryFieldBuilder().getBuilder(); + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getPrimaryOrBuilder() { + if (primaryBuilder_ != null) { + return primaryBuilder_.getMessageOrBuilder(); + } else { + return primary_ == null ? + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : primary_; + } + } + /** + *
+     * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+     * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+     * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+     * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> + getPrimaryFieldBuilder() { + if (primaryBuilder_ == null) { + primaryBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder>( + getPrimary(), + getParentForChildren(), + isClean()); + primary_ = null; + } + return primaryBuilder_; + } + + private int purpose_ = 0; + /** + *
+     * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+     * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public int getPurposeValue() { + return purpose_; + } + /** + *
+     * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+     * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public Builder setPurposeValue(int value) { + purpose_ = value; + onChanged(); + return this; + } + /** + *
+     * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+     * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose getPurpose() { + com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose result = com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.valueOf(purpose_); + return result == null ? com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.UNRECOGNIZED : result; + } + /** + *
+     * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+     * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public Builder setPurpose(com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose value) { + if (value == null) { + throw new NullPointerException(); + } + + purpose_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+     * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + public Builder clearPurpose() { + + purpose_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> createTimeBuilder_; + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder setCreateTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + } + /** + *
+     * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), + getParentForChildren(), + isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp nextRotationTime_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> nextRotationTimeBuilder_; + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public boolean hasNextRotationTime() { + return nextRotationTimeBuilder_ != null || nextRotationTime_ != null; + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public com.google.protobuf.Timestamp getNextRotationTime() { + if (nextRotationTimeBuilder_ == null) { + return nextRotationTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : nextRotationTime_; + } else { + return nextRotationTimeBuilder_.getMessage(); + } + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public Builder setNextRotationTime(com.google.protobuf.Timestamp value) { + if (nextRotationTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + nextRotationTime_ = value; + onChanged(); + } else { + nextRotationTimeBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public Builder setNextRotationTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (nextRotationTimeBuilder_ == null) { + nextRotationTime_ = builderForValue.build(); + onChanged(); + } else { + nextRotationTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public Builder mergeNextRotationTime(com.google.protobuf.Timestamp value) { + if (nextRotationTimeBuilder_ == null) { + if (nextRotationTime_ != null) { + nextRotationTime_ = + com.google.protobuf.Timestamp.newBuilder(nextRotationTime_).mergeFrom(value).buildPartial(); + } else { + nextRotationTime_ = value; + } + onChanged(); + } else { + nextRotationTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public Builder clearNextRotationTime() { + if (nextRotationTimeBuilder_ == null) { + nextRotationTime_ = null; + onChanged(); + } else { + nextRotationTime_ = null; + nextRotationTimeBuilder_ = null; + } + + return this; + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public com.google.protobuf.Timestamp.Builder getNextRotationTimeBuilder() { + + onChanged(); + return getNextRotationTimeFieldBuilder().getBuilder(); + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + public com.google.protobuf.TimestampOrBuilder getNextRotationTimeOrBuilder() { + if (nextRotationTimeBuilder_ != null) { + return nextRotationTimeBuilder_.getMessageOrBuilder(); + } else { + return nextRotationTime_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : nextRotationTime_; + } + } + /** + *
+     * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+     * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+     * 2. Mark the new version as primary.
+     * Key rotations performed manually via
+     * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+     * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+     * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+     * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getNextRotationTimeFieldBuilder() { + if (nextRotationTimeBuilder_ == null) { + nextRotationTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getNextRotationTime(), + getParentForChildren(), + isClean()); + nextRotationTime_ = null; + } + return nextRotationTimeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> rotationPeriodBuilder_; + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public boolean hasRotationPeriod() { + return rotationScheduleCase_ == 8; + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public com.google.protobuf.Duration getRotationPeriod() { + if (rotationPeriodBuilder_ == null) { + if (rotationScheduleCase_ == 8) { + return (com.google.protobuf.Duration) rotationSchedule_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } else { + if (rotationScheduleCase_ == 8) { + return rotationPeriodBuilder_.getMessage(); + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public Builder setRotationPeriod(com.google.protobuf.Duration value) { + if (rotationPeriodBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + rotationSchedule_ = value; + onChanged(); + } else { + rotationPeriodBuilder_.setMessage(value); + } + rotationScheduleCase_ = 8; + return this; + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public Builder setRotationPeriod( + com.google.protobuf.Duration.Builder builderForValue) { + if (rotationPeriodBuilder_ == null) { + rotationSchedule_ = builderForValue.build(); + onChanged(); + } else { + rotationPeriodBuilder_.setMessage(builderForValue.build()); + } + rotationScheduleCase_ = 8; + return this; + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public Builder mergeRotationPeriod(com.google.protobuf.Duration value) { + if (rotationPeriodBuilder_ == null) { + if (rotationScheduleCase_ == 8 && + rotationSchedule_ != com.google.protobuf.Duration.getDefaultInstance()) { + rotationSchedule_ = com.google.protobuf.Duration.newBuilder((com.google.protobuf.Duration) rotationSchedule_) + .mergeFrom(value).buildPartial(); + } else { + rotationSchedule_ = value; + } + onChanged(); + } else { + if (rotationScheduleCase_ == 8) { + rotationPeriodBuilder_.mergeFrom(value); + } + rotationPeriodBuilder_.setMessage(value); + } + rotationScheduleCase_ = 8; + return this; + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public Builder clearRotationPeriod() { + if (rotationPeriodBuilder_ == null) { + if (rotationScheduleCase_ == 8) { + rotationScheduleCase_ = 0; + rotationSchedule_ = null; + onChanged(); + } + } else { + if (rotationScheduleCase_ == 8) { + rotationScheduleCase_ = 0; + rotationSchedule_ = null; + } + rotationPeriodBuilder_.clear(); + } + return this; + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public com.google.protobuf.Duration.Builder getRotationPeriodBuilder() { + return getRotationPeriodFieldBuilder().getBuilder(); + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + public com.google.protobuf.DurationOrBuilder getRotationPeriodOrBuilder() { + if ((rotationScheduleCase_ == 8) && (rotationPeriodBuilder_ != null)) { + return rotationPeriodBuilder_.getMessageOrBuilder(); + } else { + if (rotationScheduleCase_ == 8) { + return (com.google.protobuf.Duration) rotationSchedule_; + } + return com.google.protobuf.Duration.getDefaultInstance(); + } + } + /** + *
+     * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+     * automatically rotates a key. Must be at least one day.
+     * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+     * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder> + getRotationPeriodFieldBuilder() { + if (rotationPeriodBuilder_ == null) { + if (!(rotationScheduleCase_ == 8)) { + rotationSchedule_ = com.google.protobuf.Duration.getDefaultInstance(); + } + rotationPeriodBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( + (com.google.protobuf.Duration) rotationSchedule_, + getParentForChildren(), + isClean()); + rotationSchedule_ = null; + } + rotationScheduleCase_ = 8; + onChanged();; + return rotationPeriodBuilder_; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> labels_; + private com.google.protobuf.MapField + internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField( + LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged();; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField( + LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + + public boolean containsLabels( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + return internalGetLabels().getMap().containsKey(key); + } + /** + * Use {@link #getLabelsMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + + public java.lang.String getLabelsOrDefault( + java.lang.String key, + java.lang.String defaultValue) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + + public java.lang.String getLabelsOrThrow( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + java.util.Map map = + internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap() + .clear(); + return this; + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + + public Builder removeLabels( + java.lang.String key) { + if (key == null) { throw new java.lang.NullPointerException(); } + internalGetMutableLabels().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + public Builder putLabels( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new java.lang.NullPointerException(); } + if (value == null) { throw new java.lang.NullPointerException(); } + internalGetMutableLabels().getMutableMap() + .put(key, value); + return this; + } + /** + *
+     * Labels with user-defined metadata. For more information, see
+     * [Labeling Keys](/kms/docs/labeling-keys).
+     * 
+ * + * map<string, string> labels = 10; + */ + + public Builder putAllLabels( + java.util.Map values) { + internalGetMutableLabels().getMutableMap() + .putAll(values); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.CryptoKey) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.CryptoKey) + private static final com.google.cloud.kms.v1.CryptoKey DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.CryptoKey(); + } + + public static com.google.cloud.kms.v1.CryptoKey getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public CryptoKey parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CryptoKey(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.CryptoKey getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyName.java new file mode 100644 index 000000000000..a14cce8fde1f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyName.java @@ -0,0 +1,235 @@ +/* + * Copyright 2018 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 + * + * http://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.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class CryptoKeyName extends KeyName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + private final String keyRing; + private final String cryptoKey; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKey() { + return cryptoKey; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private CryptoKeyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + keyRing = Preconditions.checkNotNull(builder.getKeyRing()); + cryptoKey = Preconditions.checkNotNull(builder.getCryptoKey()); + } + + public static CryptoKeyName of(String project, String location, String keyRing, String cryptoKey) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKey(cryptoKey) + .build(); + } + + public static String format(String project, String location, String keyRing, String cryptoKey) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKey(cryptoKey) + .build() + .toString(); + } + + public static CryptoKeyName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "CryptoKeyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("key_ring"), matchMap.get("crypto_key")); + } + + 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 (CryptoKeyName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldMapBuilder.put("keyRing", keyRing); + fieldMapBuilder.put("cryptoKey", cryptoKey); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "location", location, "key_ring", keyRing, "crypto_key", cryptoKey); + } + + /** Builder for CryptoKeyName. */ + public static class Builder { + + private String project; + private String location; + private String keyRing; + private String cryptoKey; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKey() { + return cryptoKey; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setKeyRing(String keyRing) { + this.keyRing = keyRing; + return this; + } + + public Builder setCryptoKey(String cryptoKey) { + this.cryptoKey = cryptoKey; + return this; + } + + private Builder() { + } + + private Builder(CryptoKeyName cryptoKeyName) { + project = cryptoKeyName.project; + location = cryptoKeyName.location; + keyRing = cryptoKeyName.keyRing; + cryptoKey = cryptoKeyName.cryptoKey; + } + + public CryptoKeyName build() { + return new CryptoKeyName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CryptoKeyName) { + CryptoKeyName that = (CryptoKeyName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)) + && (this.keyRing.equals(that.keyRing)) + && (this.cryptoKey.equals(that.cryptoKey)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + h *= 1000003; + h ^= keyRing.hashCode(); + h *= 1000003; + h ^= cryptoKey.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyOrBuilder.java new file mode 100644 index 000000000000..7af24d0cdfee --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyOrBuilder.java @@ -0,0 +1,245 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +public interface CryptoKeyOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.CryptoKey) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+   * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+   * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+   * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + boolean hasPrimary(); + /** + *
+   * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+   * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+   * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+   * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + com.google.cloud.kms.v1.CryptoKeyVersion getPrimary(); + /** + *
+   * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
+   * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given
+   * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
+   * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion primary = 2; + */ + com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getPrimaryOrBuilder(); + + /** + *
+   * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+   * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + int getPurposeValue(); + /** + *
+   * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable
+   * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3; + */ + com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose getPurpose(); + + /** + *
+   * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + boolean hasCreateTime(); + /** + *
+   * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + *
+   * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + *
+   * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+   * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+   * 2. Mark the new version as primary.
+   * Key rotations performed manually via
+   * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+   * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+   * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + boolean hasNextRotationTime(); + /** + *
+   * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+   * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+   * 2. Mark the new version as primary.
+   * Key rotations performed manually via
+   * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+   * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+   * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + com.google.protobuf.Timestamp getNextRotationTime(); + /** + *
+   * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically:
+   * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
+   * 2. Mark the new version as primary.
+   * Key rotations performed manually via
+   * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and
+   * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
+   * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
+   * 
+ * + * .google.protobuf.Timestamp next_rotation_time = 7; + */ + com.google.protobuf.TimestampOrBuilder getNextRotationTimeOrBuilder(); + + /** + *
+   * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+   * automatically rotates a key. Must be at least one day.
+   * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+   * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + boolean hasRotationPeriod(); + /** + *
+   * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+   * automatically rotates a key. Must be at least one day.
+   * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+   * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + com.google.protobuf.Duration getRotationPeriod(); + /** + *
+   * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service
+   * automatically rotates a key. Must be at least one day.
+   * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set.
+   * 
+ * + * .google.protobuf.Duration rotation_period = 8; + */ + com.google.protobuf.DurationOrBuilder getRotationPeriodOrBuilder(); + + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + int getLabelsCount(); + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + boolean containsLabels( + java.lang.String key); + /** + * Use {@link #getLabelsMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getLabels(); + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + java.util.Map + getLabelsMap(); + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + + java.lang.String getLabelsOrDefault( + java.lang.String key, + java.lang.String defaultValue); + /** + *
+   * Labels with user-defined metadata. For more information, see
+   * [Labeling Keys](/kms/docs/labeling-keys).
+   * 
+ * + * map<string, string> labels = 10; + */ + + java.lang.String getLabelsOrThrow( + java.lang.String key); + + public com.google.cloud.kms.v1.CryptoKey.RotationScheduleCase getRotationScheduleCase(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyPathName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyPathName.java new file mode 100644 index 000000000000..fbc51e1779e3 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyPathName.java @@ -0,0 +1,235 @@ +/* + * Copyright 2018 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 + * + * http://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.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class CryptoKeyPathName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key_path=**}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + private final String keyRing; + private final String cryptoKeyPath; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKeyPath() { + return cryptoKeyPath; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private CryptoKeyPathName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + keyRing = Preconditions.checkNotNull(builder.getKeyRing()); + cryptoKeyPath = Preconditions.checkNotNull(builder.getCryptoKeyPath()); + } + + public static CryptoKeyPathName of(String project, String location, String keyRing, String cryptoKeyPath) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKeyPath(cryptoKeyPath) + .build(); + } + + public static String format(String project, String location, String keyRing, String cryptoKeyPath) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKeyPath(cryptoKeyPath) + .build() + .toString(); + } + + public static CryptoKeyPathName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "CryptoKeyPathName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("key_ring"), matchMap.get("crypto_key_path")); + } + + 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 (CryptoKeyPathName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldMapBuilder.put("keyRing", keyRing); + fieldMapBuilder.put("cryptoKeyPath", cryptoKeyPath); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "location", location, "key_ring", keyRing, "crypto_key_path", cryptoKeyPath); + } + + /** Builder for CryptoKeyPathName. */ + public static class Builder { + + private String project; + private String location; + private String keyRing; + private String cryptoKeyPath; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKeyPath() { + return cryptoKeyPath; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setKeyRing(String keyRing) { + this.keyRing = keyRing; + return this; + } + + public Builder setCryptoKeyPath(String cryptoKeyPath) { + this.cryptoKeyPath = cryptoKeyPath; + return this; + } + + private Builder() { + } + + private Builder(CryptoKeyPathName cryptoKeyPathName) { + project = cryptoKeyPathName.project; + location = cryptoKeyPathName.location; + keyRing = cryptoKeyPathName.keyRing; + cryptoKeyPath = cryptoKeyPathName.cryptoKeyPath; + } + + public CryptoKeyPathName build() { + return new CryptoKeyPathName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CryptoKeyPathName) { + CryptoKeyPathName that = (CryptoKeyPathName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)) + && (this.keyRing.equals(that.keyRing)) + && (this.cryptoKeyPath.equals(that.cryptoKeyPath)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + h *= 1000003; + h ^= keyRing.hashCode(); + h *= 1000003; + h ^= cryptoKeyPath.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java new file mode 100644 index 000000000000..494668745560 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersion.java @@ -0,0 +1,1602 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an individual cryptographic key, and the
+ * associated key material.
+ * It can be used for cryptographic operations either directly, or via its
+ * parent [CryptoKey][google.cloud.kms.v1.CryptoKey], in which case the server will choose the appropriate
+ * version for the operation.
+ * For security reasons, the raw cryptographic key material represented by a
+ * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed or exported. It can only be used to
+ * encrypt or decrypt data when an authorized user or application invokes Cloud
+ * KMS.
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CryptoKeyVersion} + */ +public final class CryptoKeyVersion extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.CryptoKeyVersion) + CryptoKeyVersionOrBuilder { +private static final long serialVersionUID = 0L; + // Use CryptoKeyVersion.newBuilder() to construct. + private CryptoKeyVersion(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private CryptoKeyVersion() { + name_ = ""; + state_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private CryptoKeyVersion( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 24: { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + case 34: { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 42: { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (destroyTime_ != null) { + subBuilder = destroyTime_.toBuilder(); + } + destroyTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(destroyTime_); + destroyTime_ = subBuilder.buildPartial(); + } + + break; + } + case 50: { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (destroyEventTime_ != null) { + subBuilder = destroyEventTime_.toBuilder(); + } + destroyEventTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(destroyEventTime_); + destroyEventTime_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKeyVersion_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKeyVersion_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CryptoKeyVersion.class, com.google.cloud.kms.v1.CryptoKeyVersion.Builder.class); + } + + /** + *
+   * The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating if it can be used.
+   * 
+ * + * Protobuf enum {@code google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState} + */ + public enum CryptoKeyVersionState + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
+     * Not specified.
+     * 
+ * + * CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + */ + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED(0), + /** + *
+     * This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
+     * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests.
+     * 
+ * + * ENABLED = 1; + */ + ENABLED(1), + /** + *
+     * This version may not be used, but the key material is still available,
+     * and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state.
+     * 
+ * + * DISABLED = 2; + */ + DISABLED(2), + /** + *
+     * This version is destroyed, and the key material is no longer stored.
+     * A version may not leave this state once entered.
+     * 
+ * + * DESTROYED = 3; + */ + DESTROYED(3), + /** + *
+     * This version is scheduled for destruction, and will be destroyed soon.
+     * Call
+     * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
+     * to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state.
+     * 
+ * + * DESTROY_SCHEDULED = 4; + */ + DESTROY_SCHEDULED(4), + UNRECOGNIZED(-1), + ; + + /** + *
+     * Not specified.
+     * 
+ * + * CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + */ + public static final int CRYPTO_KEY_VERSION_STATE_UNSPECIFIED_VALUE = 0; + /** + *
+     * This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
+     * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests.
+     * 
+ * + * ENABLED = 1; + */ + public static final int ENABLED_VALUE = 1; + /** + *
+     * This version may not be used, but the key material is still available,
+     * and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state.
+     * 
+ * + * DISABLED = 2; + */ + public static final int DISABLED_VALUE = 2; + /** + *
+     * This version is destroyed, and the key material is no longer stored.
+     * A version may not leave this state once entered.
+     * 
+ * + * DESTROYED = 3; + */ + public static final int DESTROYED_VALUE = 3; + /** + *
+     * This version is scheduled for destruction, and will be destroyed soon.
+     * Call
+     * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
+     * to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state.
+     * 
+ * + * DESTROY_SCHEDULED = 4; + */ + public static final int DESTROY_SCHEDULED_VALUE = 4; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CryptoKeyVersionState valueOf(int value) { + return forNumber(value); + } + + public static CryptoKeyVersionState forNumber(int value) { + switch (value) { + case 0: return CRYPTO_KEY_VERSION_STATE_UNSPECIFIED; + case 1: return ENABLED; + case 2: return DISABLED; + case 3: return DESTROYED; + case 4: return DESTROY_SCHEDULED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + CryptoKeyVersionState> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CryptoKeyVersionState findValueByNumber(int number) { + return CryptoKeyVersionState.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + 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.CryptoKeyVersion.getDescriptor().getEnumTypes().get(0); + } + + private static final CryptoKeyVersionState[] VALUES = values(); + + public static CryptoKeyVersionState 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 CryptoKeyVersionState(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState) + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+   * 
+ * + * string name = 1; + */ + 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 this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+   * 
+ * + * string name = 1; + */ + 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 STATE_FIELD_NUMBER = 3; + private int state_; + /** + *
+   * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public int getStateValue() { + return state_; + } + /** + *
+   * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState getState() { + com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState result = com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.valueOf(state_); + return result == null ? com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.UNRECOGNIZED : result; + } + + public static final int CREATE_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp createTime_; + /** + *
+   * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + *
+   * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + *
+   * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int DESTROY_TIME_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp destroyTime_; + /** + *
+   * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+   * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public boolean hasDestroyTime() { + return destroyTime_ != null; + } + /** + *
+   * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+   * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public com.google.protobuf.Timestamp getDestroyTime() { + return destroyTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : destroyTime_; + } + /** + *
+   * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+   * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getDestroyTimeOrBuilder() { + return getDestroyTime(); + } + + public static final int DESTROY_EVENT_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp destroyEventTime_; + /** + *
+   * Output only. The time this CryptoKeyVersion's key material was
+   * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public boolean hasDestroyEventTime() { + return destroyEventTime_ != null; + } + /** + *
+   * Output only. The time this CryptoKeyVersion's key material was
+   * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public com.google.protobuf.Timestamp getDestroyEventTime() { + return destroyEventTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : destroyEventTime_; + } + /** + *
+   * Output only. The time this CryptoKeyVersion's key material was
+   * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public com.google.protobuf.TimestampOrBuilder getDestroyEventTimeOrBuilder() { + return getDestroyEventTime(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (state_ != com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.CRYPTO_KEY_VERSION_STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(3, state_); + } + if (createTime_ != null) { + output.writeMessage(4, getCreateTime()); + } + if (destroyTime_ != null) { + output.writeMessage(5, getDestroyTime()); + } + if (destroyEventTime_ != null) { + output.writeMessage(6, getDestroyEventTime()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (state_ != com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.CRYPTO_KEY_VERSION_STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, state_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getCreateTime()); + } + if (destroyTime_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getDestroyTime()); + } + if (destroyEventTime_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getDestroyEventTime()); + } + size += unknownFields.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.CryptoKeyVersion)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.CryptoKeyVersion other = (com.google.cloud.kms.v1.CryptoKeyVersion) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && state_ == other.state_; + result = result && (hasCreateTime() == other.hasCreateTime()); + if (hasCreateTime()) { + result = result && getCreateTime() + .equals(other.getCreateTime()); + } + result = result && (hasDestroyTime() == other.hasDestroyTime()); + if (hasDestroyTime()) { + result = result && getDestroyTime() + .equals(other.getDestroyTime()); + } + result = result && (hasDestroyEventTime() == other.hasDestroyEventTime()); + if (hasDestroyEventTime()) { + result = result && getDestroyEventTime() + .equals(other.getDestroyEventTime()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasDestroyTime()) { + hash = (37 * hash) + DESTROY_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDestroyTime().hashCode(); + } + if (hasDestroyEventTime()) { + hash = (37 * hash) + DESTROY_EVENT_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDestroyEventTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.CryptoKeyVersion parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CryptoKeyVersion 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.CryptoKeyVersion parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CryptoKeyVersion 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.CryptoKeyVersion parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.CryptoKeyVersion 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.CryptoKeyVersion parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CryptoKeyVersion 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.CryptoKeyVersion parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.CryptoKeyVersion 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.CryptoKeyVersion 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.CryptoKeyVersion parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.CryptoKeyVersion prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an individual cryptographic key, and the
+   * associated key material.
+   * It can be used for cryptographic operations either directly, or via its
+   * parent [CryptoKey][google.cloud.kms.v1.CryptoKey], in which case the server will choose the appropriate
+   * version for the operation.
+   * For security reasons, the raw cryptographic key material represented by a
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed or exported. It can only be used to
+   * encrypt or decrypt data when an authorized user or application invokes Cloud
+   * KMS.
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.CryptoKeyVersion} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.CryptoKeyVersion) + com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKeyVersion_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKeyVersion_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.CryptoKeyVersion.class, com.google.cloud.kms.v1.CryptoKeyVersion.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.CryptoKeyVersion.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + state_ = 0; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (destroyTimeBuilder_ == null) { + destroyTime_ = null; + } else { + destroyTime_ = null; + destroyTimeBuilder_ = null; + } + if (destroyEventTimeBuilder_ == null) { + destroyEventTime_ = null; + } else { + destroyEventTime_ = null; + destroyEventTimeBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_CryptoKeyVersion_descriptor; + } + + public com.google.cloud.kms.v1.CryptoKeyVersion getDefaultInstanceForType() { + return com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.CryptoKeyVersion build() { + com.google.cloud.kms.v1.CryptoKeyVersion result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.CryptoKeyVersion buildPartial() { + com.google.cloud.kms.v1.CryptoKeyVersion result = new com.google.cloud.kms.v1.CryptoKeyVersion(this); + result.name_ = name_; + result.state_ = state_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (destroyTimeBuilder_ == null) { + result.destroyTime_ = destroyTime_; + } else { + result.destroyTime_ = destroyTimeBuilder_.build(); + } + if (destroyEventTimeBuilder_ == null) { + result.destroyEventTime_ = destroyEventTime_; + } else { + result.destroyEventTime_ = destroyEventTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.CryptoKeyVersion) { + return mergeFrom((com.google.cloud.kms.v1.CryptoKeyVersion)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.CryptoKeyVersion other) { + if (other == com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasDestroyTime()) { + mergeDestroyTime(other.getDestroyTime()); + } + if (other.hasDestroyEventTime()) { + mergeDestroyEventTime(other.getDestroyEventTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.CryptoKeyVersion parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.CryptoKeyVersion) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+     * 
+ * + * string name = 1; + */ + 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 this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+     * 
+ * + * string name = 1; + */ + 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 this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private int state_ = 0; + /** + *
+     * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public int getStateValue() { + return state_; + } + /** + *
+     * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public Builder setStateValue(int value) { + state_ = value; + onChanged(); + return this; + } + /** + *
+     * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState getState() { + com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState result = com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.valueOf(state_); + return result == null ? com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.UNRECOGNIZED : result; + } + /** + *
+     * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public Builder setState(com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> createTimeBuilder_; + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public Builder setCreateTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + } + /** + *
+     * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), + getParentForChildren(), + isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp destroyTime_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> destroyTimeBuilder_; + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public boolean hasDestroyTime() { + return destroyTimeBuilder_ != null || destroyTime_ != null; + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public com.google.protobuf.Timestamp getDestroyTime() { + if (destroyTimeBuilder_ == null) { + return destroyTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : destroyTime_; + } else { + return destroyTimeBuilder_.getMessage(); + } + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public Builder setDestroyTime(com.google.protobuf.Timestamp value) { + if (destroyTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + destroyTime_ = value; + onChanged(); + } else { + destroyTimeBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public Builder setDestroyTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (destroyTimeBuilder_ == null) { + destroyTime_ = builderForValue.build(); + onChanged(); + } else { + destroyTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public Builder mergeDestroyTime(com.google.protobuf.Timestamp value) { + if (destroyTimeBuilder_ == null) { + if (destroyTime_ != null) { + destroyTime_ = + com.google.protobuf.Timestamp.newBuilder(destroyTime_).mergeFrom(value).buildPartial(); + } else { + destroyTime_ = value; + } + onChanged(); + } else { + destroyTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public Builder clearDestroyTime() { + if (destroyTimeBuilder_ == null) { + destroyTime_ = null; + onChanged(); + } else { + destroyTime_ = null; + destroyTimeBuilder_ = null; + } + + return this; + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public com.google.protobuf.Timestamp.Builder getDestroyTimeBuilder() { + + onChanged(); + return getDestroyTimeFieldBuilder().getBuilder(); + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + public com.google.protobuf.TimestampOrBuilder getDestroyTimeOrBuilder() { + if (destroyTimeBuilder_ != null) { + return destroyTimeBuilder_.getMessageOrBuilder(); + } else { + return destroyTime_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : destroyTime_; + } + } + /** + *
+     * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+     * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getDestroyTimeFieldBuilder() { + if (destroyTimeBuilder_ == null) { + destroyTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getDestroyTime(), + getParentForChildren(), + isClean()); + destroyTime_ = null; + } + return destroyTimeBuilder_; + } + + private com.google.protobuf.Timestamp destroyEventTime_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> destroyEventTimeBuilder_; + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public boolean hasDestroyEventTime() { + return destroyEventTimeBuilder_ != null || destroyEventTime_ != null; + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public com.google.protobuf.Timestamp getDestroyEventTime() { + if (destroyEventTimeBuilder_ == null) { + return destroyEventTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : destroyEventTime_; + } else { + return destroyEventTimeBuilder_.getMessage(); + } + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public Builder setDestroyEventTime(com.google.protobuf.Timestamp value) { + if (destroyEventTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + destroyEventTime_ = value; + onChanged(); + } else { + destroyEventTimeBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public Builder setDestroyEventTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (destroyEventTimeBuilder_ == null) { + destroyEventTime_ = builderForValue.build(); + onChanged(); + } else { + destroyEventTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public Builder mergeDestroyEventTime(com.google.protobuf.Timestamp value) { + if (destroyEventTimeBuilder_ == null) { + if (destroyEventTime_ != null) { + destroyEventTime_ = + com.google.protobuf.Timestamp.newBuilder(destroyEventTime_).mergeFrom(value).buildPartial(); + } else { + destroyEventTime_ = value; + } + onChanged(); + } else { + destroyEventTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public Builder clearDestroyEventTime() { + if (destroyEventTimeBuilder_ == null) { + destroyEventTime_ = null; + onChanged(); + } else { + destroyEventTime_ = null; + destroyEventTimeBuilder_ = null; + } + + return this; + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public com.google.protobuf.Timestamp.Builder getDestroyEventTimeBuilder() { + + onChanged(); + return getDestroyEventTimeFieldBuilder().getBuilder(); + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + public com.google.protobuf.TimestampOrBuilder getDestroyEventTimeOrBuilder() { + if (destroyEventTimeBuilder_ != null) { + return destroyEventTimeBuilder_.getMessageOrBuilder(); + } else { + return destroyEventTime_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : destroyEventTime_; + } + } + /** + *
+     * Output only. The time this CryptoKeyVersion's key material was
+     * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+     * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+     * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getDestroyEventTimeFieldBuilder() { + if (destroyEventTimeBuilder_ == null) { + destroyEventTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getDestroyEventTime(), + getParentForChildren(), + isClean()); + destroyEventTime_ = null; + } + return destroyEventTimeBuilder_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.CryptoKeyVersion) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.CryptoKeyVersion) + private static final com.google.cloud.kms.v1.CryptoKeyVersion DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.CryptoKeyVersion(); + } + + public static com.google.cloud.kms.v1.CryptoKeyVersion getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public CryptoKeyVersion parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CryptoKeyVersion(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.CryptoKeyVersion getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionName.java new file mode 100644 index 000000000000..9ce2dfe1b8da --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionName.java @@ -0,0 +1,258 @@ +/* + * Copyright 2018 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 + * + * http://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.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class CryptoKeyVersionName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + private final String keyRing; + private final String cryptoKey; + private final String cryptoKeyVersion; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKey() { + return cryptoKey; + } + + public String getCryptoKeyVersion() { + return cryptoKeyVersion; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private CryptoKeyVersionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + keyRing = Preconditions.checkNotNull(builder.getKeyRing()); + cryptoKey = Preconditions.checkNotNull(builder.getCryptoKey()); + cryptoKeyVersion = Preconditions.checkNotNull(builder.getCryptoKeyVersion()); + } + + public static CryptoKeyVersionName of(String project, String location, String keyRing, String cryptoKey, String cryptoKeyVersion) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKey(cryptoKey) + .setCryptoKeyVersion(cryptoKeyVersion) + .build(); + } + + public static String format(String project, String location, String keyRing, String cryptoKey, String cryptoKeyVersion) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .setCryptoKey(cryptoKey) + .setCryptoKeyVersion(cryptoKeyVersion) + .build() + .toString(); + } + + public static CryptoKeyVersionName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "CryptoKeyVersionName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("key_ring"), matchMap.get("crypto_key"), matchMap.get("crypto_key_version")); + } + + 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 (CryptoKeyVersionName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldMapBuilder.put("keyRing", keyRing); + fieldMapBuilder.put("cryptoKey", cryptoKey); + fieldMapBuilder.put("cryptoKeyVersion", cryptoKeyVersion); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "location", location, "key_ring", keyRing, "crypto_key", cryptoKey, "crypto_key_version", cryptoKeyVersion); + } + + /** Builder for CryptoKeyVersionName. */ + public static class Builder { + + private String project; + private String location; + private String keyRing; + private String cryptoKey; + private String cryptoKeyVersion; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public String getCryptoKey() { + return cryptoKey; + } + + public String getCryptoKeyVersion() { + return cryptoKeyVersion; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setKeyRing(String keyRing) { + this.keyRing = keyRing; + return this; + } + + public Builder setCryptoKey(String cryptoKey) { + this.cryptoKey = cryptoKey; + return this; + } + + public Builder setCryptoKeyVersion(String cryptoKeyVersion) { + this.cryptoKeyVersion = cryptoKeyVersion; + return this; + } + + private Builder() { + } + + private Builder(CryptoKeyVersionName cryptoKeyVersionName) { + project = cryptoKeyVersionName.project; + location = cryptoKeyVersionName.location; + keyRing = cryptoKeyVersionName.keyRing; + cryptoKey = cryptoKeyVersionName.cryptoKey; + cryptoKeyVersion = cryptoKeyVersionName.cryptoKeyVersion; + } + + public CryptoKeyVersionName build() { + return new CryptoKeyVersionName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof CryptoKeyVersionName) { + CryptoKeyVersionName that = (CryptoKeyVersionName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)) + && (this.keyRing.equals(that.keyRing)) + && (this.cryptoKey.equals(that.cryptoKey)) + && (this.cryptoKeyVersion.equals(that.cryptoKeyVersion)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + h *= 1000003; + h ^= keyRing.hashCode(); + h *= 1000003; + h ^= cryptoKey.hashCode(); + h *= 1000003; + h ^= cryptoKeyVersion.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java new file mode 100644 index 000000000000..15d97f920607 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/CryptoKeyVersionOrBuilder.java @@ -0,0 +1,133 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +public interface CryptoKeyVersionOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.CryptoKeyVersion) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + int getStateValue(); + /** + *
+   * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3; + */ + com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState getState(); + + /** + *
+   * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + boolean hasCreateTime(); + /** + *
+   * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + *
+   * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + *
+   * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+   * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + boolean hasDestroyTime(); + /** + *
+   * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+   * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + com.google.protobuf.Timestamp getDestroyTime(); + /** + *
+   * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled
+   * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_time = 5; + */ + com.google.protobuf.TimestampOrBuilder getDestroyTimeOrBuilder(); + + /** + *
+   * Output only. The time this CryptoKeyVersion's key material was
+   * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + boolean hasDestroyEventTime(); + /** + *
+   * Output only. The time this CryptoKeyVersion's key material was
+   * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + com.google.protobuf.Timestamp getDestroyEventTime(); + /** + *
+   * Output only. The time this CryptoKeyVersion's key material was
+   * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
+   * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
+   * 
+ * + * .google.protobuf.Timestamp destroy_event_time = 6; + */ + com.google.protobuf.TimestampOrBuilder getDestroyEventTimeOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptRequest.java new file mode 100644 index 000000000000..20c8be6960a4 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptRequest.java @@ -0,0 +1,721 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.DecryptRequest} + */ +public final class DecryptRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.DecryptRequest) + DecryptRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use DecryptRequest.newBuilder() to construct. + private DecryptRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DecryptRequest() { + name_ = ""; + ciphertext_ = com.google.protobuf.ByteString.EMPTY; + additionalAuthenticatedData_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DecryptRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: { + + ciphertext_ = input.readBytes(); + break; + } + case 26: { + + additionalAuthenticatedData_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.DecryptRequest.class, com.google.cloud.kms.v1.DecryptRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+   * The server will choose the appropriate version.
+   * 
+ * + * string name = 1; + */ + 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 resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+   * The server will choose the appropriate version.
+   * 
+ * + * string name = 1; + */ + 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 CIPHERTEXT_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString ciphertext_; + /** + *
+   * Required. The encrypted data originally returned in
+   * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
+   * 
+ * + * bytes ciphertext = 2; + */ + public com.google.protobuf.ByteString getCiphertext() { + return ciphertext_; + } + + public static final int ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString additionalAuthenticatedData_; + /** + *
+   * Optional data that must match the data originally supplied in
+   * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
+   * 
+ * + * bytes additional_authenticated_data = 3; + */ + public com.google.protobuf.ByteString getAdditionalAuthenticatedData() { + return additionalAuthenticatedData_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!ciphertext_.isEmpty()) { + output.writeBytes(2, ciphertext_); + } + if (!additionalAuthenticatedData_.isEmpty()) { + output.writeBytes(3, additionalAuthenticatedData_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!ciphertext_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, ciphertext_); + } + if (!additionalAuthenticatedData_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, additionalAuthenticatedData_); + } + size += unknownFields.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.DecryptRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.DecryptRequest other = (com.google.cloud.kms.v1.DecryptRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && getCiphertext() + .equals(other.getCiphertext()); + result = result && getAdditionalAuthenticatedData() + .equals(other.getAdditionalAuthenticatedData()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + CIPHERTEXT_FIELD_NUMBER; + hash = (53 * hash) + getCiphertext().hashCode(); + hash = (37 * hash) + ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getAdditionalAuthenticatedData().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.DecryptRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DecryptRequest 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.DecryptRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DecryptRequest 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.DecryptRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DecryptRequest 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.DecryptRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.DecryptRequest 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.DecryptRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.DecryptRequest 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.DecryptRequest 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.DecryptRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.DecryptRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.DecryptRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.DecryptRequest) + com.google.cloud.kms.v1.DecryptRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.DecryptRequest.class, com.google.cloud.kms.v1.DecryptRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.DecryptRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + ciphertext_ = com.google.protobuf.ByteString.EMPTY; + + additionalAuthenticatedData_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptRequest_descriptor; + } + + public com.google.cloud.kms.v1.DecryptRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.DecryptRequest build() { + com.google.cloud.kms.v1.DecryptRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.DecryptRequest buildPartial() { + com.google.cloud.kms.v1.DecryptRequest result = new com.google.cloud.kms.v1.DecryptRequest(this); + result.name_ = name_; + result.ciphertext_ = ciphertext_; + result.additionalAuthenticatedData_ = additionalAuthenticatedData_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.DecryptRequest) { + return mergeFrom((com.google.cloud.kms.v1.DecryptRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.DecryptRequest other) { + if (other == com.google.cloud.kms.v1.DecryptRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getCiphertext() != com.google.protobuf.ByteString.EMPTY) { + setCiphertext(other.getCiphertext()); + } + if (other.getAdditionalAuthenticatedData() != com.google.protobuf.ByteString.EMPTY) { + setAdditionalAuthenticatedData(other.getAdditionalAuthenticatedData()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.DecryptRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.DecryptRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+     * The server will choose the appropriate version.
+     * 
+ * + * string name = 1; + */ + 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 resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+     * The server will choose the appropriate version.
+     * 
+ * + * string name = 1; + */ + 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 resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+     * The server will choose the appropriate version.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+     * The server will choose the appropriate version.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+     * The server will choose the appropriate version.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString ciphertext_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * Required. The encrypted data originally returned in
+     * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
+     * 
+ * + * bytes ciphertext = 2; + */ + public com.google.protobuf.ByteString getCiphertext() { + return ciphertext_; + } + /** + *
+     * Required. The encrypted data originally returned in
+     * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
+     * 
+ * + * bytes ciphertext = 2; + */ + public Builder setCiphertext(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + ciphertext_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The encrypted data originally returned in
+     * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
+     * 
+ * + * bytes ciphertext = 2; + */ + public Builder clearCiphertext() { + + ciphertext_ = getDefaultInstance().getCiphertext(); + onChanged(); + return this; + } + + private com.google.protobuf.ByteString additionalAuthenticatedData_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * Optional data that must match the data originally supplied in
+     * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
+     * 
+ * + * bytes additional_authenticated_data = 3; + */ + public com.google.protobuf.ByteString getAdditionalAuthenticatedData() { + return additionalAuthenticatedData_; + } + /** + *
+     * Optional data that must match the data originally supplied in
+     * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
+     * 
+ * + * bytes additional_authenticated_data = 3; + */ + public Builder setAdditionalAuthenticatedData(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + additionalAuthenticatedData_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional data that must match the data originally supplied in
+     * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
+     * 
+ * + * bytes additional_authenticated_data = 3; + */ + public Builder clearAdditionalAuthenticatedData() { + + additionalAuthenticatedData_ = getDefaultInstance().getAdditionalAuthenticatedData(); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.DecryptRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.DecryptRequest) + private static final com.google.cloud.kms.v1.DecryptRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.DecryptRequest(); + } + + public static com.google.cloud.kms.v1.DecryptRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public DecryptRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DecryptRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.DecryptRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptRequestOrBuilder.java new file mode 100644 index 000000000000..589c2c6906fc --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptRequestOrBuilder.java @@ -0,0 +1,49 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface DecryptRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.DecryptRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+   * The server will choose the appropriate version.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption.
+   * The server will choose the appropriate version.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * Required. The encrypted data originally returned in
+   * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
+   * 
+ * + * bytes ciphertext = 2; + */ + com.google.protobuf.ByteString getCiphertext(); + + /** + *
+   * Optional data that must match the data originally supplied in
+   * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
+   * 
+ * + * bytes additional_authenticated_data = 3; + */ + com.google.protobuf.ByteString getAdditionalAuthenticatedData(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptResponse.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptResponse.java new file mode 100644 index 000000000000..043273edfc54 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptResponse.java @@ -0,0 +1,474 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Response message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.DecryptResponse} + */ +public final class DecryptResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.DecryptResponse) + DecryptResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use DecryptResponse.newBuilder() to construct. + private DecryptResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DecryptResponse() { + plaintext_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DecryptResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + + plaintext_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.DecryptResponse.class, com.google.cloud.kms.v1.DecryptResponse.Builder.class); + } + + public static final int PLAINTEXT_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString plaintext_; + /** + *
+   * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
+   * 
+ * + * bytes plaintext = 1; + */ + public com.google.protobuf.ByteString getPlaintext() { + return plaintext_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!plaintext_.isEmpty()) { + output.writeBytes(1, plaintext_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!plaintext_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, plaintext_); + } + size += unknownFields.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.DecryptResponse)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.DecryptResponse other = (com.google.cloud.kms.v1.DecryptResponse) obj; + + boolean result = true; + result = result && getPlaintext() + .equals(other.getPlaintext()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PLAINTEXT_FIELD_NUMBER; + hash = (53 * hash) + getPlaintext().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.DecryptResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DecryptResponse 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.DecryptResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DecryptResponse 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.DecryptResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DecryptResponse 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.DecryptResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.DecryptResponse 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.DecryptResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.DecryptResponse 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.DecryptResponse 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.DecryptResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.DecryptResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * Response message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.DecryptResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.DecryptResponse) + com.google.cloud.kms.v1.DecryptResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.DecryptResponse.class, com.google.cloud.kms.v1.DecryptResponse.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.DecryptResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + plaintext_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DecryptResponse_descriptor; + } + + public com.google.cloud.kms.v1.DecryptResponse getDefaultInstanceForType() { + return com.google.cloud.kms.v1.DecryptResponse.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.DecryptResponse build() { + com.google.cloud.kms.v1.DecryptResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.DecryptResponse buildPartial() { + com.google.cloud.kms.v1.DecryptResponse result = new com.google.cloud.kms.v1.DecryptResponse(this); + result.plaintext_ = plaintext_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.DecryptResponse) { + return mergeFrom((com.google.cloud.kms.v1.DecryptResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.DecryptResponse other) { + if (other == com.google.cloud.kms.v1.DecryptResponse.getDefaultInstance()) return this; + if (other.getPlaintext() != com.google.protobuf.ByteString.EMPTY) { + setPlaintext(other.getPlaintext()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.DecryptResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.DecryptResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.ByteString plaintext_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
+     * 
+ * + * bytes plaintext = 1; + */ + public com.google.protobuf.ByteString getPlaintext() { + return plaintext_; + } + /** + *
+     * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
+     * 
+ * + * bytes plaintext = 1; + */ + public Builder setPlaintext(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + plaintext_ = value; + onChanged(); + return this; + } + /** + *
+     * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
+     * 
+ * + * bytes plaintext = 1; + */ + public Builder clearPlaintext() { + + plaintext_ = getDefaultInstance().getPlaintext(); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.DecryptResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.DecryptResponse) + private static final com.google.cloud.kms.v1.DecryptResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.DecryptResponse(); + } + + public static com.google.cloud.kms.v1.DecryptResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public DecryptResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DecryptResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.DecryptResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptResponseOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptResponseOrBuilder.java new file mode 100644 index 000000000000..0cdb7ef6665e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DecryptResponseOrBuilder.java @@ -0,0 +1,18 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface DecryptResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.DecryptResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
+   * 
+ * + * bytes plaintext = 1; + */ + com.google.protobuf.ByteString getPlaintext(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DestroyCryptoKeyVersionRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DestroyCryptoKeyVersionRequest.java new file mode 100644 index 000000000000..582092f3e136 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DestroyCryptoKeyVersionRequest.java @@ -0,0 +1,552 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} + */ +public final class DestroyCryptoKeyVersionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) + DestroyCryptoKeyVersionRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use DestroyCryptoKeyVersionRequest.newBuilder() to construct. + private DestroyCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DestroyCryptoKeyVersionRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DestroyCryptoKeyVersionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+   * 
+ * + * string name = 1; + */ + 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; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.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.DestroyCryptoKeyVersionRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest other = (com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest 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.DestroyCryptoKeyVersionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest 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.DestroyCryptoKeyVersionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest 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.DestroyCryptoKeyVersionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest 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.DestroyCryptoKeyVersionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest 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.DestroyCryptoKeyVersionRequest 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.DestroyCryptoKeyVersionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.DestroyCryptoKeyVersionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_descriptor; + } + + public com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest build() { + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest buildPartial() { + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest result = new com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) { + return mergeFrom((com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest other) { + if (other == com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) + private static final com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest(); + } + + public static com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public DestroyCryptoKeyVersionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DestroyCryptoKeyVersionRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DestroyCryptoKeyVersionRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DestroyCryptoKeyVersionRequestOrBuilder.java new file mode 100644 index 000000000000..4ea0c9872dce --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/DestroyCryptoKeyVersionRequestOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface DestroyCryptoKeyVersionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.DestroyCryptoKeyVersionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptRequest.java new file mode 100644 index 000000000000..6bc457f4d852 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptRequest.java @@ -0,0 +1,735 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.EncryptRequest} + */ +public final class EncryptRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.EncryptRequest) + EncryptRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use EncryptRequest.newBuilder() to construct. + private EncryptRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EncryptRequest() { + name_ = ""; + plaintext_ = com.google.protobuf.ByteString.EMPTY; + additionalAuthenticatedData_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private EncryptRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: { + + plaintext_ = input.readBytes(); + break; + } + case 26: { + + additionalAuthenticatedData_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.EncryptRequest.class, com.google.cloud.kms.v1.EncryptRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * to use for encryption.
+   * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+   * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+   * 
+ * + * string name = 1; + */ + 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 resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * to use for encryption.
+   * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+   * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+   * 
+ * + * string name = 1; + */ + 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 PLAINTEXT_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString plaintext_; + /** + *
+   * Required. The data to encrypt. Must be no larger than 64KiB.
+   * 
+ * + * bytes plaintext = 2; + */ + public com.google.protobuf.ByteString getPlaintext() { + return plaintext_; + } + + public static final int ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString additionalAuthenticatedData_; + /** + *
+   * Optional data that, if specified, must also be provided during decryption
+   * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].  Must be no
+   * larger than 64KiB.
+   * 
+ * + * bytes additional_authenticated_data = 3; + */ + public com.google.protobuf.ByteString getAdditionalAuthenticatedData() { + return additionalAuthenticatedData_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!plaintext_.isEmpty()) { + output.writeBytes(2, plaintext_); + } + if (!additionalAuthenticatedData_.isEmpty()) { + output.writeBytes(3, additionalAuthenticatedData_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!plaintext_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, plaintext_); + } + if (!additionalAuthenticatedData_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, additionalAuthenticatedData_); + } + size += unknownFields.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.EncryptRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.EncryptRequest other = (com.google.cloud.kms.v1.EncryptRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && getPlaintext() + .equals(other.getPlaintext()); + result = result && getAdditionalAuthenticatedData() + .equals(other.getAdditionalAuthenticatedData()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + PLAINTEXT_FIELD_NUMBER; + hash = (53 * hash) + getPlaintext().hashCode(); + hash = (37 * hash) + ADDITIONAL_AUTHENTICATED_DATA_FIELD_NUMBER; + hash = (53 * hash) + getAdditionalAuthenticatedData().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.EncryptRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.EncryptRequest 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.EncryptRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.EncryptRequest 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.EncryptRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.EncryptRequest 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.EncryptRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.EncryptRequest 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.EncryptRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.EncryptRequest 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.EncryptRequest 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.EncryptRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.EncryptRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.EncryptRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.EncryptRequest) + com.google.cloud.kms.v1.EncryptRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.EncryptRequest.class, com.google.cloud.kms.v1.EncryptRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.EncryptRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + plaintext_ = com.google.protobuf.ByteString.EMPTY; + + additionalAuthenticatedData_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptRequest_descriptor; + } + + public com.google.cloud.kms.v1.EncryptRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.EncryptRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.EncryptRequest build() { + com.google.cloud.kms.v1.EncryptRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.EncryptRequest buildPartial() { + com.google.cloud.kms.v1.EncryptRequest result = new com.google.cloud.kms.v1.EncryptRequest(this); + result.name_ = name_; + result.plaintext_ = plaintext_; + result.additionalAuthenticatedData_ = additionalAuthenticatedData_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.EncryptRequest) { + return mergeFrom((com.google.cloud.kms.v1.EncryptRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.EncryptRequest other) { + if (other == com.google.cloud.kms.v1.EncryptRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getPlaintext() != com.google.protobuf.ByteString.EMPTY) { + setPlaintext(other.getPlaintext()); + } + if (other.getAdditionalAuthenticatedData() != com.google.protobuf.ByteString.EMPTY) { + setAdditionalAuthenticatedData(other.getAdditionalAuthenticatedData()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.EncryptRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.EncryptRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * to use for encryption.
+     * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+     * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+     * 
+ * + * string name = 1; + */ + 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 resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * to use for encryption.
+     * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+     * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+     * 
+ * + * string name = 1; + */ + 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 resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * to use for encryption.
+     * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+     * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * to use for encryption.
+     * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+     * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+     * to use for encryption.
+     * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+     * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString plaintext_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * Required. The data to encrypt. Must be no larger than 64KiB.
+     * 
+ * + * bytes plaintext = 2; + */ + public com.google.protobuf.ByteString getPlaintext() { + return plaintext_; + } + /** + *
+     * Required. The data to encrypt. Must be no larger than 64KiB.
+     * 
+ * + * bytes plaintext = 2; + */ + public Builder setPlaintext(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + plaintext_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The data to encrypt. Must be no larger than 64KiB.
+     * 
+ * + * bytes plaintext = 2; + */ + public Builder clearPlaintext() { + + plaintext_ = getDefaultInstance().getPlaintext(); + onChanged(); + return this; + } + + private com.google.protobuf.ByteString additionalAuthenticatedData_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * Optional data that, if specified, must also be provided during decryption
+     * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].  Must be no
+     * larger than 64KiB.
+     * 
+ * + * bytes additional_authenticated_data = 3; + */ + public com.google.protobuf.ByteString getAdditionalAuthenticatedData() { + return additionalAuthenticatedData_; + } + /** + *
+     * Optional data that, if specified, must also be provided during decryption
+     * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].  Must be no
+     * larger than 64KiB.
+     * 
+ * + * bytes additional_authenticated_data = 3; + */ + public Builder setAdditionalAuthenticatedData(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + additionalAuthenticatedData_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional data that, if specified, must also be provided during decryption
+     * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].  Must be no
+     * larger than 64KiB.
+     * 
+ * + * bytes additional_authenticated_data = 3; + */ + public Builder clearAdditionalAuthenticatedData() { + + additionalAuthenticatedData_ = getDefaultInstance().getAdditionalAuthenticatedData(); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.EncryptRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.EncryptRequest) + private static final com.google.cloud.kms.v1.EncryptRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.EncryptRequest(); + } + + public static com.google.cloud.kms.v1.EncryptRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public EncryptRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new EncryptRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.EncryptRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptRequestOrBuilder.java new file mode 100644 index 000000000000..22e3c758b5c2 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptRequestOrBuilder.java @@ -0,0 +1,53 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface EncryptRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.EncryptRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * to use for encryption.
+   * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+   * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
+   * to use for encryption.
+   * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its
+   * [primary version][google.cloud.kms.v1.CryptoKey.primary].
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * Required. The data to encrypt. Must be no larger than 64KiB.
+   * 
+ * + * bytes plaintext = 2; + */ + com.google.protobuf.ByteString getPlaintext(); + + /** + *
+   * Optional data that, if specified, must also be provided during decryption
+   * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].  Must be no
+   * larger than 64KiB.
+   * 
+ * + * bytes additional_authenticated_data = 3; + */ + com.google.protobuf.ByteString getAdditionalAuthenticatedData(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptResponse.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptResponse.java new file mode 100644 index 000000000000..5d4942830603 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptResponse.java @@ -0,0 +1,629 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Response message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.EncryptResponse} + */ +public final class EncryptResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.EncryptResponse) + EncryptResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use EncryptResponse.newBuilder() to construct. + private EncryptResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EncryptResponse() { + name_ = ""; + ciphertext_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private EncryptResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: { + + ciphertext_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.EncryptResponse.class, com.google.cloud.kms.v1.EncryptResponse.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+   * 
+ * + * string name = 1; + */ + 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 CIPHERTEXT_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString ciphertext_; + /** + *
+   * The encrypted data.
+   * 
+ * + * bytes ciphertext = 2; + */ + public com.google.protobuf.ByteString getCiphertext() { + return ciphertext_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!ciphertext_.isEmpty()) { + output.writeBytes(2, ciphertext_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!ciphertext_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, ciphertext_); + } + size += unknownFields.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.EncryptResponse)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.EncryptResponse other = (com.google.cloud.kms.v1.EncryptResponse) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && getCiphertext() + .equals(other.getCiphertext()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + CIPHERTEXT_FIELD_NUMBER; + hash = (53 * hash) + getCiphertext().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.EncryptResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.EncryptResponse 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.EncryptResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.EncryptResponse 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.EncryptResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.EncryptResponse 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.EncryptResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.EncryptResponse 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.EncryptResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.EncryptResponse 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.EncryptResponse 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.EncryptResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.EncryptResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * Response message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.EncryptResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.EncryptResponse) + com.google.cloud.kms.v1.EncryptResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.EncryptResponse.class, com.google.cloud.kms.v1.EncryptResponse.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.EncryptResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + ciphertext_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_EncryptResponse_descriptor; + } + + public com.google.cloud.kms.v1.EncryptResponse getDefaultInstanceForType() { + return com.google.cloud.kms.v1.EncryptResponse.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.EncryptResponse build() { + com.google.cloud.kms.v1.EncryptResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.EncryptResponse buildPartial() { + com.google.cloud.kms.v1.EncryptResponse result = new com.google.cloud.kms.v1.EncryptResponse(this); + result.name_ = name_; + result.ciphertext_ = ciphertext_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.EncryptResponse) { + return mergeFrom((com.google.cloud.kms.v1.EncryptResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.EncryptResponse other) { + if (other == com.google.cloud.kms.v1.EncryptResponse.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getCiphertext() != com.google.protobuf.ByteString.EMPTY) { + setCiphertext(other.getCiphertext()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.EncryptResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.EncryptResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString ciphertext_ = com.google.protobuf.ByteString.EMPTY; + /** + *
+     * The encrypted data.
+     * 
+ * + * bytes ciphertext = 2; + */ + public com.google.protobuf.ByteString getCiphertext() { + return ciphertext_; + } + /** + *
+     * The encrypted data.
+     * 
+ * + * bytes ciphertext = 2; + */ + public Builder setCiphertext(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + ciphertext_ = value; + onChanged(); + return this; + } + /** + *
+     * The encrypted data.
+     * 
+ * + * bytes ciphertext = 2; + */ + public Builder clearCiphertext() { + + ciphertext_ = getDefaultInstance().getCiphertext(); + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.EncryptResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.EncryptResponse) + private static final com.google.cloud.kms.v1.EncryptResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.EncryptResponse(); + } + + public static com.google.cloud.kms.v1.EncryptResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public EncryptResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new EncryptResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.EncryptResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptResponseOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptResponseOrBuilder.java new file mode 100644 index 000000000000..8b63882802fe --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/EncryptResponseOrBuilder.java @@ -0,0 +1,36 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface EncryptResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.EncryptResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * The encrypted data.
+   * 
+ * + * bytes ciphertext = 2; + */ + com.google.protobuf.ByteString getCiphertext(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyRequest.java new file mode 100644 index 000000000000..a624971bbca9 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyRequest.java @@ -0,0 +1,552 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetCryptoKeyRequest} + */ +public final class GetCryptoKeyRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.GetCryptoKeyRequest) + GetCryptoKeyRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GetCryptoKeyRequest.newBuilder() to construct. + private GetCryptoKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetCryptoKeyRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GetCryptoKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetCryptoKeyRequest.class, com.google.cloud.kms.v1.GetCryptoKeyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+   * 
+ * + * string name = 1; + */ + 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; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.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.GetCryptoKeyRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.GetCryptoKeyRequest other = (com.google.cloud.kms.v1.GetCryptoKeyRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.GetCryptoKeyRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetCryptoKeyRequest 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.GetCryptoKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetCryptoKeyRequest 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.GetCryptoKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetCryptoKeyRequest 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.GetCryptoKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.GetCryptoKeyRequest 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.GetCryptoKeyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.GetCryptoKeyRequest 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.GetCryptoKeyRequest 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.GetCryptoKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.GetCryptoKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetCryptoKeyRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.GetCryptoKeyRequest) + com.google.cloud.kms.v1.GetCryptoKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetCryptoKeyRequest.class, com.google.cloud.kms.v1.GetCryptoKeyRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.GetCryptoKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_descriptor; + } + + public com.google.cloud.kms.v1.GetCryptoKeyRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.GetCryptoKeyRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.GetCryptoKeyRequest build() { + com.google.cloud.kms.v1.GetCryptoKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.GetCryptoKeyRequest buildPartial() { + com.google.cloud.kms.v1.GetCryptoKeyRequest result = new com.google.cloud.kms.v1.GetCryptoKeyRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.GetCryptoKeyRequest) { + return mergeFrom((com.google.cloud.kms.v1.GetCryptoKeyRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.GetCryptoKeyRequest other) { + if (other == com.google.cloud.kms.v1.GetCryptoKeyRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.GetCryptoKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.GetCryptoKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.GetCryptoKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.GetCryptoKeyRequest) + private static final com.google.cloud.kms.v1.GetCryptoKeyRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.GetCryptoKeyRequest(); + } + + public static com.google.cloud.kms.v1.GetCryptoKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetCryptoKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetCryptoKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.GetCryptoKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyRequestOrBuilder.java new file mode 100644 index 000000000000..792494e86a18 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyRequestOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface GetCryptoKeyRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.GetCryptoKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyVersionRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyVersionRequest.java new file mode 100644 index 000000000000..850c6da16e1d --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyVersionRequest.java @@ -0,0 +1,552 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetCryptoKeyVersionRequest} + */ +public final class GetCryptoKeyVersionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.GetCryptoKeyVersionRequest) + GetCryptoKeyVersionRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GetCryptoKeyVersionRequest.newBuilder() to construct. + private GetCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetCryptoKeyVersionRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GetCryptoKeyVersionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+   * 
+ * + * string name = 1; + */ + 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; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.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.GetCryptoKeyVersionRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest other = (com.google.cloud.kms.v1.GetCryptoKeyVersionRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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.GetCryptoKeyVersionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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.GetCryptoKeyVersionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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.GetCryptoKeyVersionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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.GetCryptoKeyVersionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest 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.GetCryptoKeyVersionRequest 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.GetCryptoKeyVersionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetCryptoKeyVersionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.GetCryptoKeyVersionRequest) + com.google.cloud.kms.v1.GetCryptoKeyVersionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_descriptor; + } + + public com.google.cloud.kms.v1.GetCryptoKeyVersionRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.GetCryptoKeyVersionRequest build() { + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.GetCryptoKeyVersionRequest buildPartial() { + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest result = new com.google.cloud.kms.v1.GetCryptoKeyVersionRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.GetCryptoKeyVersionRequest) { + return mergeFrom((com.google.cloud.kms.v1.GetCryptoKeyVersionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.GetCryptoKeyVersionRequest other) { + if (other == com.google.cloud.kms.v1.GetCryptoKeyVersionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.GetCryptoKeyVersionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.GetCryptoKeyVersionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.GetCryptoKeyVersionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.GetCryptoKeyVersionRequest) + private static final com.google.cloud.kms.v1.GetCryptoKeyVersionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.GetCryptoKeyVersionRequest(); + } + + public static com.google.cloud.kms.v1.GetCryptoKeyVersionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetCryptoKeyVersionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetCryptoKeyVersionRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.GetCryptoKeyVersionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyVersionRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyVersionRequestOrBuilder.java new file mode 100644 index 000000000000..90f849e33a36 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetCryptoKeyVersionRequestOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface GetCryptoKeyVersionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.GetCryptoKeyVersionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetKeyRingRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetKeyRingRequest.java new file mode 100644 index 000000000000..c3239af8f86d --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetKeyRingRequest.java @@ -0,0 +1,552 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetKeyRingRequest} + */ +public final class GetKeyRingRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.GetKeyRingRequest) + GetKeyRingRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use GetKeyRingRequest.newBuilder() to construct. + private GetKeyRingRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private GetKeyRingRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private GetKeyRingRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetKeyRingRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetKeyRingRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetKeyRingRequest.class, com.google.cloud.kms.v1.GetKeyRingRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+   * 
+ * + * string name = 1; + */ + 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; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.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.GetKeyRingRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.GetKeyRingRequest other = (com.google.cloud.kms.v1.GetKeyRingRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.GetKeyRingRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetKeyRingRequest 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.GetKeyRingRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetKeyRingRequest 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.GetKeyRingRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.GetKeyRingRequest 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.GetKeyRingRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.GetKeyRingRequest 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.GetKeyRingRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.GetKeyRingRequest 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.GetKeyRingRequest 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.GetKeyRingRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.GetKeyRingRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.GetKeyRingRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.GetKeyRingRequest) + com.google.cloud.kms.v1.GetKeyRingRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetKeyRingRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetKeyRingRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.GetKeyRingRequest.class, com.google.cloud.kms.v1.GetKeyRingRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.GetKeyRingRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_GetKeyRingRequest_descriptor; + } + + public com.google.cloud.kms.v1.GetKeyRingRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.GetKeyRingRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.GetKeyRingRequest build() { + com.google.cloud.kms.v1.GetKeyRingRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.GetKeyRingRequest buildPartial() { + com.google.cloud.kms.v1.GetKeyRingRequest result = new com.google.cloud.kms.v1.GetKeyRingRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.GetKeyRingRequest) { + return mergeFrom((com.google.cloud.kms.v1.GetKeyRingRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.GetKeyRingRequest other) { + if (other == com.google.cloud.kms.v1.GetKeyRingRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.GetKeyRingRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.GetKeyRingRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.GetKeyRingRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.GetKeyRingRequest) + private static final com.google.cloud.kms.v1.GetKeyRingRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.GetKeyRingRequest(); + } + + public static com.google.cloud.kms.v1.GetKeyRingRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public GetKeyRingRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKeyRingRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.GetKeyRingRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetKeyRingRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetKeyRingRequestOrBuilder.java new file mode 100644 index 000000000000..8a791bc8938e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/GetKeyRingRequestOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface GetKeyRingRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.GetKeyRingRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyName.java new file mode 100644 index 000000000000..3ae8199ceae4 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyName.java @@ -0,0 +1,23 @@ +/* + * Copyright 2018 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 + * + * http://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.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public abstract class KeyName implements ResourceName { + protected KeyName() {} +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyNames.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyNames.java new file mode 100644 index 000000000000..a2be9589db3f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyNames.java @@ -0,0 +1,33 @@ +/* + * Copyright 2018 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 + * + * http://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.resourcenames.ResourceName; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class KeyNames { + private KeyNames() {} + + public static KeyName parse(String resourceNameString) { + if (KeyRingName.isParsableFrom(resourceNameString)) { + return KeyRingName.parse(resourceNameString); + } + if (CryptoKeyName.isParsableFrom(resourceNameString)) { + return CryptoKeyName.parse(resourceNameString); + } + return UntypedKeyName.parse(resourceNameString); + } +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRing.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRing.java new file mode 100644 index 000000000000..872a42bea5d6 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRing.java @@ -0,0 +1,788 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.KeyRing} + */ +public final class KeyRing extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.KeyRing) + KeyRingOrBuilder { +private static final long serialVersionUID = 0L; + // Use KeyRing.newBuilder() to construct. + private KeyRing(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private KeyRing() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private KeyRing( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_KeyRing_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_KeyRing_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.KeyRing.class, com.google.cloud.kms.v1.KeyRing.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string name = 1; + */ + 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 [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string name = 1; + */ + 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 CREATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp createTime_; + /** + *
+   * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + *
+   * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + *
+   * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (createTime_ != null) { + output.writeMessage(2, getCreateTime()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getCreateTime()); + } + size += unknownFields.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.KeyRing)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.KeyRing other = (com.google.cloud.kms.v1.KeyRing) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && (hasCreateTime() == other.hasCreateTime()); + if (hasCreateTime()) { + result = result && getCreateTime() + .equals(other.getCreateTime()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.KeyRing parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.KeyRing 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.KeyRing parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.KeyRing 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.KeyRing parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.KeyRing 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.KeyRing parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.KeyRing 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.KeyRing parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.KeyRing 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.KeyRing 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.KeyRing parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.KeyRing prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.KeyRing} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.KeyRing) + com.google.cloud.kms.v1.KeyRingOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_KeyRing_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_KeyRing_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.KeyRing.class, com.google.cloud.kms.v1.KeyRing.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.KeyRing.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsResourcesProto.internal_static_google_cloud_kms_v1_KeyRing_descriptor; + } + + public com.google.cloud.kms.v1.KeyRing getDefaultInstanceForType() { + return com.google.cloud.kms.v1.KeyRing.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.KeyRing build() { + com.google.cloud.kms.v1.KeyRing result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.KeyRing buildPartial() { + com.google.cloud.kms.v1.KeyRing result = new com.google.cloud.kms.v1.KeyRing(this); + result.name_ = name_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.KeyRing) { + return mergeFrom((com.google.cloud.kms.v1.KeyRing)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.KeyRing other) { + if (other == com.google.cloud.kms.v1.KeyRing.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.KeyRing parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.KeyRing) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string name = 1; + */ + 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 [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string name = 1; + */ + 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 [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> createTimeBuilder_; + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder setCreateTime( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + } + /** + *
+     * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), + getParentForChildren(), + isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.KeyRing) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.KeyRing) + private static final com.google.cloud.kms.v1.KeyRing DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.KeyRing(); + } + + public static com.google.cloud.kms.v1.KeyRing getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public KeyRing parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new KeyRing(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.KeyRing getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRingName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRingName.java new file mode 100644 index 000000000000..a017594f99b0 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRingName.java @@ -0,0 +1,212 @@ +/* + * Copyright 2018 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 + * + * http://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.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class KeyRingName extends KeyName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/keyRings/{key_ring}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + private final String keyRing; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private KeyRingName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + keyRing = Preconditions.checkNotNull(builder.getKeyRing()); + } + + public static KeyRingName of(String project, String location, String keyRing) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .build(); + } + + public static String format(String project, String location, String keyRing) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setKeyRing(keyRing) + .build() + .toString(); + } + + public static KeyRingName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "KeyRingName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("key_ring")); + } + + 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 (KeyRingName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldMapBuilder.put("keyRing", keyRing); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "location", location, "key_ring", keyRing); + } + + /** Builder for KeyRingName. */ + public static class Builder { + + private String project; + private String location; + private String keyRing; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKeyRing() { + return keyRing; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setKeyRing(String keyRing) { + this.keyRing = keyRing; + return this; + } + + private Builder() { + } + + private Builder(KeyRingName keyRingName) { + project = keyRingName.project; + location = keyRingName.location; + keyRing = keyRingName.keyRing; + } + + public KeyRingName build() { + return new KeyRingName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof KeyRingName) { + KeyRingName that = (KeyRingName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)) + && (this.keyRing.equals(that.keyRing)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + h *= 1000003; + h ^= keyRing.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRingOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRingOrBuilder.java new file mode 100644 index 000000000000..f05f5db18301 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KeyRingOrBuilder.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +public interface KeyRingOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.KeyRing) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + boolean hasCreateTime(); + /** + *
+   * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + *
+   * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsProto.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsProto.java new file mode 100644 index 000000000000..eebfe668bc7f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsProto.java @@ -0,0 +1,419 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public final class KmsProto { + private KmsProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_ListKeyRingsRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_ListKeyRingsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_ListKeyRingsResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_ListKeyRingsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_GetKeyRingRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_GetKeyRingRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_CreateKeyRingRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_CreateKeyRingRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_EncryptRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_EncryptRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_DecryptRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_DecryptRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_DecryptResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_DecryptResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_EncryptResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_EncryptResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n!google/cloud/kms/v1/service.proto\022\023goo" + + "gle.cloud.kms.v1\032\034google/api/annotations" + + ".proto\032#google/cloud/kms/v1/resources.pr" + + "oto\032 google/protobuf/field_mask.proto\032\034g" + + "oogle/protobuf/struct.proto\032\036google/prot" + + "obuf/wrappers.proto\"L\n\023ListKeyRingsReque" + + "st\022\016\n\006parent\030\001 \001(\t\022\021\n\tpage_size\030\002 \001(\005\022\022\n" + + "\npage_token\030\003 \001(\t\"N\n\025ListCryptoKeysReque" + + "st\022\016\n\006parent\030\001 \001(\t\022\021\n\tpage_size\030\002 \001(\005\022\022\n" + + "\npage_token\030\003 \001(\t\"U\n\034ListCryptoKeyVersio" + + "nsRequest\022\016\n\006parent\030\001 \001(\t\022\021\n\tpage_size\030\002" + + " \001(\005\022\022\n\npage_token\030\003 \001(\t\"t\n\024ListKeyRings" + + "Response\022/\n\tkey_rings\030\001 \003(\0132\034.google.clo" + + "ud.kms.v1.KeyRing\022\027\n\017next_page_token\030\002 \001" + + "(\t\022\022\n\ntotal_size\030\003 \001(\005\"z\n\026ListCryptoKeys" + + "Response\0223\n\013crypto_keys\030\001 \003(\0132\036.google.c" + + "loud.kms.v1.CryptoKey\022\027\n\017next_page_token" + + "\030\002 \001(\t\022\022\n\ntotal_size\030\003 \001(\005\"\220\001\n\035ListCrypt" + + "oKeyVersionsResponse\022B\n\023crypto_key_versi" + + "ons\030\001 \003(\0132%.google.cloud.kms.v1.CryptoKe" + + "yVersion\022\027\n\017next_page_token\030\002 \001(\t\022\022\n\ntot" + + "al_size\030\003 \001(\005\"!\n\021GetKeyRingRequest\022\014\n\004na" + + "me\030\001 \001(\t\"#\n\023GetCryptoKeyRequest\022\014\n\004name\030" + + "\001 \001(\t\"*\n\032GetCryptoKeyVersionRequest\022\014\n\004n" + + "ame\030\001 \001(\t\"k\n\024CreateKeyRingRequest\022\016\n\006par" + + "ent\030\001 \001(\t\022\023\n\013key_ring_id\030\002 \001(\t\022.\n\010key_ri" + + "ng\030\003 \001(\0132\034.google.cloud.kms.v1.KeyRing\"s" + + "\n\026CreateCryptoKeyRequest\022\016\n\006parent\030\001 \001(\t" + + "\022\025\n\rcrypto_key_id\030\002 \001(\t\0222\n\ncrypto_key\030\003 " + + "\001(\0132\036.google.cloud.kms.v1.CryptoKey\"r\n\035C" + + "reateCryptoKeyVersionRequest\022\016\n\006parent\030\001" + + " \001(\t\022A\n\022crypto_key_version\030\002 \001(\0132%.googl" + + "e.cloud.kms.v1.CryptoKeyVersion\"}\n\026Updat" + + "eCryptoKeyRequest\0222\n\ncrypto_key\030\001 \001(\0132\036." + + "google.cloud.kms.v1.CryptoKey\022/\n\013update_" + + "mask\030\002 \001(\0132\032.google.protobuf.FieldMask\"\223" + + "\001\n\035UpdateCryptoKeyVersionRequest\022A\n\022cryp" + + "to_key_version\030\001 \001(\0132%.google.cloud.kms." + + "v1.CryptoKeyVersion\022/\n\013update_mask\030\002 \001(\013" + + "2\032.google.protobuf.FieldMask\"X\n\016EncryptR" + + "equest\022\014\n\004name\030\001 \001(\t\022\021\n\tplaintext\030\002 \001(\014\022" + + "%\n\035additional_authenticated_data\030\003 \001(\014\"Y" + + "\n\016DecryptRequest\022\014\n\004name\030\001 \001(\t\022\022\n\ncipher" + + "text\030\002 \001(\014\022%\n\035additional_authenticated_d" + + "ata\030\003 \001(\014\"$\n\017DecryptResponse\022\021\n\tplaintex" + + "t\030\001 \001(\014\"3\n\017EncryptResponse\022\014\n\004name\030\001 \001(\t" + + "\022\022\n\nciphertext\030\002 \001(\014\"S\n$UpdateCryptoKeyP" + + "rimaryVersionRequest\022\014\n\004name\030\001 \001(\t\022\035\n\025cr" + + "ypto_key_version_id\030\002 \001(\t\".\n\036DestroyCryp" + + "toKeyVersionRequest\022\014\n\004name\030\001 \001(\t\".\n\036Res" + + "toreCryptoKeyVersionRequest\022\014\n\004name\030\001 \001(" + + "\t2\333\027\n\024KeyManagementService\022\231\001\n\014ListKeyRi" + + "ngs\022(.google.cloud.kms.v1.ListKeyRingsRe" + + "quest\032).google.cloud.kms.v1.ListKeyRings" + + "Response\"4\202\323\344\223\002.\022,/v1/{parent=projects/*" + + "/locations/*}/keyRings\022\254\001\n\016ListCryptoKey" + + "s\022*.google.cloud.kms.v1.ListCryptoKeysRe" + + "quest\032+.google.cloud.kms.v1.ListCryptoKe" + + "ysResponse\"A\202\323\344\223\002;\0229/v1/{parent=projects" + + "/*/locations/*/keyRings/*}/cryptoKeys\022\325\001" + + "\n\025ListCryptoKeyVersions\0221.google.cloud.k" + + "ms.v1.ListCryptoKeyVersionsRequest\0322.goo" + + "gle.cloud.kms.v1.ListCryptoKeyVersionsRe" + + "sponse\"U\202\323\344\223\002O\022M/v1/{parent=projects/*/l" + + "ocations/*/keyRings/*/cryptoKeys/*}/cryp" + + "toKeyVersions\022\210\001\n\nGetKeyRing\022&.google.cl" + + "oud.kms.v1.GetKeyRingRequest\032\034.google.cl" + + "oud.kms.v1.KeyRing\"4\202\323\344\223\002.\022,/v1/{name=pr" + + "ojects/*/locations/*/keyRings/*}\022\233\001\n\014Get" + + "CryptoKey\022(.google.cloud.kms.v1.GetCrypt" + + "oKeyRequest\032\036.google.cloud.kms.v1.Crypto" + + "Key\"A\202\323\344\223\002;\0229/v1/{name=projects/*/locati" + + "ons/*/keyRings/*/cryptoKeys/*}\022\304\001\n\023GetCr" + + "yptoKeyVersion\022/.google.cloud.kms.v1.Get" + + "CryptoKeyVersionRequest\032%.google.cloud.k" + + "ms.v1.CryptoKeyVersion\"U\202\323\344\223\002O\022M/v1/{nam" + + "e=projects/*/locations/*/keyRings/*/cryp" + + "toKeys/*/cryptoKeyVersions/*}\022\230\001\n\rCreate" + + "KeyRing\022).google.cloud.kms.v1.CreateKeyR" + + "ingRequest\032\034.google.cloud.kms.v1.KeyRing" + + "\">\202\323\344\223\0028\",/v1/{parent=projects/*/locatio" + + "ns/*}/keyRings:\010key_ring\022\255\001\n\017CreateCrypt" + + "oKey\022+.google.cloud.kms.v1.CreateCryptoK" + + "eyRequest\032\036.google.cloud.kms.v1.CryptoKe" + + "y\"M\202\323\344\223\002G\"9/v1/{parent=projects/*/locati" + + "ons/*/keyRings/*}/cryptoKeys:\ncrypto_key" + + "\022\336\001\n\026CreateCryptoKeyVersion\0222.google.clo" + + "ud.kms.v1.CreateCryptoKeyVersionRequest\032" + + "%.google.cloud.kms.v1.CryptoKeyVersion\"i" + + "\202\323\344\223\002c\"M/v1/{parent=projects/*/locations" + + "/*/keyRings/*/cryptoKeys/*}/cryptoKeyVer" + + "sions:\022crypto_key_version\022\270\001\n\017UpdateCryp" + + "toKey\022+.google.cloud.kms.v1.UpdateCrypto" + + "KeyRequest\032\036.google.cloud.kms.v1.CryptoK" + + "ey\"X\202\323\344\223\002R2D/v1/{crypto_key.name=project" + + "s/*/locations/*/keyRings/*/cryptoKeys/*}" + + ":\ncrypto_key\022\361\001\n\026UpdateCryptoKeyVersion\022" + + "2.google.cloud.kms.v1.UpdateCryptoKeyVer" + + "sionRequest\032%.google.cloud.kms.v1.Crypto" + + "KeyVersion\"|\202\323\344\223\002v2`/v1/{crypto_key_vers" + + "ion.name=projects/*/locations/*/keyRings" + + "/*/cryptoKeys/*/cryptoKeyVersions/*}:\022cr" + + "ypto_key_version\022\243\001\n\007Encrypt\022#.google.cl" + + "oud.kms.v1.EncryptRequest\032$.google.cloud" + + ".kms.v1.EncryptResponse\"M\202\323\344\223\002G\"B/v1/{na" + + "me=projects/*/locations/*/keyRings/*/cry" + + "ptoKeys/**}:encrypt:\001*\022\242\001\n\007Decrypt\022#.goo" + + "gle.cloud.kms.v1.DecryptRequest\032$.google" + + ".cloud.kms.v1.DecryptResponse\"L\202\323\344\223\002F\"A/" + + "v1/{name=projects/*/locations/*/keyRings" + + "/*/cryptoKeys/*}:decrypt:\001*\022\325\001\n\035UpdateCr" + + "yptoKeyPrimaryVersion\0229.google.cloud.kms" + + ".v1.UpdateCryptoKeyPrimaryVersionRequest" + + "\032\036.google.cloud.kms.v1.CryptoKey\"Y\202\323\344\223\002S" + + "\"N/v1/{name=projects/*/locations/*/keyRi" + + "ngs/*/cryptoKeys/*}:updatePrimaryVersion" + + ":\001*\022\327\001\n\027DestroyCryptoKeyVersion\0223.google" + + ".cloud.kms.v1.DestroyCryptoKeyVersionReq" + + "uest\032%.google.cloud.kms.v1.CryptoKeyVers" + + "ion\"`\202\323\344\223\002Z\"U/v1/{name=projects/*/locati" + + "ons/*/keyRings/*/cryptoKeys/*/cryptoKeyV" + + "ersions/*}:destroy:\001*\022\327\001\n\027RestoreCryptoK" + + "eyVersion\0223.google.cloud.kms.v1.RestoreC" + + "ryptoKeyVersionRequest\032%.google.cloud.km" + + "s.v1.CryptoKeyVersion\"`\202\323\344\223\002Z\"U/v1/{name" + + "=projects/*/locations/*/keyRings/*/crypt" + + "oKeys/*/cryptoKeyVersions/*}:restore:\001*B" + + "\214\001\n\027com.google.cloud.kms.v1B\010KmsProtoP\001Z" + + "6google.golang.org/genproto/googleapis/c" + + "loud/kms/v1;kms\370\001\001\252\002\023Google.Cloud.Kms.V1" + + "\312\002\023Google\\Cloud\\Kms\\V1b\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.cloud.kms.v1.KmsResourcesProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), + com.google.protobuf.WrappersProto.getDescriptor(), + }, assigner); + internal_static_google_cloud_kms_v1_ListKeyRingsRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_kms_v1_ListKeyRingsRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_ListKeyRingsRequest_descriptor, + new java.lang.String[] { "Parent", "PageSize", "PageToken", }); + internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_descriptor, + new java.lang.String[] { "Parent", "PageSize", "PageToken", }); + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_descriptor, + new java.lang.String[] { "Parent", "PageSize", "PageToken", }); + internal_static_google_cloud_kms_v1_ListKeyRingsResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_kms_v1_ListKeyRingsResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_ListKeyRingsResponse_descriptor, + new java.lang.String[] { "KeyRings", "NextPageToken", "TotalSize", }); + internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_descriptor, + new java.lang.String[] { "CryptoKeys", "NextPageToken", "TotalSize", }); + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_descriptor, + new java.lang.String[] { "CryptoKeyVersions", "NextPageToken", "TotalSize", }); + internal_static_google_cloud_kms_v1_GetKeyRingRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_kms_v1_GetKeyRingRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_GetKeyRingRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_GetCryptoKeyRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_GetCryptoKeyVersionRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_google_cloud_kms_v1_CreateKeyRingRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_kms_v1_CreateKeyRingRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_CreateKeyRingRequest_descriptor, + new java.lang.String[] { "Parent", "KeyRingId", "KeyRing", }); + internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_CreateCryptoKeyRequest_descriptor, + new java.lang.String[] { "Parent", "CryptoKeyId", "CryptoKey", }); + internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_CreateCryptoKeyVersionRequest_descriptor, + new java.lang.String[] { "Parent", "CryptoKeyVersion", }); + internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_descriptor, + new java.lang.String[] { "CryptoKey", "UpdateMask", }); + internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_descriptor, + new java.lang.String[] { "CryptoKeyVersion", "UpdateMask", }); + internal_static_google_cloud_kms_v1_EncryptRequest_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_google_cloud_kms_v1_EncryptRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_EncryptRequest_descriptor, + new java.lang.String[] { "Name", "Plaintext", "AdditionalAuthenticatedData", }); + internal_static_google_cloud_kms_v1_DecryptRequest_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_google_cloud_kms_v1_DecryptRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_DecryptRequest_descriptor, + new java.lang.String[] { "Name", "Ciphertext", "AdditionalAuthenticatedData", }); + internal_static_google_cloud_kms_v1_DecryptResponse_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_google_cloud_kms_v1_DecryptResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_DecryptResponse_descriptor, + new java.lang.String[] { "Plaintext", }); + internal_static_google_cloud_kms_v1_EncryptResponse_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_google_cloud_kms_v1_EncryptResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_EncryptResponse_descriptor, + new java.lang.String[] { "Name", "Ciphertext", }); + internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_descriptor, + new java.lang.String[] { "Name", "CryptoKeyVersionId", }); + internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_DestroyCryptoKeyVersionRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_descriptor = + getDescriptor().getMessageTypes().get(20); + internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_descriptor, + new java.lang.String[] { "Name", }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.AnnotationsProto.http); + com.google.protobuf.Descriptors.FileDescriptor + .internalUpdateFileDescriptor(descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.cloud.kms.v1.KmsResourcesProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); + com.google.protobuf.WrappersProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java new file mode 100644 index 000000000000..63cac2096708 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/KmsResourcesProto.java @@ -0,0 +1,125 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/resources.proto + +package com.google.cloud.kms.v1; + +public final class KmsResourcesProto { + private KmsResourcesProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_KeyRing_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_KeyRing_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_CryptoKey_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_CryptoKey_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_CryptoKey_LabelsEntry_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_CryptoKey_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_kms_v1_CryptoKeyVersion_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_kms_v1_CryptoKeyVersion_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n#google/cloud/kms/v1/resources.proto\022\023g" + + "oogle.cloud.kms.v1\032\034google/api/annotatio" + + "ns.proto\032\036google/protobuf/duration.proto" + + "\032\037google/protobuf/timestamp.proto\"H\n\007Key" + + "Ring\022\014\n\004name\030\001 \001(\t\022/\n\013create_time\030\002 \001(\0132" + + "\032.google.protobuf.Timestamp\"\377\003\n\tCryptoKe" + + "y\022\014\n\004name\030\001 \001(\t\0226\n\007primary\030\002 \001(\0132%.googl" + + "e.cloud.kms.v1.CryptoKeyVersion\022@\n\007purpo" + + "se\030\003 \001(\0162/.google.cloud.kms.v1.CryptoKey" + + ".CryptoKeyPurpose\022/\n\013create_time\030\005 \001(\0132\032" + + ".google.protobuf.Timestamp\0226\n\022next_rotat" + + "ion_time\030\007 \001(\0132\032.google.protobuf.Timesta" + + "mp\0224\n\017rotation_period\030\010 \001(\0132\031.google.pro" + + "tobuf.DurationH\000\022:\n\006labels\030\n \003(\0132*.googl" + + "e.cloud.kms.v1.CryptoKey.LabelsEntry\032-\n\013" + + "LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" + + "\0028\001\"K\n\020CryptoKeyPurpose\022\"\n\036CRYPTO_KEY_PU" + + "RPOSE_UNSPECIFIED\020\000\022\023\n\017ENCRYPT_DECRYPT\020\001" + + "B\023\n\021rotation_schedule\"\214\003\n\020CryptoKeyVersi" + + "on\022\014\n\004name\030\001 \001(\t\022J\n\005state\030\003 \001(\0162;.google" + + ".cloud.kms.v1.CryptoKeyVersion.CryptoKey" + + "VersionState\022/\n\013create_time\030\004 \001(\0132\032.goog" + + "le.protobuf.Timestamp\0220\n\014destroy_time\030\005 " + + "\001(\0132\032.google.protobuf.Timestamp\0226\n\022destr" + + "oy_event_time\030\006 \001(\0132\032.google.protobuf.Ti" + + "mestamp\"\202\001\n\025CryptoKeyVersionState\022(\n$CRY" + + "PTO_KEY_VERSION_STATE_UNSPECIFIED\020\000\022\013\n\007E" + + "NABLED\020\001\022\014\n\010DISABLED\020\002\022\r\n\tDESTROYED\020\003\022\025\n" + + "\021DESTROY_SCHEDULED\020\004B\225\001\n\027com.google.clou" + + "d.kms.v1B\021KmsResourcesProtoP\001Z6google.go" + + "lang.org/genproto/googleapis/cloud/kms/v" + + "1;kms\370\001\001\252\002\023Google.Cloud.Kms.V1\312\002\023Google\\" + + "Cloud\\Kms\\V1b\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.protobuf.DurationProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }, assigner); + internal_static_google_cloud_kms_v1_KeyRing_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_kms_v1_KeyRing_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_KeyRing_descriptor, + new java.lang.String[] { "Name", "CreateTime", }); + internal_static_google_cloud_kms_v1_CryptoKey_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_kms_v1_CryptoKey_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_CryptoKey_descriptor, + new java.lang.String[] { "Name", "Primary", "Purpose", "CreateTime", "NextRotationTime", "RotationPeriod", "Labels", "RotationSchedule", }); + internal_static_google_cloud_kms_v1_CryptoKey_LabelsEntry_descriptor = + internal_static_google_cloud_kms_v1_CryptoKey_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_kms_v1_CryptoKey_LabelsEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_CryptoKey_LabelsEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_google_cloud_kms_v1_CryptoKeyVersion_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_kms_v1_CryptoKeyVersion_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_kms_v1_CryptoKeyVersion_descriptor, + new java.lang.String[] { "Name", "State", "CreateTime", "DestroyTime", "DestroyEventTime", }); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.protobuf.DurationProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsRequest.java new file mode 100644 index 000000000000..5a6434941c8d --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsRequest.java @@ -0,0 +1,811 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeyVersionsRequest} + */ +public final class ListCryptoKeyVersionsRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ListCryptoKeyVersionsRequest) + ListCryptoKeyVersionsRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use ListCryptoKeyVersionsRequest.newBuilder() to construct. + private ListCryptoKeyVersionsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ListCryptoKeyVersionsRequest() { + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ListCryptoKeyVersionsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: { + + pageSize_ = input.readInt32(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.class, com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + *
+   * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to
+   * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can
+   * subsequently be obtained by including the
+   * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request.
+   * If unspecified, the server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2; + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.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.ListCryptoKeyVersionsRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest other = (com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest) obj; + + boolean result = true; + result = result && getParent() + .equals(other.getParent()); + result = result && (getPageSize() + == other.getPageSize()); + result = result && getPageToken() + .equals(other.getPageToken()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest 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.ListCryptoKeyVersionsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest 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.ListCryptoKeyVersionsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest 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.ListCryptoKeyVersionsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest 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.ListCryptoKeyVersionsRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest 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.ListCryptoKeyVersionsRequest 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.ListCryptoKeyVersionsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeyVersionsRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ListCryptoKeyVersionsRequest) + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.class, com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsRequest_descriptor; + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest build() { + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest buildPartial() { + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest result = new com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest) { + return mergeFrom((com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest other) { + if (other == com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+     * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to
+     * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can
+     * subsequently be obtained by including the
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request.
+     * If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public int getPageSize() { + return pageSize_; + } + /** + *
+     * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to
+     * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can
+     * subsequently be obtained by including the
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request.
+     * If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to
+     * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can
+     * subsequently be obtained by including the
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request.
+     * If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder setPageToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder setPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ListCryptoKeyVersionsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ListCryptoKeyVersionsRequest) + private static final com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest(); + } + + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public ListCryptoKeyVersionsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCryptoKeyVersionsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsRequestOrBuilder.java new file mode 100644 index 000000000000..cfe7fa7952f5 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsRequestOrBuilder.java @@ -0,0 +1,62 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface ListCryptoKeyVersionsRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.ListCryptoKeyVersionsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string parent = 1; + */ + java.lang.String getParent(); + /** + *
+   * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
+   * `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
+   * 
+ * + * string parent = 1; + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to
+   * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can
+   * subsequently be obtained by including the
+   * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request.
+   * If unspecified, the server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2; + */ + int getPageSize(); + + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + java.lang.String getPageToken(); + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + com.google.protobuf.ByteString + getPageTokenBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsResponse.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsResponse.java new file mode 100644 index 000000000000..7a02a5e67902 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsResponse.java @@ -0,0 +1,1084 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Response message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeyVersionsResponse} + */ +public final class ListCryptoKeyVersionsResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ListCryptoKeyVersionsResponse) + ListCryptoKeyVersionsResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use ListCryptoKeyVersionsResponse.newBuilder() to construct. + private ListCryptoKeyVersionsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ListCryptoKeyVersionsResponse() { + cryptoKeyVersions_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + totalSize_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ListCryptoKeyVersionsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeyVersions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + cryptoKeyVersions_.add( + input.readMessage(com.google.cloud.kms.v1.CryptoKeyVersion.parser(), extensionRegistry)); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + case 24: { + + totalSize_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeyVersions_ = java.util.Collections.unmodifiableList(cryptoKeyVersions_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.class, com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.Builder.class); + } + + private int bitField0_; + public static final int CRYPTO_KEY_VERSIONS_FIELD_NUMBER = 1; + private java.util.List cryptoKeyVersions_; + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public java.util.List getCryptoKeyVersionsList() { + return cryptoKeyVersions_; + } + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public java.util.List + getCryptoKeyVersionsOrBuilderList() { + return cryptoKeyVersions_; + } + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public int getCryptoKeyVersionsCount() { + return cryptoKeyVersions_.size(); + } + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersions(int index) { + return cryptoKeyVersions_.get(index); + } + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionsOrBuilder( + int index) { + return cryptoKeyVersions_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+   * results.
+   * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+   * results.
+   * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOTAL_SIZE_FIELD_NUMBER = 3; + private int totalSize_; + /** + *
+   * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
+   * query.
+   * 
+ * + * int32 total_size = 3; + */ + public int getTotalSize() { + return totalSize_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < cryptoKeyVersions_.size(); i++) { + output.writeMessage(1, cryptoKeyVersions_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + if (totalSize_ != 0) { + output.writeInt32(3, totalSize_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < cryptoKeyVersions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, cryptoKeyVersions_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + if (totalSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, totalSize_); + } + size += unknownFields.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.ListCryptoKeyVersionsResponse)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse other = (com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse) obj; + + boolean result = true; + result = result && getCryptoKeyVersionsList() + .equals(other.getCryptoKeyVersionsList()); + result = result && getNextPageToken() + .equals(other.getNextPageToken()); + result = result && (getTotalSize() + == other.getTotalSize()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getCryptoKeyVersionsCount() > 0) { + hash = (37 * hash) + CRYPTO_KEY_VERSIONS_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKeyVersionsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getTotalSize(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse 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.ListCryptoKeyVersionsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse 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.ListCryptoKeyVersionsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse 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.ListCryptoKeyVersionsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse 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.ListCryptoKeyVersionsResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse 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.ListCryptoKeyVersionsResponse 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.ListCryptoKeyVersionsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * Response message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeyVersionsResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ListCryptoKeyVersionsResponse) + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.class, com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getCryptoKeyVersionsFieldBuilder(); + } + } + public Builder clear() { + super.clear(); + if (cryptoKeyVersionsBuilder_ == null) { + cryptoKeyVersions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + cryptoKeyVersionsBuilder_.clear(); + } + nextPageToken_ = ""; + + totalSize_ = 0; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeyVersionsResponse_descriptor; + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse getDefaultInstanceForType() { + return com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse build() { + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse buildPartial() { + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse result = new com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (cryptoKeyVersionsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeyVersions_ = java.util.Collections.unmodifiableList(cryptoKeyVersions_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.cryptoKeyVersions_ = cryptoKeyVersions_; + } else { + result.cryptoKeyVersions_ = cryptoKeyVersionsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + result.totalSize_ = totalSize_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse) { + return mergeFrom((com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse other) { + if (other == com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.getDefaultInstance()) return this; + if (cryptoKeyVersionsBuilder_ == null) { + if (!other.cryptoKeyVersions_.isEmpty()) { + if (cryptoKeyVersions_.isEmpty()) { + cryptoKeyVersions_ = other.cryptoKeyVersions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.addAll(other.cryptoKeyVersions_); + } + onChanged(); + } + } else { + if (!other.cryptoKeyVersions_.isEmpty()) { + if (cryptoKeyVersionsBuilder_.isEmpty()) { + cryptoKeyVersionsBuilder_.dispose(); + cryptoKeyVersionsBuilder_ = null; + cryptoKeyVersions_ = other.cryptoKeyVersions_; + bitField0_ = (bitField0_ & ~0x00000001); + cryptoKeyVersionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getCryptoKeyVersionsFieldBuilder() : null; + } else { + cryptoKeyVersionsBuilder_.addAllMessages(other.cryptoKeyVersions_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + if (other.getTotalSize() != 0) { + setTotalSize(other.getTotalSize()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List cryptoKeyVersions_ = + java.util.Collections.emptyList(); + private void ensureCryptoKeyVersionsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeyVersions_ = new java.util.ArrayList(cryptoKeyVersions_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> cryptoKeyVersionsBuilder_; + + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public java.util.List getCryptoKeyVersionsList() { + if (cryptoKeyVersionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(cryptoKeyVersions_); + } else { + return cryptoKeyVersionsBuilder_.getMessageList(); + } + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public int getCryptoKeyVersionsCount() { + if (cryptoKeyVersionsBuilder_ == null) { + return cryptoKeyVersions_.size(); + } else { + return cryptoKeyVersionsBuilder_.getCount(); + } + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersions(int index) { + if (cryptoKeyVersionsBuilder_ == null) { + return cryptoKeyVersions_.get(index); + } else { + return cryptoKeyVersionsBuilder_.getMessage(index); + } + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder setCryptoKeyVersions( + int index, com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.set(index, value); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder setCryptoKeyVersions( + int index, com.google.cloud.kms.v1.CryptoKeyVersion.Builder builderForValue) { + if (cryptoKeyVersionsBuilder_ == null) { + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.set(index, builderForValue.build()); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder addCryptoKeyVersions(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.add(value); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder addCryptoKeyVersions( + int index, com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.add(index, value); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder addCryptoKeyVersions( + com.google.cloud.kms.v1.CryptoKeyVersion.Builder builderForValue) { + if (cryptoKeyVersionsBuilder_ == null) { + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.add(builderForValue.build()); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder addCryptoKeyVersions( + int index, com.google.cloud.kms.v1.CryptoKeyVersion.Builder builderForValue) { + if (cryptoKeyVersionsBuilder_ == null) { + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.add(index, builderForValue.build()); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder addAllCryptoKeyVersions( + java.lang.Iterable values) { + if (cryptoKeyVersionsBuilder_ == null) { + ensureCryptoKeyVersionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, cryptoKeyVersions_); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder clearCryptoKeyVersions() { + if (cryptoKeyVersionsBuilder_ == null) { + cryptoKeyVersions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.clear(); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public Builder removeCryptoKeyVersions(int index) { + if (cryptoKeyVersionsBuilder_ == null) { + ensureCryptoKeyVersionsIsMutable(); + cryptoKeyVersions_.remove(index); + onChanged(); + } else { + cryptoKeyVersionsBuilder_.remove(index); + } + return this; + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.Builder getCryptoKeyVersionsBuilder( + int index) { + return getCryptoKeyVersionsFieldBuilder().getBuilder(index); + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionsOrBuilder( + int index) { + if (cryptoKeyVersionsBuilder_ == null) { + return cryptoKeyVersions_.get(index); } else { + return cryptoKeyVersionsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public java.util.List + getCryptoKeyVersionsOrBuilderList() { + if (cryptoKeyVersionsBuilder_ != null) { + return cryptoKeyVersionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(cryptoKeyVersions_); + } + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.Builder addCryptoKeyVersionsBuilder() { + return getCryptoKeyVersionsFieldBuilder().addBuilder( + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance()); + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.Builder addCryptoKeyVersionsBuilder( + int index) { + return getCryptoKeyVersionsFieldBuilder().addBuilder( + index, com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance()); + } + /** + *
+     * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + public java.util.List + getCryptoKeyVersionsBuilderList() { + return getCryptoKeyVersionsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> + getCryptoKeyVersionsFieldBuilder() { + if (cryptoKeyVersionsBuilder_ == null) { + cryptoKeyVersionsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder>( + cryptoKeyVersions_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + cryptoKeyVersions_ = null; + } + return cryptoKeyVersionsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+     * results.
+     * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+     * results.
+     * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+     * results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+     * results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+     * results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + private int totalSize_ ; + /** + *
+     * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
+     * query.
+     * 
+ * + * int32 total_size = 3; + */ + public int getTotalSize() { + return totalSize_; + } + /** + *
+     * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
+     * query.
+     * 
+ * + * int32 total_size = 3; + */ + public Builder setTotalSize(int value) { + + totalSize_ = value; + onChanged(); + return this; + } + /** + *
+     * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
+     * query.
+     * 
+ * + * int32 total_size = 3; + */ + public Builder clearTotalSize() { + + totalSize_ = 0; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ListCryptoKeyVersionsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ListCryptoKeyVersionsResponse) + private static final com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse(); + } + + public static com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public ListCryptoKeyVersionsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCryptoKeyVersionsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsResponseOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsResponseOrBuilder.java new file mode 100644 index 000000000000..de185c53621c --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeyVersionsResponseOrBuilder.java @@ -0,0 +1,85 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface ListCryptoKeyVersionsResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.ListCryptoKeyVersionsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + java.util.List + getCryptoKeyVersionsList(); + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersions(int index); + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + int getCryptoKeyVersionsCount(); + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + java.util.List + getCryptoKeyVersionsOrBuilderList(); + /** + *
+   * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKeyVersion crypto_key_versions = 1; + */ + com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionsOrBuilder( + int index); + + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+   * results.
+   * 
+ * + * string next_page_token = 2; + */ + java.lang.String getNextPageToken(); + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of
+   * results.
+   * 
+ * + * string next_page_token = 2; + */ + com.google.protobuf.ByteString + getNextPageTokenBytes(); + + /** + *
+   * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
+   * query.
+   * 
+ * + * int32 total_size = 3; + */ + int getTotalSize(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysRequest.java new file mode 100644 index 000000000000..ed8c066e5e5e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysRequest.java @@ -0,0 +1,807 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeysRequest} + */ +public final class ListCryptoKeysRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ListCryptoKeysRequest) + ListCryptoKeysRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use ListCryptoKeysRequest.newBuilder() to construct. + private ListCryptoKeysRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ListCryptoKeysRequest() { + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ListCryptoKeysRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: { + + pageSize_ = input.readInt32(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeysRequest.class, com.google.cloud.kms.v1.ListCryptoKeysRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + *
+   * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + *
+   * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + *
+   * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the
+   * response.  Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by
+   * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent
+   * request.  If unspecified, the server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2; + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.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.ListCryptoKeysRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.ListCryptoKeysRequest other = (com.google.cloud.kms.v1.ListCryptoKeysRequest) obj; + + boolean result = true; + result = result && getParent() + .equals(other.getParent()); + result = result && (getPageSize() + == other.getPageSize()); + result = result && getPageToken() + .equals(other.getPageToken()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.ListCryptoKeysRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeysRequest 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.ListCryptoKeysRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeysRequest 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.ListCryptoKeysRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeysRequest 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.ListCryptoKeysRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeysRequest 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.ListCryptoKeysRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeysRequest 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.ListCryptoKeysRequest 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.ListCryptoKeysRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.ListCryptoKeysRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeysRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ListCryptoKeysRequest) + com.google.cloud.kms.v1.ListCryptoKeysRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeysRequest.class, com.google.cloud.kms.v1.ListCryptoKeysRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.ListCryptoKeysRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysRequest_descriptor; + } + + public com.google.cloud.kms.v1.ListCryptoKeysRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.ListCryptoKeysRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.ListCryptoKeysRequest build() { + com.google.cloud.kms.v1.ListCryptoKeysRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.ListCryptoKeysRequest buildPartial() { + com.google.cloud.kms.v1.ListCryptoKeysRequest result = new com.google.cloud.kms.v1.ListCryptoKeysRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.ListCryptoKeysRequest) { + return mergeFrom((com.google.cloud.kms.v1.ListCryptoKeysRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.ListCryptoKeysRequest other) { + if (other == com.google.cloud.kms.v1.ListCryptoKeysRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.ListCryptoKeysRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.ListCryptoKeysRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + *
+     * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+     * `projects/*/locations/*/keyRings/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the
+     * response.  Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by
+     * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent
+     * request.  If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public int getPageSize() { + return pageSize_; + } + /** + *
+     * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the
+     * response.  Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by
+     * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent
+     * request.  If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the
+     * response.  Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by
+     * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent
+     * request.  If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder setPageToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder setPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ListCryptoKeysRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ListCryptoKeysRequest) + private static final com.google.cloud.kms.v1.ListCryptoKeysRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ListCryptoKeysRequest(); + } + + public static com.google.cloud.kms.v1.ListCryptoKeysRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public ListCryptoKeysRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCryptoKeysRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.ListCryptoKeysRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysRequestOrBuilder.java new file mode 100644 index 000000000000..7825247f1017 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysRequestOrBuilder.java @@ -0,0 +1,61 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface ListCryptoKeysRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.ListCryptoKeysRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string parent = 1; + */ + java.lang.String getParent(); + /** + *
+   * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format
+   * `projects/*/locations/*/keyRings/*`.
+   * 
+ * + * string parent = 1; + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the
+   * response.  Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by
+   * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent
+   * request.  If unspecified, the server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2; + */ + int getPageSize(); + + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + java.lang.String getPageToken(); + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + com.google.protobuf.ByteString + getPageTokenBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysResponse.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysResponse.java new file mode 100644 index 000000000000..cc26d8a3a6fc --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysResponse.java @@ -0,0 +1,1073 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Response message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeysResponse} + */ +public final class ListCryptoKeysResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ListCryptoKeysResponse) + ListCryptoKeysResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use ListCryptoKeysResponse.newBuilder() to construct. + private ListCryptoKeysResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ListCryptoKeysResponse() { + cryptoKeys_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + totalSize_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ListCryptoKeysResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeys_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + cryptoKeys_.add( + input.readMessage(com.google.cloud.kms.v1.CryptoKey.parser(), extensionRegistry)); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + case 24: { + + totalSize_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeys_ = java.util.Collections.unmodifiableList(cryptoKeys_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeysResponse.class, com.google.cloud.kms.v1.ListCryptoKeysResponse.Builder.class); + } + + private int bitField0_; + public static final int CRYPTO_KEYS_FIELD_NUMBER = 1; + private java.util.List cryptoKeys_; + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public java.util.List getCryptoKeysList() { + return cryptoKeys_; + } + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public java.util.List + getCryptoKeysOrBuilderList() { + return cryptoKeys_; + } + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public int getCryptoKeysCount() { + return cryptoKeys_.size(); + } + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKeys(int index) { + return cryptoKeys_.get(index); + } + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeysOrBuilder( + int index) { + return cryptoKeys_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOTAL_SIZE_FIELD_NUMBER = 3; + private int totalSize_; + /** + *
+   * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query.
+   * 
+ * + * int32 total_size = 3; + */ + public int getTotalSize() { + return totalSize_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < cryptoKeys_.size(); i++) { + output.writeMessage(1, cryptoKeys_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + if (totalSize_ != 0) { + output.writeInt32(3, totalSize_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < cryptoKeys_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, cryptoKeys_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + if (totalSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, totalSize_); + } + size += unknownFields.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.ListCryptoKeysResponse)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.ListCryptoKeysResponse other = (com.google.cloud.kms.v1.ListCryptoKeysResponse) obj; + + boolean result = true; + result = result && getCryptoKeysList() + .equals(other.getCryptoKeysList()); + result = result && getNextPageToken() + .equals(other.getNextPageToken()); + result = result && (getTotalSize() + == other.getTotalSize()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getCryptoKeysCount() > 0) { + hash = (37 * hash) + CRYPTO_KEYS_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKeysList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getTotalSize(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.ListCryptoKeysResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeysResponse 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.ListCryptoKeysResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeysResponse 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.ListCryptoKeysResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListCryptoKeysResponse 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.ListCryptoKeysResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeysResponse 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.ListCryptoKeysResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListCryptoKeysResponse 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.ListCryptoKeysResponse 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.ListCryptoKeysResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.ListCryptoKeysResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * Response message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListCryptoKeysResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ListCryptoKeysResponse) + com.google.cloud.kms.v1.ListCryptoKeysResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListCryptoKeysResponse.class, com.google.cloud.kms.v1.ListCryptoKeysResponse.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.ListCryptoKeysResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getCryptoKeysFieldBuilder(); + } + } + public Builder clear() { + super.clear(); + if (cryptoKeysBuilder_ == null) { + cryptoKeys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + cryptoKeysBuilder_.clear(); + } + nextPageToken_ = ""; + + totalSize_ = 0; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListCryptoKeysResponse_descriptor; + } + + public com.google.cloud.kms.v1.ListCryptoKeysResponse getDefaultInstanceForType() { + return com.google.cloud.kms.v1.ListCryptoKeysResponse.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.ListCryptoKeysResponse build() { + com.google.cloud.kms.v1.ListCryptoKeysResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.ListCryptoKeysResponse buildPartial() { + com.google.cloud.kms.v1.ListCryptoKeysResponse result = new com.google.cloud.kms.v1.ListCryptoKeysResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (cryptoKeysBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeys_ = java.util.Collections.unmodifiableList(cryptoKeys_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.cryptoKeys_ = cryptoKeys_; + } else { + result.cryptoKeys_ = cryptoKeysBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + result.totalSize_ = totalSize_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.ListCryptoKeysResponse) { + return mergeFrom((com.google.cloud.kms.v1.ListCryptoKeysResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.ListCryptoKeysResponse other) { + if (other == com.google.cloud.kms.v1.ListCryptoKeysResponse.getDefaultInstance()) return this; + if (cryptoKeysBuilder_ == null) { + if (!other.cryptoKeys_.isEmpty()) { + if (cryptoKeys_.isEmpty()) { + cryptoKeys_ = other.cryptoKeys_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCryptoKeysIsMutable(); + cryptoKeys_.addAll(other.cryptoKeys_); + } + onChanged(); + } + } else { + if (!other.cryptoKeys_.isEmpty()) { + if (cryptoKeysBuilder_.isEmpty()) { + cryptoKeysBuilder_.dispose(); + cryptoKeysBuilder_ = null; + cryptoKeys_ = other.cryptoKeys_; + bitField0_ = (bitField0_ & ~0x00000001); + cryptoKeysBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getCryptoKeysFieldBuilder() : null; + } else { + cryptoKeysBuilder_.addAllMessages(other.cryptoKeys_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + if (other.getTotalSize() != 0) { + setTotalSize(other.getTotalSize()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.ListCryptoKeysResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.ListCryptoKeysResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List cryptoKeys_ = + java.util.Collections.emptyList(); + private void ensureCryptoKeysIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + cryptoKeys_ = new java.util.ArrayList(cryptoKeys_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder> cryptoKeysBuilder_; + + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public java.util.List getCryptoKeysList() { + if (cryptoKeysBuilder_ == null) { + return java.util.Collections.unmodifiableList(cryptoKeys_); + } else { + return cryptoKeysBuilder_.getMessageList(); + } + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public int getCryptoKeysCount() { + if (cryptoKeysBuilder_ == null) { + return cryptoKeys_.size(); + } else { + return cryptoKeysBuilder_.getCount(); + } + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKeys(int index) { + if (cryptoKeysBuilder_ == null) { + return cryptoKeys_.get(index); + } else { + return cryptoKeysBuilder_.getMessage(index); + } + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder setCryptoKeys( + int index, com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCryptoKeysIsMutable(); + cryptoKeys_.set(index, value); + onChanged(); + } else { + cryptoKeysBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder setCryptoKeys( + int index, com.google.cloud.kms.v1.CryptoKey.Builder builderForValue) { + if (cryptoKeysBuilder_ == null) { + ensureCryptoKeysIsMutable(); + cryptoKeys_.set(index, builderForValue.build()); + onChanged(); + } else { + cryptoKeysBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder addCryptoKeys(com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCryptoKeysIsMutable(); + cryptoKeys_.add(value); + onChanged(); + } else { + cryptoKeysBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder addCryptoKeys( + int index, com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCryptoKeysIsMutable(); + cryptoKeys_.add(index, value); + onChanged(); + } else { + cryptoKeysBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder addCryptoKeys( + com.google.cloud.kms.v1.CryptoKey.Builder builderForValue) { + if (cryptoKeysBuilder_ == null) { + ensureCryptoKeysIsMutable(); + cryptoKeys_.add(builderForValue.build()); + onChanged(); + } else { + cryptoKeysBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder addCryptoKeys( + int index, com.google.cloud.kms.v1.CryptoKey.Builder builderForValue) { + if (cryptoKeysBuilder_ == null) { + ensureCryptoKeysIsMutable(); + cryptoKeys_.add(index, builderForValue.build()); + onChanged(); + } else { + cryptoKeysBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder addAllCryptoKeys( + java.lang.Iterable values) { + if (cryptoKeysBuilder_ == null) { + ensureCryptoKeysIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, cryptoKeys_); + onChanged(); + } else { + cryptoKeysBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder clearCryptoKeys() { + if (cryptoKeysBuilder_ == null) { + cryptoKeys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + cryptoKeysBuilder_.clear(); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public Builder removeCryptoKeys(int index) { + if (cryptoKeysBuilder_ == null) { + ensureCryptoKeysIsMutable(); + cryptoKeys_.remove(index); + onChanged(); + } else { + cryptoKeysBuilder_.remove(index); + } + return this; + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKey.Builder getCryptoKeysBuilder( + int index) { + return getCryptoKeysFieldBuilder().getBuilder(index); + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeysOrBuilder( + int index) { + if (cryptoKeysBuilder_ == null) { + return cryptoKeys_.get(index); } else { + return cryptoKeysBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public java.util.List + getCryptoKeysOrBuilderList() { + if (cryptoKeysBuilder_ != null) { + return cryptoKeysBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(cryptoKeys_); + } + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKey.Builder addCryptoKeysBuilder() { + return getCryptoKeysFieldBuilder().addBuilder( + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance()); + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public com.google.cloud.kms.v1.CryptoKey.Builder addCryptoKeysBuilder( + int index) { + return getCryptoKeysFieldBuilder().addBuilder( + index, com.google.cloud.kms.v1.CryptoKey.getDefaultInstance()); + } + /** + *
+     * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+     * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + public java.util.List + getCryptoKeysBuilderList() { + return getCryptoKeysFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder> + getCryptoKeysFieldBuilder() { + if (cryptoKeysBuilder_ == null) { + cryptoKeysBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder>( + cryptoKeys_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + cryptoKeys_ = null; + } + return cryptoKeysBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + private int totalSize_ ; + /** + *
+     * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query.
+     * 
+ * + * int32 total_size = 3; + */ + public int getTotalSize() { + return totalSize_; + } + /** + *
+     * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query.
+     * 
+ * + * int32 total_size = 3; + */ + public Builder setTotalSize(int value) { + + totalSize_ = value; + onChanged(); + return this; + } + /** + *
+     * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query.
+     * 
+ * + * int32 total_size = 3; + */ + public Builder clearTotalSize() { + + totalSize_ = 0; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ListCryptoKeysResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ListCryptoKeysResponse) + private static final com.google.cloud.kms.v1.ListCryptoKeysResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ListCryptoKeysResponse(); + } + + public static com.google.cloud.kms.v1.ListCryptoKeysResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public ListCryptoKeysResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListCryptoKeysResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.ListCryptoKeysResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysResponseOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysResponseOrBuilder.java new file mode 100644 index 000000000000..0862a6cac55e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListCryptoKeysResponseOrBuilder.java @@ -0,0 +1,82 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface ListCryptoKeysResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.ListCryptoKeysResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + java.util.List + getCryptoKeysList(); + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + com.google.cloud.kms.v1.CryptoKey getCryptoKeys(int index); + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + int getCryptoKeysCount(); + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + java.util.List + getCryptoKeysOrBuilderList(); + /** + *
+   * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
+   * 
+ * + * repeated .google.cloud.kms.v1.CryptoKey crypto_keys = 1; + */ + com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeysOrBuilder( + int index); + + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + java.lang.String getNextPageToken(); + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + com.google.protobuf.ByteString + getNextPageTokenBytes(); + + /** + *
+   * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query.
+   * 
+ * + * int32 total_size = 3; + */ + int getTotalSize(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsRequest.java new file mode 100644 index 000000000000..32dc3278bc64 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsRequest.java @@ -0,0 +1,807 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListKeyRingsRequest} + */ +public final class ListKeyRingsRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ListKeyRingsRequest) + ListKeyRingsRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use ListKeyRingsRequest.newBuilder() to construct. + private ListKeyRingsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ListKeyRingsRequest() { + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ListKeyRingsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: { + + pageSize_ = input.readInt32(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListKeyRingsRequest.class, com.google.cloud.kms.v1.ListKeyRingsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + 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(); + parent_ = s; + return s; + } + } + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + *
+   * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the
+   * response.  Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
+   * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent
+   * request.  If unspecified, the server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2; + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + 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(); + pageToken_ = s; + return s; + } + } + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.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.ListKeyRingsRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.ListKeyRingsRequest other = (com.google.cloud.kms.v1.ListKeyRingsRequest) obj; + + boolean result = true; + result = result && getParent() + .equals(other.getParent()); + result = result && (getPageSize() + == other.getPageSize()); + result = result && getPageToken() + .equals(other.getPageToken()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.ListKeyRingsRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListKeyRingsRequest 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.ListKeyRingsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListKeyRingsRequest 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.ListKeyRingsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListKeyRingsRequest 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.ListKeyRingsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListKeyRingsRequest 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.ListKeyRingsRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListKeyRingsRequest 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.ListKeyRingsRequest 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.ListKeyRingsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.ListKeyRingsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListKeyRingsRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ListKeyRingsRequest) + com.google.cloud.kms.v1.ListKeyRingsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListKeyRingsRequest.class, com.google.cloud.kms.v1.ListKeyRingsRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.ListKeyRingsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsRequest_descriptor; + } + + public com.google.cloud.kms.v1.ListKeyRingsRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.ListKeyRingsRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.ListKeyRingsRequest build() { + com.google.cloud.kms.v1.ListKeyRingsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.ListKeyRingsRequest buildPartial() { + com.google.cloud.kms.v1.ListKeyRingsRequest result = new com.google.cloud.kms.v1.ListKeyRingsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.ListKeyRingsRequest) { + return mergeFrom((com.google.cloud.kms.v1.ListKeyRingsRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.ListKeyRingsRequest other) { + if (other == com.google.cloud.kms.v1.ListKeyRingsRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.ListKeyRingsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.ListKeyRingsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + *
+     * Required. The resource name of the location associated with the
+     * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+     * 
+ * + * string parent = 1; + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the
+     * response.  Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
+     * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent
+     * request.  If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public int getPageSize() { + return pageSize_; + } + /** + *
+     * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the
+     * response.  Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
+     * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent
+     * request.  If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the
+     * response.  Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
+     * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent
+     * request.  If unspecified, the server will pick an appropriate default.
+     * 
+ * + * int32 page_size = 2; + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder setPageToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + *
+     * Optional pagination token, returned earlier via
+     * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+     * 
+ * + * string page_token = 3; + */ + public Builder setPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ListKeyRingsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ListKeyRingsRequest) + private static final com.google.cloud.kms.v1.ListKeyRingsRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ListKeyRingsRequest(); + } + + public static com.google.cloud.kms.v1.ListKeyRingsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public ListKeyRingsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListKeyRingsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.ListKeyRingsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsRequestOrBuilder.java new file mode 100644 index 000000000000..3f9061087746 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsRequestOrBuilder.java @@ -0,0 +1,61 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface ListKeyRingsRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.ListKeyRingsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + java.lang.String getParent(); + /** + *
+   * Required. The resource name of the location associated with the
+   * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`.
+   * 
+ * + * string parent = 1; + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the
+   * response.  Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
+   * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent
+   * request.  If unspecified, the server will pick an appropriate default.
+   * 
+ * + * int32 page_size = 2; + */ + int getPageSize(); + + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + java.lang.String getPageToken(); + /** + *
+   * Optional pagination token, returned earlier via
+   * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
+   * 
+ * + * string page_token = 3; + */ + com.google.protobuf.ByteString + getPageTokenBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsResponse.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsResponse.java new file mode 100644 index 000000000000..db6d714f181e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsResponse.java @@ -0,0 +1,1073 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Response message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListKeyRingsResponse} + */ +public final class ListKeyRingsResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ListKeyRingsResponse) + ListKeyRingsResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use ListKeyRingsResponse.newBuilder() to construct. + private ListKeyRingsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ListKeyRingsResponse() { + keyRings_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + totalSize_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ListKeyRingsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + keyRings_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + keyRings_.add( + input.readMessage(com.google.cloud.kms.v1.KeyRing.parser(), extensionRegistry)); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + case 24: { + + totalSize_ = input.readInt32(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + keyRings_ = java.util.Collections.unmodifiableList(keyRings_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListKeyRingsResponse.class, com.google.cloud.kms.v1.ListKeyRingsResponse.Builder.class); + } + + private int bitField0_; + public static final int KEY_RINGS_FIELD_NUMBER = 1; + private java.util.List keyRings_; + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public java.util.List getKeyRingsList() { + return keyRings_; + } + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public java.util.List + getKeyRingsOrBuilderList() { + return keyRings_; + } + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public int getKeyRingsCount() { + return keyRings_.size(); + } + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRing getKeyRings(int index) { + return keyRings_.get(index); + } + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingsOrBuilder( + int index) { + return keyRings_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + 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(); + nextPageToken_ = s; + return s; + } + } + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOTAL_SIZE_FIELD_NUMBER = 3; + private int totalSize_; + /** + *
+   * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query.
+   * 
+ * + * int32 total_size = 3; + */ + public int getTotalSize() { + return totalSize_; + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < keyRings_.size(); i++) { + output.writeMessage(1, keyRings_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + if (totalSize_ != 0) { + output.writeInt32(3, totalSize_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < keyRings_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, keyRings_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + if (totalSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, totalSize_); + } + size += unknownFields.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.ListKeyRingsResponse)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.ListKeyRingsResponse other = (com.google.cloud.kms.v1.ListKeyRingsResponse) obj; + + boolean result = true; + result = result && getKeyRingsList() + .equals(other.getKeyRingsList()); + result = result && getNextPageToken() + .equals(other.getNextPageToken()); + result = result && (getTotalSize() + == other.getTotalSize()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getKeyRingsCount() > 0) { + hash = (37 * hash) + KEY_RINGS_FIELD_NUMBER; + hash = (53 * hash) + getKeyRingsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (37 * hash) + TOTAL_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getTotalSize(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.ListKeyRingsResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListKeyRingsResponse 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.ListKeyRingsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListKeyRingsResponse 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.ListKeyRingsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.ListKeyRingsResponse 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.ListKeyRingsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListKeyRingsResponse 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.ListKeyRingsResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.ListKeyRingsResponse 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.ListKeyRingsResponse 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.ListKeyRingsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.ListKeyRingsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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; + } + /** + *
+   * Response message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.ListKeyRingsResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ListKeyRingsResponse) + com.google.cloud.kms.v1.ListKeyRingsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.ListKeyRingsResponse.class, com.google.cloud.kms.v1.ListKeyRingsResponse.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.ListKeyRingsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getKeyRingsFieldBuilder(); + } + } + public Builder clear() { + super.clear(); + if (keyRingsBuilder_ == null) { + keyRings_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + keyRingsBuilder_.clear(); + } + nextPageToken_ = ""; + + totalSize_ = 0; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_ListKeyRingsResponse_descriptor; + } + + public com.google.cloud.kms.v1.ListKeyRingsResponse getDefaultInstanceForType() { + return com.google.cloud.kms.v1.ListKeyRingsResponse.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.ListKeyRingsResponse build() { + com.google.cloud.kms.v1.ListKeyRingsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.ListKeyRingsResponse buildPartial() { + com.google.cloud.kms.v1.ListKeyRingsResponse result = new com.google.cloud.kms.v1.ListKeyRingsResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (keyRingsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + keyRings_ = java.util.Collections.unmodifiableList(keyRings_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.keyRings_ = keyRings_; + } else { + result.keyRings_ = keyRingsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + result.totalSize_ = totalSize_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.ListKeyRingsResponse) { + return mergeFrom((com.google.cloud.kms.v1.ListKeyRingsResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.ListKeyRingsResponse other) { + if (other == com.google.cloud.kms.v1.ListKeyRingsResponse.getDefaultInstance()) return this; + if (keyRingsBuilder_ == null) { + if (!other.keyRings_.isEmpty()) { + if (keyRings_.isEmpty()) { + keyRings_ = other.keyRings_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureKeyRingsIsMutable(); + keyRings_.addAll(other.keyRings_); + } + onChanged(); + } + } else { + if (!other.keyRings_.isEmpty()) { + if (keyRingsBuilder_.isEmpty()) { + keyRingsBuilder_.dispose(); + keyRingsBuilder_ = null; + keyRings_ = other.keyRings_; + bitField0_ = (bitField0_ & ~0x00000001); + keyRingsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getKeyRingsFieldBuilder() : null; + } else { + keyRingsBuilder_.addAllMessages(other.keyRings_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + if (other.getTotalSize() != 0) { + setTotalSize(other.getTotalSize()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.ListKeyRingsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.ListKeyRingsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List keyRings_ = + java.util.Collections.emptyList(); + private void ensureKeyRingsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + keyRings_ = new java.util.ArrayList(keyRings_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.KeyRing, com.google.cloud.kms.v1.KeyRing.Builder, com.google.cloud.kms.v1.KeyRingOrBuilder> keyRingsBuilder_; + + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public java.util.List getKeyRingsList() { + if (keyRingsBuilder_ == null) { + return java.util.Collections.unmodifiableList(keyRings_); + } else { + return keyRingsBuilder_.getMessageList(); + } + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public int getKeyRingsCount() { + if (keyRingsBuilder_ == null) { + return keyRings_.size(); + } else { + return keyRingsBuilder_.getCount(); + } + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRing getKeyRings(int index) { + if (keyRingsBuilder_ == null) { + return keyRings_.get(index); + } else { + return keyRingsBuilder_.getMessage(index); + } + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder setKeyRings( + int index, com.google.cloud.kms.v1.KeyRing value) { + if (keyRingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeyRingsIsMutable(); + keyRings_.set(index, value); + onChanged(); + } else { + keyRingsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder setKeyRings( + int index, com.google.cloud.kms.v1.KeyRing.Builder builderForValue) { + if (keyRingsBuilder_ == null) { + ensureKeyRingsIsMutable(); + keyRings_.set(index, builderForValue.build()); + onChanged(); + } else { + keyRingsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder addKeyRings(com.google.cloud.kms.v1.KeyRing value) { + if (keyRingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeyRingsIsMutable(); + keyRings_.add(value); + onChanged(); + } else { + keyRingsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder addKeyRings( + int index, com.google.cloud.kms.v1.KeyRing value) { + if (keyRingsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeyRingsIsMutable(); + keyRings_.add(index, value); + onChanged(); + } else { + keyRingsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder addKeyRings( + com.google.cloud.kms.v1.KeyRing.Builder builderForValue) { + if (keyRingsBuilder_ == null) { + ensureKeyRingsIsMutable(); + keyRings_.add(builderForValue.build()); + onChanged(); + } else { + keyRingsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder addKeyRings( + int index, com.google.cloud.kms.v1.KeyRing.Builder builderForValue) { + if (keyRingsBuilder_ == null) { + ensureKeyRingsIsMutable(); + keyRings_.add(index, builderForValue.build()); + onChanged(); + } else { + keyRingsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder addAllKeyRings( + java.lang.Iterable values) { + if (keyRingsBuilder_ == null) { + ensureKeyRingsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, keyRings_); + onChanged(); + } else { + keyRingsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder clearKeyRings() { + if (keyRingsBuilder_ == null) { + keyRings_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + keyRingsBuilder_.clear(); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public Builder removeKeyRings(int index) { + if (keyRingsBuilder_ == null) { + ensureKeyRingsIsMutable(); + keyRings_.remove(index); + onChanged(); + } else { + keyRingsBuilder_.remove(index); + } + return this; + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRing.Builder getKeyRingsBuilder( + int index) { + return getKeyRingsFieldBuilder().getBuilder(index); + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingsOrBuilder( + int index) { + if (keyRingsBuilder_ == null) { + return keyRings_.get(index); } else { + return keyRingsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public java.util.List + getKeyRingsOrBuilderList() { + if (keyRingsBuilder_ != null) { + return keyRingsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(keyRings_); + } + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRing.Builder addKeyRingsBuilder() { + return getKeyRingsFieldBuilder().addBuilder( + com.google.cloud.kms.v1.KeyRing.getDefaultInstance()); + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public com.google.cloud.kms.v1.KeyRing.Builder addKeyRingsBuilder( + int index) { + return getKeyRingsFieldBuilder().addBuilder( + index, com.google.cloud.kms.v1.KeyRing.getDefaultInstance()); + } + /** + *
+     * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+     * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + public java.util.List + getKeyRingsBuilderList() { + return getKeyRingsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.KeyRing, com.google.cloud.kms.v1.KeyRing.Builder, com.google.cloud.kms.v1.KeyRingOrBuilder> + getKeyRingsFieldBuilder() { + if (keyRingsBuilder_ == null) { + keyRingsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.kms.v1.KeyRing, com.google.cloud.kms.v1.KeyRing.Builder, com.google.cloud.kms.v1.KeyRingOrBuilder>( + keyRings_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + keyRings_ = null; + } + return keyRingsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + *
+     * A token to retrieve next page of results. Pass this value in
+     * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + private int totalSize_ ; + /** + *
+     * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query.
+     * 
+ * + * int32 total_size = 3; + */ + public int getTotalSize() { + return totalSize_; + } + /** + *
+     * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query.
+     * 
+ * + * int32 total_size = 3; + */ + public Builder setTotalSize(int value) { + + totalSize_ = value; + onChanged(); + return this; + } + /** + *
+     * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query.
+     * 
+ * + * int32 total_size = 3; + */ + public Builder clearTotalSize() { + + totalSize_ = 0; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ListKeyRingsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ListKeyRingsResponse) + private static final com.google.cloud.kms.v1.ListKeyRingsResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ListKeyRingsResponse(); + } + + public static com.google.cloud.kms.v1.ListKeyRingsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public ListKeyRingsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListKeyRingsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.ListKeyRingsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsResponseOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsResponseOrBuilder.java new file mode 100644 index 000000000000..fb15181a302e --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/ListKeyRingsResponseOrBuilder.java @@ -0,0 +1,82 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface ListKeyRingsResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.ListKeyRingsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + java.util.List + getKeyRingsList(); + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + com.google.cloud.kms.v1.KeyRing getKeyRings(int index); + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + int getKeyRingsCount(); + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + java.util.List + getKeyRingsOrBuilderList(); + /** + *
+   * The list of [KeyRings][google.cloud.kms.v1.KeyRing].
+   * 
+ * + * repeated .google.cloud.kms.v1.KeyRing key_rings = 1; + */ + com.google.cloud.kms.v1.KeyRingOrBuilder getKeyRingsOrBuilder( + int index); + + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + java.lang.String getNextPageToken(); + /** + *
+   * A token to retrieve next page of results. Pass this value in
+   * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results.
+   * 
+ * + * string next_page_token = 2; + */ + com.google.protobuf.ByteString + getNextPageTokenBytes(); + + /** + *
+   * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query.
+   * 
+ * + * int32 total_size = 3; + */ + int getTotalSize(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/LocationName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/LocationName.java new file mode 100644 index 000000000000..ea2c9a8f9064 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/LocationName.java @@ -0,0 +1,189 @@ +/* + * Copyright 2018 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 + * + * http://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.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import java.util.Map; +import java.util.ArrayList; +import java.util.List; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class LocationName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + + private volatile Map fieldValuesMap; + + private final String project; + private final String location; + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public static LocationName 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 LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch(formattedString, "LocationName.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 (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("project", project); + fieldMapBuilder.put("location", location); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("project", project, "location", location); + } + + /** Builder for LocationName. */ + public static class Builder { + + private String project; + private String location; + + 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() { + } + + private Builder(LocationName locationName) { + project = locationName.project; + location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof LocationName) { + LocationName that = (LocationName) o; + return (this.project.equals(that.project)) + && (this.location.equals(that.location)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= project.hashCode(); + h *= 1000003; + h ^= location.hashCode(); + return h; + } +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/RestoreCryptoKeyVersionRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/RestoreCryptoKeyVersionRequest.java new file mode 100644 index 000000000000..0d47dc465582 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/RestoreCryptoKeyVersionRequest.java @@ -0,0 +1,552 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} + */ +public final class RestoreCryptoKeyVersionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) + RestoreCryptoKeyVersionRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use RestoreCryptoKeyVersionRequest.newBuilder() to construct. + private RestoreCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private RestoreCryptoKeyVersionRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private RestoreCryptoKeyVersionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+   * 
+ * + * string name = 1; + */ + 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; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.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.RestoreCryptoKeyVersionRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest other = (com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest 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.RestoreCryptoKeyVersionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest 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.RestoreCryptoKeyVersionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest 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.RestoreCryptoKeyVersionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest 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.RestoreCryptoKeyVersionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest 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.RestoreCryptoKeyVersionRequest 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.RestoreCryptoKeyVersionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.RestoreCryptoKeyVersionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_RestoreCryptoKeyVersionRequest_descriptor; + } + + public com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest build() { + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest buildPartial() { + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest result = new com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) { + return mergeFrom((com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest other) { + if (other == com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) + private static final com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest(); + } + + public static com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public RestoreCryptoKeyVersionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RestoreCryptoKeyVersionRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/RestoreCryptoKeyVersionRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/RestoreCryptoKeyVersionRequestOrBuilder.java new file mode 100644 index 000000000000..9820a7958a53 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/RestoreCryptoKeyVersionRequestOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface RestoreCryptoKeyVersionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.RestoreCryptoKeyVersionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UntypedKeyName.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UntypedKeyName.java new file mode 100644 index 000000000000..8427ac995ad8 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UntypedKeyName.java @@ -0,0 +1,103 @@ +/* + * Copyright 2018 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 + * + * http://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.common.base.Preconditions; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class UntypedKeyName extends KeyName { + + private final String rawValue; + private Map valueMap; + + private UntypedKeyName(String rawValue) { + this.rawValue = Preconditions.checkNotNull(rawValue); + this.valueMap = ImmutableMap.of("", rawValue); + } + + public static UntypedKeyName from(ResourceName resourceName) { + return new UntypedKeyName(resourceName.toString()); + } + + public static UntypedKeyName parse(String formattedString) { + return new UntypedKeyName(formattedString); + } + + 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 (UntypedKeyName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return true; + } + + /** + * Return a map with a single value rawValue keyed on an empty String "". + */ + public Map getFieldValuesMap() { + return valueMap; + } + + /** + * Return the initial rawValue if @param fieldName is an empty String, else return null. + */ + public String getFieldValue(String fieldName) { + return valueMap.get(fieldName); + } + + @Override + public String toString() { + return rawValue; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof UntypedKeyName) { + UntypedKeyName that = (UntypedKeyName) o; + return this.rawValue.equals(that.rawValue); + } + return false; + } + + @Override + public int hashCode() { + return rawValue.hashCode(); + } +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyPrimaryVersionRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyPrimaryVersionRequest.java new file mode 100644 index 000000000000..fb490cad6258 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyPrimaryVersionRequest.java @@ -0,0 +1,707 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} + */ +public final class UpdateCryptoKeyPrimaryVersionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) + UpdateCryptoKeyPrimaryVersionRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use UpdateCryptoKeyPrimaryVersionRequest.newBuilder() to construct. + private UpdateCryptoKeyPrimaryVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private UpdateCryptoKeyPrimaryVersionRequest() { + name_ = ""; + cryptoKeyVersionId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private UpdateCryptoKeyPrimaryVersionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + cryptoKeyVersionId_ = s; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.class, com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+   * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+   * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+   * 
+ * + * string name = 1; + */ + 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 CRYPTO_KEY_VERSION_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object cryptoKeyVersionId_; + /** + *
+   * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+   * 
+ * + * string crypto_key_version_id = 2; + */ + public java.lang.String getCryptoKeyVersionId() { + java.lang.Object ref = cryptoKeyVersionId_; + 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(); + cryptoKeyVersionId_ = s; + return s; + } + } + /** + *
+   * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+   * 
+ * + * string crypto_key_version_id = 2; + */ + public com.google.protobuf.ByteString + getCryptoKeyVersionIdBytes() { + java.lang.Object ref = cryptoKeyVersionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + cryptoKeyVersionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getCryptoKeyVersionIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, cryptoKeyVersionId_); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getCryptoKeyVersionIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, cryptoKeyVersionId_); + } + size += unknownFields.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.UpdateCryptoKeyPrimaryVersionRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest other = (com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) obj; + + boolean result = true; + result = result && getName() + .equals(other.getName()); + result = result && getCryptoKeyVersionId() + .equals(other.getCryptoKeyVersionId()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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) + CRYPTO_KEY_VERSION_ID_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKeyVersionId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest 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.UpdateCryptoKeyPrimaryVersionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest 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.UpdateCryptoKeyPrimaryVersionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest 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.UpdateCryptoKeyPrimaryVersionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest 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.UpdateCryptoKeyPrimaryVersionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest 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.UpdateCryptoKeyPrimaryVersionRequest 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.UpdateCryptoKeyPrimaryVersionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.class, com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + name_ = ""; + + cryptoKeyVersionId_ = ""; + + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyPrimaryVersionRequest_descriptor; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest build() { + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest buildPartial() { + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest result = new com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest(this); + result.name_ = name_; + result.cryptoKeyVersionId_ = cryptoKeyVersionId_; + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) { + return mergeFrom((com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest other) { + if (other == com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getCryptoKeyVersionId().isEmpty()) { + cryptoKeyVersionId_ = other.cryptoKeyVersionId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+     * 
+ * + * string name = 1; + */ + 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; + } + } + /** + *
+     * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+     * 
+ * + * string name = 1; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+     * 
+ * + * string name = 1; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+     * 
+ * + * string name = 1; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object cryptoKeyVersionId_ = ""; + /** + *
+     * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+     * 
+ * + * string crypto_key_version_id = 2; + */ + public java.lang.String getCryptoKeyVersionId() { + java.lang.Object ref = cryptoKeyVersionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + cryptoKeyVersionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+     * 
+ * + * string crypto_key_version_id = 2; + */ + public com.google.protobuf.ByteString + getCryptoKeyVersionIdBytes() { + java.lang.Object ref = cryptoKeyVersionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + cryptoKeyVersionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+     * 
+ * + * string crypto_key_version_id = 2; + */ + public Builder setCryptoKeyVersionId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + cryptoKeyVersionId_ = value; + onChanged(); + return this; + } + /** + *
+     * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+     * 
+ * + * string crypto_key_version_id = 2; + */ + public Builder clearCryptoKeyVersionId() { + + cryptoKeyVersionId_ = getDefaultInstance().getCryptoKeyVersionId(); + onChanged(); + return this; + } + /** + *
+     * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+     * 
+ * + * string crypto_key_version_id = 2; + */ + public Builder setCryptoKeyVersionIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + cryptoKeyVersionId_ = value; + onChanged(); + return this; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) + private static final com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest(); + } + + public static com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public UpdateCryptoKeyPrimaryVersionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateCryptoKeyPrimaryVersionRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyPrimaryVersionRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyPrimaryVersionRequestOrBuilder.java new file mode 100644 index 000000000000..cabe56bb1afc --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyPrimaryVersionRequestOrBuilder.java @@ -0,0 +1,45 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface UpdateCryptoKeyPrimaryVersionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+   * 
+ * + * string name = 1; + */ + java.lang.String getName(); + /** + *
+   * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
+   * 
+ * + * string name = 1; + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+   * 
+ * + * string crypto_key_version_id = 2; + */ + java.lang.String getCryptoKeyVersionId(); + /** + *
+   * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
+   * 
+ * + * string crypto_key_version_id = 2; + */ + com.google.protobuf.ByteString + getCryptoKeyVersionIdBytes(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyRequest.java new file mode 100644 index 000000000000..23cc354d777a --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyRequest.java @@ -0,0 +1,855 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateCryptoKeyRequest} + */ +public final class UpdateCryptoKeyRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.UpdateCryptoKeyRequest) + UpdateCryptoKeyRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use UpdateCryptoKeyRequest.newBuilder() to construct. + private UpdateCryptoKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private UpdateCryptoKeyRequest() { + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private UpdateCryptoKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + com.google.cloud.kms.v1.CryptoKey.Builder subBuilder = null; + if (cryptoKey_ != null) { + subBuilder = cryptoKey_.toBuilder(); + } + cryptoKey_ = input.readMessage(com.google.cloud.kms.v1.CryptoKey.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(cryptoKey_); + cryptoKey_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateCryptoKeyRequest.class, com.google.cloud.kms.v1.UpdateCryptoKeyRequest.Builder.class); + } + + public static final int CRYPTO_KEY_FIELD_NUMBER = 1; + private com.google.cloud.kms.v1.CryptoKey cryptoKey_; + /** + *
+   * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public boolean hasCryptoKey() { + return cryptoKey_ != null; + } + /** + *
+   * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKey() { + return cryptoKey_ == null ? com.google.cloud.kms.v1.CryptoKey.getDefaultInstance() : cryptoKey_; + } + /** + *
+   * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeyOrBuilder() { + return getCryptoKey(); + } + + 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; + */ + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + 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; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (cryptoKey_ != null) { + output.writeMessage(1, getCryptoKey()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (cryptoKey_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getCryptoKey()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.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.UpdateCryptoKeyRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.UpdateCryptoKeyRequest other = (com.google.cloud.kms.v1.UpdateCryptoKeyRequest) obj; + + boolean result = true; + result = result && (hasCryptoKey() == other.hasCryptoKey()); + if (hasCryptoKey()) { + result = result && getCryptoKey() + .equals(other.getCryptoKey()); + } + result = result && (hasUpdateMask() == other.hasUpdateMask()); + if (hasUpdateMask()) { + result = result && getUpdateMask() + .equals(other.getUpdateMask()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCryptoKey()) { + hash = (37 * hash) + CRYPTO_KEY_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKey().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest 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.UpdateCryptoKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest 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.UpdateCryptoKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest 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.UpdateCryptoKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest 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.UpdateCryptoKeyRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest 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.UpdateCryptoKeyRequest 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.UpdateCryptoKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.UpdateCryptoKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateCryptoKeyRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.UpdateCryptoKeyRequest) + com.google.cloud.kms.v1.UpdateCryptoKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateCryptoKeyRequest.class, com.google.cloud.kms.v1.UpdateCryptoKeyRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.UpdateCryptoKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + if (cryptoKeyBuilder_ == null) { + cryptoKey_ = null; + } else { + cryptoKey_ = null; + cryptoKeyBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyRequest_descriptor; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.UpdateCryptoKeyRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyRequest build() { + com.google.cloud.kms.v1.UpdateCryptoKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyRequest buildPartial() { + com.google.cloud.kms.v1.UpdateCryptoKeyRequest result = new com.google.cloud.kms.v1.UpdateCryptoKeyRequest(this); + if (cryptoKeyBuilder_ == null) { + result.cryptoKey_ = cryptoKey_; + } else { + result.cryptoKey_ = cryptoKeyBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.UpdateCryptoKeyRequest) { + return mergeFrom((com.google.cloud.kms.v1.UpdateCryptoKeyRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.UpdateCryptoKeyRequest other) { + if (other == com.google.cloud.kms.v1.UpdateCryptoKeyRequest.getDefaultInstance()) return this; + if (other.hasCryptoKey()) { + mergeCryptoKey(other.getCryptoKey()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.UpdateCryptoKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.UpdateCryptoKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.kms.v1.CryptoKey cryptoKey_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder> cryptoKeyBuilder_; + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public boolean hasCryptoKey() { + return cryptoKeyBuilder_ != null || cryptoKey_ != null; + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public com.google.cloud.kms.v1.CryptoKey getCryptoKey() { + if (cryptoKeyBuilder_ == null) { + return cryptoKey_ == null ? com.google.cloud.kms.v1.CryptoKey.getDefaultInstance() : cryptoKey_; + } else { + return cryptoKeyBuilder_.getMessage(); + } + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public Builder setCryptoKey(com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cryptoKey_ = value; + onChanged(); + } else { + cryptoKeyBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public Builder setCryptoKey( + com.google.cloud.kms.v1.CryptoKey.Builder builderForValue) { + if (cryptoKeyBuilder_ == null) { + cryptoKey_ = builderForValue.build(); + onChanged(); + } else { + cryptoKeyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public Builder mergeCryptoKey(com.google.cloud.kms.v1.CryptoKey value) { + if (cryptoKeyBuilder_ == null) { + if (cryptoKey_ != null) { + cryptoKey_ = + com.google.cloud.kms.v1.CryptoKey.newBuilder(cryptoKey_).mergeFrom(value).buildPartial(); + } else { + cryptoKey_ = value; + } + onChanged(); + } else { + cryptoKeyBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public Builder clearCryptoKey() { + if (cryptoKeyBuilder_ == null) { + cryptoKey_ = null; + onChanged(); + } else { + cryptoKey_ = null; + cryptoKeyBuilder_ = null; + } + + return this; + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public com.google.cloud.kms.v1.CryptoKey.Builder getCryptoKeyBuilder() { + + onChanged(); + return getCryptoKeyFieldBuilder().getBuilder(); + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeyOrBuilder() { + if (cryptoKeyBuilder_ != null) { + return cryptoKeyBuilder_.getMessageOrBuilder(); + } else { + return cryptoKey_ == null ? + com.google.cloud.kms.v1.CryptoKey.getDefaultInstance() : cryptoKey_; + } + } + /** + *
+     * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder> + getCryptoKeyFieldBuilder() { + if (cryptoKeyBuilder_ == null) { + cryptoKeyBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKey, com.google.cloud.kms.v1.CryptoKey.Builder, com.google.cloud.kms.v1.CryptoKeyOrBuilder>( + getCryptoKey(), + getParentForChildren(), + isClean()); + cryptoKey_ = null; + } + return cryptoKeyBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_ = null; + 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; + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + 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; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask( + com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + 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; + */ + 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_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.UpdateCryptoKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.UpdateCryptoKeyRequest) + private static final com.google.cloud.kms.v1.UpdateCryptoKeyRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.UpdateCryptoKeyRequest(); + } + + public static com.google.cloud.kms.v1.UpdateCryptoKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public UpdateCryptoKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateCryptoKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyRequestOrBuilder.java new file mode 100644 index 000000000000..7dbb1a8d6a1f --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyRequestOrBuilder.java @@ -0,0 +1,59 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface UpdateCryptoKeyRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.UpdateCryptoKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + boolean hasCryptoKey(); + /** + *
+   * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + com.google.cloud.kms.v1.CryptoKey getCryptoKey(); + /** + *
+   * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKey crypto_key = 1; + */ + com.google.cloud.kms.v1.CryptoKeyOrBuilder getCryptoKeyOrBuilder(); + + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + boolean hasUpdateMask(); + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyVersionRequest.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyVersionRequest.java new file mode 100644 index 000000000000..dd495b1c1fd9 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyVersionRequest.java @@ -0,0 +1,855 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +/** + *
+ * Request message for [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
+ * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} + */ +public final class UpdateCryptoKeyVersionRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) + UpdateCryptoKeyVersionRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use UpdateCryptoKeyVersionRequest.newBuilder() to construct. + private UpdateCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private UpdateCryptoKeyVersionRequest() { + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private UpdateCryptoKeyVersionRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + com.google.cloud.kms.v1.CryptoKeyVersion.Builder subBuilder = null; + if (cryptoKeyVersion_ != null) { + subBuilder = cryptoKeyVersion_.toBuilder(); + } + cryptoKeyVersion_ = input.readMessage(com.google.cloud.kms.v1.CryptoKeyVersion.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(cryptoKeyVersion_); + cryptoKeyVersion_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.Builder.class); + } + + public static final int CRYPTO_KEY_VERSION_FIELD_NUMBER = 1; + private com.google.cloud.kms.v1.CryptoKeyVersion cryptoKeyVersion_; + /** + *
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public boolean hasCryptoKeyVersion() { + return cryptoKeyVersion_ != null; + } + /** + *
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion() { + return cryptoKeyVersion_ == null ? com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : cryptoKeyVersion_; + } + /** + *
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionOrBuilder() { + return getCryptoKeyVersion(); + } + + 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; + */ + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + 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; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (cryptoKeyVersion_ != null) { + output.writeMessage(1, getCryptoKeyVersion()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (cryptoKeyVersion_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getCryptoKeyVersion()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.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.UpdateCryptoKeyVersionRequest)) { + return super.equals(obj); + } + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest other = (com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) obj; + + boolean result = true; + result = result && (hasCryptoKeyVersion() == other.hasCryptoKeyVersion()); + if (hasCryptoKeyVersion()) { + result = result && getCryptoKeyVersion() + .equals(other.getCryptoKeyVersion()); + } + result = result && (hasUpdateMask() == other.hasUpdateMask()); + if (hasUpdateMask()) { + result = result && getUpdateMask() + .equals(other.getUpdateMask()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasCryptoKeyVersion()) { + hash = (37 * hash) + CRYPTO_KEY_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getCryptoKeyVersion().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest 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.UpdateCryptoKeyVersionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest 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.UpdateCryptoKeyVersionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest 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.UpdateCryptoKeyVersionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest 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.UpdateCryptoKeyVersionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest 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.UpdateCryptoKeyVersionRequest 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.UpdateCryptoKeyVersionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + 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 [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
+   * 
+ * + * Protobuf type {@code google.cloud.kms.v1.UpdateCryptoKeyVersionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.class, com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.Builder.class); + } + + // Construct using com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + public Builder clear() { + super.clear(); + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersion_ = null; + } else { + cryptoKeyVersion_ = null; + cryptoKeyVersionBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.kms.v1.KmsProto.internal_static_google_cloud_kms_v1_UpdateCryptoKeyVersionRequest_descriptor; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest getDefaultInstanceForType() { + return com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.getDefaultInstance(); + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest build() { + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest buildPartial() { + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest result = new com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest(this); + if (cryptoKeyVersionBuilder_ == null) { + result.cryptoKeyVersion_ = cryptoKeyVersion_; + } else { + result.cryptoKeyVersion_ = cryptoKeyVersionBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder clone() { + return (Builder) super.clone(); + } + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) { + return mergeFrom((com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest other) { + if (other == com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest.getDefaultInstance()) return this; + if (other.hasCryptoKeyVersion()) { + mergeCryptoKeyVersion(other.getCryptoKeyVersion()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.kms.v1.CryptoKeyVersion cryptoKeyVersion_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> cryptoKeyVersionBuilder_; + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public boolean hasCryptoKeyVersion() { + return cryptoKeyVersionBuilder_ != null || cryptoKeyVersion_ != null; + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion() { + if (cryptoKeyVersionBuilder_ == null) { + return cryptoKeyVersion_ == null ? com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : cryptoKeyVersion_; + } else { + return cryptoKeyVersionBuilder_.getMessage(); + } + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public Builder setCryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + cryptoKeyVersion_ = value; + onChanged(); + } else { + cryptoKeyVersionBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public Builder setCryptoKeyVersion( + com.google.cloud.kms.v1.CryptoKeyVersion.Builder builderForValue) { + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersion_ = builderForValue.build(); + onChanged(); + } else { + cryptoKeyVersionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public Builder mergeCryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion value) { + if (cryptoKeyVersionBuilder_ == null) { + if (cryptoKeyVersion_ != null) { + cryptoKeyVersion_ = + com.google.cloud.kms.v1.CryptoKeyVersion.newBuilder(cryptoKeyVersion_).mergeFrom(value).buildPartial(); + } else { + cryptoKeyVersion_ = value; + } + onChanged(); + } else { + cryptoKeyVersionBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public Builder clearCryptoKeyVersion() { + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersion_ = null; + onChanged(); + } else { + cryptoKeyVersion_ = null; + cryptoKeyVersionBuilder_ = null; + } + + return this; + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersion.Builder getCryptoKeyVersionBuilder() { + + onChanged(); + return getCryptoKeyVersionFieldBuilder().getBuilder(); + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + public com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionOrBuilder() { + if (cryptoKeyVersionBuilder_ != null) { + return cryptoKeyVersionBuilder_.getMessageOrBuilder(); + } else { + return cryptoKeyVersion_ == null ? + com.google.cloud.kms.v1.CryptoKeyVersion.getDefaultInstance() : cryptoKeyVersion_; + } + } + /** + *
+     * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+     * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder> + getCryptoKeyVersionFieldBuilder() { + if (cryptoKeyVersionBuilder_ == null) { + cryptoKeyVersionBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.kms.v1.CryptoKeyVersion, com.google.cloud.kms.v1.CryptoKeyVersion.Builder, com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder>( + getCryptoKeyVersion(), + getParentForChildren(), + isClean()); + cryptoKeyVersion_ = null; + } + return cryptoKeyVersionBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_ = null; + 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; + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + 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; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask( + com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + *
+     * Required list of fields to be updated in this request.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + 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; + */ + 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_; + } + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) + private static final com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest(); + } + + public static com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + public UpdateCryptoKeyVersionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateCryptoKeyVersionRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + public com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyVersionRequestOrBuilder.java b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyVersionRequestOrBuilder.java new file mode 100644 index 000000000000..3e27ec755ca4 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/java/com/google/cloud/kms/v1/UpdateCryptoKeyVersionRequestOrBuilder.java @@ -0,0 +1,59 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/kms/v1/service.proto + +package com.google.cloud.kms.v1; + +public interface UpdateCryptoKeyVersionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.kms.v1.UpdateCryptoKeyVersionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + boolean hasCryptoKeyVersion(); + /** + *
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + com.google.cloud.kms.v1.CryptoKeyVersion getCryptoKeyVersion(); + /** + *
+   * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.
+   * 
+ * + * .google.cloud.kms.v1.CryptoKeyVersion crypto_key_version = 1; + */ + com.google.cloud.kms.v1.CryptoKeyVersionOrBuilder getCryptoKeyVersionOrBuilder(); + + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + boolean hasUpdateMask(); + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + *
+   * Required list of fields to be updated in this request.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto b/google-api-grpc/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto new file mode 100644 index 000000000000..212842650941 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/resources.proto @@ -0,0 +1,160 @@ +// Copyright 2017 Google Inc. +// +// 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 +// +// http://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. + +syntax = "proto3"; + +package google.cloud.kms.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; +option java_multiple_files = true; +option java_outer_classname = "KmsResourcesProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; + + +// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. +message KeyRing { + // Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format + // `projects/*/locations/*/keyRings/*`. + string name = 1; + + // Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created. + google.protobuf.Timestamp create_time = 2; +} + +// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that can be used for cryptographic +// operations. +// +// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of one or more [versions][google.cloud.kms.v1.CryptoKeyVersion], which +// represent the actual key material used in cryptographic operations. +message CryptoKey { + // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] describes the capabilities of a [CryptoKey][google.cloud.kms.v1.CryptoKey]. Two + // keys with the same purpose may use different underlying algorithms, but + // must support the same set of operations. + enum CryptoKeyPurpose { + // Not specified. + CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + ENCRYPT_DECRYPT = 1; + } + + // Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string name = 1; + + // Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used + // by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given + // in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. + // + // The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via + // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. + CryptoKeyVersion primary = 2; + + // The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable + // purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + CryptoKeyPurpose purpose = 3; + + // Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. + google.protobuf.Timestamp create_time = 5; + + // At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically: + // + // 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + // 2. Mark the new version as primary. + // + // Key rotations performed manually via + // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and + // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] + // do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. + google.protobuf.Timestamp next_rotation_time = 7; + + // Controls the rate of automatic rotation. + oneof rotation_schedule { + // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service + // automatically rotates a key. Must be at least one day. + // + // If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set. + google.protobuf.Duration rotation_period = 8; + } + + // Labels with user-defined metadata. For more information, see + // [Labeling Keys](/kms/docs/labeling-keys). + map labels = 10; +} + +// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an individual cryptographic key, and the +// associated key material. +// +// It can be used for cryptographic operations either directly, or via its +// parent [CryptoKey][google.cloud.kms.v1.CryptoKey], in which case the server will choose the appropriate +// version for the operation. +// +// For security reasons, the raw cryptographic key material represented by a +// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed or exported. It can only be used to +// encrypt or decrypt data when an authorized user or application invokes Cloud +// KMS. +message CryptoKeyVersion { + // The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating if it can be used. + enum CryptoKeyVersionState { + // Not specified. + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + + // This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests. + ENABLED = 1; + + // This version may not be used, but the key material is still available, + // and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. + DISABLED = 2; + + // This version is destroyed, and the key material is no longer stored. + // A version may not leave this state once entered. + DESTROYED = 3; + + // This version is scheduled for destruction, and will be destroyed soon. + // Call + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. + DESTROY_SCHEDULED = 4; + } + + // Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + string name = 1; + + // The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + CryptoKeyVersionState state = 3; + + // Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. + google.protobuf.Timestamp create_time = 4; + + // Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled + // for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. + google.protobuf.Timestamp destroy_time = 5; + + // Output only. The time this CryptoKeyVersion's key material was + // destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + google.protobuf.Timestamp destroy_event_time = 6; +} diff --git a/google-api-grpc/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/service.proto b/google-api-grpc/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/service.proto new file mode 100644 index 000000000000..682c95fc8508 --- /dev/null +++ b/google-api-grpc/proto-google-cloud-kms-v1/src/main/proto/google/cloud/kms/v1/service.proto @@ -0,0 +1,388 @@ +// Copyright 2017 Google Inc. +// +// 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 +// +// http://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. + +syntax = "proto3"; + +package google.cloud.kms.v1; + +import "google/api/annotations.proto"; +import "google/cloud/kms/v1/resources.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Kms.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; +option java_multiple_files = true; +option java_outer_classname = "KmsProto"; +option java_package = "com.google.cloud.kms.v1"; +option php_namespace = "Google\\Cloud\\Kms\\V1"; + + +// Google Cloud Key Management Service +// +// Manages cryptographic keys and operations using those keys. Implements a REST +// model with the following objects: +// +// * [KeyRing][google.cloud.kms.v1.KeyRing] +// * [CryptoKey][google.cloud.kms.v1.CryptoKey] +// * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] +service KeyManagementService { + // Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + rpc ListKeyRings(ListKeyRingsRequest) returns (ListKeyRingsResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}/keyRings" }; + } + + // Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" }; + } + + // Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + rpc ListCryptoKeyVersions(ListCryptoKeyVersionsRequest) returns (ListCryptoKeyVersionsResponse) { + option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" }; + } + + // Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + rpc GetKeyRing(GetKeyRingRequest) returns (KeyRing) { + option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/keyRings/*}" }; + } + + // Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its + // [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + rpc GetCryptoKey(GetCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" }; + } + + // Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + rpc GetCryptoKeyVersion(GetCryptoKeyVersionRequest) returns (CryptoKeyVersion) { + option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" }; + } + + // Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. + rpc CreateKeyRing(CreateKeyRingRequest) returns (KeyRing) { + option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/keyRings" body: "key_ring" }; + } + + // Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. + // + // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required. + rpc CreateCryptoKey(CreateCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" body: "crypto_key" }; + } + + // Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + // + // The server will assign the next sequential id. If unset, + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + rpc CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest) returns (CryptoKeyVersion) { + option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" body: "crypto_key_version" }; + } + + // Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + rpc UpdateCryptoKey(UpdateCryptoKeyRequest) returns (CryptoKey) { + option (google.api.http) = { patch: "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" body: "crypto_key" }; + } + + // Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. + // + // [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between + // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and + // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this + // method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to + // move between other states. + rpc UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest) returns (CryptoKeyVersion) { + option (google.api.http) = { patch: "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" body: "crypto_key_version" }; + } + + // Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + rpc Encrypt(EncryptRequest) returns (EncryptResponse) { + option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt" body: "*" }; + } + + // Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + rpc Decrypt(DecryptRequest) returns (DecryptResponse) { + option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt" body: "*" }; + } + + // Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] + rpc UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest) returns (CryptoKey) { + option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion" body: "*" }; + } + + // Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. + // + // Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 + // hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] + // will be changed to + // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key + // material will be irrevocably destroyed. + // + // Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process. + rpc DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest) returns (CryptoKeyVersion) { + option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy" body: "*" }; + } + + // Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + // state. + // + // Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] + // will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], + // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. + rpc RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest) returns (CryptoKeyVersion) { + option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore" body: "*" }; + } +} + +// Request message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. +message ListKeyRingsRequest { + // Required. The resource name of the location associated with the + // [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + string parent = 1; + + // Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the + // response. Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by + // including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent + // request. If unspecified, the server will pick an appropriate default. + int32 page_size = 2; + + // Optional pagination token, returned earlier via + // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. + string page_token = 3; +} + +// Request message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. +message ListCryptoKeysRequest { + // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format + // `projects/*/locations/*/keyRings/*`. + string parent = 1; + + // Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the + // response. Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by + // including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent + // request. If unspecified, the server will pick an appropriate default. + int32 page_size = 2; + + // Optional pagination token, returned earlier via + // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. + string page_token = 3; +} + +// Request message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. +message ListCryptoKeyVersionsRequest { + // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format + // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string parent = 1; + + // Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to + // include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can + // subsequently be obtained by including the + // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request. + // If unspecified, the server will pick an appropriate default. + int32 page_size = 2; + + // Optional pagination token, returned earlier via + // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. + string page_token = 3; +} + +// Response message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. +message ListKeyRingsResponse { + // The list of [KeyRings][google.cloud.kms.v1.KeyRing]. + repeated KeyRing key_rings = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. + int32 total_size = 3; +} + +// Response message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. +message ListCryptoKeysResponse { + // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + repeated CryptoKey crypto_keys = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results. + string next_page_token = 2; + + // The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query. + int32 total_size = 3; +} + +// Response message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. +message ListCryptoKeyVersionsResponse { + // The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + repeated CryptoKeyVersion crypto_key_versions = 1; + + // A token to retrieve next page of results. Pass this value in + // [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of + // results. + string next_page_token = 2; + + // The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the + // query. + int32 total_size = 3; +} + +// Request message for [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. +message GetKeyRingRequest { + // The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get. + string name = 1; +} + +// Request message for [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. +message GetCryptoKeyRequest { + // The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + string name = 1; +} + +// Request message for [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. +message GetCryptoKeyVersionRequest { + // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + string name = 1; +} + +// Request message for [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. +message CreateKeyRingRequest { + // Required. The resource name of the location associated with the + // [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + string parent = 1; + + // Required. It must be unique within a location and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string key_ring_id = 2; + + // A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. + KeyRing key_ring = 3; +} + +// Request message for [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. +message CreateCryptoKeyRequest { + // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the + // [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + string parent = 1; + + // Required. It must be unique within a KeyRing and match the regular + // expression `[a-zA-Z0-9_-]{1,63}` + string crypto_key_id = 2; + + // A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. + CryptoKey crypto_key = 3; +} + +// Request message for [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. +message CreateCryptoKeyVersionRequest { + // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with + // the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + string parent = 1; + + // A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values. + CryptoKeyVersion crypto_key_version = 2; +} + +// Request message for [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. +message UpdateCryptoKeyRequest { + // [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. + CryptoKey crypto_key = 1; + + // Required list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. +message UpdateCryptoKeyVersionRequest { + // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values. + CryptoKeyVersion crypto_key_version = 1; + + // Required list of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +message EncryptRequest { + // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + // to use for encryption. + // + // If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its + // [primary version][google.cloud.kms.v1.CryptoKey.primary]. + string name = 1; + + // Required. The data to encrypt. Must be no larger than 64KiB. + bytes plaintext = 2; + + // Optional data that, if specified, must also be provided during decryption + // through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. Must be no + // larger than 64KiB. + bytes additional_authenticated_data = 3; +} + +// Request message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +message DecryptRequest { + // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. + // The server will choose the appropriate version. + string name = 1; + + // Required. The encrypted data originally returned in + // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + bytes ciphertext = 2; + + // Optional data that must match the data originally supplied in + // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + bytes additional_authenticated_data = 3; +} + +// Response message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. +message DecryptResponse { + // The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + bytes plaintext = 1; +} + +// Response message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. +message EncryptResponse { + // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption. + string name = 1; + + // The encrypted data. + bytes ciphertext = 2; +} + +// Request message for [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. +message UpdateCryptoKeyPrimaryVersionRequest { + // The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + string name = 1; + + // The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + string crypto_key_version_id = 2; +} + +// Request message for [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. +message DestroyCryptoKeyVersionRequest { + // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. + string name = 1; +} + +// Request message for [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. +message RestoreCryptoKeyVersionRequest { + // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. + string name = 1; +} diff --git a/google-cloud-bom/pom.xml b/google-cloud-bom/pom.xml index 91c70d308375..052b79efed87 100644 --- a/google-cloud-bom/pom.xml +++ b/google-cloud-bom/pom.xml @@ -494,6 +494,27 @@ grpc-google-cloud-firestore-v1beta1 0.18.1-SNAPSHOT
+ + com.google.cloud + google-cloud-kms + 0.53.1-beta-SNAPSHOT + + + com.google.cloud + google-cloud-kms + 0.53.1-beta-SNAPSHOT + test-jar + + + com.google.api.grpc + proto-google-cloud-kms-v1 + 0.18.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-kms-v1 + 0.18.1-SNAPSHOT + com.google.cloud google-cloud-language diff --git a/google-cloud-clients/google-cloud-kms/README.md b/google-cloud-clients/google-cloud-kms/README.md new file mode 100644 index 000000000000..a18cc0e0e464 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/README.md @@ -0,0 +1,102 @@ +Google Cloud Java Client for Cloud KMS +====================================== + +Java idiomatic client for [Cloud KMS][cloud-kms]. + +[![CircleCI](https://circleci.com/gh/GoogleCloudPlatform/google-cloud-java/tree/master.svg?style=shield)](https://circleci.com/gh/GoogleCloudPlatform/google-cloud-java/tree/master) +[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/google-cloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/google-cloud-java?branch=master) +[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-kms.svg)](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-kms.svg) +[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/google-cloud-java) +[![Dependency Status](https://www.versioneye.com/user/projects/58fe4c8d6ac171426c414772/badge.svg?style=flat)](https://www.versioneye.com/user/projects/58fe4c8d6ac171426c414772) + +- [Product Documentation][kms-product-docs] +- [Client Library Documentation][kms-client-lib-docs] + +> Note: This client is a work-in-progress, and may occasionally +> make backwards-incompatible changes. + +Quickstart +---------- + +[//]: # ({x-version-update-start:google-cloud-kms:released}) +If you are using Maven, add this to your pom.xml file +```xml + + com.google.cloud + google-cloud-kms + 0.53.0-beta + +``` +If you are using Gradle, add this to your dependencies +```Groovy +compile 'com.google.cloud:google-cloud-kms:0.53.0-beta' +``` +If you are using SBT, add this to your dependencies +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-kms" % "0.53.0-beta" +``` +[//]: # ({x-version-update-end}) + +Authentication +-------------- + +See the [Authentication](https://github.com/GoogleCloudPlatform/google-cloud-java#authentication) section in the base directory's README. + +About Google Cloud Cloud KMS +---------------------------- + +Google [Cloud KMS API][cloud-kms] lets you manage encryption for your cloud services the same way you do on-premises. + +See the [Cloud KMS client library docs][kms-client-lib-docs] to learn how to use this Cloud KMS API Client Library. + +Getting Started +--------------- +#### Prerequisites +You will need a [Google Developers Console](https://console.developers.google.com/) project with the Cloud KMS API enabled. [Follow these instructions](https://cloud.google.com/docs/authentication#preparation) to get your project set up. You will also need to set up the local development environment by [installing the Google Cloud SDK](https://cloud.google.com/sdk/) and running the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +#### Installation and setup +You'll need to obtain the `google-cloud-kms` library. See the [Quickstart](#quickstart) section to add `google-cloud-kms` as a dependency in your code. + +Troubleshooting +--------------- + +To get help, follow the instructions in the [shared Troubleshooting document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting). + +Transport +--------- +Cloud KMS uses gRPC for the transport layer. + +Java Versions +------------- + +Java 7 or above is required for using this client. + +Versioning +---------- + +This library follows [Semantic Versioning](http://semver.org/). + +It is currently in major version zero (``0.y.z``), which means that anything may change at any time and the public API should not be considered stable. + +Contributing +------------ + +Contributions to this library are always welcome and highly encouraged. + +See `google-cloud`'s [CONTRIBUTING] documentation and the [shared documentation](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. + +License +------- + +Apache 2.0 - See [LICENSE] for more information. + + +[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/CONTRIBUTING.md +[code-of-conduct]:https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[LICENSE]: https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/LICENSE +[cloud-platform]: https://cloud.google.com/ +[cloud-kms]: https://cloud.google.com/kms +[kms-product-docs]: https://cloud.google.com/kms/docs +[kms-client-lib-docs]: https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/index.html?com/google/cloud/kms/v1/package-summary.html diff --git a/google-cloud-clients/google-cloud-kms/pom.xml b/google-cloud-clients/google-cloud-kms/pom.xml new file mode 100644 index 000000000000..bd497d3dbf09 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + google-cloud-kms + 0.53.1-beta-SNAPSHOT + jar + Google Cloud KMS + https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-kms + + Java idiomatic client for Google Cloud KMS + + + com.google.cloud + google-cloud-clients + 0.53.1-alpha-SNAPSHOT + + + google-cloud-kms-v1 + + + + ${project.groupId} + google-cloud-core + + + ${project.groupId} + google-cloud-core-grpc + + + com.google.api.grpc + proto-google-cloud-kms-v1 + + + com.google.api.grpc + proto-google-cloud-kms-v1 + + + io.grpc + grpc-netty-shaded + + + io.grpc + grpc-stub + + + io.grpc + grpc-auth + + + ${project.groupId} + google-cloud-core + test-jar + test + + + junit + junit + test + + + org.easymock + easymock + test + + + org.objenesis + objenesis + test + + + com.google.api.grpc + grpc-google-cloud-kms-v1 + test + + + com.google.api.grpc + grpc-google-cloud-kms-v1 + test + + + com.google.api.grpc + grpc-google-iam-v1 + test + + + com.google.api + gax-grpc + testlib + test + + + diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java new file mode 100644 index 000000000000..fc65fe176564 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java @@ -0,0 +1,2669 @@ +/* + * Copyright 2018 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.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.kms.v1.stub.KeyManagementServiceStub; +import com.google.cloud.kms.v1.stub.KeyManagementServiceStubSettings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.ByteString; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Google Cloud Key Management Service + * + *

Manages cryptographic keys and operations using those keys. Implements a REST model with the + * following objects: + * + *

* [KeyRing][google.cloud.kms.v1.KeyRing] * [CryptoKey][google.cloud.kms.v1.CryptoKey] + * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the keyManagementServiceClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of KeyManagementServiceSettings + * to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * KeyManagementServiceSettings keyManagementServiceSettings =
+ *     KeyManagementServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * KeyManagementServiceClient keyManagementServiceClient =
+ *     KeyManagementServiceClient.create(keyManagementServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * KeyManagementServiceSettings keyManagementServiceSettings =
+ *     KeyManagementServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * KeyManagementServiceClient keyManagementServiceClient =
+ *     KeyManagementServiceClient.create(keyManagementServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class KeyManagementServiceClient implements BackgroundResource { + private final KeyManagementServiceSettings settings; + private final KeyManagementServiceStub stub; + + /** Constructs an instance of KeyManagementServiceClient with default settings. */ + public static final KeyManagementServiceClient create() throws IOException { + return create(KeyManagementServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of KeyManagementServiceClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final KeyManagementServiceClient create(KeyManagementServiceSettings settings) + throws IOException { + return new KeyManagementServiceClient(settings); + } + + /** + * Constructs an instance of KeyManagementServiceClient, using the given stub for making calls. + * This is for advanced usage - prefer to use KeyManagementServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final KeyManagementServiceClient create(KeyManagementServiceStub stub) { + return new KeyManagementServiceClient(stub); + } + + /** + * Constructs an instance of KeyManagementServiceClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected KeyManagementServiceClient(KeyManagementServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((KeyManagementServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected KeyManagementServiceClient(KeyManagementServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final KeyManagementServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public KeyManagementServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (KeyRing element : keyManagementServiceClient.listKeyRings(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListKeyRingsPagedResponse listKeyRings(LocationName parent) { + ListKeyRingsRequest request = + ListKeyRingsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listKeyRings(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (KeyRing element : keyManagementServiceClient.listKeyRings(parent.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListKeyRingsPagedResponse listKeyRings(String parent) { + ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder().setParent(parent).build(); + return listKeyRings(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (KeyRing element : keyManagementServiceClient.listKeyRings(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListKeyRingsPagedResponse listKeyRings(ListKeyRingsRequest request) { + return listKeyRingsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListKeyRingsPagedResponse> future = keyManagementServiceClient.listKeyRingsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (KeyRing element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listKeyRingsPagedCallable() { + return stub.listKeyRingsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [KeyRings][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   ListKeyRingsRequest request = ListKeyRingsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListKeyRingsResponse response = keyManagementServiceClient.listKeyRingsCallable().call(request);
+   *     for (KeyRing element : response.getKeyRingsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listKeyRingsCallable() { + return stub.listKeyRingsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to + * list, in the format `projects/*/locations/*/keyRings/*`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCryptoKeysPagedResponse listCryptoKeys(KeyRingName parent) { + ListCryptoKeysRequest request = + ListCryptoKeysRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listCryptoKeys(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(parent.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to + * list, in the format `projects/*/locations/*/keyRings/*`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCryptoKeysPagedResponse listCryptoKeys(String parent) { + ListCryptoKeysRequest request = ListCryptoKeysRequest.newBuilder().setParent(parent).build(); + return listCryptoKeys(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   ListCryptoKeysRequest request = ListCryptoKeysRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (CryptoKey element : keyManagementServiceClient.listCryptoKeys(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCryptoKeysPagedResponse listCryptoKeys(ListCryptoKeysRequest request) { + return listCryptoKeysPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   ListCryptoKeysRequest request = ListCryptoKeysRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListCryptoKeysPagedResponse> future = keyManagementServiceClient.listCryptoKeysPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (CryptoKey element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listCryptoKeysPagedCallable() { + return stub.listCryptoKeysPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   ListCryptoKeysRequest request = ListCryptoKeysRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListCryptoKeysResponse response = keyManagementServiceClient.listCryptoKeysCallable().call(request);
+   *     for (CryptoKey element : response.getCryptoKeysList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listCryptoKeysCallable() { + return stub.listCryptoKeysCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   for (CryptoKeyVersion element : keyManagementServiceClient.listCryptoKeyVersions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to + * list, in the format `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(CryptoKeyName parent) { + ListCryptoKeyVersionsRequest request = + ListCryptoKeyVersionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listCryptoKeyVersions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   for (CryptoKeyVersion element : keyManagementServiceClient.listCryptoKeyVersions(parent.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to + * list, in the format `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions(String parent) { + ListCryptoKeyVersionsRequest request = + ListCryptoKeyVersionsRequest.newBuilder().setParent(parent).build(); + return listCryptoKeyVersions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ListCryptoKeyVersionsRequest request = ListCryptoKeyVersionsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (CryptoKeyVersion element : keyManagementServiceClient.listCryptoKeyVersions(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListCryptoKeyVersionsPagedResponse listCryptoKeyVersions( + ListCryptoKeyVersionsRequest request) { + return listCryptoKeyVersionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ListCryptoKeyVersionsRequest request = ListCryptoKeyVersionsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListCryptoKeyVersionsPagedResponse> future = keyManagementServiceClient.listCryptoKeyVersionsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (CryptoKeyVersion element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listCryptoKeyVersionsPagedCallable() { + return stub.listCryptoKeyVersionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ListCryptoKeyVersionsRequest request = ListCryptoKeyVersionsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListCryptoKeyVersionsResponse response = keyManagementServiceClient.listCryptoKeyVersionsCallable().call(request);
+   *     for (CryptoKeyVersion element : response.getCryptoKeyVersionsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listCryptoKeyVersionsCallable() { + return stub.listCryptoKeyVersionsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+   * }
+   * 
+ * + * @param name The [name][google.cloud.kms.v1.KeyRing.name] of the + * [KeyRing][google.cloud.kms.v1.KeyRing] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final KeyRing getKeyRing(KeyRingName name) { + + GetKeyRingRequest request = + GetKeyRingRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getKeyRing(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   KeyRing response = keyManagementServiceClient.getKeyRing(name.toString());
+   * }
+   * 
+ * + * @param name The [name][google.cloud.kms.v1.KeyRing.name] of the + * [KeyRing][google.cloud.kms.v1.KeyRing] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final KeyRing getKeyRing(String name) { + + GetKeyRingRequest request = GetKeyRingRequest.newBuilder().setName(name).build(); + return getKeyRing(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   GetKeyRingRequest request = GetKeyRingRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   KeyRing response = keyManagementServiceClient.getKeyRing(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 + */ + private final KeyRing getKeyRing(GetKeyRingRequest request) { + return getKeyRingCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   GetKeyRingRequest request = GetKeyRingRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<KeyRing> future = keyManagementServiceClient.getKeyRingCallable().futureCall(request);
+   *   // Do something
+   *   KeyRing response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getKeyRingCallable() { + return stub.getKeyRingCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its + * [primary][google.cloud.kms.v1.CryptoKey.primary] + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
+   * }
+   * 
+ * + * @param name The [name][google.cloud.kms.v1.CryptoKey.name] of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKey getCryptoKey(CryptoKeyName name) { + + GetCryptoKeyRequest request = + GetCryptoKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getCryptoKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its + * [primary][google.cloud.kms.v1.CryptoKey.primary] + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   CryptoKey response = keyManagementServiceClient.getCryptoKey(name.toString());
+   * }
+   * 
+ * + * @param name The [name][google.cloud.kms.v1.CryptoKey.name] of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKey getCryptoKey(String name) { + + GetCryptoKeyRequest request = GetCryptoKeyRequest.newBuilder().setName(name).build(); + return getCryptoKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its + * [primary][google.cloud.kms.v1.CryptoKey.primary] + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   GetCryptoKeyRequest request = GetCryptoKeyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   CryptoKey response = keyManagementServiceClient.getCryptoKey(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 + */ + private final CryptoKey getCryptoKey(GetCryptoKeyRequest request) { + return getCryptoKeyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its + * [primary][google.cloud.kms.v1.CryptoKey.primary] + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   GetCryptoKeyRequest request = GetCryptoKeyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<CryptoKey> future = keyManagementServiceClient.getCryptoKeyCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKey response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getCryptoKeyCallable() { + return stub.getCryptoKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(name);
+   * }
+   * 
+ * + * @param name The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion getCryptoKeyVersion(CryptoKeyVersionName name) { + + GetCryptoKeyVersionRequest request = + GetCryptoKeyVersionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(name.toString());
+   * }
+   * 
+ * + * @param name The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion getCryptoKeyVersion(String name) { + + GetCryptoKeyVersionRequest request = + GetCryptoKeyVersionRequest.newBuilder().setName(name).build(); + return getCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   GetCryptoKeyVersionRequest request = GetCryptoKeyVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.getCryptoKeyVersion(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 + */ + private final CryptoKeyVersion getCryptoKeyVersion(GetCryptoKeyVersionRequest request) { + return getCryptoKeyVersionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   GetCryptoKeyVersionRequest request = GetCryptoKeyVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.getCryptoKeyVersionCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKeyVersion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getCryptoKeyVersionCallable() { + return stub.getCryptoKeyVersionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String keyRingId = "";
+   *   KeyRing keyRing = KeyRing.newBuilder().build();
+   *   KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
+   * }
+   * 
+ * + * @param parent Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @param keyRingId Required. It must be unique within a location and match the regular expression + * `[a-zA-Z0-9_-]{1,63}` + * @param keyRing A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRing keyRing) { + + CreateKeyRingRequest request = + CreateKeyRingRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setKeyRingId(keyRingId) + .setKeyRing(keyRing) + .build(); + return createKeyRing(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String keyRingId = "";
+   *   KeyRing keyRing = KeyRing.newBuilder().build();
+   *   KeyRing response = keyManagementServiceClient.createKeyRing(parent.toString(), keyRingId, keyRing);
+   * }
+   * 
+ * + * @param parent Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @param keyRingId Required. It must be unique within a location and match the regular expression + * `[a-zA-Z0-9_-]{1,63}` + * @param keyRing A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final KeyRing createKeyRing(String parent, String keyRingId, KeyRing keyRing) { + + CreateKeyRingRequest request = + CreateKeyRingRequest.newBuilder() + .setParent(parent) + .setKeyRingId(keyRingId) + .setKeyRing(keyRing) + .build(); + return createKeyRing(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String keyRingId = "";
+   *   KeyRing keyRing = KeyRing.newBuilder().build();
+   *   CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setKeyRingId(keyRingId)
+   *     .setKeyRing(keyRing)
+   *     .build();
+   *   KeyRing response = keyManagementServiceClient.createKeyRing(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 KeyRing createKeyRing(CreateKeyRingRequest request) { + return createKeyRingCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   String keyRingId = "";
+   *   KeyRing keyRing = KeyRing.newBuilder().build();
+   *   CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setKeyRingId(keyRingId)
+   *     .setKeyRing(keyRing)
+   *     .build();
+   *   ApiFuture<KeyRing> future = keyManagementServiceClient.createKeyRingCallable().futureCall(request);
+   *   // Do something
+   *   KeyRing response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createKeyRingCallable() { + return stub.createKeyRingCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a + * [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   String cryptoKeyId = "my-app-key";
+   *   CryptoKey.CryptoKeyPurpose purpose = CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT;
+   *   long seconds = 2147483647L;
+   *   Timestamp nextRotationTime = Timestamp.newBuilder()
+   *     .setSeconds(seconds)
+   *     .build();
+   *   long seconds2 = 604800L;
+   *   Duration rotationPeriod = Duration.newBuilder()
+   *     .setSeconds(seconds2)
+   *     .build();
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder()
+   *     .setPurpose(purpose)
+   *     .setNextRotationTime(nextRotationTime)
+   *     .setRotationPeriod(rotationPeriod)
+   *     .build();
+   *   CryptoKey response = keyManagementServiceClient.createCryptoKey(parent, cryptoKeyId, cryptoKey);
+   * }
+   * 
+ * + * @param parent Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated + * with the [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @param cryptoKeyId Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param cryptoKey A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKey createCryptoKey( + KeyRingName parent, String cryptoKeyId, CryptoKey cryptoKey) { + + CreateCryptoKeyRequest request = + CreateCryptoKeyRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setCryptoKeyId(cryptoKeyId) + .setCryptoKey(cryptoKey) + .build(); + return createCryptoKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a + * [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   String cryptoKeyId = "my-app-key";
+   *   CryptoKey.CryptoKeyPurpose purpose = CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT;
+   *   long seconds = 2147483647L;
+   *   Timestamp nextRotationTime = Timestamp.newBuilder()
+   *     .setSeconds(seconds)
+   *     .build();
+   *   long seconds2 = 604800L;
+   *   Duration rotationPeriod = Duration.newBuilder()
+   *     .setSeconds(seconds2)
+   *     .build();
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder()
+   *     .setPurpose(purpose)
+   *     .setNextRotationTime(nextRotationTime)
+   *     .setRotationPeriod(rotationPeriod)
+   *     .build();
+   *   CryptoKey response = keyManagementServiceClient.createCryptoKey(parent.toString(), cryptoKeyId, cryptoKey);
+   * }
+   * 
+ * + * @param parent Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated + * with the [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @param cryptoKeyId Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @param cryptoKey A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKey createCryptoKey(String parent, String cryptoKeyId, CryptoKey cryptoKey) { + + CreateCryptoKeyRequest request = + CreateCryptoKeyRequest.newBuilder() + .setParent(parent) + .setCryptoKeyId(cryptoKeyId) + .setCryptoKey(cryptoKey) + .build(); + return createCryptoKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a + * [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   String cryptoKeyId = "my-app-key";
+   *   CryptoKey.CryptoKeyPurpose purpose = CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT;
+   *   long seconds = 2147483647L;
+   *   Timestamp nextRotationTime = Timestamp.newBuilder()
+   *     .setSeconds(seconds)
+   *     .build();
+   *   long seconds2 = 604800L;
+   *   Duration rotationPeriod = Duration.newBuilder()
+   *     .setSeconds(seconds2)
+   *     .build();
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder()
+   *     .setPurpose(purpose)
+   *     .setNextRotationTime(nextRotationTime)
+   *     .setRotationPeriod(rotationPeriod)
+   *     .build();
+   *   CreateCryptoKeyRequest request = CreateCryptoKeyRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setCryptoKeyId(cryptoKeyId)
+   *     .setCryptoKey(cryptoKey)
+   *     .build();
+   *   CryptoKey response = keyManagementServiceClient.createCryptoKey(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 CryptoKey createCryptoKey(CreateCryptoKeyRequest request) { + return createCryptoKeyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a + * [KeyRing][google.cloud.kms.v1.KeyRing]. + * + *

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is required. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   String cryptoKeyId = "my-app-key";
+   *   CryptoKey.CryptoKeyPurpose purpose = CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT;
+   *   long seconds = 2147483647L;
+   *   Timestamp nextRotationTime = Timestamp.newBuilder()
+   *     .setSeconds(seconds)
+   *     .build();
+   *   long seconds2 = 604800L;
+   *   Duration rotationPeriod = Duration.newBuilder()
+   *     .setSeconds(seconds2)
+   *     .build();
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder()
+   *     .setPurpose(purpose)
+   *     .setNextRotationTime(nextRotationTime)
+   *     .setRotationPeriod(rotationPeriod)
+   *     .build();
+   *   CreateCryptoKeyRequest request = CreateCryptoKeyRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setCryptoKeyId(cryptoKeyId)
+   *     .setCryptoKey(cryptoKey)
+   *     .build();
+   *   ApiFuture<CryptoKey> future = keyManagementServiceClient.createCryptoKeyCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKey response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createCryptoKeyCallable() { + return stub.createCryptoKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

The server will assign the next sequential id. If unset, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
+   * }
+   * 
+ * + * @param parent Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the + * [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * @param cryptoKeyVersion A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial + * field values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion createCryptoKeyVersion( + CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion) { + + CreateCryptoKeyVersionRequest request = + CreateCryptoKeyVersionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setCryptoKeyVersion(cryptoKeyVersion) + .build(); + return createCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

The server will assign the next sequential id. If unset, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(parent.toString(), cryptoKeyVersion);
+   * }
+   * 
+ * + * @param parent Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the + * [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the + * [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * @param cryptoKeyVersion A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial + * field values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion createCryptoKeyVersion( + String parent, CryptoKeyVersion cryptoKeyVersion) { + + CreateCryptoKeyVersionRequest request = + CreateCryptoKeyVersionRequest.newBuilder() + .setParent(parent) + .setCryptoKeyVersion(cryptoKeyVersion) + .build(); + return createCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

The server will assign the next sequential id. If unset, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   CreateCryptoKeyVersionRequest request = CreateCryptoKeyVersionRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setCryptoKeyVersion(cryptoKeyVersion)
+   *     .build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(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 CryptoKeyVersion createCryptoKeyVersion(CreateCryptoKeyVersionRequest request) { + return createCryptoKeyVersionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a + * [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

The server will assign the next sequential id. If unset, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   CreateCryptoKeyVersionRequest request = CreateCryptoKeyVersionRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setCryptoKeyVersion(cryptoKeyVersion)
+   *     .build();
+   *   ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.createCryptoKeyVersionCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKeyVersion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + createCryptoKeyVersionCallable() { + return stub.createCryptoKeyVersionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   CryptoKey response = keyManagementServiceClient.updateCryptoKey(cryptoKey, updateMask);
+   * }
+   * 
+ * + * @param cryptoKey [CryptoKey][google.cloud.kms.v1.CryptoKey] 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 CryptoKey updateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask) { + + UpdateCryptoKeyRequest request = + UpdateCryptoKeyRequest.newBuilder() + .setCryptoKey(cryptoKey) + .setUpdateMask(updateMask) + .build(); + return updateCryptoKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   UpdateCryptoKeyRequest request = UpdateCryptoKeyRequest.newBuilder()
+   *     .setCryptoKey(cryptoKey)
+   *     .setUpdateMask(updateMask)
+   *     .build();
+   *   CryptoKey response = keyManagementServiceClient.updateCryptoKey(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 CryptoKey updateCryptoKey(UpdateCryptoKeyRequest request) { + return updateCryptoKeyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKey cryptoKey = CryptoKey.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   UpdateCryptoKeyRequest request = UpdateCryptoKeyRequest.newBuilder()
+   *     .setCryptoKey(cryptoKey)
+   *     .setUpdateMask(updateMask)
+   *     .build();
+   *   ApiFuture<CryptoKey> future = keyManagementServiceClient.updateCryptoKeyCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKey response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateCryptoKeyCallable() { + return stub.updateCryptoKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. + * + *

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this + * method. See + * [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to + * move between other states. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.updateCryptoKeyVersion(cryptoKeyVersion, updateMask);
+   * }
+   * 
+ * + * @param cryptoKeyVersion [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] 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 CryptoKeyVersion updateCryptoKeyVersion( + CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask) { + + UpdateCryptoKeyVersionRequest request = + UpdateCryptoKeyVersionRequest.newBuilder() + .setCryptoKeyVersion(cryptoKeyVersion) + .setUpdateMask(updateMask) + .build(); + return updateCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. + * + *

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this + * method. See + * [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to + * move between other states. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   UpdateCryptoKeyVersionRequest request = UpdateCryptoKeyVersionRequest.newBuilder()
+   *     .setCryptoKeyVersion(cryptoKeyVersion)
+   *     .setUpdateMask(updateMask)
+   *     .build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.updateCryptoKeyVersion(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 CryptoKeyVersion updateCryptoKeyVersion(UpdateCryptoKeyVersionRequest request) { + return updateCryptoKeyVersionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. + * + *

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between + * [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this + * method. See + * [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to + * move between other states. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   UpdateCryptoKeyVersionRequest request = UpdateCryptoKeyVersionRequest.newBuilder()
+   *     .setCryptoKeyVersion(cryptoKeyVersion)
+   *     .setUpdateMask(updateMask)
+   *     .build();
+   *   ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.updateCryptoKeyVersionCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKeyVersion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateCryptoKeyVersionCallable() { + return stub.updateCryptoKeyVersionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Encrypts data, so that it can only be recovered by a call to + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyPathName name = CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]");
+   *   ByteString plaintext = ByteString.copyFromUtf8("");
+   *   EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
+   * }
+   * 
+ * + * @param name Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption. + *

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its + * [primary version][google.cloud.kms.v1.CryptoKey.primary]. + * @param plaintext Required. The data to encrypt. Must be no larger than 64KiB. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EncryptResponse encrypt(CryptoKeyPathName name, ByteString plaintext) { + + EncryptRequest request = + EncryptRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setPlaintext(plaintext) + .build(); + return encrypt(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Encrypts data, so that it can only be recovered by a call to + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyPathName name = CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]");
+   *   ByteString plaintext = ByteString.copyFromUtf8("");
+   *   EncryptResponse response = keyManagementServiceClient.encrypt(name.toString(), plaintext);
+   * }
+   * 
+ * + * @param name Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption. + *

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its + * [primary version][google.cloud.kms.v1.CryptoKey.primary]. + * @param plaintext Required. The data to encrypt. Must be no larger than 64KiB. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final EncryptResponse encrypt(String name, ByteString plaintext) { + + EncryptRequest request = + EncryptRequest.newBuilder().setName(name).setPlaintext(plaintext).build(); + return encrypt(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Encrypts data, so that it can only be recovered by a call to + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyPathName name = CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]");
+   *   ByteString plaintext = ByteString.copyFromUtf8("");
+   *   EncryptRequest request = EncryptRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setPlaintext(plaintext)
+   *     .build();
+   *   EncryptResponse response = keyManagementServiceClient.encrypt(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 EncryptResponse encrypt(EncryptRequest request) { + return encryptCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Encrypts data, so that it can only be recovered by a call to + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyPathName name = CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]");
+   *   ByteString plaintext = ByteString.copyFromUtf8("");
+   *   EncryptRequest request = EncryptRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setPlaintext(plaintext)
+   *     .build();
+   *   ApiFuture<EncryptResponse> future = keyManagementServiceClient.encryptCallable().futureCall(request);
+   *   // Do something
+   *   EncryptResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable encryptCallable() { + return stub.encryptCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Decrypts data that was protected by + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ByteString ciphertext = ByteString.copyFromUtf8("");
+   *   DecryptResponse response = keyManagementServiceClient.decrypt(name, ciphertext);
+   * }
+   * 
+ * + * @param name Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to + * use for decryption. The server will choose the appropriate version. + * @param ciphertext Required. The encrypted data originally returned in + * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DecryptResponse decrypt(CryptoKeyName name, ByteString ciphertext) { + + DecryptRequest request = + DecryptRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setCiphertext(ciphertext) + .build(); + return decrypt(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Decrypts data that was protected by + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ByteString ciphertext = ByteString.copyFromUtf8("");
+   *   DecryptResponse response = keyManagementServiceClient.decrypt(name.toString(), ciphertext);
+   * }
+   * 
+ * + * @param name Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to + * use for decryption. The server will choose the appropriate version. + * @param ciphertext Required. The encrypted data originally returned in + * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DecryptResponse decrypt(String name, ByteString ciphertext) { + + DecryptRequest request = + DecryptRequest.newBuilder().setName(name).setCiphertext(ciphertext).build(); + return decrypt(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Decrypts data that was protected by + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ByteString ciphertext = ByteString.copyFromUtf8("");
+   *   DecryptRequest request = DecryptRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setCiphertext(ciphertext)
+   *     .build();
+   *   DecryptResponse response = keyManagementServiceClient.decrypt(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 DecryptResponse decrypt(DecryptRequest request) { + return decryptCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Decrypts data that was protected by + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   ByteString ciphertext = ByteString.copyFromUtf8("");
+   *   DecryptRequest request = DecryptRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setCiphertext(ciphertext)
+   *     .build();
+   *   ApiFuture<DecryptResponse> future = keyManagementServiceClient.decryptCallable().futureCall(request);
+   *   // Do something
+   *   DecryptResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable decryptCallable() { + return stub.decryptCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   String cryptoKeyVersionId = "";
+   *   CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);
+   * }
+   * 
+ * + * @param name The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + * @param cryptoKeyVersionId The id of the child + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKey updateCryptoKeyPrimaryVersion( + CryptoKeyName name, String cryptoKeyVersionId) { + + UpdateCryptoKeyPrimaryVersionRequest request = + UpdateCryptoKeyPrimaryVersionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setCryptoKeyVersionId(cryptoKeyVersionId) + .build(); + return updateCryptoKeyPrimaryVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   String cryptoKeyVersionId = "";
+   *   CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name.toString(), cryptoKeyVersionId);
+   * }
+   * 
+ * + * @param name The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + * @param cryptoKeyVersionId The id of the child + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKey updateCryptoKeyPrimaryVersion(String name, String cryptoKeyVersionId) { + + UpdateCryptoKeyPrimaryVersionRequest request = + UpdateCryptoKeyPrimaryVersionRequest.newBuilder() + .setName(name) + .setCryptoKeyVersionId(cryptoKeyVersionId) + .build(); + return updateCryptoKeyPrimaryVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   String cryptoKeyVersionId = "";
+   *   UpdateCryptoKeyPrimaryVersionRequest request = UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setCryptoKeyVersionId(cryptoKeyVersionId)
+   *     .build();
+   *   CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(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 CryptoKey updateCryptoKeyPrimaryVersion( + UpdateCryptoKeyPrimaryVersionRequest request) { + return updateCryptoKeyPrimaryVersionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
+   *   String cryptoKeyVersionId = "";
+   *   UpdateCryptoKeyPrimaryVersionRequest request = UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setCryptoKeyVersionId(cryptoKeyVersionId)
+   *     .build();
+   *   ApiFuture<CryptoKey> future = keyManagementServiceClient.updateCryptoKeyPrimaryVersionCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKey response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateCryptoKeyPrimaryVersionCallable() { + return stub.updateCryptoKeyPrimaryVersionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. + * + *

Upon calling this method, + * [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 + * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] + * will be changed to + * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key + * material will be irrevocably destroyed. + * + *

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may + * be called to reverse the process. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name);
+   * }
+   * 
+ * + * @param name The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * to destroy. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion destroyCryptoKeyVersion(CryptoKeyVersionName name) { + + DestroyCryptoKeyVersionRequest request = + DestroyCryptoKeyVersionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return destroyCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. + * + *

Upon calling this method, + * [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 + * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] + * will be changed to + * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key + * material will be irrevocably destroyed. + * + *

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may + * be called to reverse the process. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(name.toString());
+   * }
+   * 
+ * + * @param name The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * to destroy. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion destroyCryptoKeyVersion(String name) { + + DestroyCryptoKeyVersionRequest request = + DestroyCryptoKeyVersionRequest.newBuilder().setName(name).build(); + return destroyCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. + * + *

Upon calling this method, + * [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 + * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] + * will be changed to + * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key + * material will be irrevocably destroyed. + * + *

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may + * be called to reverse the process. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   DestroyCryptoKeyVersionRequest request = DestroyCryptoKeyVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.destroyCryptoKeyVersion(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 + */ + private final CryptoKeyVersion destroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest request) { + return destroyCryptoKeyVersionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. + * + *

Upon calling this method, + * [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] + * and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 + * hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] + * will be changed to + * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key + * material will be irrevocably destroyed. + * + *

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may + * be called to reverse the process. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   DestroyCryptoKeyVersionRequest request = DestroyCryptoKeyVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.destroyCryptoKeyVersionCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKeyVersion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + destroyCryptoKeyVersionCallable() { + return stub.destroyCryptoKeyVersionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + * state. + * + *

Upon restoration of the CryptoKeyVersion, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and + * [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(name);
+   * }
+   * 
+ * + * @param name The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * to restore. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion restoreCryptoKeyVersion(CryptoKeyVersionName name) { + + RestoreCryptoKeyVersionRequest request = + RestoreCryptoKeyVersionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return restoreCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + * state. + * + *

Upon restoration of the CryptoKeyVersion, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and + * [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(name.toString());
+   * }
+   * 
+ * + * @param name The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * to restore. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CryptoKeyVersion restoreCryptoKeyVersion(String name) { + + RestoreCryptoKeyVersionRequest request = + RestoreCryptoKeyVersionRequest.newBuilder().setName(name).build(); + return restoreCryptoKeyVersion(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + * state. + * + *

Upon restoration of the CryptoKeyVersion, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and + * [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   RestoreCryptoKeyVersionRequest request = RestoreCryptoKeyVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   CryptoKeyVersion response = keyManagementServiceClient.restoreCryptoKeyVersion(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 + */ + private final CryptoKeyVersion restoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest request) { + return restoreCryptoKeyVersionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], + * state. + * + *

Upon restoration of the CryptoKeyVersion, + * [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to + * [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and + * [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   CryptoKeyVersionName name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
+   *   RestoreCryptoKeyVersionRequest request = RestoreCryptoKeyVersionRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<CryptoKeyVersion> future = keyManagementServiceClient.restoreCryptoKeyVersionCallable().futureCall(request);
+   *   // Do something
+   *   CryptoKeyVersion response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + restoreCryptoKeyVersionCallable() { + return stub.restoreCryptoKeyVersionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified resource. Replaces any existing policy. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = keyManagementServiceClient.setIamPolicy(resource, policy);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. `resource` is + * usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(KeyName resource, Policy policy) { + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setPolicy(policy) + .build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified resource. Replaces any existing policy. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = keyManagementServiceClient.setIamPolicy(resource.toString(), policy);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. `resource` is + * usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(String resource, Policy policy) { + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified resource. Replaces any existing policy. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   ResourceName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setPolicy(policy)
+   *     .build();
+   *   Policy response = keyManagementServiceClient.setIamPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy on the specified resource. Replaces any existing policy. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   ResourceName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setPolicy(policy)
+   *     .build();
+   *   ApiFuture<Policy> future = keyManagementServiceClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Policy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   Policy response = keyManagementServiceClient.getIamPolicy(resource);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is + * usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(KeyName resource) { + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   Policy response = keyManagementServiceClient.getIamPolicy(resource.toString());
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. `resource` is + * usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(String resource) { + + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   ResourceName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .build();
+   *   Policy response = keyManagementServiceClient.getIamPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + private final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a resource. Returns an empty policy if the resource exists + * and does not have a policy set. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   ResourceName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .build();
+   *   ApiFuture<Policy> future = keyManagementServiceClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Policy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. If the resource does not + * exist, this will return an empty set of permissions, not a NOT_FOUND error. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(resource, permissions);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. + * `resource` is usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + KeyName resource, List permissions) { + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. If the resource does not + * exist, this will return an empty set of permissions, not a NOT_FOUND error. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(resource.toString(), permissions);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. + * `resource` is usually specified as a path. For example, a Project resource is specified as + * `projects/{project}`. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + String resource, List permissions) { + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. If the resource does not + * exist, this will return an empty set of permissions, not a NOT_FOUND error. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   ResourceName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .addAllPermissions(permissions)
+   *     .build();
+   *   TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns permissions that a caller has on the specified resource. If the resource does not + * exist, this will return an empty set of permissions, not a NOT_FOUND error. + * + *

Sample code: + * + *


+   * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+   *   ResourceName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .addAllPermissions(permissions)
+   *     .build();
+   *   ApiFuture<TestIamPermissionsResponse> future = keyManagementServiceClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListKeyRingsPagedResponse + extends AbstractPagedListResponse< + ListKeyRingsRequest, ListKeyRingsResponse, KeyRing, ListKeyRingsPage, + ListKeyRingsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListKeyRingsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListKeyRingsPagedResponse apply(ListKeyRingsPage input) { + return new ListKeyRingsPagedResponse(input); + } + }); + } + + private ListKeyRingsPagedResponse(ListKeyRingsPage page) { + super(page, ListKeyRingsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListKeyRingsPage + extends AbstractPage { + + private ListKeyRingsPage( + PageContext context, + ListKeyRingsResponse response) { + super(context, response); + } + + private static ListKeyRingsPage createEmptyPage() { + return new ListKeyRingsPage(null, null); + } + + @Override + protected ListKeyRingsPage createPage( + PageContext context, + ListKeyRingsResponse response) { + return new ListKeyRingsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListKeyRingsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListKeyRingsRequest, ListKeyRingsResponse, KeyRing, ListKeyRingsPage, + ListKeyRingsFixedSizeCollection> { + + private ListKeyRingsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListKeyRingsFixedSizeCollection createEmptyCollection() { + return new ListKeyRingsFixedSizeCollection(null, 0); + } + + @Override + protected ListKeyRingsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListKeyRingsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListCryptoKeysPagedResponse + extends AbstractPagedListResponse< + ListCryptoKeysRequest, ListCryptoKeysResponse, CryptoKey, ListCryptoKeysPage, + ListCryptoKeysFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListCryptoKeysPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListCryptoKeysPagedResponse apply(ListCryptoKeysPage input) { + return new ListCryptoKeysPagedResponse(input); + } + }); + } + + private ListCryptoKeysPagedResponse(ListCryptoKeysPage page) { + super(page, ListCryptoKeysFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListCryptoKeysPage + extends AbstractPage< + ListCryptoKeysRequest, ListCryptoKeysResponse, CryptoKey, ListCryptoKeysPage> { + + private ListCryptoKeysPage( + PageContext context, + ListCryptoKeysResponse response) { + super(context, response); + } + + private static ListCryptoKeysPage createEmptyPage() { + return new ListCryptoKeysPage(null, null); + } + + @Override + protected ListCryptoKeysPage createPage( + PageContext context, + ListCryptoKeysResponse response) { + return new ListCryptoKeysPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListCryptoKeysFixedSizeCollection + extends AbstractFixedSizeCollection< + ListCryptoKeysRequest, ListCryptoKeysResponse, CryptoKey, ListCryptoKeysPage, + ListCryptoKeysFixedSizeCollection> { + + private ListCryptoKeysFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListCryptoKeysFixedSizeCollection createEmptyCollection() { + return new ListCryptoKeysFixedSizeCollection(null, 0); + } + + @Override + protected ListCryptoKeysFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListCryptoKeysFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListCryptoKeyVersionsPagedResponse + extends AbstractPagedListResponse< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, CryptoKeyVersion, + ListCryptoKeyVersionsPage, ListCryptoKeyVersionsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListCryptoKeyVersionsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListCryptoKeyVersionsPagedResponse apply(ListCryptoKeyVersionsPage input) { + return new ListCryptoKeyVersionsPagedResponse(input); + } + }); + } + + private ListCryptoKeyVersionsPagedResponse(ListCryptoKeyVersionsPage page) { + super(page, ListCryptoKeyVersionsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListCryptoKeyVersionsPage + extends AbstractPage< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, CryptoKeyVersion, + ListCryptoKeyVersionsPage> { + + private ListCryptoKeyVersionsPage( + PageContext + context, + ListCryptoKeyVersionsResponse response) { + super(context, response); + } + + private static ListCryptoKeyVersionsPage createEmptyPage() { + return new ListCryptoKeyVersionsPage(null, null); + } + + @Override + protected ListCryptoKeyVersionsPage createPage( + PageContext + context, + ListCryptoKeyVersionsResponse response) { + return new ListCryptoKeyVersionsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListCryptoKeyVersionsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, CryptoKeyVersion, + ListCryptoKeyVersionsPage, ListCryptoKeyVersionsFixedSizeCollection> { + + private ListCryptoKeyVersionsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListCryptoKeyVersionsFixedSizeCollection createEmptyCollection() { + return new ListCryptoKeyVersionsFixedSizeCollection(null, 0); + } + + @Override + protected ListCryptoKeyVersionsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListCryptoKeyVersionsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceSettings.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceSettings.java new file mode 100644 index 000000000000..f0352aabd4c0 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceSettings.java @@ -0,0 +1,393 @@ +/* + * Copyright 2018 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 static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.kms.v1.stub.KeyManagementServiceStubSettings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link KeyManagementServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (cloudkms.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getKeyRing to 30 seconds: + * + *

+ * 
+ * KeyManagementServiceSettings.Builder keyManagementServiceSettingsBuilder =
+ *     KeyManagementServiceSettings.newBuilder();
+ * keyManagementServiceSettingsBuilder.getKeyRingSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * KeyManagementServiceSettings keyManagementServiceSettings = keyManagementServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class KeyManagementServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listKeyRings. */ + public PagedCallSettings + listKeyRingsSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).listKeyRingsSettings(); + } + + /** Returns the object with the settings used for calls to listCryptoKeys. */ + public PagedCallSettings< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + listCryptoKeysSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).listCryptoKeysSettings(); + } + + /** Returns the object with the settings used for calls to listCryptoKeyVersions. */ + public PagedCallSettings< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + listCryptoKeyVersionsSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).listCryptoKeyVersionsSettings(); + } + + /** Returns the object with the settings used for calls to getKeyRing. */ + public UnaryCallSettings getKeyRingSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).getKeyRingSettings(); + } + + /** Returns the object with the settings used for calls to getCryptoKey. */ + public UnaryCallSettings getCryptoKeySettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).getCryptoKeySettings(); + } + + /** Returns the object with the settings used for calls to getCryptoKeyVersion. */ + public UnaryCallSettings + getCryptoKeyVersionSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).getCryptoKeyVersionSettings(); + } + + /** Returns the object with the settings used for calls to createKeyRing. */ + public UnaryCallSettings createKeyRingSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).createKeyRingSettings(); + } + + /** Returns the object with the settings used for calls to createCryptoKey. */ + public UnaryCallSettings createCryptoKeySettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).createCryptoKeySettings(); + } + + /** Returns the object with the settings used for calls to createCryptoKeyVersion. */ + public UnaryCallSettings + createCryptoKeyVersionSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).createCryptoKeyVersionSettings(); + } + + /** Returns the object with the settings used for calls to updateCryptoKey. */ + public UnaryCallSettings updateCryptoKeySettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).updateCryptoKeySettings(); + } + + /** Returns the object with the settings used for calls to updateCryptoKeyVersion. */ + public UnaryCallSettings + updateCryptoKeyVersionSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).updateCryptoKeyVersionSettings(); + } + + /** Returns the object with the settings used for calls to encrypt. */ + public UnaryCallSettings encryptSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).encryptSettings(); + } + + /** Returns the object with the settings used for calls to decrypt. */ + public UnaryCallSettings decryptSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).decryptSettings(); + } + + /** Returns the object with the settings used for calls to updateCryptoKeyPrimaryVersion. */ + public UnaryCallSettings + updateCryptoKeyPrimaryVersionSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()) + .updateCryptoKeyPrimaryVersionSettings(); + } + + /** Returns the object with the settings used for calls to destroyCryptoKeyVersion. */ + public UnaryCallSettings + destroyCryptoKeyVersionSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).destroyCryptoKeyVersionSettings(); + } + + /** Returns the object with the settings used for calls to restoreCryptoKeyVersion. */ + public UnaryCallSettings + restoreCryptoKeyVersionSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).restoreCryptoKeyVersionSettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((KeyManagementServiceStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + + public static final KeyManagementServiceSettings create(KeyManagementServiceStubSettings stub) + throws IOException { + return new KeyManagementServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return KeyManagementServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return KeyManagementServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return KeyManagementServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return KeyManagementServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return KeyManagementServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return KeyManagementServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return KeyManagementServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected KeyManagementServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for KeyManagementServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + 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()); + } + + protected Builder(KeyManagementServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public KeyManagementServiceStubSettings.Builder getStubSettingsBuilder() { + return ((KeyManagementServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to listKeyRings. */ + public PagedCallSettings.Builder< + ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse> + listKeyRingsSettings() { + return getStubSettingsBuilder().listKeyRingsSettings(); + } + + /** Returns the builder for the settings used for calls to listCryptoKeys. */ + public PagedCallSettings.Builder< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + listCryptoKeysSettings() { + return getStubSettingsBuilder().listCryptoKeysSettings(); + } + + /** Returns the builder for the settings used for calls to listCryptoKeyVersions. */ + public PagedCallSettings.Builder< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + listCryptoKeyVersionsSettings() { + return getStubSettingsBuilder().listCryptoKeyVersionsSettings(); + } + + /** Returns the builder for the settings used for calls to getKeyRing. */ + public UnaryCallSettings.Builder getKeyRingSettings() { + return getStubSettingsBuilder().getKeyRingSettings(); + } + + /** Returns the builder for the settings used for calls to getCryptoKey. */ + public UnaryCallSettings.Builder getCryptoKeySettings() { + return getStubSettingsBuilder().getCryptoKeySettings(); + } + + /** Returns the builder for the settings used for calls to getCryptoKeyVersion. */ + public UnaryCallSettings.Builder + getCryptoKeyVersionSettings() { + return getStubSettingsBuilder().getCryptoKeyVersionSettings(); + } + + /** Returns the builder for the settings used for calls to createKeyRing. */ + public UnaryCallSettings.Builder createKeyRingSettings() { + return getStubSettingsBuilder().createKeyRingSettings(); + } + + /** Returns the builder for the settings used for calls to createCryptoKey. */ + public UnaryCallSettings.Builder createCryptoKeySettings() { + return getStubSettingsBuilder().createCryptoKeySettings(); + } + + /** Returns the builder for the settings used for calls to createCryptoKeyVersion. */ + public UnaryCallSettings.Builder + createCryptoKeyVersionSettings() { + return getStubSettingsBuilder().createCryptoKeyVersionSettings(); + } + + /** Returns the builder for the settings used for calls to updateCryptoKey. */ + public UnaryCallSettings.Builder updateCryptoKeySettings() { + return getStubSettingsBuilder().updateCryptoKeySettings(); + } + + /** Returns the builder for the settings used for calls to updateCryptoKeyVersion. */ + public UnaryCallSettings.Builder + updateCryptoKeyVersionSettings() { + return getStubSettingsBuilder().updateCryptoKeyVersionSettings(); + } + + /** Returns the builder for the settings used for calls to encrypt. */ + public UnaryCallSettings.Builder encryptSettings() { + return getStubSettingsBuilder().encryptSettings(); + } + + /** Returns the builder for the settings used for calls to decrypt. */ + public UnaryCallSettings.Builder decryptSettings() { + return getStubSettingsBuilder().decryptSettings(); + } + + /** Returns the builder for the settings used for calls to updateCryptoKeyPrimaryVersion. */ + public UnaryCallSettings.Builder + updateCryptoKeyPrimaryVersionSettings() { + return getStubSettingsBuilder().updateCryptoKeyPrimaryVersionSettings(); + } + + /** Returns the builder for the settings used for calls to destroyCryptoKeyVersion. */ + public UnaryCallSettings.Builder + destroyCryptoKeyVersionSettings() { + return getStubSettingsBuilder().destroyCryptoKeyVersionSettings(); + } + + /** Returns the builder for the settings used for calls to restoreCryptoKeyVersion. */ + public UnaryCallSettings.Builder + restoreCryptoKeyVersionSettings() { + return getStubSettingsBuilder().restoreCryptoKeyVersionSettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + + @Override + public KeyManagementServiceSettings build() throws IOException { + return new KeyManagementServiceSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/package-info.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/package-info.java new file mode 100644 index 000000000000..54b961c22d45 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/package-info.java @@ -0,0 +1,43 @@ +/* + * Copyright 2018 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. + */ + +/** + * A client to Google Cloud Key Management Service (KMS) API. + * + *

The interfaces provided are listed below, along with usage samples. + * + *

========================== KeyManagementServiceClient ========================== + * + *

Service Description: Google Cloud Key Management Service + * + *

Manages cryptographic keys and operations using those keys. Implements a REST model with the + * following objects: + * + *

* [KeyRing][google.cloud.kms.v1.KeyRing] * [CryptoKey][google.cloud.kms.v1.CryptoKey] + * * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * + *

Sample for KeyManagementServiceClient: + * + *

+ * 
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ *   KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ *   KeyRing response = keyManagementServiceClient.getKeyRing(name);
+ * }
+ * 
+ * 
+ */ +package com.google.cloud.kms.v1; diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceCallableFactory.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceCallableFactory.java new file mode 100644 index 000000000000..7d0141c2a063 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceCallableFactory.java @@ -0,0 +1,116 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.kms.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Google Cloud Key Management Service (KMS) API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcKeyManagementServiceCallableFactory implements GrpcStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceStub.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceStub.java new file mode 100644 index 000000000000..42ea2ace8ff0 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceStub.java @@ -0,0 +1,794 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.kms.v1.stub; + +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.kms.v1.CreateCryptoKeyRequest; +import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.CreateKeyRingRequest; +import com.google.cloud.kms.v1.CryptoKey; +import com.google.cloud.kms.v1.CryptoKeyVersion; +import com.google.cloud.kms.v1.DecryptRequest; +import com.google.cloud.kms.v1.DecryptResponse; +import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.EncryptRequest; +import com.google.cloud.kms.v1.EncryptResponse; +import com.google.cloud.kms.v1.GetCryptoKeyRequest; +import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.GetKeyRingRequest; +import com.google.cloud.kms.v1.KeyRing; +import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest; +import com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse; +import com.google.cloud.kms.v1.ListCryptoKeysRequest; +import com.google.cloud.kms.v1.ListCryptoKeysResponse; +import com.google.cloud.kms.v1.ListKeyRingsRequest; +import com.google.cloud.kms.v1.ListKeyRingsResponse; +import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; +import com.google.common.collect.ImmutableMap; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Google Cloud Key Management Service (KMS) API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcKeyManagementServiceStub extends KeyManagementServiceStub { + + private static final MethodDescriptor + listKeyRingsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListKeyRings") + .setRequestMarshaller(ProtoUtils.marshaller(ListKeyRingsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListKeyRingsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listCryptoKeysMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListCryptoKeys") + .setRequestMarshaller( + ProtoUtils.marshaller(ListCryptoKeysRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListCryptoKeysResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listCryptoKeyVersionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListCryptoKeyVersions") + .setRequestMarshaller( + ProtoUtils.marshaller(ListCryptoKeyVersionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListCryptoKeyVersionsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor getKeyRingMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetKeyRing") + .setRequestMarshaller(ProtoUtils.marshaller(GetKeyRingRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(KeyRing.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getCryptoKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetCryptoKey") + .setRequestMarshaller(ProtoUtils.marshaller(GetCryptoKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getCryptoKeyVersionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetCryptoKeyVersion") + .setRequestMarshaller( + ProtoUtils.marshaller(GetCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createKeyRingMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateKeyRing") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateKeyRingRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(KeyRing.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createCryptoKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateCryptoKey") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateCryptoKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createCryptoKeyVersionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateCryptoKeyVersion") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateCryptoKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/UpdateCryptoKey") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateCryptoKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateCryptoKeyVersionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/UpdateCryptoKeyVersion") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) + .build(); + private static final MethodDescriptor encryptMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/Encrypt") + .setRequestMarshaller(ProtoUtils.marshaller(EncryptRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(EncryptResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor decryptMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/Decrypt") + .setRequestMarshaller(ProtoUtils.marshaller(DecryptRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(DecryptResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateCryptoKeyPrimaryVersionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.kms.v1.KeyManagementService/UpdateCryptoKeyPrimaryVersion") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateCryptoKeyPrimaryVersionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) + .build(); + private static final MethodDescriptor + destroyCryptoKeyVersionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/DestroyCryptoKeyVersion") + .setRequestMarshaller( + ProtoUtils.marshaller(DestroyCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) + .build(); + private static final MethodDescriptor + restoreCryptoKeyVersionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RestoreCryptoKeyVersion") + .setRequestMarshaller( + ProtoUtils.marshaller(RestoreCryptoKeyVersionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) + .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable listKeyRingsCallable; + private final UnaryCallable + listKeyRingsPagedCallable; + private final UnaryCallable listCryptoKeysCallable; + private final UnaryCallable + listCryptoKeysPagedCallable; + private final UnaryCallable + listCryptoKeyVersionsCallable; + private final UnaryCallable + listCryptoKeyVersionsPagedCallable; + private final UnaryCallable getKeyRingCallable; + private final UnaryCallable getCryptoKeyCallable; + private final UnaryCallable + getCryptoKeyVersionCallable; + private final UnaryCallable createKeyRingCallable; + private final UnaryCallable createCryptoKeyCallable; + private final UnaryCallable + createCryptoKeyVersionCallable; + private final UnaryCallable updateCryptoKeyCallable; + private final UnaryCallable + updateCryptoKeyVersionCallable; + private final UnaryCallable encryptCallable; + private final UnaryCallable decryptCallable; + private final UnaryCallable + updateCryptoKeyPrimaryVersionCallable; + private final UnaryCallable + destroyCryptoKeyVersionCallable; + private final UnaryCallable + restoreCryptoKeyVersionCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcKeyManagementServiceStub create(KeyManagementServiceStubSettings settings) + throws IOException { + return new GrpcKeyManagementServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcKeyManagementServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcKeyManagementServiceStub( + KeyManagementServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcKeyManagementServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcKeyManagementServiceStub( + KeyManagementServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcKeyManagementServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcKeyManagementServiceStub( + KeyManagementServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcKeyManagementServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcKeyManagementServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcKeyManagementServiceStub( + KeyManagementServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings listKeyRingsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listKeyRingsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListKeyRingsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listCryptoKeysTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listCryptoKeysMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListCryptoKeysRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listCryptoKeyVersionsTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listCryptoKeyVersionsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListCryptoKeyVersionsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getKeyRingTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getKeyRingMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetKeyRingRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getCryptoKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getCryptoKeyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetCryptoKeyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getCryptoKeyVersionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getCryptoKeyVersionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetCryptoKeyVersionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createKeyRingTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createKeyRingMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateKeyRingRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createCryptoKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createCryptoKeyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateCryptoKeyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + createCryptoKeyVersionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createCryptoKeyVersionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateCryptoKeyVersionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateCryptoKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateCryptoKeyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateCryptoKeyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("crypto_key.name", String.valueOf(request.getCryptoKey().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + updateCryptoKeyVersionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateCryptoKeyVersionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateCryptoKeyVersionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "crypto_key_version.name", + String.valueOf(request.getCryptoKeyVersion().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings encryptTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(encryptMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(EncryptRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings decryptTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(decryptMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DecryptRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + updateCryptoKeyPrimaryVersionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateCryptoKeyPrimaryVersionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + UpdateCryptoKeyPrimaryVersionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + destroyCryptoKeyVersionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(destroyCryptoKeyVersionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DestroyCryptoKeyVersionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + restoreCryptoKeyVersionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(restoreCryptoKeyVersionMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(RestoreCryptoKeyVersionRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(SetIamPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetIamPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(TestIamPermissionsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + + this.listKeyRingsCallable = + callableFactory.createUnaryCallable( + listKeyRingsTransportSettings, settings.listKeyRingsSettings(), clientContext); + this.listKeyRingsPagedCallable = + callableFactory.createPagedCallable( + listKeyRingsTransportSettings, settings.listKeyRingsSettings(), clientContext); + this.listCryptoKeysCallable = + callableFactory.createUnaryCallable( + listCryptoKeysTransportSettings, settings.listCryptoKeysSettings(), clientContext); + this.listCryptoKeysPagedCallable = + callableFactory.createPagedCallable( + listCryptoKeysTransportSettings, settings.listCryptoKeysSettings(), clientContext); + this.listCryptoKeyVersionsCallable = + callableFactory.createUnaryCallable( + listCryptoKeyVersionsTransportSettings, + settings.listCryptoKeyVersionsSettings(), + clientContext); + this.listCryptoKeyVersionsPagedCallable = + callableFactory.createPagedCallable( + listCryptoKeyVersionsTransportSettings, + settings.listCryptoKeyVersionsSettings(), + clientContext); + this.getKeyRingCallable = + callableFactory.createUnaryCallable( + getKeyRingTransportSettings, settings.getKeyRingSettings(), clientContext); + this.getCryptoKeyCallable = + callableFactory.createUnaryCallable( + getCryptoKeyTransportSettings, settings.getCryptoKeySettings(), clientContext); + this.getCryptoKeyVersionCallable = + callableFactory.createUnaryCallable( + getCryptoKeyVersionTransportSettings, + settings.getCryptoKeyVersionSettings(), + clientContext); + this.createKeyRingCallable = + callableFactory.createUnaryCallable( + createKeyRingTransportSettings, settings.createKeyRingSettings(), clientContext); + this.createCryptoKeyCallable = + callableFactory.createUnaryCallable( + createCryptoKeyTransportSettings, settings.createCryptoKeySettings(), clientContext); + this.createCryptoKeyVersionCallable = + callableFactory.createUnaryCallable( + createCryptoKeyVersionTransportSettings, + settings.createCryptoKeyVersionSettings(), + clientContext); + this.updateCryptoKeyCallable = + callableFactory.createUnaryCallable( + updateCryptoKeyTransportSettings, settings.updateCryptoKeySettings(), clientContext); + this.updateCryptoKeyVersionCallable = + callableFactory.createUnaryCallable( + updateCryptoKeyVersionTransportSettings, + settings.updateCryptoKeyVersionSettings(), + clientContext); + this.encryptCallable = + callableFactory.createUnaryCallable( + encryptTransportSettings, settings.encryptSettings(), clientContext); + this.decryptCallable = + callableFactory.createUnaryCallable( + decryptTransportSettings, settings.decryptSettings(), clientContext); + this.updateCryptoKeyPrimaryVersionCallable = + callableFactory.createUnaryCallable( + updateCryptoKeyPrimaryVersionTransportSettings, + settings.updateCryptoKeyPrimaryVersionSettings(), + clientContext); + this.destroyCryptoKeyVersionCallable = + callableFactory.createUnaryCallable( + destroyCryptoKeyVersionTransportSettings, + settings.destroyCryptoKeyVersionSettings(), + clientContext); + this.restoreCryptoKeyVersionCallable = + callableFactory.createUnaryCallable( + restoreCryptoKeyVersionTransportSettings, + settings.restoreCryptoKeyVersionSettings(), + clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable listKeyRingsPagedCallable() { + return listKeyRingsPagedCallable; + } + + public UnaryCallable listKeyRingsCallable() { + return listKeyRingsCallable; + } + + public UnaryCallable + listCryptoKeysPagedCallable() { + return listCryptoKeysPagedCallable; + } + + public UnaryCallable listCryptoKeysCallable() { + return listCryptoKeysCallable; + } + + public UnaryCallable + listCryptoKeyVersionsPagedCallable() { + return listCryptoKeyVersionsPagedCallable; + } + + public UnaryCallable + listCryptoKeyVersionsCallable() { + return listCryptoKeyVersionsCallable; + } + + public UnaryCallable getKeyRingCallable() { + return getKeyRingCallable; + } + + public UnaryCallable getCryptoKeyCallable() { + return getCryptoKeyCallable; + } + + public UnaryCallable getCryptoKeyVersionCallable() { + return getCryptoKeyVersionCallable; + } + + public UnaryCallable createKeyRingCallable() { + return createKeyRingCallable; + } + + public UnaryCallable createCryptoKeyCallable() { + return createCryptoKeyCallable; + } + + public UnaryCallable + createCryptoKeyVersionCallable() { + return createCryptoKeyVersionCallable; + } + + public UnaryCallable updateCryptoKeyCallable() { + return updateCryptoKeyCallable; + } + + public UnaryCallable + updateCryptoKeyVersionCallable() { + return updateCryptoKeyVersionCallable; + } + + public UnaryCallable encryptCallable() { + return encryptCallable; + } + + public UnaryCallable decryptCallable() { + return decryptCallable; + } + + public UnaryCallable + updateCryptoKeyPrimaryVersionCallable() { + return updateCryptoKeyPrimaryVersionCallable; + } + + public UnaryCallable + destroyCryptoKeyVersionCallable() { + return destroyCryptoKeyVersionCallable; + } + + public UnaryCallable + restoreCryptoKeyVersionCallable() { + return restoreCryptoKeyVersionCallable; + } + + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/KeyManagementServiceStub.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/KeyManagementServiceStub.java new file mode 100644 index 000000000000..4ceeb1a57abb --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/KeyManagementServiceStub.java @@ -0,0 +1,167 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.kms.v1.stub; + +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.kms.v1.CreateCryptoKeyRequest; +import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.CreateKeyRingRequest; +import com.google.cloud.kms.v1.CryptoKey; +import com.google.cloud.kms.v1.CryptoKeyVersion; +import com.google.cloud.kms.v1.DecryptRequest; +import com.google.cloud.kms.v1.DecryptResponse; +import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.EncryptRequest; +import com.google.cloud.kms.v1.EncryptResponse; +import com.google.cloud.kms.v1.GetCryptoKeyRequest; +import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.GetKeyRingRequest; +import com.google.cloud.kms.v1.KeyRing; +import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest; +import com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse; +import com.google.cloud.kms.v1.ListCryptoKeysRequest; +import com.google.cloud.kms.v1.ListCryptoKeysResponse; +import com.google.cloud.kms.v1.ListKeyRingsRequest; +import com.google.cloud.kms.v1.ListKeyRingsResponse; +import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Google Cloud Key Management Service (KMS) API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class KeyManagementServiceStub implements BackgroundResource { + + public UnaryCallable listKeyRingsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listKeyRingsPagedCallable()"); + } + + public UnaryCallable listKeyRingsCallable() { + throw new UnsupportedOperationException("Not implemented: listKeyRingsCallable()"); + } + + public UnaryCallable + listCryptoKeysPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listCryptoKeysPagedCallable()"); + } + + public UnaryCallable listCryptoKeysCallable() { + throw new UnsupportedOperationException("Not implemented: listCryptoKeysCallable()"); + } + + public UnaryCallable + listCryptoKeyVersionsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listCryptoKeyVersionsPagedCallable()"); + } + + public UnaryCallable + listCryptoKeyVersionsCallable() { + throw new UnsupportedOperationException("Not implemented: listCryptoKeyVersionsCallable()"); + } + + public UnaryCallable getKeyRingCallable() { + throw new UnsupportedOperationException("Not implemented: getKeyRingCallable()"); + } + + public UnaryCallable getCryptoKeyCallable() { + throw new UnsupportedOperationException("Not implemented: getCryptoKeyCallable()"); + } + + public UnaryCallable getCryptoKeyVersionCallable() { + throw new UnsupportedOperationException("Not implemented: getCryptoKeyVersionCallable()"); + } + + public UnaryCallable createKeyRingCallable() { + throw new UnsupportedOperationException("Not implemented: createKeyRingCallable()"); + } + + public UnaryCallable createCryptoKeyCallable() { + throw new UnsupportedOperationException("Not implemented: createCryptoKeyCallable()"); + } + + public UnaryCallable + createCryptoKeyVersionCallable() { + throw new UnsupportedOperationException("Not implemented: createCryptoKeyVersionCallable()"); + } + + public UnaryCallable updateCryptoKeyCallable() { + throw new UnsupportedOperationException("Not implemented: updateCryptoKeyCallable()"); + } + + public UnaryCallable + updateCryptoKeyVersionCallable() { + throw new UnsupportedOperationException("Not implemented: updateCryptoKeyVersionCallable()"); + } + + public UnaryCallable encryptCallable() { + throw new UnsupportedOperationException("Not implemented: encryptCallable()"); + } + + public UnaryCallable decryptCallable() { + throw new UnsupportedOperationException("Not implemented: decryptCallable()"); + } + + public UnaryCallable + updateCryptoKeyPrimaryVersionCallable() { + throw new UnsupportedOperationException( + "Not implemented: updateCryptoKeyPrimaryVersionCallable()"); + } + + public UnaryCallable + destroyCryptoKeyVersionCallable() { + throw new UnsupportedOperationException("Not implemented: destroyCryptoKeyVersionCallable()"); + } + + public UnaryCallable + restoreCryptoKeyVersionCallable() { + throw new UnsupportedOperationException("Not implemented: restoreCryptoKeyVersionCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java new file mode 100644 index 000000000000..53817ce8b7fb --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/KeyManagementServiceStubSettings.java @@ -0,0 +1,944 @@ +/* + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.kms.v1.stub; + +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.kms.v1.CreateCryptoKeyRequest; +import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.CreateKeyRingRequest; +import com.google.cloud.kms.v1.CryptoKey; +import com.google.cloud.kms.v1.CryptoKeyVersion; +import com.google.cloud.kms.v1.DecryptRequest; +import com.google.cloud.kms.v1.DecryptResponse; +import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.EncryptRequest; +import com.google.cloud.kms.v1.EncryptResponse; +import com.google.cloud.kms.v1.GetCryptoKeyRequest; +import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.GetKeyRingRequest; +import com.google.cloud.kms.v1.KeyRing; +import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest; +import com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse; +import com.google.cloud.kms.v1.ListCryptoKeysRequest; +import com.google.cloud.kms.v1.ListCryptoKeysResponse; +import com.google.cloud.kms.v1.ListKeyRingsRequest; +import com.google.cloud.kms.v1.ListKeyRingsResponse; +import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyRequest; +import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link KeyManagementServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (cloudkms.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. For + * example, to set the total timeout of getKeyRing to 30 seconds: + * + *

+ * 
+ * KeyManagementServiceStubSettings.Builder keyManagementServiceSettingsBuilder =
+ *     KeyManagementServiceStubSettings.newBuilder();
+ * keyManagementServiceSettingsBuilder.getKeyRingSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * KeyManagementServiceStubSettings keyManagementServiceSettings = keyManagementServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class KeyManagementServiceStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final PagedCallSettings< + ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse> + listKeyRingsSettings; + private final PagedCallSettings< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + listCryptoKeysSettings; + private final PagedCallSettings< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + listCryptoKeyVersionsSettings; + private final UnaryCallSettings getKeyRingSettings; + private final UnaryCallSettings getCryptoKeySettings; + private final UnaryCallSettings + getCryptoKeyVersionSettings; + private final UnaryCallSettings createKeyRingSettings; + private final UnaryCallSettings createCryptoKeySettings; + private final UnaryCallSettings + createCryptoKeyVersionSettings; + private final UnaryCallSettings updateCryptoKeySettings; + private final UnaryCallSettings + updateCryptoKeyVersionSettings; + private final UnaryCallSettings encryptSettings; + private final UnaryCallSettings decryptSettings; + private final UnaryCallSettings + updateCryptoKeyPrimaryVersionSettings; + private final UnaryCallSettings + destroyCryptoKeyVersionSettings; + private final UnaryCallSettings + restoreCryptoKeyVersionSettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + /** Returns the object with the settings used for calls to listKeyRings. */ + public PagedCallSettings + listKeyRingsSettings() { + return listKeyRingsSettings; + } + + /** Returns the object with the settings used for calls to listCryptoKeys. */ + public PagedCallSettings< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + listCryptoKeysSettings() { + return listCryptoKeysSettings; + } + + /** Returns the object with the settings used for calls to listCryptoKeyVersions. */ + public PagedCallSettings< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + listCryptoKeyVersionsSettings() { + return listCryptoKeyVersionsSettings; + } + + /** Returns the object with the settings used for calls to getKeyRing. */ + public UnaryCallSettings getKeyRingSettings() { + return getKeyRingSettings; + } + + /** Returns the object with the settings used for calls to getCryptoKey. */ + public UnaryCallSettings getCryptoKeySettings() { + return getCryptoKeySettings; + } + + /** Returns the object with the settings used for calls to getCryptoKeyVersion. */ + public UnaryCallSettings + getCryptoKeyVersionSettings() { + return getCryptoKeyVersionSettings; + } + + /** Returns the object with the settings used for calls to createKeyRing. */ + public UnaryCallSettings createKeyRingSettings() { + return createKeyRingSettings; + } + + /** Returns the object with the settings used for calls to createCryptoKey. */ + public UnaryCallSettings createCryptoKeySettings() { + return createCryptoKeySettings; + } + + /** Returns the object with the settings used for calls to createCryptoKeyVersion. */ + public UnaryCallSettings + createCryptoKeyVersionSettings() { + return createCryptoKeyVersionSettings; + } + + /** Returns the object with the settings used for calls to updateCryptoKey. */ + public UnaryCallSettings updateCryptoKeySettings() { + return updateCryptoKeySettings; + } + + /** Returns the object with the settings used for calls to updateCryptoKeyVersion. */ + public UnaryCallSettings + updateCryptoKeyVersionSettings() { + return updateCryptoKeyVersionSettings; + } + + /** Returns the object with the settings used for calls to encrypt. */ + public UnaryCallSettings encryptSettings() { + return encryptSettings; + } + + /** Returns the object with the settings used for calls to decrypt. */ + public UnaryCallSettings decryptSettings() { + return decryptSettings; + } + + /** Returns the object with the settings used for calls to updateCryptoKeyPrimaryVersion. */ + public UnaryCallSettings + updateCryptoKeyPrimaryVersionSettings() { + return updateCryptoKeyPrimaryVersionSettings; + } + + /** Returns the object with the settings used for calls to destroyCryptoKeyVersion. */ + public UnaryCallSettings + destroyCryptoKeyVersionSettings() { + return destroyCryptoKeyVersionSettings; + } + + /** Returns the object with the settings used for calls to restoreCryptoKeyVersion. */ + public UnaryCallSettings + restoreCryptoKeyVersionSettings() { + return restoreCryptoKeyVersionSettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public KeyManagementServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcKeyManagementServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "cloudkms.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(KeyManagementServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected KeyManagementServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listKeyRingsSettings = settingsBuilder.listKeyRingsSettings().build(); + listCryptoKeysSettings = settingsBuilder.listCryptoKeysSettings().build(); + listCryptoKeyVersionsSettings = settingsBuilder.listCryptoKeyVersionsSettings().build(); + getKeyRingSettings = settingsBuilder.getKeyRingSettings().build(); + getCryptoKeySettings = settingsBuilder.getCryptoKeySettings().build(); + getCryptoKeyVersionSettings = settingsBuilder.getCryptoKeyVersionSettings().build(); + createKeyRingSettings = settingsBuilder.createKeyRingSettings().build(); + createCryptoKeySettings = settingsBuilder.createCryptoKeySettings().build(); + createCryptoKeyVersionSettings = settingsBuilder.createCryptoKeyVersionSettings().build(); + updateCryptoKeySettings = settingsBuilder.updateCryptoKeySettings().build(); + updateCryptoKeyVersionSettings = settingsBuilder.updateCryptoKeyVersionSettings().build(); + encryptSettings = settingsBuilder.encryptSettings().build(); + decryptSettings = settingsBuilder.decryptSettings().build(); + updateCryptoKeyPrimaryVersionSettings = + settingsBuilder.updateCryptoKeyPrimaryVersionSettings().build(); + destroyCryptoKeyVersionSettings = settingsBuilder.destroyCryptoKeyVersionSettings().build(); + restoreCryptoKeyVersionSettings = settingsBuilder.restoreCryptoKeyVersionSettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + } + + private static final PagedListDescriptor + LIST_KEY_RINGS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListKeyRingsRequest injectToken(ListKeyRingsRequest payload, String token) { + return ListKeyRingsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListKeyRingsRequest injectPageSize(ListKeyRingsRequest payload, int pageSize) { + return ListKeyRingsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListKeyRingsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListKeyRingsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListKeyRingsResponse payload) { + return payload.getKeyRingsList(); + } + }; + + private static final PagedListDescriptor + LIST_CRYPTO_KEYS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListCryptoKeysRequest injectToken(ListCryptoKeysRequest payload, String token) { + return ListCryptoKeysRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListCryptoKeysRequest injectPageSize( + ListCryptoKeysRequest payload, int pageSize) { + return ListCryptoKeysRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListCryptoKeysRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListCryptoKeysResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListCryptoKeysResponse payload) { + return payload.getCryptoKeysList(); + } + }; + + private static final PagedListDescriptor< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, CryptoKeyVersion> + LIST_CRYPTO_KEY_VERSIONS_PAGE_STR_DESC = + new PagedListDescriptor< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, CryptoKeyVersion>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListCryptoKeyVersionsRequest injectToken( + ListCryptoKeyVersionsRequest payload, String token) { + return ListCryptoKeyVersionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListCryptoKeyVersionsRequest injectPageSize( + ListCryptoKeyVersionsRequest payload, int pageSize) { + return ListCryptoKeyVersionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListCryptoKeyVersionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListCryptoKeyVersionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListCryptoKeyVersionsResponse payload) { + return payload.getCryptoKeyVersionsList(); + } + }; + + private static final PagedListResponseFactory< + ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse> + LIST_KEY_RINGS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListKeyRingsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_KEY_RINGS_PAGE_STR_DESC, request, context); + return ListKeyRingsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + LIST_CRYPTO_KEYS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListCryptoKeysRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_CRYPTO_KEYS_PAGE_STR_DESC, request, context); + return ListCryptoKeysPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + LIST_CRYPTO_KEY_VERSIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListCryptoKeyVersionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, CryptoKeyVersion> + pageContext = + PageContext.create( + callable, LIST_CRYPTO_KEY_VERSIONS_PAGE_STR_DESC, request, context); + return ListCryptoKeyVersionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for KeyManagementServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse> + listKeyRingsSettings; + private final PagedCallSettings.Builder< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + listCryptoKeysSettings; + private final PagedCallSettings.Builder< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + listCryptoKeyVersionsSettings; + private final UnaryCallSettings.Builder getKeyRingSettings; + private final UnaryCallSettings.Builder getCryptoKeySettings; + private final UnaryCallSettings.Builder + getCryptoKeyVersionSettings; + private final UnaryCallSettings.Builder createKeyRingSettings; + private final UnaryCallSettings.Builder + createCryptoKeySettings; + private final UnaryCallSettings.Builder + createCryptoKeyVersionSettings; + private final UnaryCallSettings.Builder + updateCryptoKeySettings; + private final UnaryCallSettings.Builder + updateCryptoKeyVersionSettings; + private final UnaryCallSettings.Builder encryptSettings; + private final UnaryCallSettings.Builder decryptSettings; + private final UnaryCallSettings.Builder + updateCryptoKeyPrimaryVersionSettings; + private final UnaryCallSettings.Builder + destroyCryptoKeyVersionSettings; + private final UnaryCallSettings.Builder + restoreCryptoKeyVersionSettings; + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listKeyRingsSettings = PagedCallSettings.newBuilder(LIST_KEY_RINGS_PAGE_STR_FACT); + + listCryptoKeysSettings = PagedCallSettings.newBuilder(LIST_CRYPTO_KEYS_PAGE_STR_FACT); + + listCryptoKeyVersionsSettings = + PagedCallSettings.newBuilder(LIST_CRYPTO_KEY_VERSIONS_PAGE_STR_FACT); + + getKeyRingSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getCryptoKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getCryptoKeyVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createKeyRingSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createCryptoKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createCryptoKeyVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateCryptoKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateCryptoKeyVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + encryptSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + decryptSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateCryptoKeyPrimaryVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + destroyCryptoKeyVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + restoreCryptoKeyVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listKeyRingsSettings, + listCryptoKeysSettings, + listCryptoKeyVersionsSettings, + getKeyRingSettings, + getCryptoKeySettings, + getCryptoKeyVersionSettings, + createKeyRingSettings, + createCryptoKeySettings, + createCryptoKeyVersionSettings, + updateCryptoKeySettings, + updateCryptoKeyVersionSettings, + encryptSettings, + decryptSettings, + updateCryptoKeyPrimaryVersionSettings, + destroyCryptoKeyVersionSettings, + restoreCryptoKeyVersionSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .listKeyRingsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listCryptoKeysSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listCryptoKeyVersionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getKeyRingSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getCryptoKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getCryptoKeyVersionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createKeyRingSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createCryptoKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createCryptoKeyVersionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateCryptoKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateCryptoKeyVersionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .encryptSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .decryptSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateCryptoKeyPrimaryVersionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .destroyCryptoKeyVersionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .restoreCryptoKeyVersionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(KeyManagementServiceStubSettings settings) { + super(settings); + + listKeyRingsSettings = settings.listKeyRingsSettings.toBuilder(); + listCryptoKeysSettings = settings.listCryptoKeysSettings.toBuilder(); + listCryptoKeyVersionsSettings = settings.listCryptoKeyVersionsSettings.toBuilder(); + getKeyRingSettings = settings.getKeyRingSettings.toBuilder(); + getCryptoKeySettings = settings.getCryptoKeySettings.toBuilder(); + getCryptoKeyVersionSettings = settings.getCryptoKeyVersionSettings.toBuilder(); + createKeyRingSettings = settings.createKeyRingSettings.toBuilder(); + createCryptoKeySettings = settings.createCryptoKeySettings.toBuilder(); + createCryptoKeyVersionSettings = settings.createCryptoKeyVersionSettings.toBuilder(); + updateCryptoKeySettings = settings.updateCryptoKeySettings.toBuilder(); + updateCryptoKeyVersionSettings = settings.updateCryptoKeyVersionSettings.toBuilder(); + encryptSettings = settings.encryptSettings.toBuilder(); + decryptSettings = settings.decryptSettings.toBuilder(); + updateCryptoKeyPrimaryVersionSettings = + settings.updateCryptoKeyPrimaryVersionSettings.toBuilder(); + destroyCryptoKeyVersionSettings = settings.destroyCryptoKeyVersionSettings.toBuilder(); + restoreCryptoKeyVersionSettings = settings.restoreCryptoKeyVersionSettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listKeyRingsSettings, + listCryptoKeysSettings, + listCryptoKeyVersionsSettings, + getKeyRingSettings, + getCryptoKeySettings, + getCryptoKeyVersionSettings, + createKeyRingSettings, + createCryptoKeySettings, + createCryptoKeyVersionSettings, + updateCryptoKeySettings, + updateCryptoKeyVersionSettings, + encryptSettings, + decryptSettings, + updateCryptoKeyPrimaryVersionSettings, + destroyCryptoKeyVersionSettings, + restoreCryptoKeyVersionSettings, + setIamPolicySettings, + getIamPolicySettings, + testIamPermissionsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to listKeyRings. */ + public PagedCallSettings.Builder< + ListKeyRingsRequest, ListKeyRingsResponse, ListKeyRingsPagedResponse> + listKeyRingsSettings() { + return listKeyRingsSettings; + } + + /** Returns the builder for the settings used for calls to listCryptoKeys. */ + public PagedCallSettings.Builder< + ListCryptoKeysRequest, ListCryptoKeysResponse, ListCryptoKeysPagedResponse> + listCryptoKeysSettings() { + return listCryptoKeysSettings; + } + + /** Returns the builder for the settings used for calls to listCryptoKeyVersions. */ + public PagedCallSettings.Builder< + ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse, + ListCryptoKeyVersionsPagedResponse> + listCryptoKeyVersionsSettings() { + return listCryptoKeyVersionsSettings; + } + + /** Returns the builder for the settings used for calls to getKeyRing. */ + public UnaryCallSettings.Builder getKeyRingSettings() { + return getKeyRingSettings; + } + + /** Returns the builder for the settings used for calls to getCryptoKey. */ + public UnaryCallSettings.Builder getCryptoKeySettings() { + return getCryptoKeySettings; + } + + /** Returns the builder for the settings used for calls to getCryptoKeyVersion. */ + public UnaryCallSettings.Builder + getCryptoKeyVersionSettings() { + return getCryptoKeyVersionSettings; + } + + /** Returns the builder for the settings used for calls to createKeyRing. */ + public UnaryCallSettings.Builder createKeyRingSettings() { + return createKeyRingSettings; + } + + /** Returns the builder for the settings used for calls to createCryptoKey. */ + public UnaryCallSettings.Builder createCryptoKeySettings() { + return createCryptoKeySettings; + } + + /** Returns the builder for the settings used for calls to createCryptoKeyVersion. */ + public UnaryCallSettings.Builder + createCryptoKeyVersionSettings() { + return createCryptoKeyVersionSettings; + } + + /** Returns the builder for the settings used for calls to updateCryptoKey. */ + public UnaryCallSettings.Builder updateCryptoKeySettings() { + return updateCryptoKeySettings; + } + + /** Returns the builder for the settings used for calls to updateCryptoKeyVersion. */ + public UnaryCallSettings.Builder + updateCryptoKeyVersionSettings() { + return updateCryptoKeyVersionSettings; + } + + /** Returns the builder for the settings used for calls to encrypt. */ + public UnaryCallSettings.Builder encryptSettings() { + return encryptSettings; + } + + /** Returns the builder for the settings used for calls to decrypt. */ + public UnaryCallSettings.Builder decryptSettings() { + return decryptSettings; + } + + /** Returns the builder for the settings used for calls to updateCryptoKeyPrimaryVersion. */ + public UnaryCallSettings.Builder + updateCryptoKeyPrimaryVersionSettings() { + return updateCryptoKeyPrimaryVersionSettings; + } + + /** Returns the builder for the settings used for calls to destroyCryptoKeyVersion. */ + public UnaryCallSettings.Builder + destroyCryptoKeyVersionSettings() { + return destroyCryptoKeyVersionSettings; + } + + /** Returns the builder for the settings used for calls to restoreCryptoKeyVersion. */ + public UnaryCallSettings.Builder + restoreCryptoKeyVersionSettings() { + return restoreCryptoKeyVersionSettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @Override + public KeyManagementServiceStubSettings build() throws IOException { + return new KeyManagementServiceStubSettings(this); + } + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java new file mode 100644 index 000000000000..52161cd8a8a5 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/KeyManagementServiceClientTest.java @@ -0,0 +1,970 @@ +/* + * Copyright 2018 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 static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; +import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose; +import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.ByteString; +import com.google.protobuf.Duration; +import com.google.protobuf.FieldMask; +import com.google.protobuf.GeneratedMessageV3; +import com.google.protobuf.Timestamp; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class KeyManagementServiceClientTest { + private static MockKeyManagementService mockKeyManagementService; + private static MockIAMPolicy mockIAMPolicy; + private static MockServiceHelper serviceHelper; + private KeyManagementServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockKeyManagementService = new MockKeyManagementService(); + mockIAMPolicy = new MockIAMPolicy(); + serviceHelper = + new MockServiceHelper( + "in-process-1", + Arrays.asList(mockKeyManagementService, mockIAMPolicy)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + KeyManagementServiceSettings settings = + KeyManagementServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = KeyManagementServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listKeyRingsTest() { + String nextPageToken = ""; + int totalSize = 705419236; + KeyRing keyRingsElement = KeyRing.newBuilder().build(); + List keyRings = Arrays.asList(keyRingsElement); + ListKeyRingsResponse expectedResponse = + ListKeyRingsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .setTotalSize(totalSize) + .addAllKeyRings(keyRings) + .build(); + mockKeyManagementService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListKeyRingsPagedResponse pagedListResponse = client.listKeyRings(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getKeyRingsList().get(0), resources.get(0)); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListKeyRingsRequest actualRequest = (ListKeyRingsRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listKeyRingsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + client.listKeyRings(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listCryptoKeysTest() { + String nextPageToken = ""; + int totalSize = 705419236; + CryptoKey cryptoKeysElement = CryptoKey.newBuilder().build(); + List cryptoKeys = Arrays.asList(cryptoKeysElement); + ListCryptoKeysResponse expectedResponse = + ListCryptoKeysResponse.newBuilder() + .setNextPageToken(nextPageToken) + .setTotalSize(totalSize) + .addAllCryptoKeys(cryptoKeys) + .build(); + mockKeyManagementService.addResponse(expectedResponse); + + KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + + ListCryptoKeysPagedResponse pagedListResponse = client.listCryptoKeys(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCryptoKeysList().get(0), resources.get(0)); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListCryptoKeysRequest actualRequest = (ListCryptoKeysRequest) actualRequests.get(0); + + Assert.assertEquals(parent, KeyRingName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listCryptoKeysExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + + client.listCryptoKeys(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listCryptoKeyVersionsTest() { + String nextPageToken = ""; + int totalSize = 705419236; + CryptoKeyVersion cryptoKeyVersionsElement = CryptoKeyVersion.newBuilder().build(); + List cryptoKeyVersions = Arrays.asList(cryptoKeyVersionsElement); + ListCryptoKeyVersionsResponse expectedResponse = + ListCryptoKeyVersionsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .setTotalSize(totalSize) + .addAllCryptoKeyVersions(cryptoKeyVersions) + .build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyName parent = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + + ListCryptoKeyVersionsPagedResponse pagedListResponse = client.listCryptoKeyVersions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCryptoKeyVersionsList().get(0), resources.get(0)); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListCryptoKeyVersionsRequest actualRequest = + (ListCryptoKeyVersionsRequest) actualRequests.get(0); + + Assert.assertEquals(parent, CryptoKeyName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listCryptoKeyVersionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyName parent = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + + client.listCryptoKeyVersions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getKeyRingTest() { + KeyRingName name2 = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + KeyRing expectedResponse = KeyRing.newBuilder().setName(name2.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + + KeyRing actualResponse = client.getKeyRing(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetKeyRingRequest actualRequest = (GetKeyRingRequest) actualRequests.get(0); + + Assert.assertEquals(name, KeyRingName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getKeyRingExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + + client.getKeyRing(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getCryptoKeyTest() { + CryptoKeyName name2 = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + CryptoKey expectedResponse = CryptoKey.newBuilder().setName(name2.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + + CryptoKey actualResponse = client.getCryptoKey(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetCryptoKeyRequest actualRequest = (GetCryptoKeyRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getCryptoKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyName name = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + + client.getCryptoKey(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getCryptoKeyVersionTest() { + CryptoKeyVersionName name2 = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + CryptoKeyVersion expectedResponse = + CryptoKeyVersion.newBuilder().setName(name2.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + + CryptoKeyVersion actualResponse = client.getCryptoKeyVersion(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetCryptoKeyVersionRequest actualRequest = (GetCryptoKeyVersionRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyVersionName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getCryptoKeyVersionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + + client.getCryptoKeyVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createKeyRingTest() { + KeyRingName name = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + KeyRing expectedResponse = KeyRing.newBuilder().setName(name.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String keyRingId = "keyRingId-2056646742"; + KeyRing keyRing = KeyRing.newBuilder().build(); + + KeyRing actualResponse = client.createKeyRing(parent, keyRingId, keyRing); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateKeyRingRequest actualRequest = (CreateKeyRingRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertEquals(keyRingId, actualRequest.getKeyRingId()); + Assert.assertEquals(keyRing, actualRequest.getKeyRing()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createKeyRingExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + String keyRingId = "keyRingId-2056646742"; + KeyRing keyRing = KeyRing.newBuilder().build(); + + client.createKeyRing(parent, keyRingId, keyRing); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createCryptoKeyTest() { + CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + CryptoKey expectedResponse = CryptoKey.newBuilder().setName(name.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + String cryptoKeyId = "my-app-key"; + CryptoKey.CryptoKeyPurpose purpose = CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT; + long seconds = 2147483647L; + Timestamp nextRotationTime = Timestamp.newBuilder().setSeconds(seconds).build(); + long seconds2 = 604800L; + Duration rotationPeriod = Duration.newBuilder().setSeconds(seconds2).build(); + CryptoKey cryptoKey = + CryptoKey.newBuilder() + .setPurpose(purpose) + .setNextRotationTime(nextRotationTime) + .setRotationPeriod(rotationPeriod) + .build(); + + CryptoKey actualResponse = client.createCryptoKey(parent, cryptoKeyId, cryptoKey); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateCryptoKeyRequest actualRequest = (CreateCryptoKeyRequest) actualRequests.get(0); + + Assert.assertEquals(parent, KeyRingName.parse(actualRequest.getParent())); + Assert.assertEquals(cryptoKeyId, actualRequest.getCryptoKeyId()); + Assert.assertEquals(cryptoKey, actualRequest.getCryptoKey()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createCryptoKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + String cryptoKeyId = "my-app-key"; + CryptoKey.CryptoKeyPurpose purpose = CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT; + long seconds = 2147483647L; + Timestamp nextRotationTime = Timestamp.newBuilder().setSeconds(seconds).build(); + long seconds2 = 604800L; + Duration rotationPeriod = Duration.newBuilder().setSeconds(seconds2).build(); + CryptoKey cryptoKey = + CryptoKey.newBuilder() + .setPurpose(purpose) + .setNextRotationTime(nextRotationTime) + .setRotationPeriod(rotationPeriod) + .build(); + + client.createCryptoKey(parent, cryptoKeyId, cryptoKey); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createCryptoKeyVersionTest() { + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + CryptoKeyVersion expectedResponse = + CryptoKeyVersion.newBuilder().setName(name.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyName parent = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build(); + + CryptoKeyVersion actualResponse = client.createCryptoKeyVersion(parent, cryptoKeyVersion); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateCryptoKeyVersionRequest actualRequest = + (CreateCryptoKeyVersionRequest) actualRequests.get(0); + + Assert.assertEquals(parent, CryptoKeyName.parse(actualRequest.getParent())); + Assert.assertEquals(cryptoKeyVersion, actualRequest.getCryptoKeyVersion()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createCryptoKeyVersionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyName parent = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build(); + + client.createCryptoKeyVersion(parent, cryptoKeyVersion); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateCryptoKeyTest() { + CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + CryptoKey expectedResponse = CryptoKey.newBuilder().setName(name.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKey cryptoKey = CryptoKey.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CryptoKey actualResponse = client.updateCryptoKey(cryptoKey, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateCryptoKeyRequest actualRequest = (UpdateCryptoKeyRequest) actualRequests.get(0); + + Assert.assertEquals(cryptoKey, actualRequest.getCryptoKey()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateCryptoKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKey cryptoKey = CryptoKey.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + client.updateCryptoKey(cryptoKey, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateCryptoKeyVersionTest() { + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + CryptoKeyVersion expectedResponse = + CryptoKeyVersion.newBuilder().setName(name.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CryptoKeyVersion actualResponse = client.updateCryptoKeyVersion(cryptoKeyVersion, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateCryptoKeyVersionRequest actualRequest = + (UpdateCryptoKeyVersionRequest) actualRequests.get(0); + + Assert.assertEquals(cryptoKeyVersion, actualRequest.getCryptoKeyVersion()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateCryptoKeyVersionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + client.updateCryptoKeyVersion(cryptoKeyVersion, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void encryptTest() { + String name2 = "name2-1052831874"; + ByteString ciphertext = ByteString.copyFromUtf8("-72"); + EncryptResponse expectedResponse = + EncryptResponse.newBuilder().setName(name2).setCiphertext(ciphertext).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyPathName name = + CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]"); + ByteString plaintext = ByteString.copyFromUtf8("-9"); + + EncryptResponse actualResponse = client.encrypt(name, plaintext); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + EncryptRequest actualRequest = (EncryptRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyPathName.parse(actualRequest.getName())); + Assert.assertEquals(plaintext, actualRequest.getPlaintext()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void encryptExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyPathName name = + CryptoKeyPathName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY_PATH]"); + ByteString plaintext = ByteString.copyFromUtf8("-9"); + + client.encrypt(name, plaintext); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void decryptTest() { + ByteString plaintext = ByteString.copyFromUtf8("-9"); + DecryptResponse expectedResponse = DecryptResponse.newBuilder().setPlaintext(plaintext).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + ByteString ciphertext = ByteString.copyFromUtf8("-72"); + + DecryptResponse actualResponse = client.decrypt(name, ciphertext); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DecryptRequest actualRequest = (DecryptRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyName.parse(actualRequest.getName())); + Assert.assertEquals(ciphertext, actualRequest.getCiphertext()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void decryptExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyName name = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + ByteString ciphertext = ByteString.copyFromUtf8("-72"); + + client.decrypt(name, ciphertext); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateCryptoKeyPrimaryVersionTest() { + CryptoKeyName name2 = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + CryptoKey expectedResponse = CryptoKey.newBuilder().setName(name2.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + String cryptoKeyVersionId = "cryptoKeyVersionId729489152"; + + CryptoKey actualResponse = client.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateCryptoKeyPrimaryVersionRequest actualRequest = + (UpdateCryptoKeyPrimaryVersionRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyName.parse(actualRequest.getName())); + Assert.assertEquals(cryptoKeyVersionId, actualRequest.getCryptoKeyVersionId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateCryptoKeyPrimaryVersionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyName name = + CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"); + String cryptoKeyVersionId = "cryptoKeyVersionId729489152"; + + client.updateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void destroyCryptoKeyVersionTest() { + CryptoKeyVersionName name2 = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + CryptoKeyVersion expectedResponse = + CryptoKeyVersion.newBuilder().setName(name2.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + + CryptoKeyVersion actualResponse = client.destroyCryptoKeyVersion(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DestroyCryptoKeyVersionRequest actualRequest = + (DestroyCryptoKeyVersionRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyVersionName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void destroyCryptoKeyVersionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + + client.destroyCryptoKeyVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void restoreCryptoKeyVersionTest() { + CryptoKeyVersionName name2 = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + CryptoKeyVersion expectedResponse = + CryptoKeyVersion.newBuilder().setName(name2.toString()).build(); + mockKeyManagementService.addResponse(expectedResponse); + + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + + CryptoKeyVersion actualResponse = client.restoreCryptoKeyVersion(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockKeyManagementService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RestoreCryptoKeyVersionRequest actualRequest = + (RestoreCryptoKeyVersionRequest) actualRequests.get(0); + + Assert.assertEquals(name, CryptoKeyVersionName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void restoreCryptoKeyVersionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockKeyManagementService.addException(exception); + + try { + CryptoKeyVersionName name = + CryptoKeyVersionName.of( + "[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"); + + client.restoreCryptoKeyVersion(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setIamPolicyTest() { + int version = 351608024; + ByteString etag = ByteString.copyFromUtf8("21"); + Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + mockIAMPolicy.addResponse(expectedResponse); + + KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + Policy policy = Policy.newBuilder().build(); + + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getIamPolicyTest() { + int version = 351608024; + ByteString etag = ByteString.copyFromUtf8("21"); + Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + mockIAMPolicy.addResponse(expectedResponse); + + KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + + client.getIamPolicy(resource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsTest() { + TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + mockIAMPolicy.addResponse(expectedResponse); + + KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockIAMPolicy.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + + Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockIAMPolicy.addException(exception); + + try { + KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]"); + List permissions = new ArrayList<>(); + + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockIAMPolicy.java b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockIAMPolicy.java new file mode 100644 index 000000000000..d3e7bc726951 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockIAMPolicy.java @@ -0,0 +1,57 @@ +/* + * Copyright 2018 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.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.GeneratedMessageV3; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockIAMPolicy implements MockGrpcService { + private final MockIAMPolicyImpl serviceImpl; + + public MockIAMPolicy() { + serviceImpl = new MockIAMPolicyImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(GeneratedMessageV3 response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockIAMPolicyImpl.java b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockIAMPolicyImpl.java new file mode 100644 index 000000000000..01f0624d0e9a --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockIAMPolicyImpl.java @@ -0,0 +1,107 @@ +/* + * Copyright 2018 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.core.BetaApi; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.IAMPolicyGrpc.IAMPolicyImplBase; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.GeneratedMessageV3; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockIAMPolicyImpl extends IAMPolicyImplBase { + private ArrayList requests; + private Queue responses; + + public MockIAMPolicyImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(GeneratedMessageV3 response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext((Policy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext((Policy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void testIamPermissions( + TestIamPermissionsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof TestIamPermissionsResponse) { + requests.add(request); + responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockKeyManagementService.java b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockKeyManagementService.java new file mode 100644 index 000000000000..21be21210afa --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockKeyManagementService.java @@ -0,0 +1,57 @@ +/* + * Copyright 2018 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.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.GeneratedMessageV3; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockKeyManagementService implements MockGrpcService { + private final MockKeyManagementServiceImpl serviceImpl; + + public MockKeyManagementService() { + serviceImpl = new MockKeyManagementServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(GeneratedMessageV3 response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockKeyManagementServiceImpl.java b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockKeyManagementServiceImpl.java new file mode 100644 index 000000000000..7b9943b577d5 --- /dev/null +++ b/google-cloud-clients/google-cloud-kms/src/test/java/com/google/cloud/kms/v1/MockKeyManagementServiceImpl.java @@ -0,0 +1,296 @@ +/* + * Copyright 2018 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.core.BetaApi; +import com.google.cloud.kms.v1.KeyManagementServiceGrpc.KeyManagementServiceImplBase; +import com.google.protobuf.GeneratedMessageV3; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockKeyManagementServiceImpl extends KeyManagementServiceImplBase { + private ArrayList requests; + private Queue responses; + + public MockKeyManagementServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(GeneratedMessageV3 response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void listKeyRings( + ListKeyRingsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListKeyRingsResponse) { + requests.add(request); + responseObserver.onNext((ListKeyRingsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listCryptoKeys( + ListCryptoKeysRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListCryptoKeysResponse) { + requests.add(request); + responseObserver.onNext((ListCryptoKeysResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listCryptoKeyVersions( + ListCryptoKeyVersionsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListCryptoKeyVersionsResponse) { + requests.add(request); + responseObserver.onNext((ListCryptoKeyVersionsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getKeyRing(GetKeyRingRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof KeyRing) { + requests.add(request); + responseObserver.onNext((KeyRing) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getCryptoKey( + GetCryptoKeyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKey) { + requests.add(request); + responseObserver.onNext((CryptoKey) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getCryptoKeyVersion( + GetCryptoKeyVersionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKeyVersion) { + requests.add(request); + responseObserver.onNext((CryptoKeyVersion) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createKeyRing( + CreateKeyRingRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof KeyRing) { + requests.add(request); + responseObserver.onNext((KeyRing) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createCryptoKey( + CreateCryptoKeyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKey) { + requests.add(request); + responseObserver.onNext((CryptoKey) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createCryptoKeyVersion( + CreateCryptoKeyVersionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKeyVersion) { + requests.add(request); + responseObserver.onNext((CryptoKeyVersion) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateCryptoKey( + UpdateCryptoKeyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKey) { + requests.add(request); + responseObserver.onNext((CryptoKey) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateCryptoKeyVersion( + UpdateCryptoKeyVersionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKeyVersion) { + requests.add(request); + responseObserver.onNext((CryptoKeyVersion) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void encrypt(EncryptRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof EncryptResponse) { + requests.add(request); + responseObserver.onNext((EncryptResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void decrypt(DecryptRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof DecryptResponse) { + requests.add(request); + responseObserver.onNext((DecryptResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateCryptoKeyPrimaryVersion( + UpdateCryptoKeyPrimaryVersionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKey) { + requests.add(request); + responseObserver.onNext((CryptoKey) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void destroyCryptoKeyVersion( + DestroyCryptoKeyVersionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKeyVersion) { + requests.add(request); + responseObserver.onNext((CryptoKeyVersion) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void restoreCryptoKeyVersion( + RestoreCryptoKeyVersionRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof CryptoKeyVersion) { + requests.add(request); + responseObserver.onNext((CryptoKeyVersion) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-clients/pom.xml b/google-cloud-clients/pom.xml index ecdad53aa7d7..5f80b4a468b8 100644 --- a/google-cloud-clients/pom.xml +++ b/google-cloud-clients/pom.xml @@ -429,6 +429,7 @@ google-cloud-errorreporting google-cloud-firestore google-cloud-iot + google-cloud-kms google-cloud-language google-cloud-logging google-cloud-monitoring @@ -752,7 +753,7 @@ Stub packages - com.google.cloud.bigquerydatatransfer.v1.stub:com.google.cloud.container.v1.stub:com.google.cloud.dlp.v2beta1.stub:com.google.cloud.dlp.v2.stub:com.google.cloud.dialogflow.v2beta1.stub:com.google.cloud.dialogflow.v2.stub:com.google.cloud.errorreporting.v1beta1.stub:com.google.cloud.firestore.v1beta1.stub:com.google.cloud.language.v1beta2.stub:com.google.cloud.language.v1.stub:com.google.cloud.logging.v2.stub:com.google.cloud.monitoring.v3.stub:com.google.cloud.pubsub.v1.stub:com.google.cloud.speech.v1beta1.stub:com.google.cloud.speech.v1.stub:com.google.cloud.tasks.v2beta2.stub:com.google.cloud.texttospeech.v1beta1.stub:com.google.cloud.texttospeech.v1.stub:com.google.cloud.trace.v1.stub:com.google.cloud.trace.v2.stub:com.google.cloud.videointelligence.v1beta1.stub:com.google.cloud.videointelligence.v1beta2.stub:com.google.cloud.videointelligence.v1.stub:com.google.cloud.videointelligence.v1p1beta1.stub:com.google.cloud.vision.v1.stub:com.google.cloud.vision.v1p1beta1.stub:com.google.cloud.vision.v1p2beta1.stub + com.google.cloud.bigquerydatatransfer.v1.stub:com.google.cloud.container.v1.stub:com.google.cloud.dlp.v2beta1.stub:com.google.cloud.dlp.v2.stub:com.google.cloud.dialogflow.v2beta1.stub:com.google.cloud.dialogflow.v2.stub:com.google.cloud.errorreporting.v1beta1.stub:com.google.cloud.firestore.v1beta1.stub:com.google.cloud.kms.v1.stub:com.google.cloud.language.v1beta2.stub:com.google.cloud.language.v1.stub:com.google.cloud.logging.v2.stub:com.google.cloud.monitoring.v3.stub:com.google.cloud.pubsub.v1.stub:com.google.cloud.speech.v1beta1.stub:com.google.cloud.speech.v1.stub:com.google.cloud.tasks.v2beta2.stub:com.google.cloud.texttospeech.v1beta1.stub:com.google.cloud.texttospeech.v1.stub:com.google.cloud.trace.v1.stub:com.google.cloud.trace.v2.stub:com.google.cloud.videointelligence.v1beta1.stub:com.google.cloud.videointelligence.v1beta2.stub:com.google.cloud.videointelligence.v1.stub:com.google.cloud.videointelligence.v1p1beta1.stub:com.google.cloud.vision.v1.stub:com.google.cloud.vision.v1p1beta1.stub:com.google.cloud.vision.v1p2beta1.stub Deprecated packages diff --git a/versions.txt b/versions.txt index 85392e68fd39..06dade41bb1f 100644 --- a/versions.txt +++ b/versions.txt @@ -18,6 +18,7 @@ grpc-google-cloud-dialogflow-v2beta1:0.18.0:0.18.1-SNAPSHOT grpc-google-cloud-dlp-v2:0.18.0:0.18.1-SNAPSHOT grpc-google-cloud-error-reporting-v1beta1:0.18.0:0.18.1-SNAPSHOT grpc-google-cloud-firestore-v1beta1:0.18.0:0.18.1-SNAPSHOT +grpc-google-cloud-kms-v1:0.18.0:0.18.1-SNAPSHOT grpc-google-cloud-language-v1:1.17.0:1.17.1-SNAPSHOT grpc-google-cloud-language-v1beta2:0.18.0:0.18.1-SNAPSHOT grpc-google-cloud-logging-v2:0.18.0:0.18.1-SNAPSHOT @@ -56,6 +57,7 @@ proto-google-cloud-dialogflow-v2beta1:0.18.0:0.18.1-SNAPSHOT proto-google-cloud-dlp-v2:0.18.0:0.18.1-SNAPSHOT proto-google-cloud-error-reporting-v1beta1:0.18.0:0.18.1-SNAPSHOT proto-google-cloud-firestore-v1beta1:0.18.0:0.18.1-SNAPSHOT +proto-google-cloud-kms-v1:0.18.0:0.18.1-SNAPSHOT proto-google-cloud-language-v1:1.17.0:1.17.1-SNAPSHOT proto-google-cloud-language-v1beta2:0.18.0:0.18.1-SNAPSHOT proto-google-cloud-logging-v2:0.18.0:0.18.1-SNAPSHOT @@ -114,6 +116,7 @@ google-cloud-dns:0.53.0-alpha:0.53.1-alpha-SNAPSHOT google-cloud-errorreporting:0.53.0-beta:0.53.1-beta-SNAPSHOT google-cloud-examples:0.53.0-alpha:0.53.1-alpha-SNAPSHOT google-cloud-firestore:0.53.0-beta:0.53.1-beta-SNAPSHOT +google-cloud-kms:0.53.0-beta:0.53.1-beta-SNAPSHOT google-cloud-language:1.35.0:1.35.1-SNAPSHOT google-cloud-logging:1.35.0:1.35.1-SNAPSHOT google-cloud-logging-logback:0.53.0-alpha:0.53.1-alpha-SNAPSHOT