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/api/monitored_resource.proto 18 19 package com.google.api; 20 21 /** 22 * 23 * 24 * <pre> 25 * An object representing a resource that can be used for monitoring, logging, 26 * billing, or other purposes. Examples include virtual machine instances, 27 * databases, and storage devices such as disks. The `type` field identifies a 28 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object 29 * that describes the resource's schema. Information in the `labels` field 30 * identifies the actual resource and its attributes according to the schema. 31 * For example, a particular Compute Engine VM instance could be represented by 32 * the following object, because the 33 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for 34 * `"gce_instance"` has labels 35 * `"project_id"`, `"instance_id"` and `"zone"`: 36 * { "type": "gce_instance", 37 * "labels": { "project_id": "my-project", 38 * "instance_id": "12345678901234", 39 * "zone": "us-central1-a" }} 40 * </pre> 41 * 42 * Protobuf type {@code google.api.MonitoredResource} 43 */ 44 public final class MonitoredResource extends com.google.protobuf.GeneratedMessageV3 45 implements 46 // @@protoc_insertion_point(message_implements:google.api.MonitoredResource) 47 MonitoredResourceOrBuilder { 48 private static final long serialVersionUID = 0L; 49 // Use MonitoredResource.newBuilder() to construct. MonitoredResource(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)50 private MonitoredResource(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 51 super(builder); 52 } 53 MonitoredResource()54 private MonitoredResource() { 55 type_ = ""; 56 } 57 58 @java.lang.Override 59 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)60 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 61 return new MonitoredResource(); 62 } 63 64 @java.lang.Override getUnknownFields()65 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 66 return this.unknownFields; 67 } 68 getDescriptor()69 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 70 return com.google.api.MonitoredResourceProto 71 .internal_static_google_api_MonitoredResource_descriptor; 72 } 73 74 @SuppressWarnings({"rawtypes"}) 75 @java.lang.Override internalGetMapField(int number)76 protected com.google.protobuf.MapField internalGetMapField(int number) { 77 switch (number) { 78 case 2: 79 return internalGetLabels(); 80 default: 81 throw new RuntimeException("Invalid map field number: " + number); 82 } 83 } 84 85 @java.lang.Override 86 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()87 internalGetFieldAccessorTable() { 88 return com.google.api.MonitoredResourceProto 89 .internal_static_google_api_MonitoredResource_fieldAccessorTable 90 .ensureFieldAccessorsInitialized( 91 com.google.api.MonitoredResource.class, com.google.api.MonitoredResource.Builder.class); 92 } 93 94 public static final int TYPE_FIELD_NUMBER = 1; 95 96 @SuppressWarnings("serial") 97 private volatile java.lang.Object type_ = ""; 98 /** 99 * 100 * 101 * <pre> 102 * Required. The monitored resource type. This field must match 103 * the `type` field of a 104 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 105 * object. For example, the type of a Compute Engine VM instance is 106 * `gce_instance`. Some descriptors include the service name in the type; for 107 * example, the type of a Datastream stream is 108 * `datastream.googleapis.com/Stream`. 109 * </pre> 110 * 111 * <code>string type = 1;</code> 112 * 113 * @return The type. 114 */ 115 @java.lang.Override getType()116 public java.lang.String getType() { 117 java.lang.Object ref = type_; 118 if (ref instanceof java.lang.String) { 119 return (java.lang.String) ref; 120 } else { 121 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 122 java.lang.String s = bs.toStringUtf8(); 123 type_ = s; 124 return s; 125 } 126 } 127 /** 128 * 129 * 130 * <pre> 131 * Required. The monitored resource type. This field must match 132 * the `type` field of a 133 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 134 * object. For example, the type of a Compute Engine VM instance is 135 * `gce_instance`. Some descriptors include the service name in the type; for 136 * example, the type of a Datastream stream is 137 * `datastream.googleapis.com/Stream`. 138 * </pre> 139 * 140 * <code>string type = 1;</code> 141 * 142 * @return The bytes for type. 143 */ 144 @java.lang.Override getTypeBytes()145 public com.google.protobuf.ByteString getTypeBytes() { 146 java.lang.Object ref = type_; 147 if (ref instanceof java.lang.String) { 148 com.google.protobuf.ByteString b = 149 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 150 type_ = b; 151 return b; 152 } else { 153 return (com.google.protobuf.ByteString) ref; 154 } 155 } 156 157 public static final int LABELS_FIELD_NUMBER = 2; 158 159 private static final class LabelsDefaultEntryHolder { 160 static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry = 161 com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance( 162 com.google.api.MonitoredResourceProto 163 .internal_static_google_api_MonitoredResource_LabelsEntry_descriptor, 164 com.google.protobuf.WireFormat.FieldType.STRING, 165 "", 166 com.google.protobuf.WireFormat.FieldType.STRING, 167 ""); 168 } 169 170 @SuppressWarnings("serial") 171 private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_; 172 internalGetLabels()173 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() { 174 if (labels_ == null) { 175 return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); 176 } 177 return labels_; 178 } 179 getLabelsCount()180 public int getLabelsCount() { 181 return internalGetLabels().getMap().size(); 182 } 183 /** 184 * 185 * 186 * <pre> 187 * Required. Values for all of the labels listed in the associated monitored 188 * resource descriptor. For example, Compute Engine VM instances use the 189 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 190 * </pre> 191 * 192 * <code>map<string, string> labels = 2;</code> 193 */ 194 @java.lang.Override containsLabels(java.lang.String key)195 public boolean containsLabels(java.lang.String key) { 196 if (key == null) { 197 throw new NullPointerException("map key"); 198 } 199 return internalGetLabels().getMap().containsKey(key); 200 } 201 /** Use {@link #getLabelsMap()} instead. */ 202 @java.lang.Override 203 @java.lang.Deprecated getLabels()204 public java.util.Map<java.lang.String, java.lang.String> getLabels() { 205 return getLabelsMap(); 206 } 207 /** 208 * 209 * 210 * <pre> 211 * Required. Values for all of the labels listed in the associated monitored 212 * resource descriptor. For example, Compute Engine VM instances use the 213 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 214 * </pre> 215 * 216 * <code>map<string, string> labels = 2;</code> 217 */ 218 @java.lang.Override getLabelsMap()219 public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() { 220 return internalGetLabels().getMap(); 221 } 222 /** 223 * 224 * 225 * <pre> 226 * Required. Values for all of the labels listed in the associated monitored 227 * resource descriptor. For example, Compute Engine VM instances use the 228 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 229 * </pre> 230 * 231 * <code>map<string, string> labels = 2;</code> 232 */ 233 @java.lang.Override getLabelsOrDefault( java.lang.String key, java.lang.String defaultValue)234 public /* nullable */ java.lang.String getLabelsOrDefault( 235 java.lang.String key, 236 /* nullable */ 237 java.lang.String defaultValue) { 238 if (key == null) { 239 throw new NullPointerException("map key"); 240 } 241 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 242 return map.containsKey(key) ? map.get(key) : defaultValue; 243 } 244 /** 245 * 246 * 247 * <pre> 248 * Required. Values for all of the labels listed in the associated monitored 249 * resource descriptor. For example, Compute Engine VM instances use the 250 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 251 * </pre> 252 * 253 * <code>map<string, string> labels = 2;</code> 254 */ 255 @java.lang.Override getLabelsOrThrow(java.lang.String key)256 public java.lang.String getLabelsOrThrow(java.lang.String key) { 257 if (key == null) { 258 throw new NullPointerException("map key"); 259 } 260 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 261 if (!map.containsKey(key)) { 262 throw new java.lang.IllegalArgumentException(); 263 } 264 return map.get(key); 265 } 266 267 private byte memoizedIsInitialized = -1; 268 269 @java.lang.Override isInitialized()270 public final boolean isInitialized() { 271 byte isInitialized = memoizedIsInitialized; 272 if (isInitialized == 1) return true; 273 if (isInitialized == 0) return false; 274 275 memoizedIsInitialized = 1; 276 return true; 277 } 278 279 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)280 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 281 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) { 282 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, type_); 283 } 284 com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( 285 output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 2); 286 getUnknownFields().writeTo(output); 287 } 288 289 @java.lang.Override getSerializedSize()290 public int getSerializedSize() { 291 int size = memoizedSize; 292 if (size != -1) return size; 293 294 size = 0; 295 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) { 296 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, type_); 297 } 298 for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : 299 internalGetLabels().getMap().entrySet()) { 300 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ = 301 LabelsDefaultEntryHolder.defaultEntry 302 .newBuilderForType() 303 .setKey(entry.getKey()) 304 .setValue(entry.getValue()) 305 .build(); 306 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, labels__); 307 } 308 size += getUnknownFields().getSerializedSize(); 309 memoizedSize = size; 310 return size; 311 } 312 313 @java.lang.Override equals(final java.lang.Object obj)314 public boolean equals(final java.lang.Object obj) { 315 if (obj == this) { 316 return true; 317 } 318 if (!(obj instanceof com.google.api.MonitoredResource)) { 319 return super.equals(obj); 320 } 321 com.google.api.MonitoredResource other = (com.google.api.MonitoredResource) obj; 322 323 if (!getType().equals(other.getType())) return false; 324 if (!internalGetLabels().equals(other.internalGetLabels())) return false; 325 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 326 return true; 327 } 328 329 @java.lang.Override hashCode()330 public int hashCode() { 331 if (memoizedHashCode != 0) { 332 return memoizedHashCode; 333 } 334 int hash = 41; 335 hash = (19 * hash) + getDescriptor().hashCode(); 336 hash = (37 * hash) + TYPE_FIELD_NUMBER; 337 hash = (53 * hash) + getType().hashCode(); 338 if (!internalGetLabels().getMap().isEmpty()) { 339 hash = (37 * hash) + LABELS_FIELD_NUMBER; 340 hash = (53 * hash) + internalGetLabels().hashCode(); 341 } 342 hash = (29 * hash) + getUnknownFields().hashCode(); 343 memoizedHashCode = hash; 344 return hash; 345 } 346 parseFrom(java.nio.ByteBuffer data)347 public static com.google.api.MonitoredResource parseFrom(java.nio.ByteBuffer data) 348 throws com.google.protobuf.InvalidProtocolBufferException { 349 return PARSER.parseFrom(data); 350 } 351 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)352 public static com.google.api.MonitoredResource parseFrom( 353 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 354 throws com.google.protobuf.InvalidProtocolBufferException { 355 return PARSER.parseFrom(data, extensionRegistry); 356 } 357 parseFrom(com.google.protobuf.ByteString data)358 public static com.google.api.MonitoredResource parseFrom(com.google.protobuf.ByteString data) 359 throws com.google.protobuf.InvalidProtocolBufferException { 360 return PARSER.parseFrom(data); 361 } 362 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)363 public static com.google.api.MonitoredResource parseFrom( 364 com.google.protobuf.ByteString data, 365 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 366 throws com.google.protobuf.InvalidProtocolBufferException { 367 return PARSER.parseFrom(data, extensionRegistry); 368 } 369 parseFrom(byte[] data)370 public static com.google.api.MonitoredResource parseFrom(byte[] data) 371 throws com.google.protobuf.InvalidProtocolBufferException { 372 return PARSER.parseFrom(data); 373 } 374 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)375 public static com.google.api.MonitoredResource parseFrom( 376 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 377 throws com.google.protobuf.InvalidProtocolBufferException { 378 return PARSER.parseFrom(data, extensionRegistry); 379 } 380 parseFrom(java.io.InputStream input)381 public static com.google.api.MonitoredResource parseFrom(java.io.InputStream input) 382 throws java.io.IOException { 383 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 384 } 385 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)386 public static com.google.api.MonitoredResource parseFrom( 387 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 388 throws java.io.IOException { 389 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 390 PARSER, input, extensionRegistry); 391 } 392 parseDelimitedFrom(java.io.InputStream input)393 public static com.google.api.MonitoredResource parseDelimitedFrom(java.io.InputStream input) 394 throws java.io.IOException { 395 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 396 } 397 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)398 public static com.google.api.MonitoredResource parseDelimitedFrom( 399 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 400 throws java.io.IOException { 401 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 402 PARSER, input, extensionRegistry); 403 } 404 parseFrom( com.google.protobuf.CodedInputStream input)405 public static com.google.api.MonitoredResource parseFrom( 406 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 407 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 408 } 409 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)410 public static com.google.api.MonitoredResource parseFrom( 411 com.google.protobuf.CodedInputStream input, 412 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 413 throws java.io.IOException { 414 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 415 PARSER, input, extensionRegistry); 416 } 417 418 @java.lang.Override newBuilderForType()419 public Builder newBuilderForType() { 420 return newBuilder(); 421 } 422 newBuilder()423 public static Builder newBuilder() { 424 return DEFAULT_INSTANCE.toBuilder(); 425 } 426 newBuilder(com.google.api.MonitoredResource prototype)427 public static Builder newBuilder(com.google.api.MonitoredResource prototype) { 428 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 429 } 430 431 @java.lang.Override toBuilder()432 public Builder toBuilder() { 433 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 434 } 435 436 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)437 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 438 Builder builder = new Builder(parent); 439 return builder; 440 } 441 /** 442 * 443 * 444 * <pre> 445 * An object representing a resource that can be used for monitoring, logging, 446 * billing, or other purposes. Examples include virtual machine instances, 447 * databases, and storage devices such as disks. The `type` field identifies a 448 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object 449 * that describes the resource's schema. Information in the `labels` field 450 * identifies the actual resource and its attributes according to the schema. 451 * For example, a particular Compute Engine VM instance could be represented by 452 * the following object, because the 453 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for 454 * `"gce_instance"` has labels 455 * `"project_id"`, `"instance_id"` and `"zone"`: 456 * { "type": "gce_instance", 457 * "labels": { "project_id": "my-project", 458 * "instance_id": "12345678901234", 459 * "zone": "us-central1-a" }} 460 * </pre> 461 * 462 * Protobuf type {@code google.api.MonitoredResource} 463 */ 464 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 465 implements 466 // @@protoc_insertion_point(builder_implements:google.api.MonitoredResource) 467 com.google.api.MonitoredResourceOrBuilder { getDescriptor()468 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 469 return com.google.api.MonitoredResourceProto 470 .internal_static_google_api_MonitoredResource_descriptor; 471 } 472 473 @SuppressWarnings({"rawtypes"}) internalGetMapField(int number)474 protected com.google.protobuf.MapField internalGetMapField(int number) { 475 switch (number) { 476 case 2: 477 return internalGetLabels(); 478 default: 479 throw new RuntimeException("Invalid map field number: " + number); 480 } 481 } 482 483 @SuppressWarnings({"rawtypes"}) internalGetMutableMapField(int number)484 protected com.google.protobuf.MapField internalGetMutableMapField(int number) { 485 switch (number) { 486 case 2: 487 return internalGetMutableLabels(); 488 default: 489 throw new RuntimeException("Invalid map field number: " + number); 490 } 491 } 492 493 @java.lang.Override 494 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()495 internalGetFieldAccessorTable() { 496 return com.google.api.MonitoredResourceProto 497 .internal_static_google_api_MonitoredResource_fieldAccessorTable 498 .ensureFieldAccessorsInitialized( 499 com.google.api.MonitoredResource.class, 500 com.google.api.MonitoredResource.Builder.class); 501 } 502 503 // Construct using com.google.api.MonitoredResource.newBuilder() Builder()504 private Builder() {} 505 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)506 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 507 super(parent); 508 } 509 510 @java.lang.Override clear()511 public Builder clear() { 512 super.clear(); 513 bitField0_ = 0; 514 type_ = ""; 515 internalGetMutableLabels().clear(); 516 return this; 517 } 518 519 @java.lang.Override getDescriptorForType()520 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 521 return com.google.api.MonitoredResourceProto 522 .internal_static_google_api_MonitoredResource_descriptor; 523 } 524 525 @java.lang.Override getDefaultInstanceForType()526 public com.google.api.MonitoredResource getDefaultInstanceForType() { 527 return com.google.api.MonitoredResource.getDefaultInstance(); 528 } 529 530 @java.lang.Override build()531 public com.google.api.MonitoredResource build() { 532 com.google.api.MonitoredResource result = buildPartial(); 533 if (!result.isInitialized()) { 534 throw newUninitializedMessageException(result); 535 } 536 return result; 537 } 538 539 @java.lang.Override buildPartial()540 public com.google.api.MonitoredResource buildPartial() { 541 com.google.api.MonitoredResource result = new com.google.api.MonitoredResource(this); 542 if (bitField0_ != 0) { 543 buildPartial0(result); 544 } 545 onBuilt(); 546 return result; 547 } 548 buildPartial0(com.google.api.MonitoredResource result)549 private void buildPartial0(com.google.api.MonitoredResource result) { 550 int from_bitField0_ = bitField0_; 551 if (((from_bitField0_ & 0x00000001) != 0)) { 552 result.type_ = type_; 553 } 554 if (((from_bitField0_ & 0x00000002) != 0)) { 555 result.labels_ = internalGetLabels(); 556 result.labels_.makeImmutable(); 557 } 558 } 559 560 @java.lang.Override clone()561 public Builder clone() { 562 return super.clone(); 563 } 564 565 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)566 public Builder setField( 567 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 568 return super.setField(field, value); 569 } 570 571 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)572 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 573 return super.clearField(field); 574 } 575 576 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)577 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 578 return super.clearOneof(oneof); 579 } 580 581 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)582 public Builder setRepeatedField( 583 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 584 return super.setRepeatedField(field, index, value); 585 } 586 587 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)588 public Builder addRepeatedField( 589 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 590 return super.addRepeatedField(field, value); 591 } 592 593 @java.lang.Override mergeFrom(com.google.protobuf.Message other)594 public Builder mergeFrom(com.google.protobuf.Message other) { 595 if (other instanceof com.google.api.MonitoredResource) { 596 return mergeFrom((com.google.api.MonitoredResource) other); 597 } else { 598 super.mergeFrom(other); 599 return this; 600 } 601 } 602 mergeFrom(com.google.api.MonitoredResource other)603 public Builder mergeFrom(com.google.api.MonitoredResource other) { 604 if (other == com.google.api.MonitoredResource.getDefaultInstance()) return this; 605 if (!other.getType().isEmpty()) { 606 type_ = other.type_; 607 bitField0_ |= 0x00000001; 608 onChanged(); 609 } 610 internalGetMutableLabels().mergeFrom(other.internalGetLabels()); 611 bitField0_ |= 0x00000002; 612 this.mergeUnknownFields(other.getUnknownFields()); 613 onChanged(); 614 return this; 615 } 616 617 @java.lang.Override isInitialized()618 public final boolean isInitialized() { 619 return true; 620 } 621 622 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)623 public Builder mergeFrom( 624 com.google.protobuf.CodedInputStream input, 625 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 626 throws java.io.IOException { 627 if (extensionRegistry == null) { 628 throw new java.lang.NullPointerException(); 629 } 630 try { 631 boolean done = false; 632 while (!done) { 633 int tag = input.readTag(); 634 switch (tag) { 635 case 0: 636 done = true; 637 break; 638 case 10: 639 { 640 type_ = input.readStringRequireUtf8(); 641 bitField0_ |= 0x00000001; 642 break; 643 } // case 10 644 case 18: 645 { 646 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ = 647 input.readMessage( 648 LabelsDefaultEntryHolder.defaultEntry.getParserForType(), 649 extensionRegistry); 650 internalGetMutableLabels() 651 .getMutableMap() 652 .put(labels__.getKey(), labels__.getValue()); 653 bitField0_ |= 0x00000002; 654 break; 655 } // case 18 656 default: 657 { 658 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 659 done = true; // was an endgroup tag 660 } 661 break; 662 } // default: 663 } // switch (tag) 664 } // while (!done) 665 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 666 throw e.unwrapIOException(); 667 } finally { 668 onChanged(); 669 } // finally 670 return this; 671 } 672 673 private int bitField0_; 674 675 private java.lang.Object type_ = ""; 676 /** 677 * 678 * 679 * <pre> 680 * Required. The monitored resource type. This field must match 681 * the `type` field of a 682 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 683 * object. For example, the type of a Compute Engine VM instance is 684 * `gce_instance`. Some descriptors include the service name in the type; for 685 * example, the type of a Datastream stream is 686 * `datastream.googleapis.com/Stream`. 687 * </pre> 688 * 689 * <code>string type = 1;</code> 690 * 691 * @return The type. 692 */ getType()693 public java.lang.String getType() { 694 java.lang.Object ref = type_; 695 if (!(ref instanceof java.lang.String)) { 696 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 697 java.lang.String s = bs.toStringUtf8(); 698 type_ = s; 699 return s; 700 } else { 701 return (java.lang.String) ref; 702 } 703 } 704 /** 705 * 706 * 707 * <pre> 708 * Required. The monitored resource type. This field must match 709 * the `type` field of a 710 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 711 * object. For example, the type of a Compute Engine VM instance is 712 * `gce_instance`. Some descriptors include the service name in the type; for 713 * example, the type of a Datastream stream is 714 * `datastream.googleapis.com/Stream`. 715 * </pre> 716 * 717 * <code>string type = 1;</code> 718 * 719 * @return The bytes for type. 720 */ getTypeBytes()721 public com.google.protobuf.ByteString getTypeBytes() { 722 java.lang.Object ref = type_; 723 if (ref instanceof String) { 724 com.google.protobuf.ByteString b = 725 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 726 type_ = b; 727 return b; 728 } else { 729 return (com.google.protobuf.ByteString) ref; 730 } 731 } 732 /** 733 * 734 * 735 * <pre> 736 * Required. The monitored resource type. This field must match 737 * the `type` field of a 738 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 739 * object. For example, the type of a Compute Engine VM instance is 740 * `gce_instance`. Some descriptors include the service name in the type; for 741 * example, the type of a Datastream stream is 742 * `datastream.googleapis.com/Stream`. 743 * </pre> 744 * 745 * <code>string type = 1;</code> 746 * 747 * @param value The type to set. 748 * @return This builder for chaining. 749 */ setType(java.lang.String value)750 public Builder setType(java.lang.String value) { 751 if (value == null) { 752 throw new NullPointerException(); 753 } 754 type_ = value; 755 bitField0_ |= 0x00000001; 756 onChanged(); 757 return this; 758 } 759 /** 760 * 761 * 762 * <pre> 763 * Required. The monitored resource type. This field must match 764 * the `type` field of a 765 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 766 * object. For example, the type of a Compute Engine VM instance is 767 * `gce_instance`. Some descriptors include the service name in the type; for 768 * example, the type of a Datastream stream is 769 * `datastream.googleapis.com/Stream`. 770 * </pre> 771 * 772 * <code>string type = 1;</code> 773 * 774 * @return This builder for chaining. 775 */ clearType()776 public Builder clearType() { 777 type_ = getDefaultInstance().getType(); 778 bitField0_ = (bitField0_ & ~0x00000001); 779 onChanged(); 780 return this; 781 } 782 /** 783 * 784 * 785 * <pre> 786 * Required. The monitored resource type. This field must match 787 * the `type` field of a 788 * [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] 789 * object. For example, the type of a Compute Engine VM instance is 790 * `gce_instance`. Some descriptors include the service name in the type; for 791 * example, the type of a Datastream stream is 792 * `datastream.googleapis.com/Stream`. 793 * </pre> 794 * 795 * <code>string type = 1;</code> 796 * 797 * @param value The bytes for type to set. 798 * @return This builder for chaining. 799 */ setTypeBytes(com.google.protobuf.ByteString value)800 public Builder setTypeBytes(com.google.protobuf.ByteString value) { 801 if (value == null) { 802 throw new NullPointerException(); 803 } 804 checkByteStringIsUtf8(value); 805 type_ = value; 806 bitField0_ |= 0x00000001; 807 onChanged(); 808 return this; 809 } 810 811 private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_; 812 internalGetLabels()813 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() { 814 if (labels_ == null) { 815 return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); 816 } 817 return labels_; 818 } 819 820 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMutableLabels()821 internalGetMutableLabels() { 822 if (labels_ == null) { 823 labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); 824 } 825 if (!labels_.isMutable()) { 826 labels_ = labels_.copy(); 827 } 828 bitField0_ |= 0x00000002; 829 onChanged(); 830 return labels_; 831 } 832 getLabelsCount()833 public int getLabelsCount() { 834 return internalGetLabels().getMap().size(); 835 } 836 /** 837 * 838 * 839 * <pre> 840 * Required. Values for all of the labels listed in the associated monitored 841 * resource descriptor. For example, Compute Engine VM instances use the 842 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 843 * </pre> 844 * 845 * <code>map<string, string> labels = 2;</code> 846 */ 847 @java.lang.Override containsLabels(java.lang.String key)848 public boolean containsLabels(java.lang.String key) { 849 if (key == null) { 850 throw new NullPointerException("map key"); 851 } 852 return internalGetLabels().getMap().containsKey(key); 853 } 854 /** Use {@link #getLabelsMap()} instead. */ 855 @java.lang.Override 856 @java.lang.Deprecated getLabels()857 public java.util.Map<java.lang.String, java.lang.String> getLabels() { 858 return getLabelsMap(); 859 } 860 /** 861 * 862 * 863 * <pre> 864 * Required. Values for all of the labels listed in the associated monitored 865 * resource descriptor. For example, Compute Engine VM instances use the 866 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 867 * </pre> 868 * 869 * <code>map<string, string> labels = 2;</code> 870 */ 871 @java.lang.Override getLabelsMap()872 public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() { 873 return internalGetLabels().getMap(); 874 } 875 /** 876 * 877 * 878 * <pre> 879 * Required. Values for all of the labels listed in the associated monitored 880 * resource descriptor. For example, Compute Engine VM instances use the 881 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 882 * </pre> 883 * 884 * <code>map<string, string> labels = 2;</code> 885 */ 886 @java.lang.Override getLabelsOrDefault( java.lang.String key, java.lang.String defaultValue)887 public /* nullable */ java.lang.String getLabelsOrDefault( 888 java.lang.String key, 889 /* nullable */ 890 java.lang.String defaultValue) { 891 if (key == null) { 892 throw new NullPointerException("map key"); 893 } 894 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 895 return map.containsKey(key) ? map.get(key) : defaultValue; 896 } 897 /** 898 * 899 * 900 * <pre> 901 * Required. Values for all of the labels listed in the associated monitored 902 * resource descriptor. For example, Compute Engine VM instances use the 903 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 904 * </pre> 905 * 906 * <code>map<string, string> labels = 2;</code> 907 */ 908 @java.lang.Override getLabelsOrThrow(java.lang.String key)909 public java.lang.String getLabelsOrThrow(java.lang.String key) { 910 if (key == null) { 911 throw new NullPointerException("map key"); 912 } 913 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 914 if (!map.containsKey(key)) { 915 throw new java.lang.IllegalArgumentException(); 916 } 917 return map.get(key); 918 } 919 clearLabels()920 public Builder clearLabels() { 921 bitField0_ = (bitField0_ & ~0x00000002); 922 internalGetMutableLabels().getMutableMap().clear(); 923 return this; 924 } 925 /** 926 * 927 * 928 * <pre> 929 * Required. Values for all of the labels listed in the associated monitored 930 * resource descriptor. For example, Compute Engine VM instances use the 931 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 932 * </pre> 933 * 934 * <code>map<string, string> labels = 2;</code> 935 */ removeLabels(java.lang.String key)936 public Builder removeLabels(java.lang.String key) { 937 if (key == null) { 938 throw new NullPointerException("map key"); 939 } 940 internalGetMutableLabels().getMutableMap().remove(key); 941 return this; 942 } 943 /** Use alternate mutation accessors instead. */ 944 @java.lang.Deprecated getMutableLabels()945 public java.util.Map<java.lang.String, java.lang.String> getMutableLabels() { 946 bitField0_ |= 0x00000002; 947 return internalGetMutableLabels().getMutableMap(); 948 } 949 /** 950 * 951 * 952 * <pre> 953 * Required. Values for all of the labels listed in the associated monitored 954 * resource descriptor. For example, Compute Engine VM instances use the 955 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 956 * </pre> 957 * 958 * <code>map<string, string> labels = 2;</code> 959 */ putLabels(java.lang.String key, java.lang.String value)960 public Builder putLabels(java.lang.String key, java.lang.String value) { 961 if (key == null) { 962 throw new NullPointerException("map key"); 963 } 964 if (value == null) { 965 throw new NullPointerException("map value"); 966 } 967 internalGetMutableLabels().getMutableMap().put(key, value); 968 bitField0_ |= 0x00000002; 969 return this; 970 } 971 /** 972 * 973 * 974 * <pre> 975 * Required. Values for all of the labels listed in the associated monitored 976 * resource descriptor. For example, Compute Engine VM instances use the 977 * labels `"project_id"`, `"instance_id"`, and `"zone"`. 978 * </pre> 979 * 980 * <code>map<string, string> labels = 2;</code> 981 */ putAllLabels(java.util.Map<java.lang.String, java.lang.String> values)982 public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) { 983 internalGetMutableLabels().getMutableMap().putAll(values); 984 bitField0_ |= 0x00000002; 985 return this; 986 } 987 988 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)989 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 990 return super.setUnknownFields(unknownFields); 991 } 992 993 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)994 public final Builder mergeUnknownFields( 995 final com.google.protobuf.UnknownFieldSet unknownFields) { 996 return super.mergeUnknownFields(unknownFields); 997 } 998 999 // @@protoc_insertion_point(builder_scope:google.api.MonitoredResource) 1000 } 1001 1002 // @@protoc_insertion_point(class_scope:google.api.MonitoredResource) 1003 private static final com.google.api.MonitoredResource DEFAULT_INSTANCE; 1004 1005 static { 1006 DEFAULT_INSTANCE = new com.google.api.MonitoredResource(); 1007 } 1008 getDefaultInstance()1009 public static com.google.api.MonitoredResource getDefaultInstance() { 1010 return DEFAULT_INSTANCE; 1011 } 1012 1013 private static final com.google.protobuf.Parser<MonitoredResource> PARSER = 1014 new com.google.protobuf.AbstractParser<MonitoredResource>() { 1015 @java.lang.Override 1016 public MonitoredResource parsePartialFrom( 1017 com.google.protobuf.CodedInputStream input, 1018 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1019 throws com.google.protobuf.InvalidProtocolBufferException { 1020 Builder builder = newBuilder(); 1021 try { 1022 builder.mergeFrom(input, extensionRegistry); 1023 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1024 throw e.setUnfinishedMessage(builder.buildPartial()); 1025 } catch (com.google.protobuf.UninitializedMessageException e) { 1026 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 1027 } catch (java.io.IOException e) { 1028 throw new com.google.protobuf.InvalidProtocolBufferException(e) 1029 .setUnfinishedMessage(builder.buildPartial()); 1030 } 1031 return builder.buildPartial(); 1032 } 1033 }; 1034 parser()1035 public static com.google.protobuf.Parser<MonitoredResource> parser() { 1036 return PARSER; 1037 } 1038 1039 @java.lang.Override getParserForType()1040 public com.google.protobuf.Parser<MonitoredResource> getParserForType() { 1041 return PARSER; 1042 } 1043 1044 @java.lang.Override getDefaultInstanceForType()1045 public com.google.api.MonitoredResource getDefaultInstanceForType() { 1046 return DEFAULT_INSTANCE; 1047 } 1048 } 1049