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