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.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. 27 * </pre> 28 * 29 * Protobuf type {@code google.cloud.kms.v1.GenerateRandomBytesRequest} 30 */ 31 public final class GenerateRandomBytesRequest extends com.google.protobuf.GeneratedMessageV3 32 implements 33 // @@protoc_insertion_point(message_implements:google.cloud.kms.v1.GenerateRandomBytesRequest) 34 GenerateRandomBytesRequestOrBuilder { 35 private static final long serialVersionUID = 0L; 36 // Use GenerateRandomBytesRequest.newBuilder() to construct. GenerateRandomBytesRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)37 private GenerateRandomBytesRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 38 super(builder); 39 } 40 GenerateRandomBytesRequest()41 private GenerateRandomBytesRequest() { 42 location_ = ""; 43 protectionLevel_ = 0; 44 } 45 46 @java.lang.Override 47 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)48 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 49 return new GenerateRandomBytesRequest(); 50 } 51 52 @java.lang.Override getUnknownFields()53 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 54 return this.unknownFields; 55 } 56 getDescriptor()57 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 58 return com.google.cloud.kms.v1.KmsProto 59 .internal_static_google_cloud_kms_v1_GenerateRandomBytesRequest_descriptor; 60 } 61 62 @java.lang.Override 63 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()64 internalGetFieldAccessorTable() { 65 return com.google.cloud.kms.v1.KmsProto 66 .internal_static_google_cloud_kms_v1_GenerateRandomBytesRequest_fieldAccessorTable 67 .ensureFieldAccessorsInitialized( 68 com.google.cloud.kms.v1.GenerateRandomBytesRequest.class, 69 com.google.cloud.kms.v1.GenerateRandomBytesRequest.Builder.class); 70 } 71 72 public static final int LOCATION_FIELD_NUMBER = 1; 73 74 @SuppressWarnings("serial") 75 private volatile java.lang.Object location_ = ""; 76 /** 77 * 78 * 79 * <pre> 80 * The project-specific location in which to generate random bytes. 81 * For example, "projects/my-project/locations/us-central1". 82 * </pre> 83 * 84 * <code>string location = 1;</code> 85 * 86 * @return The location. 87 */ 88 @java.lang.Override getLocation()89 public java.lang.String getLocation() { 90 java.lang.Object ref = location_; 91 if (ref instanceof java.lang.String) { 92 return (java.lang.String) ref; 93 } else { 94 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 95 java.lang.String s = bs.toStringUtf8(); 96 location_ = s; 97 return s; 98 } 99 } 100 /** 101 * 102 * 103 * <pre> 104 * The project-specific location in which to generate random bytes. 105 * For example, "projects/my-project/locations/us-central1". 106 * </pre> 107 * 108 * <code>string location = 1;</code> 109 * 110 * @return The bytes for location. 111 */ 112 @java.lang.Override getLocationBytes()113 public com.google.protobuf.ByteString getLocationBytes() { 114 java.lang.Object ref = location_; 115 if (ref instanceof java.lang.String) { 116 com.google.protobuf.ByteString b = 117 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 118 location_ = b; 119 return b; 120 } else { 121 return (com.google.protobuf.ByteString) ref; 122 } 123 } 124 125 public static final int LENGTH_BYTES_FIELD_NUMBER = 2; 126 private int lengthBytes_ = 0; 127 /** 128 * 129 * 130 * <pre> 131 * The length in bytes of the amount of randomness to retrieve. Minimum 8 132 * bytes, maximum 1024 bytes. 133 * </pre> 134 * 135 * <code>int32 length_bytes = 2;</code> 136 * 137 * @return The lengthBytes. 138 */ 139 @java.lang.Override getLengthBytes()140 public int getLengthBytes() { 141 return lengthBytes_; 142 } 143 144 public static final int PROTECTION_LEVEL_FIELD_NUMBER = 3; 145 private int protectionLevel_ = 0; 146 /** 147 * 148 * 149 * <pre> 150 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 151 * generating the random data. Currently, only 152 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 153 * supported. 154 * </pre> 155 * 156 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 157 * 158 * @return The enum numeric value on the wire for protectionLevel. 159 */ 160 @java.lang.Override getProtectionLevelValue()161 public int getProtectionLevelValue() { 162 return protectionLevel_; 163 } 164 /** 165 * 166 * 167 * <pre> 168 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 169 * generating the random data. Currently, only 170 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 171 * supported. 172 * </pre> 173 * 174 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 175 * 176 * @return The protectionLevel. 177 */ 178 @java.lang.Override getProtectionLevel()179 public com.google.cloud.kms.v1.ProtectionLevel getProtectionLevel() { 180 com.google.cloud.kms.v1.ProtectionLevel result = 181 com.google.cloud.kms.v1.ProtectionLevel.forNumber(protectionLevel_); 182 return result == null ? com.google.cloud.kms.v1.ProtectionLevel.UNRECOGNIZED : result; 183 } 184 185 private byte memoizedIsInitialized = -1; 186 187 @java.lang.Override isInitialized()188 public final boolean isInitialized() { 189 byte isInitialized = memoizedIsInitialized; 190 if (isInitialized == 1) return true; 191 if (isInitialized == 0) return false; 192 193 memoizedIsInitialized = 1; 194 return true; 195 } 196 197 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)198 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 199 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { 200 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, location_); 201 } 202 if (lengthBytes_ != 0) { 203 output.writeInt32(2, lengthBytes_); 204 } 205 if (protectionLevel_ 206 != com.google.cloud.kms.v1.ProtectionLevel.PROTECTION_LEVEL_UNSPECIFIED.getNumber()) { 207 output.writeEnum(3, protectionLevel_); 208 } 209 getUnknownFields().writeTo(output); 210 } 211 212 @java.lang.Override getSerializedSize()213 public int getSerializedSize() { 214 int size = memoizedSize; 215 if (size != -1) return size; 216 217 size = 0; 218 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { 219 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, location_); 220 } 221 if (lengthBytes_ != 0) { 222 size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, lengthBytes_); 223 } 224 if (protectionLevel_ 225 != com.google.cloud.kms.v1.ProtectionLevel.PROTECTION_LEVEL_UNSPECIFIED.getNumber()) { 226 size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, protectionLevel_); 227 } 228 size += getUnknownFields().getSerializedSize(); 229 memoizedSize = size; 230 return size; 231 } 232 233 @java.lang.Override equals(final java.lang.Object obj)234 public boolean equals(final java.lang.Object obj) { 235 if (obj == this) { 236 return true; 237 } 238 if (!(obj instanceof com.google.cloud.kms.v1.GenerateRandomBytesRequest)) { 239 return super.equals(obj); 240 } 241 com.google.cloud.kms.v1.GenerateRandomBytesRequest other = 242 (com.google.cloud.kms.v1.GenerateRandomBytesRequest) obj; 243 244 if (!getLocation().equals(other.getLocation())) return false; 245 if (getLengthBytes() != other.getLengthBytes()) return false; 246 if (protectionLevel_ != other.protectionLevel_) return false; 247 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 248 return true; 249 } 250 251 @java.lang.Override hashCode()252 public int hashCode() { 253 if (memoizedHashCode != 0) { 254 return memoizedHashCode; 255 } 256 int hash = 41; 257 hash = (19 * hash) + getDescriptor().hashCode(); 258 hash = (37 * hash) + LOCATION_FIELD_NUMBER; 259 hash = (53 * hash) + getLocation().hashCode(); 260 hash = (37 * hash) + LENGTH_BYTES_FIELD_NUMBER; 261 hash = (53 * hash) + getLengthBytes(); 262 hash = (37 * hash) + PROTECTION_LEVEL_FIELD_NUMBER; 263 hash = (53 * hash) + protectionLevel_; 264 hash = (29 * hash) + getUnknownFields().hashCode(); 265 memoizedHashCode = hash; 266 return hash; 267 } 268 parseFrom( java.nio.ByteBuffer data)269 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 270 java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { 271 return PARSER.parseFrom(data); 272 } 273 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)274 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 275 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 276 throws com.google.protobuf.InvalidProtocolBufferException { 277 return PARSER.parseFrom(data, extensionRegistry); 278 } 279 parseFrom( com.google.protobuf.ByteString data)280 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 281 com.google.protobuf.ByteString data) 282 throws com.google.protobuf.InvalidProtocolBufferException { 283 return PARSER.parseFrom(data); 284 } 285 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)286 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 287 com.google.protobuf.ByteString data, 288 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 289 throws com.google.protobuf.InvalidProtocolBufferException { 290 return PARSER.parseFrom(data, extensionRegistry); 291 } 292 parseFrom(byte[] data)293 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom(byte[] data) 294 throws com.google.protobuf.InvalidProtocolBufferException { 295 return PARSER.parseFrom(data); 296 } 297 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)298 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 299 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 300 throws com.google.protobuf.InvalidProtocolBufferException { 301 return PARSER.parseFrom(data, extensionRegistry); 302 } 303 parseFrom( java.io.InputStream input)304 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 305 java.io.InputStream input) throws java.io.IOException { 306 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 307 } 308 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)309 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 310 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 311 throws java.io.IOException { 312 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 313 PARSER, input, extensionRegistry); 314 } 315 parseDelimitedFrom( java.io.InputStream input)316 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseDelimitedFrom( 317 java.io.InputStream input) throws java.io.IOException { 318 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 319 } 320 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)321 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseDelimitedFrom( 322 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 323 throws java.io.IOException { 324 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 325 PARSER, input, extensionRegistry); 326 } 327 parseFrom( com.google.protobuf.CodedInputStream input)328 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 329 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 330 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 331 } 332 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)333 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest parseFrom( 334 com.google.protobuf.CodedInputStream input, 335 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 336 throws java.io.IOException { 337 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 338 PARSER, input, extensionRegistry); 339 } 340 341 @java.lang.Override newBuilderForType()342 public Builder newBuilderForType() { 343 return newBuilder(); 344 } 345 newBuilder()346 public static Builder newBuilder() { 347 return DEFAULT_INSTANCE.toBuilder(); 348 } 349 newBuilder(com.google.cloud.kms.v1.GenerateRandomBytesRequest prototype)350 public static Builder newBuilder(com.google.cloud.kms.v1.GenerateRandomBytesRequest prototype) { 351 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 352 } 353 354 @java.lang.Override toBuilder()355 public Builder toBuilder() { 356 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 357 } 358 359 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)360 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 361 Builder builder = new Builder(parent); 362 return builder; 363 } 364 /** 365 * 366 * 367 * <pre> 368 * Request message for 369 * [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. 370 * </pre> 371 * 372 * Protobuf type {@code google.cloud.kms.v1.GenerateRandomBytesRequest} 373 */ 374 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 375 implements 376 // @@protoc_insertion_point(builder_implements:google.cloud.kms.v1.GenerateRandomBytesRequest) 377 com.google.cloud.kms.v1.GenerateRandomBytesRequestOrBuilder { getDescriptor()378 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 379 return com.google.cloud.kms.v1.KmsProto 380 .internal_static_google_cloud_kms_v1_GenerateRandomBytesRequest_descriptor; 381 } 382 383 @java.lang.Override 384 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()385 internalGetFieldAccessorTable() { 386 return com.google.cloud.kms.v1.KmsProto 387 .internal_static_google_cloud_kms_v1_GenerateRandomBytesRequest_fieldAccessorTable 388 .ensureFieldAccessorsInitialized( 389 com.google.cloud.kms.v1.GenerateRandomBytesRequest.class, 390 com.google.cloud.kms.v1.GenerateRandomBytesRequest.Builder.class); 391 } 392 393 // Construct using com.google.cloud.kms.v1.GenerateRandomBytesRequest.newBuilder() Builder()394 private Builder() {} 395 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)396 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 397 super(parent); 398 } 399 400 @java.lang.Override clear()401 public Builder clear() { 402 super.clear(); 403 bitField0_ = 0; 404 location_ = ""; 405 lengthBytes_ = 0; 406 protectionLevel_ = 0; 407 return this; 408 } 409 410 @java.lang.Override getDescriptorForType()411 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 412 return com.google.cloud.kms.v1.KmsProto 413 .internal_static_google_cloud_kms_v1_GenerateRandomBytesRequest_descriptor; 414 } 415 416 @java.lang.Override getDefaultInstanceForType()417 public com.google.cloud.kms.v1.GenerateRandomBytesRequest getDefaultInstanceForType() { 418 return com.google.cloud.kms.v1.GenerateRandomBytesRequest.getDefaultInstance(); 419 } 420 421 @java.lang.Override build()422 public com.google.cloud.kms.v1.GenerateRandomBytesRequest build() { 423 com.google.cloud.kms.v1.GenerateRandomBytesRequest result = buildPartial(); 424 if (!result.isInitialized()) { 425 throw newUninitializedMessageException(result); 426 } 427 return result; 428 } 429 430 @java.lang.Override buildPartial()431 public com.google.cloud.kms.v1.GenerateRandomBytesRequest buildPartial() { 432 com.google.cloud.kms.v1.GenerateRandomBytesRequest result = 433 new com.google.cloud.kms.v1.GenerateRandomBytesRequest(this); 434 if (bitField0_ != 0) { 435 buildPartial0(result); 436 } 437 onBuilt(); 438 return result; 439 } 440 buildPartial0(com.google.cloud.kms.v1.GenerateRandomBytesRequest result)441 private void buildPartial0(com.google.cloud.kms.v1.GenerateRandomBytesRequest result) { 442 int from_bitField0_ = bitField0_; 443 if (((from_bitField0_ & 0x00000001) != 0)) { 444 result.location_ = location_; 445 } 446 if (((from_bitField0_ & 0x00000002) != 0)) { 447 result.lengthBytes_ = lengthBytes_; 448 } 449 if (((from_bitField0_ & 0x00000004) != 0)) { 450 result.protectionLevel_ = protectionLevel_; 451 } 452 } 453 454 @java.lang.Override clone()455 public Builder clone() { 456 return super.clone(); 457 } 458 459 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)460 public Builder setField( 461 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 462 return super.setField(field, value); 463 } 464 465 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)466 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 467 return super.clearField(field); 468 } 469 470 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)471 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 472 return super.clearOneof(oneof); 473 } 474 475 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)476 public Builder setRepeatedField( 477 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 478 return super.setRepeatedField(field, index, value); 479 } 480 481 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)482 public Builder addRepeatedField( 483 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 484 return super.addRepeatedField(field, value); 485 } 486 487 @java.lang.Override mergeFrom(com.google.protobuf.Message other)488 public Builder mergeFrom(com.google.protobuf.Message other) { 489 if (other instanceof com.google.cloud.kms.v1.GenerateRandomBytesRequest) { 490 return mergeFrom((com.google.cloud.kms.v1.GenerateRandomBytesRequest) other); 491 } else { 492 super.mergeFrom(other); 493 return this; 494 } 495 } 496 mergeFrom(com.google.cloud.kms.v1.GenerateRandomBytesRequest other)497 public Builder mergeFrom(com.google.cloud.kms.v1.GenerateRandomBytesRequest other) { 498 if (other == com.google.cloud.kms.v1.GenerateRandomBytesRequest.getDefaultInstance()) 499 return this; 500 if (!other.getLocation().isEmpty()) { 501 location_ = other.location_; 502 bitField0_ |= 0x00000001; 503 onChanged(); 504 } 505 if (other.getLengthBytes() != 0) { 506 setLengthBytes(other.getLengthBytes()); 507 } 508 if (other.protectionLevel_ != 0) { 509 setProtectionLevelValue(other.getProtectionLevelValue()); 510 } 511 this.mergeUnknownFields(other.getUnknownFields()); 512 onChanged(); 513 return this; 514 } 515 516 @java.lang.Override isInitialized()517 public final boolean isInitialized() { 518 return true; 519 } 520 521 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)522 public Builder mergeFrom( 523 com.google.protobuf.CodedInputStream input, 524 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 525 throws java.io.IOException { 526 if (extensionRegistry == null) { 527 throw new java.lang.NullPointerException(); 528 } 529 try { 530 boolean done = false; 531 while (!done) { 532 int tag = input.readTag(); 533 switch (tag) { 534 case 0: 535 done = true; 536 break; 537 case 10: 538 { 539 location_ = input.readStringRequireUtf8(); 540 bitField0_ |= 0x00000001; 541 break; 542 } // case 10 543 case 16: 544 { 545 lengthBytes_ = input.readInt32(); 546 bitField0_ |= 0x00000002; 547 break; 548 } // case 16 549 case 24: 550 { 551 protectionLevel_ = input.readEnum(); 552 bitField0_ |= 0x00000004; 553 break; 554 } // case 24 555 default: 556 { 557 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 558 done = true; // was an endgroup tag 559 } 560 break; 561 } // default: 562 } // switch (tag) 563 } // while (!done) 564 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 565 throw e.unwrapIOException(); 566 } finally { 567 onChanged(); 568 } // finally 569 return this; 570 } 571 572 private int bitField0_; 573 574 private java.lang.Object location_ = ""; 575 /** 576 * 577 * 578 * <pre> 579 * The project-specific location in which to generate random bytes. 580 * For example, "projects/my-project/locations/us-central1". 581 * </pre> 582 * 583 * <code>string location = 1;</code> 584 * 585 * @return The location. 586 */ getLocation()587 public java.lang.String getLocation() { 588 java.lang.Object ref = location_; 589 if (!(ref instanceof java.lang.String)) { 590 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 591 java.lang.String s = bs.toStringUtf8(); 592 location_ = s; 593 return s; 594 } else { 595 return (java.lang.String) ref; 596 } 597 } 598 /** 599 * 600 * 601 * <pre> 602 * The project-specific location in which to generate random bytes. 603 * For example, "projects/my-project/locations/us-central1". 604 * </pre> 605 * 606 * <code>string location = 1;</code> 607 * 608 * @return The bytes for location. 609 */ getLocationBytes()610 public com.google.protobuf.ByteString getLocationBytes() { 611 java.lang.Object ref = location_; 612 if (ref instanceof String) { 613 com.google.protobuf.ByteString b = 614 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 615 location_ = b; 616 return b; 617 } else { 618 return (com.google.protobuf.ByteString) ref; 619 } 620 } 621 /** 622 * 623 * 624 * <pre> 625 * The project-specific location in which to generate random bytes. 626 * For example, "projects/my-project/locations/us-central1". 627 * </pre> 628 * 629 * <code>string location = 1;</code> 630 * 631 * @param value The location to set. 632 * @return This builder for chaining. 633 */ setLocation(java.lang.String value)634 public Builder setLocation(java.lang.String value) { 635 if (value == null) { 636 throw new NullPointerException(); 637 } 638 location_ = value; 639 bitField0_ |= 0x00000001; 640 onChanged(); 641 return this; 642 } 643 /** 644 * 645 * 646 * <pre> 647 * The project-specific location in which to generate random bytes. 648 * For example, "projects/my-project/locations/us-central1". 649 * </pre> 650 * 651 * <code>string location = 1;</code> 652 * 653 * @return This builder for chaining. 654 */ clearLocation()655 public Builder clearLocation() { 656 location_ = getDefaultInstance().getLocation(); 657 bitField0_ = (bitField0_ & ~0x00000001); 658 onChanged(); 659 return this; 660 } 661 /** 662 * 663 * 664 * <pre> 665 * The project-specific location in which to generate random bytes. 666 * For example, "projects/my-project/locations/us-central1". 667 * </pre> 668 * 669 * <code>string location = 1;</code> 670 * 671 * @param value The bytes for location to set. 672 * @return This builder for chaining. 673 */ setLocationBytes(com.google.protobuf.ByteString value)674 public Builder setLocationBytes(com.google.protobuf.ByteString value) { 675 if (value == null) { 676 throw new NullPointerException(); 677 } 678 checkByteStringIsUtf8(value); 679 location_ = value; 680 bitField0_ |= 0x00000001; 681 onChanged(); 682 return this; 683 } 684 685 private int lengthBytes_; 686 /** 687 * 688 * 689 * <pre> 690 * The length in bytes of the amount of randomness to retrieve. Minimum 8 691 * bytes, maximum 1024 bytes. 692 * </pre> 693 * 694 * <code>int32 length_bytes = 2;</code> 695 * 696 * @return The lengthBytes. 697 */ 698 @java.lang.Override getLengthBytes()699 public int getLengthBytes() { 700 return lengthBytes_; 701 } 702 /** 703 * 704 * 705 * <pre> 706 * The length in bytes of the amount of randomness to retrieve. Minimum 8 707 * bytes, maximum 1024 bytes. 708 * </pre> 709 * 710 * <code>int32 length_bytes = 2;</code> 711 * 712 * @param value The lengthBytes to set. 713 * @return This builder for chaining. 714 */ setLengthBytes(int value)715 public Builder setLengthBytes(int value) { 716 717 lengthBytes_ = value; 718 bitField0_ |= 0x00000002; 719 onChanged(); 720 return this; 721 } 722 /** 723 * 724 * 725 * <pre> 726 * The length in bytes of the amount of randomness to retrieve. Minimum 8 727 * bytes, maximum 1024 bytes. 728 * </pre> 729 * 730 * <code>int32 length_bytes = 2;</code> 731 * 732 * @return This builder for chaining. 733 */ clearLengthBytes()734 public Builder clearLengthBytes() { 735 bitField0_ = (bitField0_ & ~0x00000002); 736 lengthBytes_ = 0; 737 onChanged(); 738 return this; 739 } 740 741 private int protectionLevel_ = 0; 742 /** 743 * 744 * 745 * <pre> 746 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 747 * generating the random data. Currently, only 748 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 749 * supported. 750 * </pre> 751 * 752 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 753 * 754 * @return The enum numeric value on the wire for protectionLevel. 755 */ 756 @java.lang.Override getProtectionLevelValue()757 public int getProtectionLevelValue() { 758 return protectionLevel_; 759 } 760 /** 761 * 762 * 763 * <pre> 764 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 765 * generating the random data. Currently, only 766 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 767 * supported. 768 * </pre> 769 * 770 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 771 * 772 * @param value The enum numeric value on the wire for protectionLevel to set. 773 * @return This builder for chaining. 774 */ setProtectionLevelValue(int value)775 public Builder setProtectionLevelValue(int value) { 776 protectionLevel_ = value; 777 bitField0_ |= 0x00000004; 778 onChanged(); 779 return this; 780 } 781 /** 782 * 783 * 784 * <pre> 785 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 786 * generating the random data. Currently, only 787 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 788 * supported. 789 * </pre> 790 * 791 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 792 * 793 * @return The protectionLevel. 794 */ 795 @java.lang.Override getProtectionLevel()796 public com.google.cloud.kms.v1.ProtectionLevel getProtectionLevel() { 797 com.google.cloud.kms.v1.ProtectionLevel result = 798 com.google.cloud.kms.v1.ProtectionLevel.forNumber(protectionLevel_); 799 return result == null ? com.google.cloud.kms.v1.ProtectionLevel.UNRECOGNIZED : result; 800 } 801 /** 802 * 803 * 804 * <pre> 805 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 806 * generating the random data. Currently, only 807 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 808 * supported. 809 * </pre> 810 * 811 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 812 * 813 * @param value The protectionLevel to set. 814 * @return This builder for chaining. 815 */ setProtectionLevel(com.google.cloud.kms.v1.ProtectionLevel value)816 public Builder setProtectionLevel(com.google.cloud.kms.v1.ProtectionLevel value) { 817 if (value == null) { 818 throw new NullPointerException(); 819 } 820 bitField0_ |= 0x00000004; 821 protectionLevel_ = value.getNumber(); 822 onChanged(); 823 return this; 824 } 825 /** 826 * 827 * 828 * <pre> 829 * The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when 830 * generating the random data. Currently, only 831 * [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is 832 * supported. 833 * </pre> 834 * 835 * <code>.google.cloud.kms.v1.ProtectionLevel protection_level = 3;</code> 836 * 837 * @return This builder for chaining. 838 */ clearProtectionLevel()839 public Builder clearProtectionLevel() { 840 bitField0_ = (bitField0_ & ~0x00000004); 841 protectionLevel_ = 0; 842 onChanged(); 843 return this; 844 } 845 846 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)847 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 848 return super.setUnknownFields(unknownFields); 849 } 850 851 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)852 public final Builder mergeUnknownFields( 853 final com.google.protobuf.UnknownFieldSet unknownFields) { 854 return super.mergeUnknownFields(unknownFields); 855 } 856 857 // @@protoc_insertion_point(builder_scope:google.cloud.kms.v1.GenerateRandomBytesRequest) 858 } 859 860 // @@protoc_insertion_point(class_scope:google.cloud.kms.v1.GenerateRandomBytesRequest) 861 private static final com.google.cloud.kms.v1.GenerateRandomBytesRequest DEFAULT_INSTANCE; 862 863 static { 864 DEFAULT_INSTANCE = new com.google.cloud.kms.v1.GenerateRandomBytesRequest(); 865 } 866 getDefaultInstance()867 public static com.google.cloud.kms.v1.GenerateRandomBytesRequest getDefaultInstance() { 868 return DEFAULT_INSTANCE; 869 } 870 871 private static final com.google.protobuf.Parser<GenerateRandomBytesRequest> PARSER = 872 new com.google.protobuf.AbstractParser<GenerateRandomBytesRequest>() { 873 @java.lang.Override 874 public GenerateRandomBytesRequest parsePartialFrom( 875 com.google.protobuf.CodedInputStream input, 876 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 877 throws com.google.protobuf.InvalidProtocolBufferException { 878 Builder builder = newBuilder(); 879 try { 880 builder.mergeFrom(input, extensionRegistry); 881 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 882 throw e.setUnfinishedMessage(builder.buildPartial()); 883 } catch (com.google.protobuf.UninitializedMessageException e) { 884 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 885 } catch (java.io.IOException e) { 886 throw new com.google.protobuf.InvalidProtocolBufferException(e) 887 .setUnfinishedMessage(builder.buildPartial()); 888 } 889 return builder.buildPartial(); 890 } 891 }; 892 parser()893 public static com.google.protobuf.Parser<GenerateRandomBytesRequest> parser() { 894 return PARSER; 895 } 896 897 @java.lang.Override getParserForType()898 public com.google.protobuf.Parser<GenerateRandomBytesRequest> getParserForType() { 899 return PARSER; 900 } 901 902 @java.lang.Override getDefaultInstanceForType()903 public com.google.cloud.kms.v1.GenerateRandomBytesRequest getDefaultInstanceForType() { 904 return DEFAULT_INSTANCE; 905 } 906 } 907