• 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/resources.proto
18 
19 package com.google.cloud.kms.v1;
20 
21 /**
22  *
23  *
24  * <pre>
25  * The public key for a given
26  * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
27  * [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
28  * </pre>
29  *
30  * Protobuf type {@code google.cloud.kms.v1.PublicKey}
31  */
32 public final class PublicKey extends com.google.protobuf.GeneratedMessageV3
33     implements
34     // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.PublicKey)
35     PublicKeyOrBuilder {
36   private static final long serialVersionUID = 0L;
37   // Use PublicKey.newBuilder() to construct.
PublicKey(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)38   private PublicKey(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
39     super(builder);
40   }
41 
PublicKey()42   private PublicKey() {
43     pem_ = "";
44     algorithm_ = 0;
45     name_ = "";
46     protectionLevel_ = 0;
47   }
48 
49   @java.lang.Override
50   @SuppressWarnings({"unused"})
newInstance(UnusedPrivateParameter unused)51   protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
52     return new PublicKey();
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.KmsResourcesProto
62         .internal_static_google_cloud_kms_v1_PublicKey_descriptor;
63   }
64 
65   @java.lang.Override
66   protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()67       internalGetFieldAccessorTable() {
68     return com.google.cloud.kms.v1.KmsResourcesProto
69         .internal_static_google_cloud_kms_v1_PublicKey_fieldAccessorTable
70         .ensureFieldAccessorsInitialized(
71             com.google.cloud.kms.v1.PublicKey.class,
72             com.google.cloud.kms.v1.PublicKey.Builder.class);
73   }
74 
75   public static final int PEM_FIELD_NUMBER = 1;
76 
77   @SuppressWarnings("serial")
78   private volatile java.lang.Object pem_ = "";
79   /**
80    *
81    *
82    * <pre>
83    * The public key, encoded in PEM format. For more information, see the
84    * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
85    * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
86    * [Textual Encoding of Subject Public Key Info]
87    * (https://tools.ietf.org/html/rfc7468#section-13).
88    * </pre>
89    *
90    * <code>string pem = 1;</code>
91    *
92    * @return The pem.
93    */
94   @java.lang.Override
getPem()95   public java.lang.String getPem() {
96     java.lang.Object ref = pem_;
97     if (ref instanceof java.lang.String) {
98       return (java.lang.String) ref;
99     } else {
100       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
101       java.lang.String s = bs.toStringUtf8();
102       pem_ = s;
103       return s;
104     }
105   }
106   /**
107    *
108    *
109    * <pre>
110    * The public key, encoded in PEM format. For more information, see the
111    * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
112    * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
113    * [Textual Encoding of Subject Public Key Info]
114    * (https://tools.ietf.org/html/rfc7468#section-13).
115    * </pre>
116    *
117    * <code>string pem = 1;</code>
118    *
119    * @return The bytes for pem.
120    */
121   @java.lang.Override
getPemBytes()122   public com.google.protobuf.ByteString getPemBytes() {
123     java.lang.Object ref = pem_;
124     if (ref instanceof java.lang.String) {
125       com.google.protobuf.ByteString b =
126           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
127       pem_ = b;
128       return b;
129     } else {
130       return (com.google.protobuf.ByteString) ref;
131     }
132   }
133 
134   public static final int ALGORITHM_FIELD_NUMBER = 2;
135   private int algorithm_ = 0;
136   /**
137    *
138    *
139    * <pre>
140    * The
141    * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
142    * associated with this key.
143    * </pre>
144    *
145    * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
146    *
147    * @return The enum numeric value on the wire for algorithm.
148    */
149   @java.lang.Override
getAlgorithmValue()150   public int getAlgorithmValue() {
151     return algorithm_;
152   }
153   /**
154    *
155    *
156    * <pre>
157    * The
158    * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
159    * associated with this key.
160    * </pre>
161    *
162    * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
163    *
164    * @return The algorithm.
165    */
166   @java.lang.Override
getAlgorithm()167   public com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm getAlgorithm() {
168     com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm result =
169         com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.forNumber(algorithm_);
170     return result == null
171         ? com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.UNRECOGNIZED
172         : result;
173   }
174 
175   public static final int PEM_CRC32C_FIELD_NUMBER = 3;
176   private com.google.protobuf.Int64Value pemCrc32C_;
177   /**
178    *
179    *
180    * <pre>
181    * Integrity verification field. A CRC32C checksum of the returned
182    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
183    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
184    * computing the CRC32C checksum of
185    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
186    * results to this field. Discard the response in case of non-matching
187    * checksum values, and perform a limited number of retries. A persistent
188    * mismatch may indicate an issue in your computation of the CRC32C checksum.
189    * Note: This field is defined as int64 for reasons of compatibility across
190    * different languages. However, it is a non-negative integer, which will
191    * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
192    * that support this type.
193    * NOTE: This field is in Beta.
194    * </pre>
195    *
196    * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
197    *
198    * @return Whether the pemCrc32c field is set.
199    */
200   @java.lang.Override
hasPemCrc32C()201   public boolean hasPemCrc32C() {
202     return pemCrc32C_ != null;
203   }
204   /**
205    *
206    *
207    * <pre>
208    * Integrity verification field. A CRC32C checksum of the returned
209    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
210    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
211    * computing the CRC32C checksum of
212    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
213    * results to this field. Discard the response in case of non-matching
214    * checksum values, and perform a limited number of retries. A persistent
215    * mismatch may indicate an issue in your computation of the CRC32C checksum.
216    * Note: This field is defined as int64 for reasons of compatibility across
217    * different languages. However, it is a non-negative integer, which will
218    * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
219    * that support this type.
220    * NOTE: This field is in Beta.
221    * </pre>
222    *
223    * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
224    *
225    * @return The pemCrc32c.
226    */
227   @java.lang.Override
getPemCrc32C()228   public com.google.protobuf.Int64Value getPemCrc32C() {
229     return pemCrc32C_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : pemCrc32C_;
230   }
231   /**
232    *
233    *
234    * <pre>
235    * Integrity verification field. A CRC32C checksum of the returned
236    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
237    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
238    * computing the CRC32C checksum of
239    * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
240    * results to this field. Discard the response in case of non-matching
241    * checksum values, and perform a limited number of retries. A persistent
242    * mismatch may indicate an issue in your computation of the CRC32C checksum.
243    * Note: This field is defined as int64 for reasons of compatibility across
244    * different languages. However, it is a non-negative integer, which will
245    * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
246    * that support this type.
247    * NOTE: This field is in Beta.
248    * </pre>
249    *
250    * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
251    */
252   @java.lang.Override
getPemCrc32COrBuilder()253   public com.google.protobuf.Int64ValueOrBuilder getPemCrc32COrBuilder() {
254     return pemCrc32C_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : pemCrc32C_;
255   }
256 
257   public static final int NAME_FIELD_NUMBER = 4;
258 
259   @SuppressWarnings("serial")
260   private volatile java.lang.Object name_ = "";
261   /**
262    *
263    *
264    * <pre>
265    * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
266    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
267    * Provided here for verification.
268    * NOTE: This field is in Beta.
269    * </pre>
270    *
271    * <code>string name = 4;</code>
272    *
273    * @return The name.
274    */
275   @java.lang.Override
getName()276   public java.lang.String getName() {
277     java.lang.Object ref = name_;
278     if (ref instanceof java.lang.String) {
279       return (java.lang.String) ref;
280     } else {
281       com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
282       java.lang.String s = bs.toStringUtf8();
283       name_ = s;
284       return s;
285     }
286   }
287   /**
288    *
289    *
290    * <pre>
291    * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
292    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
293    * Provided here for verification.
294    * NOTE: This field is in Beta.
295    * </pre>
296    *
297    * <code>string name = 4;</code>
298    *
299    * @return The bytes for name.
300    */
301   @java.lang.Override
getNameBytes()302   public com.google.protobuf.ByteString getNameBytes() {
303     java.lang.Object ref = name_;
304     if (ref instanceof java.lang.String) {
305       com.google.protobuf.ByteString b =
306           com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
307       name_ = b;
308       return b;
309     } else {
310       return (com.google.protobuf.ByteString) ref;
311     }
312   }
313 
314   public static final int PROTECTION_LEVEL_FIELD_NUMBER = 5;
315   private int protectionLevel_ = 0;
316   /**
317    *
318    *
319    * <pre>
320    * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
321    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
322    * </pre>
323    *
324    * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
325    *
326    * @return The enum numeric value on the wire for protectionLevel.
327    */
328   @java.lang.Override
getProtectionLevelValue()329   public int getProtectionLevelValue() {
330     return protectionLevel_;
331   }
332   /**
333    *
334    *
335    * <pre>
336    * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
337    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
338    * </pre>
339    *
340    * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
341    *
342    * @return The protectionLevel.
343    */
344   @java.lang.Override
getProtectionLevel()345   public com.google.cloud.kms.v1.ProtectionLevel getProtectionLevel() {
346     com.google.cloud.kms.v1.ProtectionLevel result =
347         com.google.cloud.kms.v1.ProtectionLevel.forNumber(protectionLevel_);
348     return result == null ? com.google.cloud.kms.v1.ProtectionLevel.UNRECOGNIZED : result;
349   }
350 
351   private byte memoizedIsInitialized = -1;
352 
353   @java.lang.Override
isInitialized()354   public final boolean isInitialized() {
355     byte isInitialized = memoizedIsInitialized;
356     if (isInitialized == 1) return true;
357     if (isInitialized == 0) return false;
358 
359     memoizedIsInitialized = 1;
360     return true;
361   }
362 
363   @java.lang.Override
writeTo(com.google.protobuf.CodedOutputStream output)364   public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
365     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pem_)) {
366       com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pem_);
367     }
368     if (algorithm_
369         != com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm
370             .CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED
371             .getNumber()) {
372       output.writeEnum(2, algorithm_);
373     }
374     if (pemCrc32C_ != null) {
375       output.writeMessage(3, getPemCrc32C());
376     }
377     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
378       com.google.protobuf.GeneratedMessageV3.writeString(output, 4, name_);
379     }
380     if (protectionLevel_
381         != com.google.cloud.kms.v1.ProtectionLevel.PROTECTION_LEVEL_UNSPECIFIED.getNumber()) {
382       output.writeEnum(5, protectionLevel_);
383     }
384     getUnknownFields().writeTo(output);
385   }
386 
387   @java.lang.Override
getSerializedSize()388   public int getSerializedSize() {
389     int size = memoizedSize;
390     if (size != -1) return size;
391 
392     size = 0;
393     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pem_)) {
394       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pem_);
395     }
396     if (algorithm_
397         != com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm
398             .CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED
399             .getNumber()) {
400       size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, algorithm_);
401     }
402     if (pemCrc32C_ != null) {
403       size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPemCrc32C());
404     }
405     if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) {
406       size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, name_);
407     }
408     if (protectionLevel_
409         != com.google.cloud.kms.v1.ProtectionLevel.PROTECTION_LEVEL_UNSPECIFIED.getNumber()) {
410       size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, protectionLevel_);
411     }
412     size += getUnknownFields().getSerializedSize();
413     memoizedSize = size;
414     return size;
415   }
416 
417   @java.lang.Override
equals(final java.lang.Object obj)418   public boolean equals(final java.lang.Object obj) {
419     if (obj == this) {
420       return true;
421     }
422     if (!(obj instanceof com.google.cloud.kms.v1.PublicKey)) {
423       return super.equals(obj);
424     }
425     com.google.cloud.kms.v1.PublicKey other = (com.google.cloud.kms.v1.PublicKey) obj;
426 
427     if (!getPem().equals(other.getPem())) return false;
428     if (algorithm_ != other.algorithm_) return false;
429     if (hasPemCrc32C() != other.hasPemCrc32C()) return false;
430     if (hasPemCrc32C()) {
431       if (!getPemCrc32C().equals(other.getPemCrc32C())) return false;
432     }
433     if (!getName().equals(other.getName())) return false;
434     if (protectionLevel_ != other.protectionLevel_) return false;
435     if (!getUnknownFields().equals(other.getUnknownFields())) return false;
436     return true;
437   }
438 
439   @java.lang.Override
hashCode()440   public int hashCode() {
441     if (memoizedHashCode != 0) {
442       return memoizedHashCode;
443     }
444     int hash = 41;
445     hash = (19 * hash) + getDescriptor().hashCode();
446     hash = (37 * hash) + PEM_FIELD_NUMBER;
447     hash = (53 * hash) + getPem().hashCode();
448     hash = (37 * hash) + ALGORITHM_FIELD_NUMBER;
449     hash = (53 * hash) + algorithm_;
450     if (hasPemCrc32C()) {
451       hash = (37 * hash) + PEM_CRC32C_FIELD_NUMBER;
452       hash = (53 * hash) + getPemCrc32C().hashCode();
453     }
454     hash = (37 * hash) + NAME_FIELD_NUMBER;
455     hash = (53 * hash) + getName().hashCode();
456     hash = (37 * hash) + PROTECTION_LEVEL_FIELD_NUMBER;
457     hash = (53 * hash) + protectionLevel_;
458     hash = (29 * hash) + getUnknownFields().hashCode();
459     memoizedHashCode = hash;
460     return hash;
461   }
462 
parseFrom(java.nio.ByteBuffer data)463   public static com.google.cloud.kms.v1.PublicKey parseFrom(java.nio.ByteBuffer data)
464       throws com.google.protobuf.InvalidProtocolBufferException {
465     return PARSER.parseFrom(data);
466   }
467 
parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)468   public static com.google.cloud.kms.v1.PublicKey parseFrom(
469       java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
470       throws com.google.protobuf.InvalidProtocolBufferException {
471     return PARSER.parseFrom(data, extensionRegistry);
472   }
473 
parseFrom(com.google.protobuf.ByteString data)474   public static com.google.cloud.kms.v1.PublicKey parseFrom(com.google.protobuf.ByteString data)
475       throws com.google.protobuf.InvalidProtocolBufferException {
476     return PARSER.parseFrom(data);
477   }
478 
parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)479   public static com.google.cloud.kms.v1.PublicKey parseFrom(
480       com.google.protobuf.ByteString data,
481       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
482       throws com.google.protobuf.InvalidProtocolBufferException {
483     return PARSER.parseFrom(data, extensionRegistry);
484   }
485 
parseFrom(byte[] data)486   public static com.google.cloud.kms.v1.PublicKey parseFrom(byte[] data)
487       throws com.google.protobuf.InvalidProtocolBufferException {
488     return PARSER.parseFrom(data);
489   }
490 
parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)491   public static com.google.cloud.kms.v1.PublicKey parseFrom(
492       byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
493       throws com.google.protobuf.InvalidProtocolBufferException {
494     return PARSER.parseFrom(data, extensionRegistry);
495   }
496 
parseFrom(java.io.InputStream input)497   public static com.google.cloud.kms.v1.PublicKey parseFrom(java.io.InputStream input)
498       throws java.io.IOException {
499     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
500   }
501 
parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)502   public static com.google.cloud.kms.v1.PublicKey parseFrom(
503       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
504       throws java.io.IOException {
505     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
506         PARSER, input, extensionRegistry);
507   }
508 
parseDelimitedFrom(java.io.InputStream input)509   public static com.google.cloud.kms.v1.PublicKey parseDelimitedFrom(java.io.InputStream input)
510       throws java.io.IOException {
511     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
512   }
513 
parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)514   public static com.google.cloud.kms.v1.PublicKey parseDelimitedFrom(
515       java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
516       throws java.io.IOException {
517     return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
518         PARSER, input, extensionRegistry);
519   }
520 
parseFrom( com.google.protobuf.CodedInputStream input)521   public static com.google.cloud.kms.v1.PublicKey parseFrom(
522       com.google.protobuf.CodedInputStream input) throws java.io.IOException {
523     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
524   }
525 
parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)526   public static com.google.cloud.kms.v1.PublicKey parseFrom(
527       com.google.protobuf.CodedInputStream input,
528       com.google.protobuf.ExtensionRegistryLite extensionRegistry)
529       throws java.io.IOException {
530     return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
531         PARSER, input, extensionRegistry);
532   }
533 
534   @java.lang.Override
newBuilderForType()535   public Builder newBuilderForType() {
536     return newBuilder();
537   }
538 
newBuilder()539   public static Builder newBuilder() {
540     return DEFAULT_INSTANCE.toBuilder();
541   }
542 
newBuilder(com.google.cloud.kms.v1.PublicKey prototype)543   public static Builder newBuilder(com.google.cloud.kms.v1.PublicKey prototype) {
544     return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
545   }
546 
547   @java.lang.Override
toBuilder()548   public Builder toBuilder() {
549     return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
550   }
551 
552   @java.lang.Override
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)553   protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
554     Builder builder = new Builder(parent);
555     return builder;
556   }
557   /**
558    *
559    *
560    * <pre>
561    * The public key for a given
562    * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
563    * [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
564    * </pre>
565    *
566    * Protobuf type {@code google.cloud.kms.v1.PublicKey}
567    */
568   public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
569       implements
570       // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.PublicKey)
571       com.google.cloud.kms.v1.PublicKeyOrBuilder {
getDescriptor()572     public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
573       return com.google.cloud.kms.v1.KmsResourcesProto
574           .internal_static_google_cloud_kms_v1_PublicKey_descriptor;
575     }
576 
577     @java.lang.Override
578     protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable()579         internalGetFieldAccessorTable() {
580       return com.google.cloud.kms.v1.KmsResourcesProto
581           .internal_static_google_cloud_kms_v1_PublicKey_fieldAccessorTable
582           .ensureFieldAccessorsInitialized(
583               com.google.cloud.kms.v1.PublicKey.class,
584               com.google.cloud.kms.v1.PublicKey.Builder.class);
585     }
586 
587     // Construct using com.google.cloud.kms.v1.PublicKey.newBuilder()
Builder()588     private Builder() {}
589 
Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)590     private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
591       super(parent);
592     }
593 
594     @java.lang.Override
clear()595     public Builder clear() {
596       super.clear();
597       bitField0_ = 0;
598       pem_ = "";
599       algorithm_ = 0;
600       pemCrc32C_ = null;
601       if (pemCrc32CBuilder_ != null) {
602         pemCrc32CBuilder_.dispose();
603         pemCrc32CBuilder_ = null;
604       }
605       name_ = "";
606       protectionLevel_ = 0;
607       return this;
608     }
609 
610     @java.lang.Override
getDescriptorForType()611     public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
612       return com.google.cloud.kms.v1.KmsResourcesProto
613           .internal_static_google_cloud_kms_v1_PublicKey_descriptor;
614     }
615 
616     @java.lang.Override
getDefaultInstanceForType()617     public com.google.cloud.kms.v1.PublicKey getDefaultInstanceForType() {
618       return com.google.cloud.kms.v1.PublicKey.getDefaultInstance();
619     }
620 
621     @java.lang.Override
build()622     public com.google.cloud.kms.v1.PublicKey build() {
623       com.google.cloud.kms.v1.PublicKey result = buildPartial();
624       if (!result.isInitialized()) {
625         throw newUninitializedMessageException(result);
626       }
627       return result;
628     }
629 
630     @java.lang.Override
buildPartial()631     public com.google.cloud.kms.v1.PublicKey buildPartial() {
632       com.google.cloud.kms.v1.PublicKey result = new com.google.cloud.kms.v1.PublicKey(this);
633       if (bitField0_ != 0) {
634         buildPartial0(result);
635       }
636       onBuilt();
637       return result;
638     }
639 
buildPartial0(com.google.cloud.kms.v1.PublicKey result)640     private void buildPartial0(com.google.cloud.kms.v1.PublicKey result) {
641       int from_bitField0_ = bitField0_;
642       if (((from_bitField0_ & 0x00000001) != 0)) {
643         result.pem_ = pem_;
644       }
645       if (((from_bitField0_ & 0x00000002) != 0)) {
646         result.algorithm_ = algorithm_;
647       }
648       if (((from_bitField0_ & 0x00000004) != 0)) {
649         result.pemCrc32C_ = pemCrc32CBuilder_ == null ? pemCrc32C_ : pemCrc32CBuilder_.build();
650       }
651       if (((from_bitField0_ & 0x00000008) != 0)) {
652         result.name_ = name_;
653       }
654       if (((from_bitField0_ & 0x00000010) != 0)) {
655         result.protectionLevel_ = protectionLevel_;
656       }
657     }
658 
659     @java.lang.Override
clone()660     public Builder clone() {
661       return super.clone();
662     }
663 
664     @java.lang.Override
setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)665     public Builder setField(
666         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
667       return super.setField(field, value);
668     }
669 
670     @java.lang.Override
clearField(com.google.protobuf.Descriptors.FieldDescriptor field)671     public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
672       return super.clearField(field);
673     }
674 
675     @java.lang.Override
clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)676     public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
677       return super.clearOneof(oneof);
678     }
679 
680     @java.lang.Override
setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)681     public Builder setRepeatedField(
682         com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
683       return super.setRepeatedField(field, index, value);
684     }
685 
686     @java.lang.Override
addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)687     public Builder addRepeatedField(
688         com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
689       return super.addRepeatedField(field, value);
690     }
691 
692     @java.lang.Override
mergeFrom(com.google.protobuf.Message other)693     public Builder mergeFrom(com.google.protobuf.Message other) {
694       if (other instanceof com.google.cloud.kms.v1.PublicKey) {
695         return mergeFrom((com.google.cloud.kms.v1.PublicKey) other);
696       } else {
697         super.mergeFrom(other);
698         return this;
699       }
700     }
701 
mergeFrom(com.google.cloud.kms.v1.PublicKey other)702     public Builder mergeFrom(com.google.cloud.kms.v1.PublicKey other) {
703       if (other == com.google.cloud.kms.v1.PublicKey.getDefaultInstance()) return this;
704       if (!other.getPem().isEmpty()) {
705         pem_ = other.pem_;
706         bitField0_ |= 0x00000001;
707         onChanged();
708       }
709       if (other.algorithm_ != 0) {
710         setAlgorithmValue(other.getAlgorithmValue());
711       }
712       if (other.hasPemCrc32C()) {
713         mergePemCrc32C(other.getPemCrc32C());
714       }
715       if (!other.getName().isEmpty()) {
716         name_ = other.name_;
717         bitField0_ |= 0x00000008;
718         onChanged();
719       }
720       if (other.protectionLevel_ != 0) {
721         setProtectionLevelValue(other.getProtectionLevelValue());
722       }
723       this.mergeUnknownFields(other.getUnknownFields());
724       onChanged();
725       return this;
726     }
727 
728     @java.lang.Override
isInitialized()729     public final boolean isInitialized() {
730       return true;
731     }
732 
733     @java.lang.Override
mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)734     public Builder mergeFrom(
735         com.google.protobuf.CodedInputStream input,
736         com.google.protobuf.ExtensionRegistryLite extensionRegistry)
737         throws java.io.IOException {
738       if (extensionRegistry == null) {
739         throw new java.lang.NullPointerException();
740       }
741       try {
742         boolean done = false;
743         while (!done) {
744           int tag = input.readTag();
745           switch (tag) {
746             case 0:
747               done = true;
748               break;
749             case 10:
750               {
751                 pem_ = input.readStringRequireUtf8();
752                 bitField0_ |= 0x00000001;
753                 break;
754               } // case 10
755             case 16:
756               {
757                 algorithm_ = input.readEnum();
758                 bitField0_ |= 0x00000002;
759                 break;
760               } // case 16
761             case 26:
762               {
763                 input.readMessage(getPemCrc32CFieldBuilder().getBuilder(), extensionRegistry);
764                 bitField0_ |= 0x00000004;
765                 break;
766               } // case 26
767             case 34:
768               {
769                 name_ = input.readStringRequireUtf8();
770                 bitField0_ |= 0x00000008;
771                 break;
772               } // case 34
773             case 40:
774               {
775                 protectionLevel_ = input.readEnum();
776                 bitField0_ |= 0x00000010;
777                 break;
778               } // case 40
779             default:
780               {
781                 if (!super.parseUnknownField(input, extensionRegistry, tag)) {
782                   done = true; // was an endgroup tag
783                 }
784                 break;
785               } // default:
786           } // switch (tag)
787         } // while (!done)
788       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
789         throw e.unwrapIOException();
790       } finally {
791         onChanged();
792       } // finally
793       return this;
794     }
795 
796     private int bitField0_;
797 
798     private java.lang.Object pem_ = "";
799     /**
800      *
801      *
802      * <pre>
803      * The public key, encoded in PEM format. For more information, see the
804      * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
805      * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
806      * [Textual Encoding of Subject Public Key Info]
807      * (https://tools.ietf.org/html/rfc7468#section-13).
808      * </pre>
809      *
810      * <code>string pem = 1;</code>
811      *
812      * @return The pem.
813      */
getPem()814     public java.lang.String getPem() {
815       java.lang.Object ref = pem_;
816       if (!(ref instanceof java.lang.String)) {
817         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
818         java.lang.String s = bs.toStringUtf8();
819         pem_ = s;
820         return s;
821       } else {
822         return (java.lang.String) ref;
823       }
824     }
825     /**
826      *
827      *
828      * <pre>
829      * The public key, encoded in PEM format. For more information, see the
830      * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
831      * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
832      * [Textual Encoding of Subject Public Key Info]
833      * (https://tools.ietf.org/html/rfc7468#section-13).
834      * </pre>
835      *
836      * <code>string pem = 1;</code>
837      *
838      * @return The bytes for pem.
839      */
getPemBytes()840     public com.google.protobuf.ByteString getPemBytes() {
841       java.lang.Object ref = pem_;
842       if (ref instanceof String) {
843         com.google.protobuf.ByteString b =
844             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
845         pem_ = b;
846         return b;
847       } else {
848         return (com.google.protobuf.ByteString) ref;
849       }
850     }
851     /**
852      *
853      *
854      * <pre>
855      * The public key, encoded in PEM format. For more information, see the
856      * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
857      * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
858      * [Textual Encoding of Subject Public Key Info]
859      * (https://tools.ietf.org/html/rfc7468#section-13).
860      * </pre>
861      *
862      * <code>string pem = 1;</code>
863      *
864      * @param value The pem to set.
865      * @return This builder for chaining.
866      */
setPem(java.lang.String value)867     public Builder setPem(java.lang.String value) {
868       if (value == null) {
869         throw new NullPointerException();
870       }
871       pem_ = value;
872       bitField0_ |= 0x00000001;
873       onChanged();
874       return this;
875     }
876     /**
877      *
878      *
879      * <pre>
880      * The public key, encoded in PEM format. For more information, see the
881      * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
882      * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
883      * [Textual Encoding of Subject Public Key Info]
884      * (https://tools.ietf.org/html/rfc7468#section-13).
885      * </pre>
886      *
887      * <code>string pem = 1;</code>
888      *
889      * @return This builder for chaining.
890      */
clearPem()891     public Builder clearPem() {
892       pem_ = getDefaultInstance().getPem();
893       bitField0_ = (bitField0_ & ~0x00000001);
894       onChanged();
895       return this;
896     }
897     /**
898      *
899      *
900      * <pre>
901      * The public key, encoded in PEM format. For more information, see the
902      * [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
903      * [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
904      * [Textual Encoding of Subject Public Key Info]
905      * (https://tools.ietf.org/html/rfc7468#section-13).
906      * </pre>
907      *
908      * <code>string pem = 1;</code>
909      *
910      * @param value The bytes for pem to set.
911      * @return This builder for chaining.
912      */
setPemBytes(com.google.protobuf.ByteString value)913     public Builder setPemBytes(com.google.protobuf.ByteString value) {
914       if (value == null) {
915         throw new NullPointerException();
916       }
917       checkByteStringIsUtf8(value);
918       pem_ = value;
919       bitField0_ |= 0x00000001;
920       onChanged();
921       return this;
922     }
923 
924     private int algorithm_ = 0;
925     /**
926      *
927      *
928      * <pre>
929      * The
930      * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
931      * associated with this key.
932      * </pre>
933      *
934      * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
935      *
936      * @return The enum numeric value on the wire for algorithm.
937      */
938     @java.lang.Override
getAlgorithmValue()939     public int getAlgorithmValue() {
940       return algorithm_;
941     }
942     /**
943      *
944      *
945      * <pre>
946      * The
947      * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
948      * associated with this key.
949      * </pre>
950      *
951      * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
952      *
953      * @param value The enum numeric value on the wire for algorithm to set.
954      * @return This builder for chaining.
955      */
setAlgorithmValue(int value)956     public Builder setAlgorithmValue(int value) {
957       algorithm_ = value;
958       bitField0_ |= 0x00000002;
959       onChanged();
960       return this;
961     }
962     /**
963      *
964      *
965      * <pre>
966      * The
967      * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
968      * associated with this key.
969      * </pre>
970      *
971      * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
972      *
973      * @return The algorithm.
974      */
975     @java.lang.Override
getAlgorithm()976     public com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm getAlgorithm() {
977       com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm result =
978           com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.forNumber(algorithm_);
979       return result == null
980           ? com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.UNRECOGNIZED
981           : result;
982     }
983     /**
984      *
985      *
986      * <pre>
987      * The
988      * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
989      * associated with this key.
990      * </pre>
991      *
992      * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
993      *
994      * @param value The algorithm to set.
995      * @return This builder for chaining.
996      */
setAlgorithm( com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm value)997     public Builder setAlgorithm(
998         com.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm value) {
999       if (value == null) {
1000         throw new NullPointerException();
1001       }
1002       bitField0_ |= 0x00000002;
1003       algorithm_ = value.getNumber();
1004       onChanged();
1005       return this;
1006     }
1007     /**
1008      *
1009      *
1010      * <pre>
1011      * The
1012      * [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
1013      * associated with this key.
1014      * </pre>
1015      *
1016      * <code>.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2;</code>
1017      *
1018      * @return This builder for chaining.
1019      */
clearAlgorithm()1020     public Builder clearAlgorithm() {
1021       bitField0_ = (bitField0_ & ~0x00000002);
1022       algorithm_ = 0;
1023       onChanged();
1024       return this;
1025     }
1026 
1027     private com.google.protobuf.Int64Value pemCrc32C_;
1028     private com.google.protobuf.SingleFieldBuilderV3<
1029             com.google.protobuf.Int64Value,
1030             com.google.protobuf.Int64Value.Builder,
1031             com.google.protobuf.Int64ValueOrBuilder>
1032         pemCrc32CBuilder_;
1033     /**
1034      *
1035      *
1036      * <pre>
1037      * Integrity verification field. A CRC32C checksum of the returned
1038      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1039      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1040      * computing the CRC32C checksum of
1041      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1042      * results to this field. Discard the response in case of non-matching
1043      * checksum values, and perform a limited number of retries. A persistent
1044      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1045      * Note: This field is defined as int64 for reasons of compatibility across
1046      * different languages. However, it is a non-negative integer, which will
1047      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1048      * that support this type.
1049      * NOTE: This field is in Beta.
1050      * </pre>
1051      *
1052      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1053      *
1054      * @return Whether the pemCrc32c field is set.
1055      */
hasPemCrc32C()1056     public boolean hasPemCrc32C() {
1057       return ((bitField0_ & 0x00000004) != 0);
1058     }
1059     /**
1060      *
1061      *
1062      * <pre>
1063      * Integrity verification field. A CRC32C checksum of the returned
1064      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1065      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1066      * computing the CRC32C checksum of
1067      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1068      * results to this field. Discard the response in case of non-matching
1069      * checksum values, and perform a limited number of retries. A persistent
1070      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1071      * Note: This field is defined as int64 for reasons of compatibility across
1072      * different languages. However, it is a non-negative integer, which will
1073      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1074      * that support this type.
1075      * NOTE: This field is in Beta.
1076      * </pre>
1077      *
1078      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1079      *
1080      * @return The pemCrc32c.
1081      */
getPemCrc32C()1082     public com.google.protobuf.Int64Value getPemCrc32C() {
1083       if (pemCrc32CBuilder_ == null) {
1084         return pemCrc32C_ == null
1085             ? com.google.protobuf.Int64Value.getDefaultInstance()
1086             : pemCrc32C_;
1087       } else {
1088         return pemCrc32CBuilder_.getMessage();
1089       }
1090     }
1091     /**
1092      *
1093      *
1094      * <pre>
1095      * Integrity verification field. A CRC32C checksum of the returned
1096      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1097      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1098      * computing the CRC32C checksum of
1099      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1100      * results to this field. Discard the response in case of non-matching
1101      * checksum values, and perform a limited number of retries. A persistent
1102      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1103      * Note: This field is defined as int64 for reasons of compatibility across
1104      * different languages. However, it is a non-negative integer, which will
1105      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1106      * that support this type.
1107      * NOTE: This field is in Beta.
1108      * </pre>
1109      *
1110      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1111      */
setPemCrc32C(com.google.protobuf.Int64Value value)1112     public Builder setPemCrc32C(com.google.protobuf.Int64Value value) {
1113       if (pemCrc32CBuilder_ == null) {
1114         if (value == null) {
1115           throw new NullPointerException();
1116         }
1117         pemCrc32C_ = value;
1118       } else {
1119         pemCrc32CBuilder_.setMessage(value);
1120       }
1121       bitField0_ |= 0x00000004;
1122       onChanged();
1123       return this;
1124     }
1125     /**
1126      *
1127      *
1128      * <pre>
1129      * Integrity verification field. A CRC32C checksum of the returned
1130      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1131      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1132      * computing the CRC32C checksum of
1133      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1134      * results to this field. Discard the response in case of non-matching
1135      * checksum values, and perform a limited number of retries. A persistent
1136      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1137      * Note: This field is defined as int64 for reasons of compatibility across
1138      * different languages. However, it is a non-negative integer, which will
1139      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1140      * that support this type.
1141      * NOTE: This field is in Beta.
1142      * </pre>
1143      *
1144      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1145      */
setPemCrc32C(com.google.protobuf.Int64Value.Builder builderForValue)1146     public Builder setPemCrc32C(com.google.protobuf.Int64Value.Builder builderForValue) {
1147       if (pemCrc32CBuilder_ == null) {
1148         pemCrc32C_ = builderForValue.build();
1149       } else {
1150         pemCrc32CBuilder_.setMessage(builderForValue.build());
1151       }
1152       bitField0_ |= 0x00000004;
1153       onChanged();
1154       return this;
1155     }
1156     /**
1157      *
1158      *
1159      * <pre>
1160      * Integrity verification field. A CRC32C checksum of the returned
1161      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1162      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1163      * computing the CRC32C checksum of
1164      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1165      * results to this field. Discard the response in case of non-matching
1166      * checksum values, and perform a limited number of retries. A persistent
1167      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1168      * Note: This field is defined as int64 for reasons of compatibility across
1169      * different languages. However, it is a non-negative integer, which will
1170      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1171      * that support this type.
1172      * NOTE: This field is in Beta.
1173      * </pre>
1174      *
1175      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1176      */
mergePemCrc32C(com.google.protobuf.Int64Value value)1177     public Builder mergePemCrc32C(com.google.protobuf.Int64Value value) {
1178       if (pemCrc32CBuilder_ == null) {
1179         if (((bitField0_ & 0x00000004) != 0)
1180             && pemCrc32C_ != null
1181             && pemCrc32C_ != com.google.protobuf.Int64Value.getDefaultInstance()) {
1182           getPemCrc32CBuilder().mergeFrom(value);
1183         } else {
1184           pemCrc32C_ = value;
1185         }
1186       } else {
1187         pemCrc32CBuilder_.mergeFrom(value);
1188       }
1189       bitField0_ |= 0x00000004;
1190       onChanged();
1191       return this;
1192     }
1193     /**
1194      *
1195      *
1196      * <pre>
1197      * Integrity verification field. A CRC32C checksum of the returned
1198      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1199      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1200      * computing the CRC32C checksum of
1201      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1202      * results to this field. Discard the response in case of non-matching
1203      * checksum values, and perform a limited number of retries. A persistent
1204      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1205      * Note: This field is defined as int64 for reasons of compatibility across
1206      * different languages. However, it is a non-negative integer, which will
1207      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1208      * that support this type.
1209      * NOTE: This field is in Beta.
1210      * </pre>
1211      *
1212      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1213      */
clearPemCrc32C()1214     public Builder clearPemCrc32C() {
1215       bitField0_ = (bitField0_ & ~0x00000004);
1216       pemCrc32C_ = null;
1217       if (pemCrc32CBuilder_ != null) {
1218         pemCrc32CBuilder_.dispose();
1219         pemCrc32CBuilder_ = null;
1220       }
1221       onChanged();
1222       return this;
1223     }
1224     /**
1225      *
1226      *
1227      * <pre>
1228      * Integrity verification field. A CRC32C checksum of the returned
1229      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1230      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1231      * computing the CRC32C checksum of
1232      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1233      * results to this field. Discard the response in case of non-matching
1234      * checksum values, and perform a limited number of retries. A persistent
1235      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1236      * Note: This field is defined as int64 for reasons of compatibility across
1237      * different languages. However, it is a non-negative integer, which will
1238      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1239      * that support this type.
1240      * NOTE: This field is in Beta.
1241      * </pre>
1242      *
1243      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1244      */
getPemCrc32CBuilder()1245     public com.google.protobuf.Int64Value.Builder getPemCrc32CBuilder() {
1246       bitField0_ |= 0x00000004;
1247       onChanged();
1248       return getPemCrc32CFieldBuilder().getBuilder();
1249     }
1250     /**
1251      *
1252      *
1253      * <pre>
1254      * Integrity verification field. A CRC32C checksum of the returned
1255      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1256      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1257      * computing the CRC32C checksum of
1258      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1259      * results to this field. Discard the response in case of non-matching
1260      * checksum values, and perform a limited number of retries. A persistent
1261      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1262      * Note: This field is defined as int64 for reasons of compatibility across
1263      * different languages. However, it is a non-negative integer, which will
1264      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1265      * that support this type.
1266      * NOTE: This field is in Beta.
1267      * </pre>
1268      *
1269      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1270      */
getPemCrc32COrBuilder()1271     public com.google.protobuf.Int64ValueOrBuilder getPemCrc32COrBuilder() {
1272       if (pemCrc32CBuilder_ != null) {
1273         return pemCrc32CBuilder_.getMessageOrBuilder();
1274       } else {
1275         return pemCrc32C_ == null
1276             ? com.google.protobuf.Int64Value.getDefaultInstance()
1277             : pemCrc32C_;
1278       }
1279     }
1280     /**
1281      *
1282      *
1283      * <pre>
1284      * Integrity verification field. A CRC32C checksum of the returned
1285      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
1286      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
1287      * computing the CRC32C checksum of
1288      * [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
1289      * results to this field. Discard the response in case of non-matching
1290      * checksum values, and perform a limited number of retries. A persistent
1291      * mismatch may indicate an issue in your computation of the CRC32C checksum.
1292      * Note: This field is defined as int64 for reasons of compatibility across
1293      * different languages. However, it is a non-negative integer, which will
1294      * never exceed 2^32-1, and can be safely downconverted to uint32 in languages
1295      * that support this type.
1296      * NOTE: This field is in Beta.
1297      * </pre>
1298      *
1299      * <code>.google.protobuf.Int64Value pem_crc32c = 3;</code>
1300      */
1301     private com.google.protobuf.SingleFieldBuilderV3<
1302             com.google.protobuf.Int64Value,
1303             com.google.protobuf.Int64Value.Builder,
1304             com.google.protobuf.Int64ValueOrBuilder>
getPemCrc32CFieldBuilder()1305         getPemCrc32CFieldBuilder() {
1306       if (pemCrc32CBuilder_ == null) {
1307         pemCrc32CBuilder_ =
1308             new com.google.protobuf.SingleFieldBuilderV3<
1309                 com.google.protobuf.Int64Value,
1310                 com.google.protobuf.Int64Value.Builder,
1311                 com.google.protobuf.Int64ValueOrBuilder>(
1312                 getPemCrc32C(), getParentForChildren(), isClean());
1313         pemCrc32C_ = null;
1314       }
1315       return pemCrc32CBuilder_;
1316     }
1317 
1318     private java.lang.Object name_ = "";
1319     /**
1320      *
1321      *
1322      * <pre>
1323      * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
1324      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1325      * Provided here for verification.
1326      * NOTE: This field is in Beta.
1327      * </pre>
1328      *
1329      * <code>string name = 4;</code>
1330      *
1331      * @return The name.
1332      */
getName()1333     public java.lang.String getName() {
1334       java.lang.Object ref = name_;
1335       if (!(ref instanceof java.lang.String)) {
1336         com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
1337         java.lang.String s = bs.toStringUtf8();
1338         name_ = s;
1339         return s;
1340       } else {
1341         return (java.lang.String) ref;
1342       }
1343     }
1344     /**
1345      *
1346      *
1347      * <pre>
1348      * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
1349      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1350      * Provided here for verification.
1351      * NOTE: This field is in Beta.
1352      * </pre>
1353      *
1354      * <code>string name = 4;</code>
1355      *
1356      * @return The bytes for name.
1357      */
getNameBytes()1358     public com.google.protobuf.ByteString getNameBytes() {
1359       java.lang.Object ref = name_;
1360       if (ref instanceof String) {
1361         com.google.protobuf.ByteString b =
1362             com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
1363         name_ = b;
1364         return b;
1365       } else {
1366         return (com.google.protobuf.ByteString) ref;
1367       }
1368     }
1369     /**
1370      *
1371      *
1372      * <pre>
1373      * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
1374      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1375      * Provided here for verification.
1376      * NOTE: This field is in Beta.
1377      * </pre>
1378      *
1379      * <code>string name = 4;</code>
1380      *
1381      * @param value The name to set.
1382      * @return This builder for chaining.
1383      */
setName(java.lang.String value)1384     public Builder setName(java.lang.String value) {
1385       if (value == null) {
1386         throw new NullPointerException();
1387       }
1388       name_ = value;
1389       bitField0_ |= 0x00000008;
1390       onChanged();
1391       return this;
1392     }
1393     /**
1394      *
1395      *
1396      * <pre>
1397      * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
1398      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1399      * Provided here for verification.
1400      * NOTE: This field is in Beta.
1401      * </pre>
1402      *
1403      * <code>string name = 4;</code>
1404      *
1405      * @return This builder for chaining.
1406      */
clearName()1407     public Builder clearName() {
1408       name_ = getDefaultInstance().getName();
1409       bitField0_ = (bitField0_ & ~0x00000008);
1410       onChanged();
1411       return this;
1412     }
1413     /**
1414      *
1415      *
1416      * <pre>
1417      * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
1418      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1419      * Provided here for verification.
1420      * NOTE: This field is in Beta.
1421      * </pre>
1422      *
1423      * <code>string name = 4;</code>
1424      *
1425      * @param value The bytes for name to set.
1426      * @return This builder for chaining.
1427      */
setNameBytes(com.google.protobuf.ByteString value)1428     public Builder setNameBytes(com.google.protobuf.ByteString value) {
1429       if (value == null) {
1430         throw new NullPointerException();
1431       }
1432       checkByteStringIsUtf8(value);
1433       name_ = value;
1434       bitField0_ |= 0x00000008;
1435       onChanged();
1436       return this;
1437     }
1438 
1439     private int protectionLevel_ = 0;
1440     /**
1441      *
1442      *
1443      * <pre>
1444      * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
1445      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1446      * </pre>
1447      *
1448      * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
1449      *
1450      * @return The enum numeric value on the wire for protectionLevel.
1451      */
1452     @java.lang.Override
getProtectionLevelValue()1453     public int getProtectionLevelValue() {
1454       return protectionLevel_;
1455     }
1456     /**
1457      *
1458      *
1459      * <pre>
1460      * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
1461      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1462      * </pre>
1463      *
1464      * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
1465      *
1466      * @param value The enum numeric value on the wire for protectionLevel to set.
1467      * @return This builder for chaining.
1468      */
setProtectionLevelValue(int value)1469     public Builder setProtectionLevelValue(int value) {
1470       protectionLevel_ = value;
1471       bitField0_ |= 0x00000010;
1472       onChanged();
1473       return this;
1474     }
1475     /**
1476      *
1477      *
1478      * <pre>
1479      * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
1480      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1481      * </pre>
1482      *
1483      * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
1484      *
1485      * @return The protectionLevel.
1486      */
1487     @java.lang.Override
getProtectionLevel()1488     public com.google.cloud.kms.v1.ProtectionLevel getProtectionLevel() {
1489       com.google.cloud.kms.v1.ProtectionLevel result =
1490           com.google.cloud.kms.v1.ProtectionLevel.forNumber(protectionLevel_);
1491       return result == null ? com.google.cloud.kms.v1.ProtectionLevel.UNRECOGNIZED : result;
1492     }
1493     /**
1494      *
1495      *
1496      * <pre>
1497      * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
1498      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1499      * </pre>
1500      *
1501      * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
1502      *
1503      * @param value The protectionLevel to set.
1504      * @return This builder for chaining.
1505      */
setProtectionLevel(com.google.cloud.kms.v1.ProtectionLevel value)1506     public Builder setProtectionLevel(com.google.cloud.kms.v1.ProtectionLevel value) {
1507       if (value == null) {
1508         throw new NullPointerException();
1509       }
1510       bitField0_ |= 0x00000010;
1511       protectionLevel_ = value.getNumber();
1512       onChanged();
1513       return this;
1514     }
1515     /**
1516      *
1517      *
1518      * <pre>
1519      * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
1520      * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
1521      * </pre>
1522      *
1523      * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 5;</code>
1524      *
1525      * @return This builder for chaining.
1526      */
clearProtectionLevel()1527     public Builder clearProtectionLevel() {
1528       bitField0_ = (bitField0_ & ~0x00000010);
1529       protectionLevel_ = 0;
1530       onChanged();
1531       return this;
1532     }
1533 
1534     @java.lang.Override
setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1535     public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
1536       return super.setUnknownFields(unknownFields);
1537     }
1538 
1539     @java.lang.Override
mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1540     public final Builder mergeUnknownFields(
1541         final com.google.protobuf.UnknownFieldSet unknownFields) {
1542       return super.mergeUnknownFields(unknownFields);
1543     }
1544 
1545     // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.PublicKey)
1546   }
1547 
1548   // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.PublicKey)
1549   private static final com.google.cloud.kms.v1.PublicKey DEFAULT_INSTANCE;
1550 
1551   static {
1552     DEFAULT_INSTANCE = new com.google.cloud.kms.v1.PublicKey();
1553   }
1554 
getDefaultInstance()1555   public static com.google.cloud.kms.v1.PublicKey getDefaultInstance() {
1556     return DEFAULT_INSTANCE;
1557   }
1558 
1559   private static final com.google.protobuf.Parser<PublicKey> PARSER =
1560       new com.google.protobuf.AbstractParser<PublicKey>() {
1561         @java.lang.Override
1562         public PublicKey parsePartialFrom(
1563             com.google.protobuf.CodedInputStream input,
1564             com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1565             throws com.google.protobuf.InvalidProtocolBufferException {
1566           Builder builder = newBuilder();
1567           try {
1568             builder.mergeFrom(input, extensionRegistry);
1569           } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1570             throw e.setUnfinishedMessage(builder.buildPartial());
1571           } catch (com.google.protobuf.UninitializedMessageException e) {
1572             throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
1573           } catch (java.io.IOException e) {
1574             throw new com.google.protobuf.InvalidProtocolBufferException(e)
1575                 .setUnfinishedMessage(builder.buildPartial());
1576           }
1577           return builder.buildPartial();
1578         }
1579       };
1580 
parser()1581   public static com.google.protobuf.Parser<PublicKey> parser() {
1582     return PARSER;
1583   }
1584 
1585   @java.lang.Override
getParserForType()1586   public com.google.protobuf.Parser<PublicKey> getParserForType() {
1587     return PARSER;
1588   }
1589 
1590   @java.lang.Override
getDefaultInstanceForType()1591   public com.google.cloud.kms.v1.PublicKey getDefaultInstanceForType() {
1592     return DEFAULT_INSTANCE;
1593   }
1594 }
1595