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 * In contrast to a single BackendService in HttpRouteAction to which all matching traffic is directed to, WeightedBackendService allows traffic to be split across multiple backend services. The volume of traffic for each backend service is proportional to the weight specified in each WeightedBackendService 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.compute.v1.WeightedBackendService} 29 */ 30 public final class WeightedBackendService extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.compute.v1.WeightedBackendService) 33 WeightedBackendServiceOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use WeightedBackendService.newBuilder() to construct. WeightedBackendService(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private WeightedBackendService(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 WeightedBackendService()40 private WeightedBackendService() { 41 backendService_ = ""; 42 } 43 44 @java.lang.Override 45 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)46 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 47 return new WeightedBackendService(); 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_WeightedBackendService_descriptor; 58 } 59 60 @java.lang.Override 61 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()62 internalGetFieldAccessorTable() { 63 return com.google.cloud.compute.v1.Compute 64 .internal_static_google_cloud_compute_v1_WeightedBackendService_fieldAccessorTable 65 .ensureFieldAccessorsInitialized( 66 com.google.cloud.compute.v1.WeightedBackendService.class, 67 com.google.cloud.compute.v1.WeightedBackendService.Builder.class); 68 } 69 70 private int bitField0_; 71 public static final int BACKEND_SERVICE_FIELD_NUMBER = 306946058; 72 73 @SuppressWarnings("serial") 74 private volatile java.lang.Object backendService_ = ""; 75 /** 76 * 77 * 78 * <pre> 79 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 80 * </pre> 81 * 82 * <code>optional string backend_service = 306946058;</code> 83 * 84 * @return Whether the backendService field is set. 85 */ 86 @java.lang.Override hasBackendService()87 public boolean hasBackendService() { 88 return ((bitField0_ & 0x00000001) != 0); 89 } 90 /** 91 * 92 * 93 * <pre> 94 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 95 * </pre> 96 * 97 * <code>optional string backend_service = 306946058;</code> 98 * 99 * @return The backendService. 100 */ 101 @java.lang.Override getBackendService()102 public java.lang.String getBackendService() { 103 java.lang.Object ref = backendService_; 104 if (ref instanceof java.lang.String) { 105 return (java.lang.String) ref; 106 } else { 107 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 108 java.lang.String s = bs.toStringUtf8(); 109 backendService_ = s; 110 return s; 111 } 112 } 113 /** 114 * 115 * 116 * <pre> 117 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 118 * </pre> 119 * 120 * <code>optional string backend_service = 306946058;</code> 121 * 122 * @return The bytes for backendService. 123 */ 124 @java.lang.Override getBackendServiceBytes()125 public com.google.protobuf.ByteString getBackendServiceBytes() { 126 java.lang.Object ref = backendService_; 127 if (ref instanceof java.lang.String) { 128 com.google.protobuf.ByteString b = 129 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 130 backendService_ = b; 131 return b; 132 } else { 133 return (com.google.protobuf.ByteString) ref; 134 } 135 } 136 137 public static final int HEADER_ACTION_FIELD_NUMBER = 328077352; 138 private com.google.cloud.compute.v1.HttpHeaderAction headerAction_; 139 /** 140 * 141 * 142 * <pre> 143 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 144 * </pre> 145 * 146 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 147 * 148 * @return Whether the headerAction field is set. 149 */ 150 @java.lang.Override hasHeaderAction()151 public boolean hasHeaderAction() { 152 return ((bitField0_ & 0x00000002) != 0); 153 } 154 /** 155 * 156 * 157 * <pre> 158 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 159 * </pre> 160 * 161 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 162 * 163 * @return The headerAction. 164 */ 165 @java.lang.Override getHeaderAction()166 public com.google.cloud.compute.v1.HttpHeaderAction getHeaderAction() { 167 return headerAction_ == null 168 ? com.google.cloud.compute.v1.HttpHeaderAction.getDefaultInstance() 169 : headerAction_; 170 } 171 /** 172 * 173 * 174 * <pre> 175 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 176 * </pre> 177 * 178 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 179 */ 180 @java.lang.Override getHeaderActionOrBuilder()181 public com.google.cloud.compute.v1.HttpHeaderActionOrBuilder getHeaderActionOrBuilder() { 182 return headerAction_ == null 183 ? com.google.cloud.compute.v1.HttpHeaderAction.getDefaultInstance() 184 : headerAction_; 185 } 186 187 public static final int WEIGHT_FIELD_NUMBER = 282149496; 188 private int weight_ = 0; 189 /** 190 * 191 * 192 * <pre> 193 * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. The value must be from 0 to 1000. 194 * </pre> 195 * 196 * <code>optional uint32 weight = 282149496;</code> 197 * 198 * @return Whether the weight field is set. 199 */ 200 @java.lang.Override hasWeight()201 public boolean hasWeight() { 202 return ((bitField0_ & 0x00000004) != 0); 203 } 204 /** 205 * 206 * 207 * <pre> 208 * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. The value must be from 0 to 1000. 209 * </pre> 210 * 211 * <code>optional uint32 weight = 282149496;</code> 212 * 213 * @return The weight. 214 */ 215 @java.lang.Override getWeight()216 public int getWeight() { 217 return weight_; 218 } 219 220 private byte memoizedIsInitialized = -1; 221 222 @java.lang.Override isInitialized()223 public final boolean isInitialized() { 224 byte isInitialized = memoizedIsInitialized; 225 if (isInitialized == 1) return true; 226 if (isInitialized == 0) return false; 227 228 memoizedIsInitialized = 1; 229 return true; 230 } 231 232 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)233 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 234 if (((bitField0_ & 0x00000004) != 0)) { 235 output.writeUInt32(282149496, weight_); 236 } 237 if (((bitField0_ & 0x00000001) != 0)) { 238 com.google.protobuf.GeneratedMessageV3.writeString(output, 306946058, backendService_); 239 } 240 if (((bitField0_ & 0x00000002) != 0)) { 241 output.writeMessage(328077352, getHeaderAction()); 242 } 243 getUnknownFields().writeTo(output); 244 } 245 246 @java.lang.Override getSerializedSize()247 public int getSerializedSize() { 248 int size = memoizedSize; 249 if (size != -1) return size; 250 251 size = 0; 252 if (((bitField0_ & 0x00000004) != 0)) { 253 size += com.google.protobuf.CodedOutputStream.computeUInt32Size(282149496, weight_); 254 } 255 if (((bitField0_ & 0x00000001) != 0)) { 256 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(306946058, backendService_); 257 } 258 if (((bitField0_ & 0x00000002) != 0)) { 259 size += 260 com.google.protobuf.CodedOutputStream.computeMessageSize(328077352, getHeaderAction()); 261 } 262 size += getUnknownFields().getSerializedSize(); 263 memoizedSize = size; 264 return size; 265 } 266 267 @java.lang.Override equals(final java.lang.Object obj)268 public boolean equals(final java.lang.Object obj) { 269 if (obj == this) { 270 return true; 271 } 272 if (!(obj instanceof com.google.cloud.compute.v1.WeightedBackendService)) { 273 return super.equals(obj); 274 } 275 com.google.cloud.compute.v1.WeightedBackendService other = 276 (com.google.cloud.compute.v1.WeightedBackendService) obj; 277 278 if (hasBackendService() != other.hasBackendService()) return false; 279 if (hasBackendService()) { 280 if (!getBackendService().equals(other.getBackendService())) return false; 281 } 282 if (hasHeaderAction() != other.hasHeaderAction()) return false; 283 if (hasHeaderAction()) { 284 if (!getHeaderAction().equals(other.getHeaderAction())) return false; 285 } 286 if (hasWeight() != other.hasWeight()) return false; 287 if (hasWeight()) { 288 if (getWeight() != other.getWeight()) return false; 289 } 290 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 291 return true; 292 } 293 294 @java.lang.Override hashCode()295 public int hashCode() { 296 if (memoizedHashCode != 0) { 297 return memoizedHashCode; 298 } 299 int hash = 41; 300 hash = (19 * hash) + getDescriptor().hashCode(); 301 if (hasBackendService()) { 302 hash = (37 * hash) + BACKEND_SERVICE_FIELD_NUMBER; 303 hash = (53 * hash) + getBackendService().hashCode(); 304 } 305 if (hasHeaderAction()) { 306 hash = (37 * hash) + HEADER_ACTION_FIELD_NUMBER; 307 hash = (53 * hash) + getHeaderAction().hashCode(); 308 } 309 if (hasWeight()) { 310 hash = (37 * hash) + WEIGHT_FIELD_NUMBER; 311 hash = (53 * hash) + getWeight(); 312 } 313 hash = (29 * hash) + getUnknownFields().hashCode(); 314 memoizedHashCode = hash; 315 return hash; 316 } 317 parseFrom( java.nio.ByteBuffer data)318 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 319 java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { 320 return PARSER.parseFrom(data); 321 } 322 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)323 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 324 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 325 throws com.google.protobuf.InvalidProtocolBufferException { 326 return PARSER.parseFrom(data, extensionRegistry); 327 } 328 parseFrom( com.google.protobuf.ByteString data)329 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 330 com.google.protobuf.ByteString data) 331 throws com.google.protobuf.InvalidProtocolBufferException { 332 return PARSER.parseFrom(data); 333 } 334 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)335 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 336 com.google.protobuf.ByteString data, 337 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 338 throws com.google.protobuf.InvalidProtocolBufferException { 339 return PARSER.parseFrom(data, extensionRegistry); 340 } 341 parseFrom(byte[] data)342 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom(byte[] data) 343 throws com.google.protobuf.InvalidProtocolBufferException { 344 return PARSER.parseFrom(data); 345 } 346 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)347 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 348 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 349 throws com.google.protobuf.InvalidProtocolBufferException { 350 return PARSER.parseFrom(data, extensionRegistry); 351 } 352 parseFrom( java.io.InputStream input)353 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 354 java.io.InputStream input) throws java.io.IOException { 355 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 356 } 357 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)358 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 359 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 360 throws java.io.IOException { 361 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 362 PARSER, input, extensionRegistry); 363 } 364 parseDelimitedFrom( java.io.InputStream input)365 public static com.google.cloud.compute.v1.WeightedBackendService parseDelimitedFrom( 366 java.io.InputStream input) throws java.io.IOException { 367 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 368 } 369 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)370 public static com.google.cloud.compute.v1.WeightedBackendService parseDelimitedFrom( 371 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 372 throws java.io.IOException { 373 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 374 PARSER, input, extensionRegistry); 375 } 376 parseFrom( com.google.protobuf.CodedInputStream input)377 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 378 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 379 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 380 } 381 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)382 public static com.google.cloud.compute.v1.WeightedBackendService parseFrom( 383 com.google.protobuf.CodedInputStream input, 384 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 385 throws java.io.IOException { 386 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 387 PARSER, input, extensionRegistry); 388 } 389 390 @java.lang.Override newBuilderForType()391 public Builder newBuilderForType() { 392 return newBuilder(); 393 } 394 newBuilder()395 public static Builder newBuilder() { 396 return DEFAULT_INSTANCE.toBuilder(); 397 } 398 newBuilder(com.google.cloud.compute.v1.WeightedBackendService prototype)399 public static Builder newBuilder(com.google.cloud.compute.v1.WeightedBackendService prototype) { 400 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 401 } 402 403 @java.lang.Override toBuilder()404 public Builder toBuilder() { 405 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 406 } 407 408 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)409 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 410 Builder builder = new Builder(parent); 411 return builder; 412 } 413 /** 414 * 415 * 416 * <pre> 417 * In contrast to a single BackendService in HttpRouteAction to which all matching traffic is directed to, WeightedBackendService allows traffic to be split across multiple backend services. The volume of traffic for each backend service is proportional to the weight specified in each WeightedBackendService 418 * </pre> 419 * 420 * Protobuf type {@code google.cloud.compute.v1.WeightedBackendService} 421 */ 422 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 423 implements 424 // @@protoc_insertion_point(builder_implements:google.cloud.compute.v1.WeightedBackendService) 425 com.google.cloud.compute.v1.WeightedBackendServiceOrBuilder { getDescriptor()426 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 427 return com.google.cloud.compute.v1.Compute 428 .internal_static_google_cloud_compute_v1_WeightedBackendService_descriptor; 429 } 430 431 @java.lang.Override 432 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()433 internalGetFieldAccessorTable() { 434 return com.google.cloud.compute.v1.Compute 435 .internal_static_google_cloud_compute_v1_WeightedBackendService_fieldAccessorTable 436 .ensureFieldAccessorsInitialized( 437 com.google.cloud.compute.v1.WeightedBackendService.class, 438 com.google.cloud.compute.v1.WeightedBackendService.Builder.class); 439 } 440 441 // Construct using com.google.cloud.compute.v1.WeightedBackendService.newBuilder() Builder()442 private Builder() { 443 maybeForceBuilderInitialization(); 444 } 445 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)446 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 447 super(parent); 448 maybeForceBuilderInitialization(); 449 } 450 maybeForceBuilderInitialization()451 private void maybeForceBuilderInitialization() { 452 if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { 453 getHeaderActionFieldBuilder(); 454 } 455 } 456 457 @java.lang.Override clear()458 public Builder clear() { 459 super.clear(); 460 bitField0_ = 0; 461 backendService_ = ""; 462 headerAction_ = null; 463 if (headerActionBuilder_ != null) { 464 headerActionBuilder_.dispose(); 465 headerActionBuilder_ = null; 466 } 467 weight_ = 0; 468 return this; 469 } 470 471 @java.lang.Override getDescriptorForType()472 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 473 return com.google.cloud.compute.v1.Compute 474 .internal_static_google_cloud_compute_v1_WeightedBackendService_descriptor; 475 } 476 477 @java.lang.Override getDefaultInstanceForType()478 public com.google.cloud.compute.v1.WeightedBackendService getDefaultInstanceForType() { 479 return com.google.cloud.compute.v1.WeightedBackendService.getDefaultInstance(); 480 } 481 482 @java.lang.Override build()483 public com.google.cloud.compute.v1.WeightedBackendService build() { 484 com.google.cloud.compute.v1.WeightedBackendService result = buildPartial(); 485 if (!result.isInitialized()) { 486 throw newUninitializedMessageException(result); 487 } 488 return result; 489 } 490 491 @java.lang.Override buildPartial()492 public com.google.cloud.compute.v1.WeightedBackendService buildPartial() { 493 com.google.cloud.compute.v1.WeightedBackendService result = 494 new com.google.cloud.compute.v1.WeightedBackendService(this); 495 if (bitField0_ != 0) { 496 buildPartial0(result); 497 } 498 onBuilt(); 499 return result; 500 } 501 buildPartial0(com.google.cloud.compute.v1.WeightedBackendService result)502 private void buildPartial0(com.google.cloud.compute.v1.WeightedBackendService result) { 503 int from_bitField0_ = bitField0_; 504 int to_bitField0_ = 0; 505 if (((from_bitField0_ & 0x00000001) != 0)) { 506 result.backendService_ = backendService_; 507 to_bitField0_ |= 0x00000001; 508 } 509 if (((from_bitField0_ & 0x00000002) != 0)) { 510 result.headerAction_ = 511 headerActionBuilder_ == null ? headerAction_ : headerActionBuilder_.build(); 512 to_bitField0_ |= 0x00000002; 513 } 514 if (((from_bitField0_ & 0x00000004) != 0)) { 515 result.weight_ = weight_; 516 to_bitField0_ |= 0x00000004; 517 } 518 result.bitField0_ |= to_bitField0_; 519 } 520 521 @java.lang.Override clone()522 public Builder clone() { 523 return super.clone(); 524 } 525 526 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)527 public Builder setField( 528 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 529 return super.setField(field, value); 530 } 531 532 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)533 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 534 return super.clearField(field); 535 } 536 537 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)538 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 539 return super.clearOneof(oneof); 540 } 541 542 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)543 public Builder setRepeatedField( 544 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 545 return super.setRepeatedField(field, index, value); 546 } 547 548 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)549 public Builder addRepeatedField( 550 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 551 return super.addRepeatedField(field, value); 552 } 553 554 @java.lang.Override mergeFrom(com.google.protobuf.Message other)555 public Builder mergeFrom(com.google.protobuf.Message other) { 556 if (other instanceof com.google.cloud.compute.v1.WeightedBackendService) { 557 return mergeFrom((com.google.cloud.compute.v1.WeightedBackendService) other); 558 } else { 559 super.mergeFrom(other); 560 return this; 561 } 562 } 563 mergeFrom(com.google.cloud.compute.v1.WeightedBackendService other)564 public Builder mergeFrom(com.google.cloud.compute.v1.WeightedBackendService other) { 565 if (other == com.google.cloud.compute.v1.WeightedBackendService.getDefaultInstance()) 566 return this; 567 if (other.hasBackendService()) { 568 backendService_ = other.backendService_; 569 bitField0_ |= 0x00000001; 570 onChanged(); 571 } 572 if (other.hasHeaderAction()) { 573 mergeHeaderAction(other.getHeaderAction()); 574 } 575 if (other.hasWeight()) { 576 setWeight(other.getWeight()); 577 } 578 this.mergeUnknownFields(other.getUnknownFields()); 579 onChanged(); 580 return this; 581 } 582 583 @java.lang.Override isInitialized()584 public final boolean isInitialized() { 585 return true; 586 } 587 588 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)589 public Builder mergeFrom( 590 com.google.protobuf.CodedInputStream input, 591 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 592 throws java.io.IOException { 593 if (extensionRegistry == null) { 594 throw new java.lang.NullPointerException(); 595 } 596 try { 597 boolean done = false; 598 while (!done) { 599 int tag = input.readTag(); 600 switch (tag) { 601 case 0: 602 done = true; 603 break; 604 case -2037771328: 605 { 606 weight_ = input.readUInt32(); 607 bitField0_ |= 0x00000004; 608 break; 609 } // case -2037771328 610 case -1839398830: 611 { 612 backendService_ = input.readStringRequireUtf8(); 613 bitField0_ |= 0x00000001; 614 break; 615 } // case -1839398830 616 case -1670348478: 617 { 618 input.readMessage(getHeaderActionFieldBuilder().getBuilder(), extensionRegistry); 619 bitField0_ |= 0x00000002; 620 break; 621 } // case -1670348478 622 default: 623 { 624 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 625 done = true; // was an endgroup tag 626 } 627 break; 628 } // default: 629 } // switch (tag) 630 } // while (!done) 631 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 632 throw e.unwrapIOException(); 633 } finally { 634 onChanged(); 635 } // finally 636 return this; 637 } 638 639 private int bitField0_; 640 641 private java.lang.Object backendService_ = ""; 642 /** 643 * 644 * 645 * <pre> 646 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 647 * </pre> 648 * 649 * <code>optional string backend_service = 306946058;</code> 650 * 651 * @return Whether the backendService field is set. 652 */ hasBackendService()653 public boolean hasBackendService() { 654 return ((bitField0_ & 0x00000001) != 0); 655 } 656 /** 657 * 658 * 659 * <pre> 660 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 661 * </pre> 662 * 663 * <code>optional string backend_service = 306946058;</code> 664 * 665 * @return The backendService. 666 */ getBackendService()667 public java.lang.String getBackendService() { 668 java.lang.Object ref = backendService_; 669 if (!(ref instanceof java.lang.String)) { 670 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 671 java.lang.String s = bs.toStringUtf8(); 672 backendService_ = s; 673 return s; 674 } else { 675 return (java.lang.String) ref; 676 } 677 } 678 /** 679 * 680 * 681 * <pre> 682 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 683 * </pre> 684 * 685 * <code>optional string backend_service = 306946058;</code> 686 * 687 * @return The bytes for backendService. 688 */ getBackendServiceBytes()689 public com.google.protobuf.ByteString getBackendServiceBytes() { 690 java.lang.Object ref = backendService_; 691 if (ref instanceof String) { 692 com.google.protobuf.ByteString b = 693 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 694 backendService_ = b; 695 return b; 696 } else { 697 return (com.google.protobuf.ByteString) ref; 698 } 699 } 700 /** 701 * 702 * 703 * <pre> 704 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 705 * </pre> 706 * 707 * <code>optional string backend_service = 306946058;</code> 708 * 709 * @param value The backendService to set. 710 * @return This builder for chaining. 711 */ setBackendService(java.lang.String value)712 public Builder setBackendService(java.lang.String value) { 713 if (value == null) { 714 throw new NullPointerException(); 715 } 716 backendService_ = value; 717 bitField0_ |= 0x00000001; 718 onChanged(); 719 return this; 720 } 721 /** 722 * 723 * 724 * <pre> 725 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 726 * </pre> 727 * 728 * <code>optional string backend_service = 306946058;</code> 729 * 730 * @return This builder for chaining. 731 */ clearBackendService()732 public Builder clearBackendService() { 733 backendService_ = getDefaultInstance().getBackendService(); 734 bitField0_ = (bitField0_ & ~0x00000001); 735 onChanged(); 736 return this; 737 } 738 /** 739 * 740 * 741 * <pre> 742 * The full or partial URL to the default BackendService resource. Before forwarding the request to backendService, the load balancer applies any relevant headerActions specified as part of this backendServiceWeight. 743 * </pre> 744 * 745 * <code>optional string backend_service = 306946058;</code> 746 * 747 * @param value The bytes for backendService to set. 748 * @return This builder for chaining. 749 */ setBackendServiceBytes(com.google.protobuf.ByteString value)750 public Builder setBackendServiceBytes(com.google.protobuf.ByteString value) { 751 if (value == null) { 752 throw new NullPointerException(); 753 } 754 checkByteStringIsUtf8(value); 755 backendService_ = value; 756 bitField0_ |= 0x00000001; 757 onChanged(); 758 return this; 759 } 760 761 private com.google.cloud.compute.v1.HttpHeaderAction headerAction_; 762 private com.google.protobuf.SingleFieldBuilderV3< 763 com.google.cloud.compute.v1.HttpHeaderAction, 764 com.google.cloud.compute.v1.HttpHeaderAction.Builder, 765 com.google.cloud.compute.v1.HttpHeaderActionOrBuilder> 766 headerActionBuilder_; 767 /** 768 * 769 * 770 * <pre> 771 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 772 * </pre> 773 * 774 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 775 * 776 * @return Whether the headerAction field is set. 777 */ hasHeaderAction()778 public boolean hasHeaderAction() { 779 return ((bitField0_ & 0x00000002) != 0); 780 } 781 /** 782 * 783 * 784 * <pre> 785 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 786 * </pre> 787 * 788 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 789 * 790 * @return The headerAction. 791 */ getHeaderAction()792 public com.google.cloud.compute.v1.HttpHeaderAction getHeaderAction() { 793 if (headerActionBuilder_ == null) { 794 return headerAction_ == null 795 ? com.google.cloud.compute.v1.HttpHeaderAction.getDefaultInstance() 796 : headerAction_; 797 } else { 798 return headerActionBuilder_.getMessage(); 799 } 800 } 801 /** 802 * 803 * 804 * <pre> 805 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 806 * </pre> 807 * 808 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 809 */ setHeaderAction(com.google.cloud.compute.v1.HttpHeaderAction value)810 public Builder setHeaderAction(com.google.cloud.compute.v1.HttpHeaderAction value) { 811 if (headerActionBuilder_ == null) { 812 if (value == null) { 813 throw new NullPointerException(); 814 } 815 headerAction_ = value; 816 } else { 817 headerActionBuilder_.setMessage(value); 818 } 819 bitField0_ |= 0x00000002; 820 onChanged(); 821 return this; 822 } 823 /** 824 * 825 * 826 * <pre> 827 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 828 * </pre> 829 * 830 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 831 */ setHeaderAction( com.google.cloud.compute.v1.HttpHeaderAction.Builder builderForValue)832 public Builder setHeaderAction( 833 com.google.cloud.compute.v1.HttpHeaderAction.Builder builderForValue) { 834 if (headerActionBuilder_ == null) { 835 headerAction_ = builderForValue.build(); 836 } else { 837 headerActionBuilder_.setMessage(builderForValue.build()); 838 } 839 bitField0_ |= 0x00000002; 840 onChanged(); 841 return this; 842 } 843 /** 844 * 845 * 846 * <pre> 847 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 848 * </pre> 849 * 850 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 851 */ mergeHeaderAction(com.google.cloud.compute.v1.HttpHeaderAction value)852 public Builder mergeHeaderAction(com.google.cloud.compute.v1.HttpHeaderAction value) { 853 if (headerActionBuilder_ == null) { 854 if (((bitField0_ & 0x00000002) != 0) 855 && headerAction_ != null 856 && headerAction_ != com.google.cloud.compute.v1.HttpHeaderAction.getDefaultInstance()) { 857 getHeaderActionBuilder().mergeFrom(value); 858 } else { 859 headerAction_ = value; 860 } 861 } else { 862 headerActionBuilder_.mergeFrom(value); 863 } 864 bitField0_ |= 0x00000002; 865 onChanged(); 866 return this; 867 } 868 /** 869 * 870 * 871 * <pre> 872 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 873 * </pre> 874 * 875 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 876 */ clearHeaderAction()877 public Builder clearHeaderAction() { 878 bitField0_ = (bitField0_ & ~0x00000002); 879 headerAction_ = null; 880 if (headerActionBuilder_ != null) { 881 headerActionBuilder_.dispose(); 882 headerActionBuilder_ = null; 883 } 884 onChanged(); 885 return this; 886 } 887 /** 888 * 889 * 890 * <pre> 891 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 892 * </pre> 893 * 894 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 895 */ getHeaderActionBuilder()896 public com.google.cloud.compute.v1.HttpHeaderAction.Builder getHeaderActionBuilder() { 897 bitField0_ |= 0x00000002; 898 onChanged(); 899 return getHeaderActionFieldBuilder().getBuilder(); 900 } 901 /** 902 * 903 * 904 * <pre> 905 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 906 * </pre> 907 * 908 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 909 */ getHeaderActionOrBuilder()910 public com.google.cloud.compute.v1.HttpHeaderActionOrBuilder getHeaderActionOrBuilder() { 911 if (headerActionBuilder_ != null) { 912 return headerActionBuilder_.getMessageOrBuilder(); 913 } else { 914 return headerAction_ == null 915 ? com.google.cloud.compute.v1.HttpHeaderAction.getDefaultInstance() 916 : headerAction_; 917 } 918 } 919 /** 920 * 921 * 922 * <pre> 923 * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. 924 * </pre> 925 * 926 * <code>optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352;</code> 927 */ 928 private com.google.protobuf.SingleFieldBuilderV3< 929 com.google.cloud.compute.v1.HttpHeaderAction, 930 com.google.cloud.compute.v1.HttpHeaderAction.Builder, 931 com.google.cloud.compute.v1.HttpHeaderActionOrBuilder> getHeaderActionFieldBuilder()932 getHeaderActionFieldBuilder() { 933 if (headerActionBuilder_ == null) { 934 headerActionBuilder_ = 935 new com.google.protobuf.SingleFieldBuilderV3< 936 com.google.cloud.compute.v1.HttpHeaderAction, 937 com.google.cloud.compute.v1.HttpHeaderAction.Builder, 938 com.google.cloud.compute.v1.HttpHeaderActionOrBuilder>( 939 getHeaderAction(), getParentForChildren(), isClean()); 940 headerAction_ = null; 941 } 942 return headerActionBuilder_; 943 } 944 945 private int weight_; 946 /** 947 * 948 * 949 * <pre> 950 * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. The value must be from 0 to 1000. 951 * </pre> 952 * 953 * <code>optional uint32 weight = 282149496;</code> 954 * 955 * @return Whether the weight field is set. 956 */ 957 @java.lang.Override hasWeight()958 public boolean hasWeight() { 959 return ((bitField0_ & 0x00000004) != 0); 960 } 961 /** 962 * 963 * 964 * <pre> 965 * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. The value must be from 0 to 1000. 966 * </pre> 967 * 968 * <code>optional uint32 weight = 282149496;</code> 969 * 970 * @return The weight. 971 */ 972 @java.lang.Override getWeight()973 public int getWeight() { 974 return weight_; 975 } 976 /** 977 * 978 * 979 * <pre> 980 * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. The value must be from 0 to 1000. 981 * </pre> 982 * 983 * <code>optional uint32 weight = 282149496;</code> 984 * 985 * @param value The weight to set. 986 * @return This builder for chaining. 987 */ setWeight(int value)988 public Builder setWeight(int value) { 989 990 weight_ = value; 991 bitField0_ |= 0x00000004; 992 onChanged(); 993 return this; 994 } 995 /** 996 * 997 * 998 * <pre> 999 * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. The value must be from 0 to 1000. 1000 * </pre> 1001 * 1002 * <code>optional uint32 weight = 282149496;</code> 1003 * 1004 * @return This builder for chaining. 1005 */ clearWeight()1006 public Builder clearWeight() { 1007 bitField0_ = (bitField0_ & ~0x00000004); 1008 weight_ = 0; 1009 onChanged(); 1010 return this; 1011 } 1012 1013 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)1014 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 1015 return super.setUnknownFields(unknownFields); 1016 } 1017 1018 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)1019 public final Builder mergeUnknownFields( 1020 final com.google.protobuf.UnknownFieldSet unknownFields) { 1021 return super.mergeUnknownFields(unknownFields); 1022 } 1023 1024 // @@protoc_insertion_point(builder_scope:google.cloud.compute.v1.WeightedBackendService) 1025 } 1026 1027 // @@protoc_insertion_point(class_scope:google.cloud.compute.v1.WeightedBackendService) 1028 private static final com.google.cloud.compute.v1.WeightedBackendService DEFAULT_INSTANCE; 1029 1030 static { 1031 DEFAULT_INSTANCE = new com.google.cloud.compute.v1.WeightedBackendService(); 1032 } 1033 getDefaultInstance()1034 public static com.google.cloud.compute.v1.WeightedBackendService getDefaultInstance() { 1035 return DEFAULT_INSTANCE; 1036 } 1037 1038 private static final com.google.protobuf.Parser<WeightedBackendService> PARSER = 1039 new com.google.protobuf.AbstractParser<WeightedBackendService>() { 1040 @java.lang.Override 1041 public WeightedBackendService parsePartialFrom( 1042 com.google.protobuf.CodedInputStream input, 1043 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1044 throws com.google.protobuf.InvalidProtocolBufferException { 1045 Builder builder = newBuilder(); 1046 try { 1047 builder.mergeFrom(input, extensionRegistry); 1048 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1049 throw e.setUnfinishedMessage(builder.buildPartial()); 1050 } catch (com.google.protobuf.UninitializedMessageException e) { 1051 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1052 } catch (java.io.IOException e) { 1053 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1054 .setUnfinishedMessage(builder.buildPartial()); 1055 } 1056 return builder.buildPartial(); 1057 } 1058 }; 1059 parser()1060 public static com.google.protobuf.Parser<WeightedBackendService> parser() { 1061 return PARSER; 1062 } 1063 1064 @java.lang.Override getParserForType()1065 public com.google.protobuf.Parser<WeightedBackendService> getParserForType() { 1066 return PARSER; 1067 } 1068 1069 @java.lang.Override getDefaultInstanceForType()1070 public com.google.cloud.compute.v1.WeightedBackendService getDefaultInstanceForType() { 1071 return DEFAULT_INSTANCE; 1072 } 1073 } 1074