• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 // Generated by the protocol buffer compiler.  DO NOT EDIT!
17 // source: google/cloud/kms/v1/service.proto
18 
19 package com.google.cloud.kms.v1;
20 
21 /**
22  *
23  *
24  * <pre>
25  * Request message for
26  * [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
27  * </pre>
28  *
29  * Protobuf type {@code google.cloud.kms.v1.ImportCryptoKeyVersionRequest}
30  */
31 public final class ImportCryptoKeyVersionRequest extends com.google.protobuf.GeneratedMessageV3
32     implements
33     // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.ImportCryptoKeyVersionRequest)
34     ImportCryptoKeyVersionRequestOrBuilder {
35   private static final long serialVersionUID = 0L;
36   // Use ImportCryptoKeyVersionRequest.newBuilder() to construct.
ImportCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)37   private ImportCryptoKeyVersionRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
38     super(builder);
39   }
40 
ImportCryptoKeyVersionRequest()41   private ImportCryptoKeyVersionRequest() {
42     parent_ = "";
43     cryptoKeyVersion_ = "";
44     algorithm_ = 0;
45     importJob_ = "";
46     wrappedKey_ = com.google.protobuf.ByteString.EMPTY;
47   }
48 
49   @java.lang.Override
50   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)51   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
52     return new ImportCryptoKeyVersionRequest();
53   }
54 
55   @java.lang.Override
getUnknownFields()56   public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
57     return this.unknownFields;
58   }
59 
getDescriptor()60   public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
61     return com.google.cloud.kms.v1.KmsProto
62         .internal_static_google_cloud_kms_v1_ImportCryptoKeyVersionRequest_descriptor;
63   }
64 
65   @java.lang.Override
66   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()67       internalGetFieldAccessorTable() {
68     return com.google.cloud.kms.v1.KmsProto
69         .internal_static_google_cloud_kms_v1_ImportCryptoKeyVersionRequest_fieldAccessorTable
70         .ensureFieldAccessorsInitialized(
71             com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.class,
72             com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.Builder.class);
73   }
74 
75   private int wrappedKeyMaterialCase_ = 0;
76   private java.lang.Object wrappedKeyMaterial_;
77 
78   public enum WrappedKeyMaterialCase
79       implements
80           com.google.protobuf.Internal.EnumLite,
81           com.google.protobuf.AbstractMessage.InternalOneOfEnum {
82     RSA_AES_WRAPPED_KEY(5),
83     WRAPPEDKEYMATERIAL_NOT_SET(0);
84     private final int value;
85 
WrappedKeyMaterialCase(int value)86     private WrappedKeyMaterialCase(int value) {
87       this.value = value;
88     }
89     /**
90      * @param value The number of the enum to look for.
91      * @return The enum associated with the given number.
92      * @deprecated Use {@link #forNumber(int)} instead.
93      */
94     @java.lang.Deprecated
valueOf(int value)95     public static WrappedKeyMaterialCase valueOf(int value) {
96       return forNumber(value);
97     }
98 
forNumber(int value)99     public static WrappedKeyMaterialCase forNumber(int value) {
100       switch (value) {
101         case 5:
102           return RSA_AES_WRAPPED_KEY;
103         case 0:
104           return WRAPPEDKEYMATERIAL_NOT_SET;
105         default:
106           return null;
107       }
108     }
109 
getNumber()110     public int getNumber() {
111       return this.value;
112     }
113   };
114 
getWrappedKeyMaterialCase()115   public WrappedKeyMaterialCase getWrappedKeyMaterialCase() {
116     return WrappedKeyMaterialCase.forNumber(wrappedKeyMaterialCase_);
117   }
118 
119   public static final int PARENT_FIELD_NUMBER = 1;
120 
121   @SuppressWarnings("serial")
122   private volatile java.lang.Object parent_ = "";
123   /**
124    *
125    *
126    * <pre>
127    * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
128    * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
129    * The create permission is only required on this key when creating a new
130    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
131    * </pre>
132    *
133    * <code>
134    * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
135    * </code>
136    *
137    * @return The parent.
138    */
139   @java.lang.Override
getParent()140   public java.lang.String getParent() {
141     java.lang.Object ref = parent_;
142     if (ref instanceof java.lang.String) {
143       return (java.lang.String) ref;
144     } else {
145       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
146       java.lang.String s = bs.toStringUtf8();
147       parent_ = s;
148       return s;
149     }
150   }
151   /**
152    *
153    *
154    * <pre>
155    * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
156    * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
157    * The create permission is only required on this key when creating a new
158    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
159    * </pre>
160    *
161    * <code>
162    * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
163    * </code>
164    *
165    * @return The bytes for parent.
166    */
167   @java.lang.Override
getParentBytes()168   public com.google.protobuf.ByteString getParentBytes() {
169     java.lang.Object ref = parent_;
170     if (ref instanceof java.lang.String) {
171       com.google.protobuf.ByteString b =
172           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
173       parent_ = b;
174       return b;
175     } else {
176       return (com.google.protobuf.ByteString) ref;
177     }
178   }
179 
180   public static final int CRYPTO_KEY_VERSION_FIELD_NUMBER = 6;
181 
182   @SuppressWarnings("serial")
183   private volatile java.lang.Object cryptoKeyVersion_ = "";
184   /**
185    *
186    *
187    * <pre>
188    * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
189    * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
190    * target for an import operation. If this field is not present, a new
191    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
192    * supplied key material is created.
193    * If this field is present, the supplied key material is imported into
194    * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
195    * import into an existing
196    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
197    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
198    * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
199    * have been previously created via [ImportCryptoKeyVersion][], and be in
200    * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
201    * or
202    * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
203    * state. The key material and algorithm must match the previous
204    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
205    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
206    * key material.
207    * </pre>
208    *
209    * <code>
210    * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
211    * </code>
212    *
213    * @return The cryptoKeyVersion.
214    */
215   @java.lang.Override
getCryptoKeyVersion()216   public java.lang.String getCryptoKeyVersion() {
217     java.lang.Object ref = cryptoKeyVersion_;
218     if (ref instanceof java.lang.String) {
219       return (java.lang.String) ref;
220     } else {
221       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
222       java.lang.String s = bs.toStringUtf8();
223       cryptoKeyVersion_ = s;
224       return s;
225     }
226   }
227   /**
228    *
229    *
230    * <pre>
231    * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
232    * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
233    * target for an import operation. If this field is not present, a new
234    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
235    * supplied key material is created.
236    * If this field is present, the supplied key material is imported into
237    * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
238    * import into an existing
239    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
240    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
241    * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
242    * have been previously created via [ImportCryptoKeyVersion][], and be in
243    * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
244    * or
245    * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
246    * state. The key material and algorithm must match the previous
247    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
248    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
249    * key material.
250    * </pre>
251    *
252    * <code>
253    * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
254    * </code>
255    *
256    * @return The bytes for cryptoKeyVersion.
257    */
258   @java.lang.Override
getCryptoKeyVersionBytes()259   public com.google.protobuf.ByteString getCryptoKeyVersionBytes() {
260     java.lang.Object ref = cryptoKeyVersion_;
261     if (ref instanceof java.lang.String) {
262       com.google.protobuf.ByteString b =
263           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
264       cryptoKeyVersion_ = b;
265       return b;
266     } else {
267       return (com.google.protobuf.ByteString) ref;
268     }
269   }
270 
271   public static final int ALGORITHM_FIELD_NUMBER = 2;
272   private int algorithm_ = 0;
273   /**
274    *
275    *
276    * <pre>
277    * Required. The
278    * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
279    * of the key being imported. This does not need to match the
280    * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
281    * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
282    * </pre>
283    *
284    * <code>
285    * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
286    * </code>
287    *
288    * @return The enum numeric value on the wire for algorithm.
289    */
290   @java.lang.Override
getAlgorithmValue()291   public int getAlgorithmValue() {
292     return algorithm_;
293   }
294   /**
295    *
296    *
297    * <pre>
298    * Required. The
299    * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
300    * of the key being imported. This does not need to match the
301    * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
302    * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
303    * </pre>
304    *
305    * <code>
306    * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
307    * </code>
308    *
309    * @return The algorithm.
310    */
311   @java.lang.Override
getAlgorithm()312   public com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm getAlgorithm() {
313     com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm result =
314         com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.forNumber(algorithm_);
315     return result == null
316         ? com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.UNRECOGNIZED
317         : result;
318   }
319 
320   public static final int IMPORT_JOB_FIELD_NUMBER = 4;
321 
322   @SuppressWarnings("serial")
323   private volatile java.lang.Object importJob_ = "";
324   /**
325    *
326    *
327    * <pre>
328    * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
329    * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
330    * material.
331    * </pre>
332    *
333    * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
334    *
335    * @return The importJob.
336    */
337   @java.lang.Override
getImportJob()338   public java.lang.String getImportJob() {
339     java.lang.Object ref = importJob_;
340     if (ref instanceof java.lang.String) {
341       return (java.lang.String) ref;
342     } else {
343       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
344       java.lang.String s = bs.toStringUtf8();
345       importJob_ = s;
346       return s;
347     }
348   }
349   /**
350    *
351    *
352    * <pre>
353    * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
354    * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
355    * material.
356    * </pre>
357    *
358    * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
359    *
360    * @return The bytes for importJob.
361    */
362   @java.lang.Override
getImportJobBytes()363   public com.google.protobuf.ByteString getImportJobBytes() {
364     java.lang.Object ref = importJob_;
365     if (ref instanceof java.lang.String) {
366       com.google.protobuf.ByteString b =
367           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
368       importJob_ = b;
369       return b;
370     } else {
371       return (com.google.protobuf.ByteString) ref;
372     }
373   }
374 
375   public static final int WRAPPED_KEY_FIELD_NUMBER = 8;
376   private com.google.protobuf.ByteString wrappedKey_ = com.google.protobuf.ByteString.EMPTY;
377   /**
378    *
379    *
380    * <pre>
381    * Optional. The wrapped key material to import.
382    * Before wrapping, key material must be formatted. If importing symmetric key
383    * material, the expected key material format is plain bytes. If importing
384    * asymmetric key material, the expected key material format is PKCS#8-encoded
385    * DER (the PrivateKeyInfo structure from RFC 5208).
386    * When wrapping with import methods
387    * ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
388    * or
389    * [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
390    * or
391    * [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
392    * or
393    * [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
394    * this field must contain the concatenation of:
395    * &lt;ol&gt;
396    *   &lt;li&gt;An ephemeral AES-256 wrapping key wrapped with the
397    *       [public_key][google.cloud.kms.v1.ImportJob.public_key] using
398    *       RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty
399    *       label.
400    *   &lt;/li&gt;
401    *   &lt;li&gt;The formatted key to be imported, wrapped with the ephemeral AES-256
402    *       key using AES-KWP (RFC 5649).
403    *   &lt;/li&gt;
404    * &lt;/ol&gt;
405    * This format is the same as the format produced by PKCS#11 mechanism
406    * CKM_RSA_AES_KEY_WRAP.
407    * When wrapping with import methods
408    * ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
409    * or
410    * [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
411    * this field must contain the formatted key to be imported, wrapped with the
412    * [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
413    * with SHA-256, MGF1 with SHA-256, and an empty label.
414    * </pre>
415    *
416    * <code>bytes wrapped_key = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
417    *
418    * @return The wrappedKey.
419    */
420   @java.lang.Override
getWrappedKey()421   public com.google.protobuf.ByteString getWrappedKey() {
422     return wrappedKey_;
423   }
424 
425   public static final int RSA_AES_WRAPPED_KEY_FIELD_NUMBER = 5;
426   /**
427    *
428    *
429    * <pre>
430    * Optional. This field has the same meaning as
431    * [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
432    * Prefer to use that field in new work. Either that field or this field
433    * (but not both) must be specified.
434    * </pre>
435    *
436    * <code>bytes rsa_aes_wrapped_key = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
437    *
438    * @return Whether the rsaAesWrappedKey field is set.
439    */
440   @java.lang.Override
hasRsaAesWrappedKey()441   public boolean hasRsaAesWrappedKey() {
442     return wrappedKeyMaterialCase_ == 5;
443   }
444   /**
445    *
446    *
447    * <pre>
448    * Optional. This field has the same meaning as
449    * [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
450    * Prefer to use that field in new work. Either that field or this field
451    * (but not both) must be specified.
452    * </pre>
453    *
454    * <code>bytes rsa_aes_wrapped_key = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
455    *
456    * @return The rsaAesWrappedKey.
457    */
458   @java.lang.Override
getRsaAesWrappedKey()459   public com.google.protobuf.ByteString getRsaAesWrappedKey() {
460     if (wrappedKeyMaterialCase_ == 5) {
461       return (com.google.protobuf.ByteString) wrappedKeyMaterial_;
462     }
463     return com.google.protobuf.ByteString.EMPTY;
464   }
465 
466   private byte memoizedIsInitialized = -1;
467 
468   @java.lang.Override
isInitialized()469   public final boolean isInitialized() {
470     byte isInitialized = memoizedIsInitialized;
471     if (isInitialized == 1) return true;
472     if (isInitialized == 0) return false;
473 
474     memoizedIsInitialized = 1;
475     return true;
476   }
477 
478   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)479   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
480     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
481       com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_);
482     }
483     if (algorithm_
484         != com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm
485             .CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED
486             .getNumber()) {
487       output.writeEnum(2, algorithm_);
488     }
489     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(importJob_)) {
490       com.google.protobuf.GeneratedMessageV3.writeString(output, 4, importJob_);
491     }
492     if (wrappedKeyMaterialCase_ == 5) {
493       output.writeBytes(5, (com.google.protobuf.ByteString) wrappedKeyMaterial_);
494     }
495     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cryptoKeyVersion_)) {
496       com.google.protobuf.GeneratedMessageV3.writeString(output, 6, cryptoKeyVersion_);
497     }
498     if (!wrappedKey_.isEmpty()) {
499       output.writeBytes(8, wrappedKey_);
500     }
501     getUnknownFields().writeTo(output);
502   }
503 
504   @java.lang.Override
getSerializedSize()505   public int getSerializedSize() {
506     int size = memoizedSize;
507     if (size != -1) return size;
508 
509     size = 0;
510     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) {
511       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_);
512     }
513     if (algorithm_
514         != com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm
515             .CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED
516             .getNumber()) {
517       size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, algorithm_);
518     }
519     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(importJob_)) {
520       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, importJob_);
521     }
522     if (wrappedKeyMaterialCase_ == 5) {
523       size +=
524           com.google.protobuf.CodedOutputStream.computeBytesSize(
525               5, (com.google.protobuf.ByteString) wrappedKeyMaterial_);
526     }
527     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(cryptoKeyVersion_)) {
528       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, cryptoKeyVersion_);
529     }
530     if (!wrappedKey_.isEmpty()) {
531       size += com.google.protobuf.CodedOutputStream.computeBytesSize(8, wrappedKey_);
532     }
533     size += getUnknownFields().getSerializedSize();
534     memoizedSize = size;
535     return size;
536   }
537 
538   @java.lang.Override
equals(final java.lang.Object obj)539   public boolean equals(final java.lang.Object obj) {
540     if (obj == this) {
541       return true;
542     }
543     if (!(obj instanceof com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest)) {
544       return super.equals(obj);
545     }
546     com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest other =
547         (com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) obj;
548 
549     if (!getParent().equals(other.getParent())) return false;
550     if (!getCryptoKeyVersion().equals(other.getCryptoKeyVersion())) return false;
551     if (algorithm_ != other.algorithm_) return false;
552     if (!getImportJob().equals(other.getImportJob())) return false;
553     if (!getWrappedKey().equals(other.getWrappedKey())) return false;
554     if (!getWrappedKeyMaterialCase().equals(other.getWrappedKeyMaterialCase())) return false;
555     switch (wrappedKeyMaterialCase_) {
556       case 5:
557         if (!getRsaAesWrappedKey().equals(other.getRsaAesWrappedKey())) return false;
558         break;
559       case 0:
560       default:
561     }
562     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
563     return true;
564   }
565 
566   @java.lang.Override
hashCode()567   public int hashCode() {
568     if (memoizedHashCode != 0) {
569       return memoizedHashCode;
570     }
571     int hash = 41;
572     hash = (19 * hash) + getDescriptor().hashCode();
573     hash = (37 * hash) + PARENT_FIELD_NUMBER;
574     hash = (53 * hash) + getParent().hashCode();
575     hash = (37 * hash) + CRYPTO_KEY_VERSION_FIELD_NUMBER;
576     hash = (53 * hash) + getCryptoKeyVersion().hashCode();
577     hash = (37 * hash) + ALGORITHM_FIELD_NUMBER;
578     hash = (53 * hash) + algorithm_;
579     hash = (37 * hash) + IMPORT_JOB_FIELD_NUMBER;
580     hash = (53 * hash) + getImportJob().hashCode();
581     hash = (37 * hash) + WRAPPED_KEY_FIELD_NUMBER;
582     hash = (53 * hash) + getWrappedKey().hashCode();
583     switch (wrappedKeyMaterialCase_) {
584       case 5:
585         hash = (37 * hash) + RSA_AES_WRAPPED_KEY_FIELD_NUMBER;
586         hash = (53 * hash) + getRsaAesWrappedKey().hashCode();
587         break;
588       case 0:
589       default:
590     }
591     hash = (29 * hash) + getUnknownFields().hashCode();
592     memoizedHashCode = hash;
593     return hash;
594   }
595 
parseFrom( java.nio.ByteBuffer data)596   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
597       java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
598     return PARSER.parseFrom(data);
599   }
600 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)601   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
602       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
603       throws com.google.protobuf.InvalidProtocolBufferException {
604     return PARSER.parseFrom(data, extensionRegistry);
605   }
606 
parseFrom( com.google.protobuf.ByteString data)607   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
608       com.google.protobuf.ByteString data)
609       throws com.google.protobuf.InvalidProtocolBufferException {
610     return PARSER.parseFrom(data);
611   }
612 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)613   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
614       com.google.protobuf.ByteString data,
615       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
616       throws com.google.protobuf.InvalidProtocolBufferException {
617     return PARSER.parseFrom(data, extensionRegistry);
618   }
619 
parseFrom(byte[] data)620   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(byte[] data)
621       throws com.google.protobuf.InvalidProtocolBufferException {
622     return PARSER.parseFrom(data);
623   }
624 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)625   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
626       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
627       throws com.google.protobuf.InvalidProtocolBufferException {
628     return PARSER.parseFrom(data, extensionRegistry);
629   }
630 
parseFrom( java.io.InputStream input)631   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
632       java.io.InputStream input) throws java.io.IOException {
633     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
634   }
635 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)636   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
637       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
638       throws java.io.IOException {
639     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
640         PARSER, input, extensionRegistry);
641   }
642 
parseDelimitedFrom( java.io.InputStream input)643   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseDelimitedFrom(
644       java.io.InputStream input) throws java.io.IOException {
645     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
646   }
647 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)648   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseDelimitedFrom(
649       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
650       throws java.io.IOException {
651     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
652         PARSER, input, extensionRegistry);
653   }
654 
parseFrom( com.google.protobuf.CodedInputStream input)655   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
656       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
657     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
658   }
659 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)660   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest parseFrom(
661       com.google.protobuf.CodedInputStream input,
662       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
663       throws java.io.IOException {
664     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
665         PARSER, input, extensionRegistry);
666   }
667 
668   @java.lang.Override
newBuilderForType()669   public Builder newBuilderForType() {
670     return newBuilder();
671   }
672 
newBuilder()673   public static Builder newBuilder() {
674     return DEFAULT_INSTANCE.toBuilder();
675   }
676 
newBuilder( com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest prototype)677   public static Builder newBuilder(
678       com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest prototype) {
679     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
680   }
681 
682   @java.lang.Override
toBuilder()683   public Builder toBuilder() {
684     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
685   }
686 
687   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)688   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
689     Builder builder = new Builder(parent);
690     return builder;
691   }
692   /**
693    *
694    *
695    * <pre>
696    * Request message for
697    * [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
698    * </pre>
699    *
700    * Protobuf type {@code google.cloud.kms.v1.ImportCryptoKeyVersionRequest}
701    */
702   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
703       implements
704       // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.ImportCryptoKeyVersionRequest)
705       com.google.cloud.kms.v1.ImportCryptoKeyVersionRequestOrBuilder {
getDescriptor()706     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
707       return com.google.cloud.kms.v1.KmsProto
708           .internal_static_google_cloud_kms_v1_ImportCryptoKeyVersionRequest_descriptor;
709     }
710 
711     @java.lang.Override
712     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()713         internalGetFieldAccessorTable() {
714       return com.google.cloud.kms.v1.KmsProto
715           .internal_static_google_cloud_kms_v1_ImportCryptoKeyVersionRequest_fieldAccessorTable
716           .ensureFieldAccessorsInitialized(
717               com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.class,
718               com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.Builder.class);
719     }
720 
721     // Construct using com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.newBuilder()
Builder()722     private Builder() {}
723 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)724     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
725       super(parent);
726     }
727 
728     @java.lang.Override
clear()729     public Builder clear() {
730       super.clear();
731       bitField0_ = 0;
732       parent_ = "";
733       cryptoKeyVersion_ = "";
734       algorithm_ = 0;
735       importJob_ = "";
736       wrappedKey_ = com.google.protobuf.ByteString.EMPTY;
737       wrappedKeyMaterialCase_ = 0;
738       wrappedKeyMaterial_ = null;
739       return this;
740     }
741 
742     @java.lang.Override
getDescriptorForType()743     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
744       return com.google.cloud.kms.v1.KmsProto
745           .internal_static_google_cloud_kms_v1_ImportCryptoKeyVersionRequest_descriptor;
746     }
747 
748     @java.lang.Override
getDefaultInstanceForType()749     public com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest getDefaultInstanceForType() {
750       return com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.getDefaultInstance();
751     }
752 
753     @java.lang.Override
build()754     public com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest build() {
755       com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest result = buildPartial();
756       if (!result.isInitialized()) {
757         throw newUninitializedMessageException(result);
758       }
759       return result;
760     }
761 
762     @java.lang.Override
buildPartial()763     public com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest buildPartial() {
764       com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest result =
765           new com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest(this);
766       if (bitField0_ != 0) {
767         buildPartial0(result);
768       }
769       buildPartialOneofs(result);
770       onBuilt();
771       return result;
772     }
773 
buildPartial0(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest result)774     private void buildPartial0(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest result) {
775       int from_bitField0_ = bitField0_;
776       if (((from_bitField0_ & 0x00000001) != 0)) {
777         result.parent_ = parent_;
778       }
779       if (((from_bitField0_ & 0x00000002) != 0)) {
780         result.cryptoKeyVersion_ = cryptoKeyVersion_;
781       }
782       if (((from_bitField0_ & 0x00000004) != 0)) {
783         result.algorithm_ = algorithm_;
784       }
785       if (((from_bitField0_ & 0x00000008) != 0)) {
786         result.importJob_ = importJob_;
787       }
788       if (((from_bitField0_ & 0x00000010) != 0)) {
789         result.wrappedKey_ = wrappedKey_;
790       }
791     }
792 
buildPartialOneofs(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest result)793     private void buildPartialOneofs(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest result) {
794       result.wrappedKeyMaterialCase_ = wrappedKeyMaterialCase_;
795       result.wrappedKeyMaterial_ = this.wrappedKeyMaterial_;
796     }
797 
798     @java.lang.Override
clone()799     public Builder clone() {
800       return super.clone();
801     }
802 
803     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)804     public Builder setField(
805         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
806       return super.setField(field, value);
807     }
808 
809     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)810     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
811       return super.clearField(field);
812     }
813 
814     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)815     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
816       return super.clearOneof(oneof);
817     }
818 
819     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)820     public Builder setRepeatedField(
821         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
822       return super.setRepeatedField(field, index, value);
823     }
824 
825     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)826     public Builder addRepeatedField(
827         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
828       return super.addRepeatedField(field, value);
829     }
830 
831     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)832     public Builder mergeFrom(com.google.protobuf.Message other) {
833       if (other instanceof com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) {
834         return mergeFrom((com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest) other);
835       } else {
836         super.mergeFrom(other);
837         return this;
838       }
839     }
840 
mergeFrom(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest other)841     public Builder mergeFrom(com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest other) {
842       if (other == com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest.getDefaultInstance())
843         return this;
844       if (!other.getParent().isEmpty()) {
845         parent_ = other.parent_;
846         bitField0_ |= 0x00000001;
847         onChanged();
848       }
849       if (!other.getCryptoKeyVersion().isEmpty()) {
850         cryptoKeyVersion_ = other.cryptoKeyVersion_;
851         bitField0_ |= 0x00000002;
852         onChanged();
853       }
854       if (other.algorithm_ != 0) {
855         setAlgorithmValue(other.getAlgorithmValue());
856       }
857       if (!other.getImportJob().isEmpty()) {
858         importJob_ = other.importJob_;
859         bitField0_ |= 0x00000008;
860         onChanged();
861       }
862       if (other.getWrappedKey() != com.google.protobuf.ByteString.EMPTY) {
863         setWrappedKey(other.getWrappedKey());
864       }
865       switch (other.getWrappedKeyMaterialCase()) {
866         case RSA_AES_WRAPPED_KEY:
867           {
868             setRsaAesWrappedKey(other.getRsaAesWrappedKey());
869             break;
870           }
871         case WRAPPEDKEYMATERIAL_NOT_SET:
872           {
873             break;
874           }
875       }
876       this.mergeUnknownFields(other.getUnknownFields());
877       onChanged();
878       return this;
879     }
880 
881     @java.lang.Override
isInitialized()882     public final boolean isInitialized() {
883       return true;
884     }
885 
886     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)887     public Builder mergeFrom(
888         com.google.protobuf.CodedInputStream input,
889         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
890         throws java.io.IOException {
891       if (extensionRegistry == null) {
892         throw new java.lang.NullPointerException();
893       }
894       try {
895         boolean done = false;
896         while (!done) {
897           int tag = input.readTag();
898           switch (tag) {
899             case 0:
900               done = true;
901               break;
902             case 10:
903               {
904                 parent_ = input.readStringRequireUtf8();
905                 bitField0_ |= 0x00000001;
906                 break;
907               } // case 10
908             case 16:
909               {
910                 algorithm_ = input.readEnum();
911                 bitField0_ |= 0x00000004;
912                 break;
913               } // case 16
914             case 34:
915               {
916                 importJob_ = input.readStringRequireUtf8();
917                 bitField0_ |= 0x00000008;
918                 break;
919               } // case 34
920             case 42:
921               {
922                 wrappedKeyMaterial_ = input.readBytes();
923                 wrappedKeyMaterialCase_ = 5;
924                 break;
925               } // case 42
926             case 50:
927               {
928                 cryptoKeyVersion_ = input.readStringRequireUtf8();
929                 bitField0_ |= 0x00000002;
930                 break;
931               } // case 50
932             case 66:
933               {
934                 wrappedKey_ = input.readBytes();
935                 bitField0_ |= 0x00000010;
936                 break;
937               } // case 66
938             default:
939               {
940                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
941                   done = true; // was an endgroup tag
942                 }
943                 break;
944               } // default:
945           } // switch (tag)
946         } // while (!done)
947       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
948         throw e.unwrapIOException();
949       } finally {
950         onChanged();
951       } // finally
952       return this;
953     }
954 
955     private int wrappedKeyMaterialCase_ = 0;
956     private java.lang.Object wrappedKeyMaterial_;
957 
getWrappedKeyMaterialCase()958     public WrappedKeyMaterialCase getWrappedKeyMaterialCase() {
959       return WrappedKeyMaterialCase.forNumber(wrappedKeyMaterialCase_);
960     }
961 
clearWrappedKeyMaterial()962     public Builder clearWrappedKeyMaterial() {
963       wrappedKeyMaterialCase_ = 0;
964       wrappedKeyMaterial_ = null;
965       onChanged();
966       return this;
967     }
968 
969     private int bitField0_;
970 
971     private java.lang.Object parent_ = "";
972     /**
973      *
974      *
975      * <pre>
976      * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
977      * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
978      * The create permission is only required on this key when creating a new
979      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
980      * </pre>
981      *
982      * <code>
983      * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
984      * </code>
985      *
986      * @return The parent.
987      */
getParent()988     public java.lang.String getParent() {
989       java.lang.Object ref = parent_;
990       if (!(ref instanceof java.lang.String)) {
991         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
992         java.lang.String s = bs.toStringUtf8();
993         parent_ = s;
994         return s;
995       } else {
996         return (java.lang.String) ref;
997       }
998     }
999     /**
1000      *
1001      *
1002      * <pre>
1003      * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
1004      * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
1005      * The create permission is only required on this key when creating a new
1006      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
1007      * </pre>
1008      *
1009      * <code>
1010      * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
1011      * </code>
1012      *
1013      * @return The bytes for parent.
1014      */
getParentBytes()1015     public com.google.protobuf.ByteString getParentBytes() {
1016       java.lang.Object ref = parent_;
1017       if (ref instanceof String) {
1018         com.google.protobuf.ByteString b =
1019             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1020         parent_ = b;
1021         return b;
1022       } else {
1023         return (com.google.protobuf.ByteString) ref;
1024       }
1025     }
1026     /**
1027      *
1028      *
1029      * <pre>
1030      * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
1031      * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
1032      * The create permission is only required on this key when creating a new
1033      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
1034      * </pre>
1035      *
1036      * <code>
1037      * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
1038      * </code>
1039      *
1040      * @param value The parent to set.
1041      * @return This builder for chaining.
1042      */
setParent(java.lang.String value)1043     public Builder setParent(java.lang.String value) {
1044       if (value == null) {
1045         throw new NullPointerException();
1046       }
1047       parent_ = value;
1048       bitField0_ |= 0x00000001;
1049       onChanged();
1050       return this;
1051     }
1052     /**
1053      *
1054      *
1055      * <pre>
1056      * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
1057      * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
1058      * The create permission is only required on this key when creating a new
1059      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
1060      * </pre>
1061      *
1062      * <code>
1063      * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
1064      * </code>
1065      *
1066      * @return This builder for chaining.
1067      */
clearParent()1068     public Builder clearParent() {
1069       parent_ = getDefaultInstance().getParent();
1070       bitField0_ = (bitField0_ & ~0x00000001);
1071       onChanged();
1072       return this;
1073     }
1074     /**
1075      *
1076      *
1077      * <pre>
1078      * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
1079      * [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
1080      * The create permission is only required on this key when creating a new
1081      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
1082      * </pre>
1083      *
1084      * <code>
1085      * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }
1086      * </code>
1087      *
1088      * @param value The bytes for parent to set.
1089      * @return This builder for chaining.
1090      */
setParentBytes(com.google.protobuf.ByteString value)1091     public Builder setParentBytes(com.google.protobuf.ByteString value) {
1092       if (value == null) {
1093         throw new NullPointerException();
1094       }
1095       checkByteStringIsUtf8(value);
1096       parent_ = value;
1097       bitField0_ |= 0x00000001;
1098       onChanged();
1099       return this;
1100     }
1101 
1102     private java.lang.Object cryptoKeyVersion_ = "";
1103     /**
1104      *
1105      *
1106      * <pre>
1107      * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
1108      * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
1109      * target for an import operation. If this field is not present, a new
1110      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
1111      * supplied key material is created.
1112      * If this field is present, the supplied key material is imported into
1113      * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
1114      * import into an existing
1115      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
1116      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
1117      * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
1118      * have been previously created via [ImportCryptoKeyVersion][], and be in
1119      * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
1120      * or
1121      * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
1122      * state. The key material and algorithm must match the previous
1123      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
1124      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
1125      * key material.
1126      * </pre>
1127      *
1128      * <code>
1129      * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
1130      * </code>
1131      *
1132      * @return The cryptoKeyVersion.
1133      */
getCryptoKeyVersion()1134     public java.lang.String getCryptoKeyVersion() {
1135       java.lang.Object ref = cryptoKeyVersion_;
1136       if (!(ref instanceof java.lang.String)) {
1137         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
1138         java.lang.String s = bs.toStringUtf8();
1139         cryptoKeyVersion_ = s;
1140         return s;
1141       } else {
1142         return (java.lang.String) ref;
1143       }
1144     }
1145     /**
1146      *
1147      *
1148      * <pre>
1149      * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
1150      * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
1151      * target for an import operation. If this field is not present, a new
1152      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
1153      * supplied key material is created.
1154      * If this field is present, the supplied key material is imported into
1155      * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
1156      * import into an existing
1157      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
1158      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
1159      * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
1160      * have been previously created via [ImportCryptoKeyVersion][], and be in
1161      * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
1162      * or
1163      * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
1164      * state. The key material and algorithm must match the previous
1165      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
1166      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
1167      * key material.
1168      * </pre>
1169      *
1170      * <code>
1171      * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
1172      * </code>
1173      *
1174      * @return The bytes for cryptoKeyVersion.
1175      */
getCryptoKeyVersionBytes()1176     public com.google.protobuf.ByteString getCryptoKeyVersionBytes() {
1177       java.lang.Object ref = cryptoKeyVersion_;
1178       if (ref instanceof String) {
1179         com.google.protobuf.ByteString b =
1180             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1181         cryptoKeyVersion_ = b;
1182         return b;
1183       } else {
1184         return (com.google.protobuf.ByteString) ref;
1185       }
1186     }
1187     /**
1188      *
1189      *
1190      * <pre>
1191      * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
1192      * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
1193      * target for an import operation. If this field is not present, a new
1194      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
1195      * supplied key material is created.
1196      * If this field is present, the supplied key material is imported into
1197      * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
1198      * import into an existing
1199      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
1200      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
1201      * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
1202      * have been previously created via [ImportCryptoKeyVersion][], and be in
1203      * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
1204      * or
1205      * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
1206      * state. The key material and algorithm must match the previous
1207      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
1208      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
1209      * key material.
1210      * </pre>
1211      *
1212      * <code>
1213      * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
1214      * </code>
1215      *
1216      * @param value The cryptoKeyVersion to set.
1217      * @return This builder for chaining.
1218      */
setCryptoKeyVersion(java.lang.String value)1219     public Builder setCryptoKeyVersion(java.lang.String value) {
1220       if (value == null) {
1221         throw new NullPointerException();
1222       }
1223       cryptoKeyVersion_ = value;
1224       bitField0_ |= 0x00000002;
1225       onChanged();
1226       return this;
1227     }
1228     /**
1229      *
1230      *
1231      * <pre>
1232      * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
1233      * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
1234      * target for an import operation. If this field is not present, a new
1235      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
1236      * supplied key material is created.
1237      * If this field is present, the supplied key material is imported into
1238      * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
1239      * import into an existing
1240      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
1241      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
1242      * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
1243      * have been previously created via [ImportCryptoKeyVersion][], and be in
1244      * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
1245      * or
1246      * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
1247      * state. The key material and algorithm must match the previous
1248      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
1249      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
1250      * key material.
1251      * </pre>
1252      *
1253      * <code>
1254      * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
1255      * </code>
1256      *
1257      * @return This builder for chaining.
1258      */
clearCryptoKeyVersion()1259     public Builder clearCryptoKeyVersion() {
1260       cryptoKeyVersion_ = getDefaultInstance().getCryptoKeyVersion();
1261       bitField0_ = (bitField0_ & ~0x00000002);
1262       onChanged();
1263       return this;
1264     }
1265     /**
1266      *
1267      *
1268      * <pre>
1269      * Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
1270      * an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
1271      * target for an import operation. If this field is not present, a new
1272      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
1273      * supplied key material is created.
1274      * If this field is present, the supplied key material is imported into
1275      * the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
1276      * import into an existing
1277      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
1278      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
1279      * [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
1280      * have been previously created via [ImportCryptoKeyVersion][], and be in
1281      * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
1282      * or
1283      * [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
1284      * state. The key material and algorithm must match the previous
1285      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
1286      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
1287      * key material.
1288      * </pre>
1289      *
1290      * <code>
1291      * string crypto_key_version = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }
1292      * </code>
1293      *
1294      * @param value The bytes for cryptoKeyVersion to set.
1295      * @return This builder for chaining.
1296      */
setCryptoKeyVersionBytes(com.google.protobuf.ByteString value)1297     public Builder setCryptoKeyVersionBytes(com.google.protobuf.ByteString value) {
1298       if (value == null) {
1299         throw new NullPointerException();
1300       }
1301       checkByteStringIsUtf8(value);
1302       cryptoKeyVersion_ = value;
1303       bitField0_ |= 0x00000002;
1304       onChanged();
1305       return this;
1306     }
1307 
1308     private int algorithm_ = 0;
1309     /**
1310      *
1311      *
1312      * <pre>
1313      * Required. The
1314      * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
1315      * of the key being imported. This does not need to match the
1316      * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
1317      * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
1318      * </pre>
1319      *
1320      * <code>
1321      * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
1322      * </code>
1323      *
1324      * @return The enum numeric value on the wire for algorithm.
1325      */
1326     @java.lang.Override
getAlgorithmValue()1327     public int getAlgorithmValue() {
1328       return algorithm_;
1329     }
1330     /**
1331      *
1332      *
1333      * <pre>
1334      * Required. The
1335      * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
1336      * of the key being imported. This does not need to match the
1337      * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
1338      * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
1339      * </pre>
1340      *
1341      * <code>
1342      * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
1343      * </code>
1344      *
1345      * @param value The enum numeric value on the wire for algorithm to set.
1346      * @return This builder for chaining.
1347      */
setAlgorithmValue(int value)1348     public Builder setAlgorithmValue(int value) {
1349       algorithm_ = value;
1350       bitField0_ |= 0x00000004;
1351       onChanged();
1352       return this;
1353     }
1354     /**
1355      *
1356      *
1357      * <pre>
1358      * Required. The
1359      * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
1360      * of the key being imported. This does not need to match the
1361      * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
1362      * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
1363      * </pre>
1364      *
1365      * <code>
1366      * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
1367      * </code>
1368      *
1369      * @return The algorithm.
1370      */
1371     @java.lang.Override
getAlgorithm()1372     public com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm getAlgorithm() {
1373       com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm result =
1374           com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.forNumber(algorithm_);
1375       return result == null
1376           ? com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.UNRECOGNIZED
1377           : result;
1378     }
1379     /**
1380      *
1381      *
1382      * <pre>
1383      * Required. The
1384      * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
1385      * of the key being imported. This does not need to match the
1386      * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
1387      * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
1388      * </pre>
1389      *
1390      * <code>
1391      * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
1392      * </code>
1393      *
1394      * @param value The algorithm to set.
1395      * @return This builder for chaining.
1396      */
setAlgorithm( com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm value)1397     public Builder setAlgorithm(
1398         com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm value) {
1399       if (value == null) {
1400         throw new NullPointerException();
1401       }
1402       bitField0_ |= 0x00000004;
1403       algorithm_ = value.getNumber();
1404       onChanged();
1405       return this;
1406     }
1407     /**
1408      *
1409      *
1410      * <pre>
1411      * Required. The
1412      * [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
1413      * of the key being imported. This does not need to match the
1414      * [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
1415      * [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
1416      * </pre>
1417      *
1418      * <code>
1419      * .google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2 [(.google.api.field_behavior) = REQUIRED];
1420      * </code>
1421      *
1422      * @return This builder for chaining.
1423      */
clearAlgorithm()1424     public Builder clearAlgorithm() {
1425       bitField0_ = (bitField0_ & ~0x00000004);
1426       algorithm_ = 0;
1427       onChanged();
1428       return this;
1429     }
1430 
1431     private java.lang.Object importJob_ = "";
1432     /**
1433      *
1434      *
1435      * <pre>
1436      * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
1437      * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
1438      * material.
1439      * </pre>
1440      *
1441      * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
1442      *
1443      * @return The importJob.
1444      */
getImportJob()1445     public java.lang.String getImportJob() {
1446       java.lang.Object ref = importJob_;
1447       if (!(ref instanceof java.lang.String)) {
1448         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
1449         java.lang.String s = bs.toStringUtf8();
1450         importJob_ = s;
1451         return s;
1452       } else {
1453         return (java.lang.String) ref;
1454       }
1455     }
1456     /**
1457      *
1458      *
1459      * <pre>
1460      * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
1461      * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
1462      * material.
1463      * </pre>
1464      *
1465      * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
1466      *
1467      * @return The bytes for importJob.
1468      */
getImportJobBytes()1469     public com.google.protobuf.ByteString getImportJobBytes() {
1470       java.lang.Object ref = importJob_;
1471       if (ref instanceof String) {
1472         com.google.protobuf.ByteString b =
1473             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1474         importJob_ = b;
1475         return b;
1476       } else {
1477         return (com.google.protobuf.ByteString) ref;
1478       }
1479     }
1480     /**
1481      *
1482      *
1483      * <pre>
1484      * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
1485      * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
1486      * material.
1487      * </pre>
1488      *
1489      * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
1490      *
1491      * @param value The importJob to set.
1492      * @return This builder for chaining.
1493      */
setImportJob(java.lang.String value)1494     public Builder setImportJob(java.lang.String value) {
1495       if (value == null) {
1496         throw new NullPointerException();
1497       }
1498       importJob_ = value;
1499       bitField0_ |= 0x00000008;
1500       onChanged();
1501       return this;
1502     }
1503     /**
1504      *
1505      *
1506      * <pre>
1507      * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
1508      * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
1509      * material.
1510      * </pre>
1511      *
1512      * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
1513      *
1514      * @return This builder for chaining.
1515      */
clearImportJob()1516     public Builder clearImportJob() {
1517       importJob_ = getDefaultInstance().getImportJob();
1518       bitField0_ = (bitField0_ & ~0x00000008);
1519       onChanged();
1520       return this;
1521     }
1522     /**
1523      *
1524      *
1525      * <pre>
1526      * Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
1527      * [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
1528      * material.
1529      * </pre>
1530      *
1531      * <code>string import_job = 4 [(.google.api.field_behavior) = REQUIRED];</code>
1532      *
1533      * @param value The bytes for importJob to set.
1534      * @return This builder for chaining.
1535      */
setImportJobBytes(com.google.protobuf.ByteString value)1536     public Builder setImportJobBytes(com.google.protobuf.ByteString value) {
1537       if (value == null) {
1538         throw new NullPointerException();
1539       }
1540       checkByteStringIsUtf8(value);
1541       importJob_ = value;
1542       bitField0_ |= 0x00000008;
1543       onChanged();
1544       return this;
1545     }
1546 
1547     private com.google.protobuf.ByteString wrappedKey_ = com.google.protobuf.ByteString.EMPTY;
1548     /**
1549      *
1550      *
1551      * <pre>
1552      * Optional. The wrapped key material to import.
1553      * Before wrapping, key material must be formatted. If importing symmetric key
1554      * material, the expected key material format is plain bytes. If importing
1555      * asymmetric key material, the expected key material format is PKCS#8-encoded
1556      * DER (the PrivateKeyInfo structure from RFC 5208).
1557      * When wrapping with import methods
1558      * ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
1559      * or
1560      * [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
1561      * or
1562      * [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
1563      * or
1564      * [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
1565      * this field must contain the concatenation of:
1566      * &lt;ol&gt;
1567      *   &lt;li&gt;An ephemeral AES-256 wrapping key wrapped with the
1568      *       [public_key][google.cloud.kms.v1.ImportJob.public_key] using
1569      *       RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty
1570      *       label.
1571      *   &lt;/li&gt;
1572      *   &lt;li&gt;The formatted key to be imported, wrapped with the ephemeral AES-256
1573      *       key using AES-KWP (RFC 5649).
1574      *   &lt;/li&gt;
1575      * &lt;/ol&gt;
1576      * This format is the same as the format produced by PKCS#11 mechanism
1577      * CKM_RSA_AES_KEY_WRAP.
1578      * When wrapping with import methods
1579      * ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
1580      * or
1581      * [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
1582      * this field must contain the formatted key to be imported, wrapped with the
1583      * [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
1584      * with SHA-256, MGF1 with SHA-256, and an empty label.
1585      * </pre>
1586      *
1587      * <code>bytes wrapped_key = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
1588      *
1589      * @return The wrappedKey.
1590      */
1591     @java.lang.Override
getWrappedKey()1592     public com.google.protobuf.ByteString getWrappedKey() {
1593       return wrappedKey_;
1594     }
1595     /**
1596      *
1597      *
1598      * <pre>
1599      * Optional. The wrapped key material to import.
1600      * Before wrapping, key material must be formatted. If importing symmetric key
1601      * material, the expected key material format is plain bytes. If importing
1602      * asymmetric key material, the expected key material format is PKCS#8-encoded
1603      * DER (the PrivateKeyInfo structure from RFC 5208).
1604      * When wrapping with import methods
1605      * ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
1606      * or
1607      * [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
1608      * or
1609      * [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
1610      * or
1611      * [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
1612      * this field must contain the concatenation of:
1613      * &lt;ol&gt;
1614      *   &lt;li&gt;An ephemeral AES-256 wrapping key wrapped with the
1615      *       [public_key][google.cloud.kms.v1.ImportJob.public_key] using
1616      *       RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty
1617      *       label.
1618      *   &lt;/li&gt;
1619      *   &lt;li&gt;The formatted key to be imported, wrapped with the ephemeral AES-256
1620      *       key using AES-KWP (RFC 5649).
1621      *   &lt;/li&gt;
1622      * &lt;/ol&gt;
1623      * This format is the same as the format produced by PKCS#11 mechanism
1624      * CKM_RSA_AES_KEY_WRAP.
1625      * When wrapping with import methods
1626      * ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
1627      * or
1628      * [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
1629      * this field must contain the formatted key to be imported, wrapped with the
1630      * [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
1631      * with SHA-256, MGF1 with SHA-256, and an empty label.
1632      * </pre>
1633      *
1634      * <code>bytes wrapped_key = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
1635      *
1636      * @param value The wrappedKey to set.
1637      * @return This builder for chaining.
1638      */
setWrappedKey(com.google.protobuf.ByteString value)1639     public Builder setWrappedKey(com.google.protobuf.ByteString value) {
1640       if (value == null) {
1641         throw new NullPointerException();
1642       }
1643       wrappedKey_ = value;
1644       bitField0_ |= 0x00000010;
1645       onChanged();
1646       return this;
1647     }
1648     /**
1649      *
1650      *
1651      * <pre>
1652      * Optional. The wrapped key material to import.
1653      * Before wrapping, key material must be formatted. If importing symmetric key
1654      * material, the expected key material format is plain bytes. If importing
1655      * asymmetric key material, the expected key material format is PKCS#8-encoded
1656      * DER (the PrivateKeyInfo structure from RFC 5208).
1657      * When wrapping with import methods
1658      * ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
1659      * or
1660      * [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
1661      * or
1662      * [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
1663      * or
1664      * [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
1665      * this field must contain the concatenation of:
1666      * &lt;ol&gt;
1667      *   &lt;li&gt;An ephemeral AES-256 wrapping key wrapped with the
1668      *       [public_key][google.cloud.kms.v1.ImportJob.public_key] using
1669      *       RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty
1670      *       label.
1671      *   &lt;/li&gt;
1672      *   &lt;li&gt;The formatted key to be imported, wrapped with the ephemeral AES-256
1673      *       key using AES-KWP (RFC 5649).
1674      *   &lt;/li&gt;
1675      * &lt;/ol&gt;
1676      * This format is the same as the format produced by PKCS#11 mechanism
1677      * CKM_RSA_AES_KEY_WRAP.
1678      * When wrapping with import methods
1679      * ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
1680      * or
1681      * [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
1682      * this field must contain the formatted key to be imported, wrapped with the
1683      * [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
1684      * with SHA-256, MGF1 with SHA-256, and an empty label.
1685      * </pre>
1686      *
1687      * <code>bytes wrapped_key = 8 [(.google.api.field_behavior) = OPTIONAL];</code>
1688      *
1689      * @return This builder for chaining.
1690      */
clearWrappedKey()1691     public Builder clearWrappedKey() {
1692       bitField0_ = (bitField0_ & ~0x00000010);
1693       wrappedKey_ = getDefaultInstance().getWrappedKey();
1694       onChanged();
1695       return this;
1696     }
1697 
1698     /**
1699      *
1700      *
1701      * <pre>
1702      * Optional. This field has the same meaning as
1703      * [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
1704      * Prefer to use that field in new work. Either that field or this field
1705      * (but not both) must be specified.
1706      * </pre>
1707      *
1708      * <code>bytes rsa_aes_wrapped_key = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
1709      *
1710      * @return Whether the rsaAesWrappedKey field is set.
1711      */
hasRsaAesWrappedKey()1712     public boolean hasRsaAesWrappedKey() {
1713       return wrappedKeyMaterialCase_ == 5;
1714     }
1715     /**
1716      *
1717      *
1718      * <pre>
1719      * Optional. This field has the same meaning as
1720      * [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
1721      * Prefer to use that field in new work. Either that field or this field
1722      * (but not both) must be specified.
1723      * </pre>
1724      *
1725      * <code>bytes rsa_aes_wrapped_key = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
1726      *
1727      * @return The rsaAesWrappedKey.
1728      */
getRsaAesWrappedKey()1729     public com.google.protobuf.ByteString getRsaAesWrappedKey() {
1730       if (wrappedKeyMaterialCase_ == 5) {
1731         return (com.google.protobuf.ByteString) wrappedKeyMaterial_;
1732       }
1733       return com.google.protobuf.ByteString.EMPTY;
1734     }
1735     /**
1736      *
1737      *
1738      * <pre>
1739      * Optional. This field has the same meaning as
1740      * [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
1741      * Prefer to use that field in new work. Either that field or this field
1742      * (but not both) must be specified.
1743      * </pre>
1744      *
1745      * <code>bytes rsa_aes_wrapped_key = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
1746      *
1747      * @param value The rsaAesWrappedKey to set.
1748      * @return This builder for chaining.
1749      */
setRsaAesWrappedKey(com.google.protobuf.ByteString value)1750     public Builder setRsaAesWrappedKey(com.google.protobuf.ByteString value) {
1751       if (value == null) {
1752         throw new NullPointerException();
1753       }
1754       wrappedKeyMaterialCase_ = 5;
1755       wrappedKeyMaterial_ = value;
1756       onChanged();
1757       return this;
1758     }
1759     /**
1760      *
1761      *
1762      * <pre>
1763      * Optional. This field has the same meaning as
1764      * [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
1765      * Prefer to use that field in new work. Either that field or this field
1766      * (but not both) must be specified.
1767      * </pre>
1768      *
1769      * <code>bytes rsa_aes_wrapped_key = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
1770      *
1771      * @return This builder for chaining.
1772      */
clearRsaAesWrappedKey()1773     public Builder clearRsaAesWrappedKey() {
1774       if (wrappedKeyMaterialCase_ == 5) {
1775         wrappedKeyMaterialCase_ = 0;
1776         wrappedKeyMaterial_ = null;
1777         onChanged();
1778       }
1779       return this;
1780     }
1781 
1782     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1783     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
1784       return super.setUnknownFields(unknownFields);
1785     }
1786 
1787     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1788     public final Builder mergeUnknownFields(
1789         final com.google.protobuf.UnknownFieldSet unknownFields) {
1790       return super.mergeUnknownFields(unknownFields);
1791     }
1792 
1793     // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.ImportCryptoKeyVersionRequest)
1794   }
1795 
1796   // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.ImportCryptoKeyVersionRequest)
1797   private static final com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest DEFAULT_INSTANCE;
1798 
1799   static {
1800     DEFAULT_INSTANCE = new com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest();
1801   }
1802 
getDefaultInstance()1803   public static com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest getDefaultInstance() {
1804     return DEFAULT_INSTANCE;
1805   }
1806 
1807   private static final com.google.protobuf.Parser<ImportCryptoKeyVersionRequest> PARSER =
1808       new com.google.protobuf.AbstractParser<ImportCryptoKeyVersionRequest>() {
1809         @java.lang.Override
1810         public ImportCryptoKeyVersionRequest parsePartialFrom(
1811             com.google.protobuf.CodedInputStream input,
1812             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1813             throws com.google.protobuf.InvalidProtocolBufferException {
1814           Builder builder = newBuilder();
1815           try {
1816             builder.mergeFrom(input, extensionRegistry);
1817           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1818             throw e.setUnfinishedMessage(builder.buildPartial());
1819           } catch (com.google.protobuf.UninitializedMessageException e) {
1820             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1821           } catch (java.io.IOException e) {
1822             throw new com.google.protobuf.InvalidProtocolBufferException(e)
1823                 .setUnfinishedMessage(builder.buildPartial());
1824           }
1825           return builder.buildPartial();
1826         }
1827       };
1828 
parser()1829   public static com.google.protobuf.Parser<ImportCryptoKeyVersionRequest> parser() {
1830     return PARSER;
1831   }
1832 
1833   @java.lang.Override
getParserForType()1834   public com.google.protobuf.Parser<ImportCryptoKeyVersionRequest> getParserForType() {
1835     return PARSER;
1836   }
1837 
1838   @java.lang.Override
getDefaultInstanceForType()1839   public com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest getDefaultInstanceForType() {
1840     return DEFAULT_INSTANCE;
1841   }
1842 }
1843