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/container/v1/cluster_service.proto 18 19 package com.google.container.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) 26 * is the configuration of desired reservation which instances could take 27 * capacity from. 28 * </pre> 29 * 30 * Protobuf type {@code google.container.v1.ReservationAffinity} 31 */ 32 public final class ReservationAffinity extends com.google.protobuf.GeneratedMessageV3 33 implements 34 // @@protoc_insertion_point(message_implements:google.container.v1.ReservationAffinity) 35 ReservationAffinityOrBuilder { 36 private static final long serialVersionUID = 0L; 37 // Use ReservationAffinity.newBuilder() to construct. ReservationAffinity(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)38 private ReservationAffinity(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 39 super(builder); 40 } 41 ReservationAffinity()42 private ReservationAffinity() { 43 consumeReservationType_ = 0; 44 key_ = ""; 45 values_ = com.google.protobuf.LazyStringArrayList.EMPTY; 46 } 47 48 @java.lang.Override 49 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)50 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 51 return new ReservationAffinity(); 52 } 53 54 @java.lang.Override getUnknownFields()55 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 56 return this.unknownFields; 57 } 58 getDescriptor()59 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 60 return com.google.container.v1.ClusterServiceProto 61 .internal_static_google_container_v1_ReservationAffinity_descriptor; 62 } 63 64 @java.lang.Override 65 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()66 internalGetFieldAccessorTable() { 67 return com.google.container.v1.ClusterServiceProto 68 .internal_static_google_container_v1_ReservationAffinity_fieldAccessorTable 69 .ensureFieldAccessorsInitialized( 70 com.google.container.v1.ReservationAffinity.class, 71 com.google.container.v1.ReservationAffinity.Builder.class); 72 } 73 74 /** 75 * 76 * 77 * <pre> 78 * Indicates whether to consume capacity from a reservation or not. 79 * </pre> 80 * 81 * Protobuf enum {@code google.container.v1.ReservationAffinity.Type} 82 */ 83 public enum Type implements com.google.protobuf.ProtocolMessageEnum { 84 /** 85 * 86 * 87 * <pre> 88 * Default value. This should not be used. 89 * </pre> 90 * 91 * <code>UNSPECIFIED = 0;</code> 92 */ 93 UNSPECIFIED(0), 94 /** 95 * 96 * 97 * <pre> 98 * Do not consume from any reserved capacity. 99 * </pre> 100 * 101 * <code>NO_RESERVATION = 1;</code> 102 */ 103 NO_RESERVATION(1), 104 /** 105 * 106 * 107 * <pre> 108 * Consume any reservation available. 109 * </pre> 110 * 111 * <code>ANY_RESERVATION = 2;</code> 112 */ 113 ANY_RESERVATION(2), 114 /** 115 * 116 * 117 * <pre> 118 * Must consume from a specific reservation. Must specify key value fields 119 * for specifying the reservations. 120 * </pre> 121 * 122 * <code>SPECIFIC_RESERVATION = 3;</code> 123 */ 124 SPECIFIC_RESERVATION(3), 125 UNRECOGNIZED(-1), 126 ; 127 128 /** 129 * 130 * 131 * <pre> 132 * Default value. This should not be used. 133 * </pre> 134 * 135 * <code>UNSPECIFIED = 0;</code> 136 */ 137 public static final int UNSPECIFIED_VALUE = 0; 138 /** 139 * 140 * 141 * <pre> 142 * Do not consume from any reserved capacity. 143 * </pre> 144 * 145 * <code>NO_RESERVATION = 1;</code> 146 */ 147 public static final int NO_RESERVATION_VALUE = 1; 148 /** 149 * 150 * 151 * <pre> 152 * Consume any reservation available. 153 * </pre> 154 * 155 * <code>ANY_RESERVATION = 2;</code> 156 */ 157 public static final int ANY_RESERVATION_VALUE = 2; 158 /** 159 * 160 * 161 * <pre> 162 * Must consume from a specific reservation. Must specify key value fields 163 * for specifying the reservations. 164 * </pre> 165 * 166 * <code>SPECIFIC_RESERVATION = 3;</code> 167 */ 168 public static final int SPECIFIC_RESERVATION_VALUE = 3; 169 getNumber()170 public final int getNumber() { 171 if (this == UNRECOGNIZED) { 172 throw new java.lang.IllegalArgumentException( 173 "Can't get the number of an unknown enum value."); 174 } 175 return value; 176 } 177 178 /** 179 * @param value The numeric wire value of the corresponding enum entry. 180 * @return The enum associated with the given numeric wire value. 181 * @deprecated Use {@link #forNumber(int)} instead. 182 */ 183 @java.lang.Deprecated valueOf(int value)184 public static Type valueOf(int value) { 185 return forNumber(value); 186 } 187 188 /** 189 * @param value The numeric wire value of the corresponding enum entry. 190 * @return The enum associated with the given numeric wire value. 191 */ forNumber(int value)192 public static Type forNumber(int value) { 193 switch (value) { 194 case 0: 195 return UNSPECIFIED; 196 case 1: 197 return NO_RESERVATION; 198 case 2: 199 return ANY_RESERVATION; 200 case 3: 201 return SPECIFIC_RESERVATION; 202 default: 203 return null; 204 } 205 } 206 internalGetValueMap()207 public static com.google.protobuf.Internal.EnumLiteMap<Type> internalGetValueMap() { 208 return internalValueMap; 209 } 210 211 private static final com.google.protobuf.Internal.EnumLiteMap<Type> internalValueMap = 212 new com.google.protobuf.Internal.EnumLiteMap<Type>() { 213 public Type findValueByNumber(int number) { 214 return Type.forNumber(number); 215 } 216 }; 217 getValueDescriptor()218 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 219 if (this == UNRECOGNIZED) { 220 throw new java.lang.IllegalStateException( 221 "Can't get the descriptor of an unrecognized enum value."); 222 } 223 return getDescriptor().getValues().get(ordinal()); 224 } 225 getDescriptorForType()226 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 227 return getDescriptor(); 228 } 229 getDescriptor()230 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 231 return com.google.container.v1.ReservationAffinity.getDescriptor().getEnumTypes().get(0); 232 } 233 234 private static final Type[] VALUES = values(); 235 valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)236 public static Type valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 237 if (desc.getType() != getDescriptor()) { 238 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 239 } 240 if (desc.getIndex() == -1) { 241 return UNRECOGNIZED; 242 } 243 return VALUES[desc.getIndex()]; 244 } 245 246 private final int value; 247 Type(int value)248 private Type(int value) { 249 this.value = value; 250 } 251 252 // @@protoc_insertion_point(enum_scope:google.container.v1.ReservationAffinity.Type) 253 } 254 255 public static final int CONSUME_RESERVATION_TYPE_FIELD_NUMBER = 1; 256 private int consumeReservationType_ = 0; 257 /** 258 * 259 * 260 * <pre> 261 * Corresponds to the type of reservation consumption. 262 * </pre> 263 * 264 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 265 * 266 * @return The enum numeric value on the wire for consumeReservationType. 267 */ 268 @java.lang.Override getConsumeReservationTypeValue()269 public int getConsumeReservationTypeValue() { 270 return consumeReservationType_; 271 } 272 /** 273 * 274 * 275 * <pre> 276 * Corresponds to the type of reservation consumption. 277 * </pre> 278 * 279 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 280 * 281 * @return The consumeReservationType. 282 */ 283 @java.lang.Override getConsumeReservationType()284 public com.google.container.v1.ReservationAffinity.Type getConsumeReservationType() { 285 com.google.container.v1.ReservationAffinity.Type result = 286 com.google.container.v1.ReservationAffinity.Type.forNumber(consumeReservationType_); 287 return result == null ? com.google.container.v1.ReservationAffinity.Type.UNRECOGNIZED : result; 288 } 289 290 public static final int KEY_FIELD_NUMBER = 2; 291 292 @SuppressWarnings("serial") 293 private volatile java.lang.Object key_ = ""; 294 /** 295 * 296 * 297 * <pre> 298 * Corresponds to the label key of a reservation resource. To target a 299 * SPECIFIC_RESERVATION by name, specify 300 * "compute.googleapis.com/reservation-name" as the key and specify the name 301 * of your reservation as its value. 302 * </pre> 303 * 304 * <code>string key = 2;</code> 305 * 306 * @return The key. 307 */ 308 @java.lang.Override getKey()309 public java.lang.String getKey() { 310 java.lang.Object ref = key_; 311 if (ref instanceof java.lang.String) { 312 return (java.lang.String) ref; 313 } else { 314 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 315 java.lang.String s = bs.toStringUtf8(); 316 key_ = s; 317 return s; 318 } 319 } 320 /** 321 * 322 * 323 * <pre> 324 * Corresponds to the label key of a reservation resource. To target a 325 * SPECIFIC_RESERVATION by name, specify 326 * "compute.googleapis.com/reservation-name" as the key and specify the name 327 * of your reservation as its value. 328 * </pre> 329 * 330 * <code>string key = 2;</code> 331 * 332 * @return The bytes for key. 333 */ 334 @java.lang.Override getKeyBytes()335 public com.google.protobuf.ByteString getKeyBytes() { 336 java.lang.Object ref = key_; 337 if (ref instanceof java.lang.String) { 338 com.google.protobuf.ByteString b = 339 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 340 key_ = b; 341 return b; 342 } else { 343 return (com.google.protobuf.ByteString) ref; 344 } 345 } 346 347 public static final int VALUES_FIELD_NUMBER = 3; 348 349 @SuppressWarnings("serial") 350 private com.google.protobuf.LazyStringList values_; 351 /** 352 * 353 * 354 * <pre> 355 * Corresponds to the label value(s) of reservation resource(s). 356 * </pre> 357 * 358 * <code>repeated string values = 3;</code> 359 * 360 * @return A list containing the values. 361 */ getValuesList()362 public com.google.protobuf.ProtocolStringList getValuesList() { 363 return values_; 364 } 365 /** 366 * 367 * 368 * <pre> 369 * Corresponds to the label value(s) of reservation resource(s). 370 * </pre> 371 * 372 * <code>repeated string values = 3;</code> 373 * 374 * @return The count of values. 375 */ getValuesCount()376 public int getValuesCount() { 377 return values_.size(); 378 } 379 /** 380 * 381 * 382 * <pre> 383 * Corresponds to the label value(s) of reservation resource(s). 384 * </pre> 385 * 386 * <code>repeated string values = 3;</code> 387 * 388 * @param index The index of the element to return. 389 * @return The values at the given index. 390 */ getValues(int index)391 public java.lang.String getValues(int index) { 392 return values_.get(index); 393 } 394 /** 395 * 396 * 397 * <pre> 398 * Corresponds to the label value(s) of reservation resource(s). 399 * </pre> 400 * 401 * <code>repeated string values = 3;</code> 402 * 403 * @param index The index of the value to return. 404 * @return The bytes of the values at the given index. 405 */ getValuesBytes(int index)406 public com.google.protobuf.ByteString getValuesBytes(int index) { 407 return values_.getByteString(index); 408 } 409 410 private byte memoizedIsInitialized = -1; 411 412 @java.lang.Override isInitialized()413 public final boolean isInitialized() { 414 byte isInitialized = memoizedIsInitialized; 415 if (isInitialized == 1) return true; 416 if (isInitialized == 0) return false; 417 418 memoizedIsInitialized = 1; 419 return true; 420 } 421 422 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)423 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 424 if (consumeReservationType_ 425 != com.google.container.v1.ReservationAffinity.Type.UNSPECIFIED.getNumber()) { 426 output.writeEnum(1, consumeReservationType_); 427 } 428 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { 429 com.google.protobuf.GeneratedMessageV3.writeString(output, 2, key_); 430 } 431 for (int i = 0; i < values_.size(); i++) { 432 com.google.protobuf.GeneratedMessageV3.writeString(output, 3, values_.getRaw(i)); 433 } 434 getUnknownFields().writeTo(output); 435 } 436 437 @java.lang.Override getSerializedSize()438 public int getSerializedSize() { 439 int size = memoizedSize; 440 if (size != -1) return size; 441 442 size = 0; 443 if (consumeReservationType_ 444 != com.google.container.v1.ReservationAffinity.Type.UNSPECIFIED.getNumber()) { 445 size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, consumeReservationType_); 446 } 447 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { 448 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, key_); 449 } 450 { 451 int dataSize = 0; 452 for (int i = 0; i < values_.size(); i++) { 453 dataSize += computeStringSizeNoTag(values_.getRaw(i)); 454 } 455 size += dataSize; 456 size += 1 * getValuesList().size(); 457 } 458 size += getUnknownFields().getSerializedSize(); 459 memoizedSize = size; 460 return size; 461 } 462 463 @java.lang.Override equals(final java.lang.Object obj)464 public boolean equals(final java.lang.Object obj) { 465 if (obj == this) { 466 return true; 467 } 468 if (!(obj instanceof com.google.container.v1.ReservationAffinity)) { 469 return super.equals(obj); 470 } 471 com.google.container.v1.ReservationAffinity other = 472 (com.google.container.v1.ReservationAffinity) obj; 473 474 if (consumeReservationType_ != other.consumeReservationType_) return false; 475 if (!getKey().equals(other.getKey())) return false; 476 if (!getValuesList().equals(other.getValuesList())) return false; 477 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 478 return true; 479 } 480 481 @java.lang.Override hashCode()482 public int hashCode() { 483 if (memoizedHashCode != 0) { 484 return memoizedHashCode; 485 } 486 int hash = 41; 487 hash = (19 * hash) + getDescriptor().hashCode(); 488 hash = (37 * hash) + CONSUME_RESERVATION_TYPE_FIELD_NUMBER; 489 hash = (53 * hash) + consumeReservationType_; 490 hash = (37 * hash) + KEY_FIELD_NUMBER; 491 hash = (53 * hash) + getKey().hashCode(); 492 if (getValuesCount() > 0) { 493 hash = (37 * hash) + VALUES_FIELD_NUMBER; 494 hash = (53 * hash) + getValuesList().hashCode(); 495 } 496 hash = (29 * hash) + getUnknownFields().hashCode(); 497 memoizedHashCode = hash; 498 return hash; 499 } 500 parseFrom(java.nio.ByteBuffer data)501 public static com.google.container.v1.ReservationAffinity parseFrom(java.nio.ByteBuffer data) 502 throws com.google.protobuf.InvalidProtocolBufferException { 503 return PARSER.parseFrom(data); 504 } 505 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)506 public static com.google.container.v1.ReservationAffinity parseFrom( 507 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 508 throws com.google.protobuf.InvalidProtocolBufferException { 509 return PARSER.parseFrom(data, extensionRegistry); 510 } 511 parseFrom( com.google.protobuf.ByteString data)512 public static com.google.container.v1.ReservationAffinity parseFrom( 513 com.google.protobuf.ByteString data) 514 throws com.google.protobuf.InvalidProtocolBufferException { 515 return PARSER.parseFrom(data); 516 } 517 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)518 public static com.google.container.v1.ReservationAffinity parseFrom( 519 com.google.protobuf.ByteString data, 520 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 521 throws com.google.protobuf.InvalidProtocolBufferException { 522 return PARSER.parseFrom(data, extensionRegistry); 523 } 524 parseFrom(byte[] data)525 public static com.google.container.v1.ReservationAffinity parseFrom(byte[] data) 526 throws com.google.protobuf.InvalidProtocolBufferException { 527 return PARSER.parseFrom(data); 528 } 529 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)530 public static com.google.container.v1.ReservationAffinity parseFrom( 531 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 532 throws com.google.protobuf.InvalidProtocolBufferException { 533 return PARSER.parseFrom(data, extensionRegistry); 534 } 535 parseFrom(java.io.InputStream input)536 public static com.google.container.v1.ReservationAffinity parseFrom(java.io.InputStream input) 537 throws java.io.IOException { 538 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 539 } 540 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)541 public static com.google.container.v1.ReservationAffinity parseFrom( 542 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 543 throws java.io.IOException { 544 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 545 PARSER, input, extensionRegistry); 546 } 547 parseDelimitedFrom( java.io.InputStream input)548 public static com.google.container.v1.ReservationAffinity parseDelimitedFrom( 549 java.io.InputStream input) throws java.io.IOException { 550 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 551 } 552 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)553 public static com.google.container.v1.ReservationAffinity parseDelimitedFrom( 554 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 555 throws java.io.IOException { 556 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 557 PARSER, input, extensionRegistry); 558 } 559 parseFrom( com.google.protobuf.CodedInputStream input)560 public static com.google.container.v1.ReservationAffinity parseFrom( 561 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 562 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 563 } 564 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)565 public static com.google.container.v1.ReservationAffinity parseFrom( 566 com.google.protobuf.CodedInputStream input, 567 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 568 throws java.io.IOException { 569 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 570 PARSER, input, extensionRegistry); 571 } 572 573 @java.lang.Override newBuilderForType()574 public Builder newBuilderForType() { 575 return newBuilder(); 576 } 577 newBuilder()578 public static Builder newBuilder() { 579 return DEFAULT_INSTANCE.toBuilder(); 580 } 581 newBuilder(com.google.container.v1.ReservationAffinity prototype)582 public static Builder newBuilder(com.google.container.v1.ReservationAffinity prototype) { 583 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 584 } 585 586 @java.lang.Override toBuilder()587 public Builder toBuilder() { 588 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 589 } 590 591 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)592 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 593 Builder builder = new Builder(parent); 594 return builder; 595 } 596 /** 597 * 598 * 599 * <pre> 600 * [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) 601 * is the configuration of desired reservation which instances could take 602 * capacity from. 603 * </pre> 604 * 605 * Protobuf type {@code google.container.v1.ReservationAffinity} 606 */ 607 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 608 implements 609 // @@protoc_insertion_point(builder_implements:google.container.v1.ReservationAffinity) 610 com.google.container.v1.ReservationAffinityOrBuilder { getDescriptor()611 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 612 return com.google.container.v1.ClusterServiceProto 613 .internal_static_google_container_v1_ReservationAffinity_descriptor; 614 } 615 616 @java.lang.Override 617 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()618 internalGetFieldAccessorTable() { 619 return com.google.container.v1.ClusterServiceProto 620 .internal_static_google_container_v1_ReservationAffinity_fieldAccessorTable 621 .ensureFieldAccessorsInitialized( 622 com.google.container.v1.ReservationAffinity.class, 623 com.google.container.v1.ReservationAffinity.Builder.class); 624 } 625 626 // Construct using com.google.container.v1.ReservationAffinity.newBuilder() Builder()627 private Builder() {} 628 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)629 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 630 super(parent); 631 } 632 633 @java.lang.Override clear()634 public Builder clear() { 635 super.clear(); 636 bitField0_ = 0; 637 consumeReservationType_ = 0; 638 key_ = ""; 639 values_ = com.google.protobuf.LazyStringArrayList.EMPTY; 640 bitField0_ = (bitField0_ & ~0x00000004); 641 return this; 642 } 643 644 @java.lang.Override getDescriptorForType()645 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 646 return com.google.container.v1.ClusterServiceProto 647 .internal_static_google_container_v1_ReservationAffinity_descriptor; 648 } 649 650 @java.lang.Override getDefaultInstanceForType()651 public com.google.container.v1.ReservationAffinity getDefaultInstanceForType() { 652 return com.google.container.v1.ReservationAffinity.getDefaultInstance(); 653 } 654 655 @java.lang.Override build()656 public com.google.container.v1.ReservationAffinity build() { 657 com.google.container.v1.ReservationAffinity result = buildPartial(); 658 if (!result.isInitialized()) { 659 throw newUninitializedMessageException(result); 660 } 661 return result; 662 } 663 664 @java.lang.Override buildPartial()665 public com.google.container.v1.ReservationAffinity buildPartial() { 666 com.google.container.v1.ReservationAffinity result = 667 new com.google.container.v1.ReservationAffinity(this); 668 buildPartialRepeatedFields(result); 669 if (bitField0_ != 0) { 670 buildPartial0(result); 671 } 672 onBuilt(); 673 return result; 674 } 675 buildPartialRepeatedFields(com.google.container.v1.ReservationAffinity result)676 private void buildPartialRepeatedFields(com.google.container.v1.ReservationAffinity result) { 677 if (((bitField0_ & 0x00000004) != 0)) { 678 values_ = values_.getUnmodifiableView(); 679 bitField0_ = (bitField0_ & ~0x00000004); 680 } 681 result.values_ = values_; 682 } 683 buildPartial0(com.google.container.v1.ReservationAffinity result)684 private void buildPartial0(com.google.container.v1.ReservationAffinity result) { 685 int from_bitField0_ = bitField0_; 686 if (((from_bitField0_ & 0x00000001) != 0)) { 687 result.consumeReservationType_ = consumeReservationType_; 688 } 689 if (((from_bitField0_ & 0x00000002) != 0)) { 690 result.key_ = key_; 691 } 692 } 693 694 @java.lang.Override clone()695 public Builder clone() { 696 return super.clone(); 697 } 698 699 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)700 public Builder setField( 701 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 702 return super.setField(field, value); 703 } 704 705 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)706 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 707 return super.clearField(field); 708 } 709 710 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)711 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 712 return super.clearOneof(oneof); 713 } 714 715 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)716 public Builder setRepeatedField( 717 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 718 return super.setRepeatedField(field, index, value); 719 } 720 721 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)722 public Builder addRepeatedField( 723 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 724 return super.addRepeatedField(field, value); 725 } 726 727 @java.lang.Override mergeFrom(com.google.protobuf.Message other)728 public Builder mergeFrom(com.google.protobuf.Message other) { 729 if (other instanceof com.google.container.v1.ReservationAffinity) { 730 return mergeFrom((com.google.container.v1.ReservationAffinity) other); 731 } else { 732 super.mergeFrom(other); 733 return this; 734 } 735 } 736 mergeFrom(com.google.container.v1.ReservationAffinity other)737 public Builder mergeFrom(com.google.container.v1.ReservationAffinity other) { 738 if (other == com.google.container.v1.ReservationAffinity.getDefaultInstance()) return this; 739 if (other.consumeReservationType_ != 0) { 740 setConsumeReservationTypeValue(other.getConsumeReservationTypeValue()); 741 } 742 if (!other.getKey().isEmpty()) { 743 key_ = other.key_; 744 bitField0_ |= 0x00000002; 745 onChanged(); 746 } 747 if (!other.values_.isEmpty()) { 748 if (values_.isEmpty()) { 749 values_ = other.values_; 750 bitField0_ = (bitField0_ & ~0x00000004); 751 } else { 752 ensureValuesIsMutable(); 753 values_.addAll(other.values_); 754 } 755 onChanged(); 756 } 757 this.mergeUnknownFields(other.getUnknownFields()); 758 onChanged(); 759 return this; 760 } 761 762 @java.lang.Override isInitialized()763 public final boolean isInitialized() { 764 return true; 765 } 766 767 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)768 public Builder mergeFrom( 769 com.google.protobuf.CodedInputStream input, 770 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 771 throws java.io.IOException { 772 if (extensionRegistry == null) { 773 throw new java.lang.NullPointerException(); 774 } 775 try { 776 boolean done = false; 777 while (!done) { 778 int tag = input.readTag(); 779 switch (tag) { 780 case 0: 781 done = true; 782 break; 783 case 8: 784 { 785 consumeReservationType_ = input.readEnum(); 786 bitField0_ |= 0x00000001; 787 break; 788 } // case 8 789 case 18: 790 { 791 key_ = input.readStringRequireUtf8(); 792 bitField0_ |= 0x00000002; 793 break; 794 } // case 18 795 case 26: 796 { 797 java.lang.String s = input.readStringRequireUtf8(); 798 ensureValuesIsMutable(); 799 values_.add(s); 800 break; 801 } // case 26 802 default: 803 { 804 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 805 done = true; // was an endgroup tag 806 } 807 break; 808 } // default: 809 } // switch (tag) 810 } // while (!done) 811 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 812 throw e.unwrapIOException(); 813 } finally { 814 onChanged(); 815 } // finally 816 return this; 817 } 818 819 private int bitField0_; 820 821 private int consumeReservationType_ = 0; 822 /** 823 * 824 * 825 * <pre> 826 * Corresponds to the type of reservation consumption. 827 * </pre> 828 * 829 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 830 * 831 * @return The enum numeric value on the wire for consumeReservationType. 832 */ 833 @java.lang.Override getConsumeReservationTypeValue()834 public int getConsumeReservationTypeValue() { 835 return consumeReservationType_; 836 } 837 /** 838 * 839 * 840 * <pre> 841 * Corresponds to the type of reservation consumption. 842 * </pre> 843 * 844 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 845 * 846 * @param value The enum numeric value on the wire for consumeReservationType to set. 847 * @return This builder for chaining. 848 */ setConsumeReservationTypeValue(int value)849 public Builder setConsumeReservationTypeValue(int value) { 850 consumeReservationType_ = value; 851 bitField0_ |= 0x00000001; 852 onChanged(); 853 return this; 854 } 855 /** 856 * 857 * 858 * <pre> 859 * Corresponds to the type of reservation consumption. 860 * </pre> 861 * 862 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 863 * 864 * @return The consumeReservationType. 865 */ 866 @java.lang.Override getConsumeReservationType()867 public com.google.container.v1.ReservationAffinity.Type getConsumeReservationType() { 868 com.google.container.v1.ReservationAffinity.Type result = 869 com.google.container.v1.ReservationAffinity.Type.forNumber(consumeReservationType_); 870 return result == null 871 ? com.google.container.v1.ReservationAffinity.Type.UNRECOGNIZED 872 : result; 873 } 874 /** 875 * 876 * 877 * <pre> 878 * Corresponds to the type of reservation consumption. 879 * </pre> 880 * 881 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 882 * 883 * @param value The consumeReservationType to set. 884 * @return This builder for chaining. 885 */ setConsumeReservationType( com.google.container.v1.ReservationAffinity.Type value)886 public Builder setConsumeReservationType( 887 com.google.container.v1.ReservationAffinity.Type value) { 888 if (value == null) { 889 throw new NullPointerException(); 890 } 891 bitField0_ |= 0x00000001; 892 consumeReservationType_ = value.getNumber(); 893 onChanged(); 894 return this; 895 } 896 /** 897 * 898 * 899 * <pre> 900 * Corresponds to the type of reservation consumption. 901 * </pre> 902 * 903 * <code>.google.container.v1.ReservationAffinity.Type consume_reservation_type = 1;</code> 904 * 905 * @return This builder for chaining. 906 */ clearConsumeReservationType()907 public Builder clearConsumeReservationType() { 908 bitField0_ = (bitField0_ & ~0x00000001); 909 consumeReservationType_ = 0; 910 onChanged(); 911 return this; 912 } 913 914 private java.lang.Object key_ = ""; 915 /** 916 * 917 * 918 * <pre> 919 * Corresponds to the label key of a reservation resource. To target a 920 * SPECIFIC_RESERVATION by name, specify 921 * "compute.googleapis.com/reservation-name" as the key and specify the name 922 * of your reservation as its value. 923 * </pre> 924 * 925 * <code>string key = 2;</code> 926 * 927 * @return The key. 928 */ getKey()929 public java.lang.String getKey() { 930 java.lang.Object ref = key_; 931 if (!(ref instanceof java.lang.String)) { 932 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 933 java.lang.String s = bs.toStringUtf8(); 934 key_ = s; 935 return s; 936 } else { 937 return (java.lang.String) ref; 938 } 939 } 940 /** 941 * 942 * 943 * <pre> 944 * Corresponds to the label key of a reservation resource. To target a 945 * SPECIFIC_RESERVATION by name, specify 946 * "compute.googleapis.com/reservation-name" as the key and specify the name 947 * of your reservation as its value. 948 * </pre> 949 * 950 * <code>string key = 2;</code> 951 * 952 * @return The bytes for key. 953 */ getKeyBytes()954 public com.google.protobuf.ByteString getKeyBytes() { 955 java.lang.Object ref = key_; 956 if (ref instanceof String) { 957 com.google.protobuf.ByteString b = 958 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 959 key_ = b; 960 return b; 961 } else { 962 return (com.google.protobuf.ByteString) ref; 963 } 964 } 965 /** 966 * 967 * 968 * <pre> 969 * Corresponds to the label key of a reservation resource. To target a 970 * SPECIFIC_RESERVATION by name, specify 971 * "compute.googleapis.com/reservation-name" as the key and specify the name 972 * of your reservation as its value. 973 * </pre> 974 * 975 * <code>string key = 2;</code> 976 * 977 * @param value The key to set. 978 * @return This builder for chaining. 979 */ setKey(java.lang.String value)980 public Builder setKey(java.lang.String value) { 981 if (value == null) { 982 throw new NullPointerException(); 983 } 984 key_ = value; 985 bitField0_ |= 0x00000002; 986 onChanged(); 987 return this; 988 } 989 /** 990 * 991 * 992 * <pre> 993 * Corresponds to the label key of a reservation resource. To target a 994 * SPECIFIC_RESERVATION by name, specify 995 * "compute.googleapis.com/reservation-name" as the key and specify the name 996 * of your reservation as its value. 997 * </pre> 998 * 999 * <code>string key = 2;</code> 1000 * 1001 * @return This builder for chaining. 1002 */ clearKey()1003 public Builder clearKey() { 1004 key_ = getDefaultInstance().getKey(); 1005 bitField0_ = (bitField0_ & ~0x00000002); 1006 onChanged(); 1007 return this; 1008 } 1009 /** 1010 * 1011 * 1012 * <pre> 1013 * Corresponds to the label key of a reservation resource. To target a 1014 * SPECIFIC_RESERVATION by name, specify 1015 * "compute.googleapis.com/reservation-name" as the key and specify the name 1016 * of your reservation as its value. 1017 * </pre> 1018 * 1019 * <code>string key = 2;</code> 1020 * 1021 * @param value The bytes for key to set. 1022 * @return This builder for chaining. 1023 */ setKeyBytes(com.google.protobuf.ByteString value)1024 public Builder setKeyBytes(com.google.protobuf.ByteString value) { 1025 if (value == null) { 1026 throw new NullPointerException(); 1027 } 1028 checkByteStringIsUtf8(value); 1029 key_ = value; 1030 bitField0_ |= 0x00000002; 1031 onChanged(); 1032 return this; 1033 } 1034 1035 private com.google.protobuf.LazyStringList values_ = 1036 com.google.protobuf.LazyStringArrayList.EMPTY; 1037 ensureValuesIsMutable()1038 private void ensureValuesIsMutable() { 1039 if (!((bitField0_ & 0x00000004) != 0)) { 1040 values_ = new com.google.protobuf.LazyStringArrayList(values_); 1041 bitField0_ |= 0x00000004; 1042 } 1043 } 1044 /** 1045 * 1046 * 1047 * <pre> 1048 * Corresponds to the label value(s) of reservation resource(s). 1049 * </pre> 1050 * 1051 * <code>repeated string values = 3;</code> 1052 * 1053 * @return A list containing the values. 1054 */ getValuesList()1055 public com.google.protobuf.ProtocolStringList getValuesList() { 1056 return values_.getUnmodifiableView(); 1057 } 1058 /** 1059 * 1060 * 1061 * <pre> 1062 * Corresponds to the label value(s) of reservation resource(s). 1063 * </pre> 1064 * 1065 * <code>repeated string values = 3;</code> 1066 * 1067 * @return The count of values. 1068 */ getValuesCount()1069 public int getValuesCount() { 1070 return values_.size(); 1071 } 1072 /** 1073 * 1074 * 1075 * <pre> 1076 * Corresponds to the label value(s) of reservation resource(s). 1077 * </pre> 1078 * 1079 * <code>repeated string values = 3;</code> 1080 * 1081 * @param index The index of the element to return. 1082 * @return The values at the given index. 1083 */ getValues(int index)1084 public java.lang.String getValues(int index) { 1085 return values_.get(index); 1086 } 1087 /** 1088 * 1089 * 1090 * <pre> 1091 * Corresponds to the label value(s) of reservation resource(s). 1092 * </pre> 1093 * 1094 * <code>repeated string values = 3;</code> 1095 * 1096 * @param index The index of the value to return. 1097 * @return The bytes of the values at the given index. 1098 */ getValuesBytes(int index)1099 public com.google.protobuf.ByteString getValuesBytes(int index) { 1100 return values_.getByteString(index); 1101 } 1102 /** 1103 * 1104 * 1105 * <pre> 1106 * Corresponds to the label value(s) of reservation resource(s). 1107 * </pre> 1108 * 1109 * <code>repeated string values = 3;</code> 1110 * 1111 * @param index The index to set the value at. 1112 * @param value The values to set. 1113 * @return This builder for chaining. 1114 */ setValues(int index, java.lang.String value)1115 public Builder setValues(int index, java.lang.String value) { 1116 if (value == null) { 1117 throw new NullPointerException(); 1118 } 1119 ensureValuesIsMutable(); 1120 values_.set(index, value); 1121 onChanged(); 1122 return this; 1123 } 1124 /** 1125 * 1126 * 1127 * <pre> 1128 * Corresponds to the label value(s) of reservation resource(s). 1129 * </pre> 1130 * 1131 * <code>repeated string values = 3;</code> 1132 * 1133 * @param value The values to add. 1134 * @return This builder for chaining. 1135 */ addValues(java.lang.String value)1136 public Builder addValues(java.lang.String value) { 1137 if (value == null) { 1138 throw new NullPointerException(); 1139 } 1140 ensureValuesIsMutable(); 1141 values_.add(value); 1142 onChanged(); 1143 return this; 1144 } 1145 /** 1146 * 1147 * 1148 * <pre> 1149 * Corresponds to the label value(s) of reservation resource(s). 1150 * </pre> 1151 * 1152 * <code>repeated string values = 3;</code> 1153 * 1154 * @param values The values to add. 1155 * @return This builder for chaining. 1156 */ addAllValues(java.lang.Iterable<java.lang.String> values)1157 public Builder addAllValues(java.lang.Iterable<java.lang.String> values) { 1158 ensureValuesIsMutable(); 1159 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, values_); 1160 onChanged(); 1161 return this; 1162 } 1163 /** 1164 * 1165 * 1166 * <pre> 1167 * Corresponds to the label value(s) of reservation resource(s). 1168 * </pre> 1169 * 1170 * <code>repeated string values = 3;</code> 1171 * 1172 * @return This builder for chaining. 1173 */ clearValues()1174 public Builder clearValues() { 1175 values_ = com.google.protobuf.LazyStringArrayList.EMPTY; 1176 bitField0_ = (bitField0_ & ~0x00000004); 1177 onChanged(); 1178 return this; 1179 } 1180 /** 1181 * 1182 * 1183 * <pre> 1184 * Corresponds to the label value(s) of reservation resource(s). 1185 * </pre> 1186 * 1187 * <code>repeated string values = 3;</code> 1188 * 1189 * @param value The bytes of the values to add. 1190 * @return This builder for chaining. 1191 */ addValuesBytes(com.google.protobuf.ByteString value)1192 public Builder addValuesBytes(com.google.protobuf.ByteString value) { 1193 if (value == null) { 1194 throw new NullPointerException(); 1195 } 1196 checkByteStringIsUtf8(value); 1197 ensureValuesIsMutable(); 1198 values_.add(value); 1199 onChanged(); 1200 return this; 1201 } 1202 1203 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1204 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1205 return super.setUnknownFields(unknownFields); 1206 } 1207 1208 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1209 public final Builder mergeUnknownFields( 1210 final com.google.protobuf.UnknownFieldSet unknownFields) { 1211 return super.mergeUnknownFields(unknownFields); 1212 } 1213 1214 // @@protoc_insertion_point(builder_scope:google.container.v1.ReservationAffinity) 1215 } 1216 1217 // @@protoc_insertion_point(class_scope:google.container.v1.ReservationAffinity) 1218 private static final com.google.container.v1.ReservationAffinity DEFAULT_INSTANCE; 1219 1220 static { 1221 DEFAULT_INSTANCE = new com.google.container.v1.ReservationAffinity(); 1222 } 1223 getDefaultInstance()1224 public static com.google.container.v1.ReservationAffinity getDefaultInstance() { 1225 return DEFAULT_INSTANCE; 1226 } 1227 1228 private static final com.google.protobuf.Parser<ReservationAffinity> PARSER = 1229 new com.google.protobuf.AbstractParser<ReservationAffinity>() { 1230 @java.lang.Override 1231 public ReservationAffinity parsePartialFrom( 1232 com.google.protobuf.CodedInputStream input, 1233 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1234 throws com.google.protobuf.InvalidProtocolBufferException { 1235 Builder builder = newBuilder(); 1236 try { 1237 builder.mergeFrom(input, extensionRegistry); 1238 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1239 throw e.setUnfinishedMessage(builder.buildPartial()); 1240 } catch (com.google.protobuf.UninitializedMessageException e) { 1241 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1242 } catch (java.io.IOException e) { 1243 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1244 .setUnfinishedMessage(builder.buildPartial()); 1245 } 1246 return builder.buildPartial(); 1247 } 1248 }; 1249 parser()1250 public static com.google.protobuf.Parser<ReservationAffinity> parser() { 1251 return PARSER; 1252 } 1253 1254 @java.lang.Override getParserForType()1255 public com.google.protobuf.Parser<ReservationAffinity> getParserForType() { 1256 return PARSER; 1257 } 1258 1259 @java.lang.Override getDefaultInstanceForType()1260 public com.google.container.v1.ReservationAffinity getDefaultInstanceForType() { 1261 return DEFAULT_INSTANCE; 1262 } 1263 } 1264