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