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/rpc/code.proto 18 19 package com.google.rpc; 20 21 /** 22 * 23 * 24 * <pre> 25 * The canonical error codes for gRPC APIs. 26 * Sometimes multiple error codes may apply. Services should return 27 * the most specific error code that applies. For example, prefer 28 * `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. 29 * Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. 30 * </pre> 31 * 32 * Protobuf enum {@code google.rpc.Code} 33 */ 34 public enum Code implements com.google.protobuf.ProtocolMessageEnum { 35 /** 36 * 37 * 38 * <pre> 39 * Not an error; returned on success. 40 * HTTP Mapping: 200 OK 41 * </pre> 42 * 43 * <code>OK = 0;</code> 44 */ 45 OK(0), 46 /** 47 * 48 * 49 * <pre> 50 * The operation was cancelled, typically by the caller. 51 * HTTP Mapping: 499 Client Closed Request 52 * </pre> 53 * 54 * <code>CANCELLED = 1;</code> 55 */ 56 CANCELLED(1), 57 /** 58 * 59 * 60 * <pre> 61 * Unknown error. For example, this error may be returned when 62 * a `Status` value received from another address space belongs to 63 * an error space that is not known in this address space. Also 64 * errors raised by APIs that do not return enough error information 65 * may be converted to this error. 66 * HTTP Mapping: 500 Internal Server Error 67 * </pre> 68 * 69 * <code>UNKNOWN = 2;</code> 70 */ 71 UNKNOWN(2), 72 /** 73 * 74 * 75 * <pre> 76 * The client specified an invalid argument. Note that this differs 77 * from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments 78 * that are problematic regardless of the state of the system 79 * (e.g., a malformed file name). 80 * HTTP Mapping: 400 Bad Request 81 * </pre> 82 * 83 * <code>INVALID_ARGUMENT = 3;</code> 84 */ 85 INVALID_ARGUMENT(3), 86 /** 87 * 88 * 89 * <pre> 90 * The deadline expired before the operation could complete. For operations 91 * that change the state of the system, this error may be returned 92 * even if the operation has completed successfully. For example, a 93 * successful response from a server could have been delayed long 94 * enough for the deadline to expire. 95 * HTTP Mapping: 504 Gateway Timeout 96 * </pre> 97 * 98 * <code>DEADLINE_EXCEEDED = 4;</code> 99 */ 100 DEADLINE_EXCEEDED(4), 101 /** 102 * 103 * 104 * <pre> 105 * Some requested entity (e.g., file or directory) was not found. 106 * Note to server developers: if a request is denied for an entire class 107 * of users, such as gradual feature rollout or undocumented allowlist, 108 * `NOT_FOUND` may be used. If a request is denied for some users within 109 * a class of users, such as user-based access control, `PERMISSION_DENIED` 110 * must be used. 111 * HTTP Mapping: 404 Not Found 112 * </pre> 113 * 114 * <code>NOT_FOUND = 5;</code> 115 */ 116 NOT_FOUND(5), 117 /** 118 * 119 * 120 * <pre> 121 * The entity that a client attempted to create (e.g., file or directory) 122 * already exists. 123 * HTTP Mapping: 409 Conflict 124 * </pre> 125 * 126 * <code>ALREADY_EXISTS = 6;</code> 127 */ 128 ALREADY_EXISTS(6), 129 /** 130 * 131 * 132 * <pre> 133 * The caller does not have permission to execute the specified 134 * operation. `PERMISSION_DENIED` must not be used for rejections 135 * caused by exhausting some resource (use `RESOURCE_EXHAUSTED` 136 * instead for those errors). `PERMISSION_DENIED` must not be 137 * used if the caller can not be identified (use `UNAUTHENTICATED` 138 * instead for those errors). This error code does not imply the 139 * request is valid or the requested entity exists or satisfies 140 * other pre-conditions. 141 * HTTP Mapping: 403 Forbidden 142 * </pre> 143 * 144 * <code>PERMISSION_DENIED = 7;</code> 145 */ 146 PERMISSION_DENIED(7), 147 /** 148 * 149 * 150 * <pre> 151 * The request does not have valid authentication credentials for the 152 * operation. 153 * HTTP Mapping: 401 Unauthorized 154 * </pre> 155 * 156 * <code>UNAUTHENTICATED = 16;</code> 157 */ 158 UNAUTHENTICATED(16), 159 /** 160 * 161 * 162 * <pre> 163 * Some resource has been exhausted, perhaps a per-user quota, or 164 * perhaps the entire file system is out of space. 165 * HTTP Mapping: 429 Too Many Requests 166 * </pre> 167 * 168 * <code>RESOURCE_EXHAUSTED = 8;</code> 169 */ 170 RESOURCE_EXHAUSTED(8), 171 /** 172 * 173 * 174 * <pre> 175 * The operation was rejected because the system is not in a state 176 * required for the operation's execution. For example, the directory 177 * to be deleted is non-empty, an rmdir operation is applied to 178 * a non-directory, etc. 179 * Service implementors can use the following guidelines to decide 180 * between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: 181 * (a) Use `UNAVAILABLE` if the client can retry just the failing call. 182 * (b) Use `ABORTED` if the client should retry at a higher level. For 183 * example, when a client-specified test-and-set fails, indicating the 184 * client should restart a read-modify-write sequence. 185 * (c) Use `FAILED_PRECONDITION` if the client should not retry until 186 * the system state has been explicitly fixed. For example, if an "rmdir" 187 * fails because the directory is non-empty, `FAILED_PRECONDITION` 188 * should be returned since the client should not retry unless 189 * the files are deleted from the directory. 190 * HTTP Mapping: 400 Bad Request 191 * </pre> 192 * 193 * <code>FAILED_PRECONDITION = 9;</code> 194 */ 195 FAILED_PRECONDITION(9), 196 /** 197 * 198 * 199 * <pre> 200 * The operation was aborted, typically due to a concurrency issue such as 201 * a sequencer check failure or transaction abort. 202 * See the guidelines above for deciding between `FAILED_PRECONDITION`, 203 * `ABORTED`, and `UNAVAILABLE`. 204 * HTTP Mapping: 409 Conflict 205 * </pre> 206 * 207 * <code>ABORTED = 10;</code> 208 */ 209 ABORTED(10), 210 /** 211 * 212 * 213 * <pre> 214 * The operation was attempted past the valid range. E.g., seeking or 215 * reading past end-of-file. 216 * Unlike `INVALID_ARGUMENT`, this error indicates a problem that may 217 * be fixed if the system state changes. For example, a 32-bit file 218 * system will generate `INVALID_ARGUMENT` if asked to read at an 219 * offset that is not in the range [0,2^32-1], but it will generate 220 * `OUT_OF_RANGE` if asked to read from an offset past the current 221 * file size. 222 * There is a fair bit of overlap between `FAILED_PRECONDITION` and 223 * `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific 224 * error) when it applies so that callers who are iterating through 225 * a space can easily look for an `OUT_OF_RANGE` error to detect when 226 * they are done. 227 * HTTP Mapping: 400 Bad Request 228 * </pre> 229 * 230 * <code>OUT_OF_RANGE = 11;</code> 231 */ 232 OUT_OF_RANGE(11), 233 /** 234 * 235 * 236 * <pre> 237 * The operation is not implemented or is not supported/enabled in this 238 * service. 239 * HTTP Mapping: 501 Not Implemented 240 * </pre> 241 * 242 * <code>UNIMPLEMENTED = 12;</code> 243 */ 244 UNIMPLEMENTED(12), 245 /** 246 * 247 * 248 * <pre> 249 * Internal errors. This means that some invariants expected by the 250 * underlying system have been broken. This error code is reserved 251 * for serious errors. 252 * HTTP Mapping: 500 Internal Server Error 253 * </pre> 254 * 255 * <code>INTERNAL = 13;</code> 256 */ 257 INTERNAL(13), 258 /** 259 * 260 * 261 * <pre> 262 * The service is currently unavailable. This is most likely a 263 * transient condition, which can be corrected by retrying with 264 * a backoff. Note that it is not always safe to retry 265 * non-idempotent operations. 266 * See the guidelines above for deciding between `FAILED_PRECONDITION`, 267 * `ABORTED`, and `UNAVAILABLE`. 268 * HTTP Mapping: 503 Service Unavailable 269 * </pre> 270 * 271 * <code>UNAVAILABLE = 14;</code> 272 */ 273 UNAVAILABLE(14), 274 /** 275 * 276 * 277 * <pre> 278 * Unrecoverable data loss or corruption. 279 * HTTP Mapping: 500 Internal Server Error 280 * </pre> 281 * 282 * <code>DATA_LOSS = 15;</code> 283 */ 284 DATA_LOSS(15), 285 UNRECOGNIZED(-1), 286 ; 287 288 /** 289 * 290 * 291 * <pre> 292 * Not an error; returned on success. 293 * HTTP Mapping: 200 OK 294 * </pre> 295 * 296 * <code>OK = 0;</code> 297 */ 298 public static final int OK_VALUE = 0; 299 /** 300 * 301 * 302 * <pre> 303 * The operation was cancelled, typically by the caller. 304 * HTTP Mapping: 499 Client Closed Request 305 * </pre> 306 * 307 * <code>CANCELLED = 1;</code> 308 */ 309 public static final int CANCELLED_VALUE = 1; 310 /** 311 * 312 * 313 * <pre> 314 * Unknown error. For example, this error may be returned when 315 * a `Status` value received from another address space belongs to 316 * an error space that is not known in this address space. Also 317 * errors raised by APIs that do not return enough error information 318 * may be converted to this error. 319 * HTTP Mapping: 500 Internal Server Error 320 * </pre> 321 * 322 * <code>UNKNOWN = 2;</code> 323 */ 324 public static final int UNKNOWN_VALUE = 2; 325 /** 326 * 327 * 328 * <pre> 329 * The client specified an invalid argument. Note that this differs 330 * from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments 331 * that are problematic regardless of the state of the system 332 * (e.g., a malformed file name). 333 * HTTP Mapping: 400 Bad Request 334 * </pre> 335 * 336 * <code>INVALID_ARGUMENT = 3;</code> 337 */ 338 public static final int INVALID_ARGUMENT_VALUE = 3; 339 /** 340 * 341 * 342 * <pre> 343 * The deadline expired before the operation could complete. For operations 344 * that change the state of the system, this error may be returned 345 * even if the operation has completed successfully. For example, a 346 * successful response from a server could have been delayed long 347 * enough for the deadline to expire. 348 * HTTP Mapping: 504 Gateway Timeout 349 * </pre> 350 * 351 * <code>DEADLINE_EXCEEDED = 4;</code> 352 */ 353 public static final int DEADLINE_EXCEEDED_VALUE = 4; 354 /** 355 * 356 * 357 * <pre> 358 * Some requested entity (e.g., file or directory) was not found. 359 * Note to server developers: if a request is denied for an entire class 360 * of users, such as gradual feature rollout or undocumented allowlist, 361 * `NOT_FOUND` may be used. If a request is denied for some users within 362 * a class of users, such as user-based access control, `PERMISSION_DENIED` 363 * must be used. 364 * HTTP Mapping: 404 Not Found 365 * </pre> 366 * 367 * <code>NOT_FOUND = 5;</code> 368 */ 369 public static final int NOT_FOUND_VALUE = 5; 370 /** 371 * 372 * 373 * <pre> 374 * The entity that a client attempted to create (e.g., file or directory) 375 * already exists. 376 * HTTP Mapping: 409 Conflict 377 * </pre> 378 * 379 * <code>ALREADY_EXISTS = 6;</code> 380 */ 381 public static final int ALREADY_EXISTS_VALUE = 6; 382 /** 383 * 384 * 385 * <pre> 386 * The caller does not have permission to execute the specified 387 * operation. `PERMISSION_DENIED` must not be used for rejections 388 * caused by exhausting some resource (use `RESOURCE_EXHAUSTED` 389 * instead for those errors). `PERMISSION_DENIED` must not be 390 * used if the caller can not be identified (use `UNAUTHENTICATED` 391 * instead for those errors). This error code does not imply the 392 * request is valid or the requested entity exists or satisfies 393 * other pre-conditions. 394 * HTTP Mapping: 403 Forbidden 395 * </pre> 396 * 397 * <code>PERMISSION_DENIED = 7;</code> 398 */ 399 public static final int PERMISSION_DENIED_VALUE = 7; 400 /** 401 * 402 * 403 * <pre> 404 * The request does not have valid authentication credentials for the 405 * operation. 406 * HTTP Mapping: 401 Unauthorized 407 * </pre> 408 * 409 * <code>UNAUTHENTICATED = 16;</code> 410 */ 411 public static final int UNAUTHENTICATED_VALUE = 16; 412 /** 413 * 414 * 415 * <pre> 416 * Some resource has been exhausted, perhaps a per-user quota, or 417 * perhaps the entire file system is out of space. 418 * HTTP Mapping: 429 Too Many Requests 419 * </pre> 420 * 421 * <code>RESOURCE_EXHAUSTED = 8;</code> 422 */ 423 public static final int RESOURCE_EXHAUSTED_VALUE = 8; 424 /** 425 * 426 * 427 * <pre> 428 * The operation was rejected because the system is not in a state 429 * required for the operation's execution. For example, the directory 430 * to be deleted is non-empty, an rmdir operation is applied to 431 * a non-directory, etc. 432 * Service implementors can use the following guidelines to decide 433 * between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: 434 * (a) Use `UNAVAILABLE` if the client can retry just the failing call. 435 * (b) Use `ABORTED` if the client should retry at a higher level. For 436 * example, when a client-specified test-and-set fails, indicating the 437 * client should restart a read-modify-write sequence. 438 * (c) Use `FAILED_PRECONDITION` if the client should not retry until 439 * the system state has been explicitly fixed. For example, if an "rmdir" 440 * fails because the directory is non-empty, `FAILED_PRECONDITION` 441 * should be returned since the client should not retry unless 442 * the files are deleted from the directory. 443 * HTTP Mapping: 400 Bad Request 444 * </pre> 445 * 446 * <code>FAILED_PRECONDITION = 9;</code> 447 */ 448 public static final int FAILED_PRECONDITION_VALUE = 9; 449 /** 450 * 451 * 452 * <pre> 453 * The operation was aborted, typically due to a concurrency issue such as 454 * a sequencer check failure or transaction abort. 455 * See the guidelines above for deciding between `FAILED_PRECONDITION`, 456 * `ABORTED`, and `UNAVAILABLE`. 457 * HTTP Mapping: 409 Conflict 458 * </pre> 459 * 460 * <code>ABORTED = 10;</code> 461 */ 462 public static final int ABORTED_VALUE = 10; 463 /** 464 * 465 * 466 * <pre> 467 * The operation was attempted past the valid range. E.g., seeking or 468 * reading past end-of-file. 469 * Unlike `INVALID_ARGUMENT`, this error indicates a problem that may 470 * be fixed if the system state changes. For example, a 32-bit file 471 * system will generate `INVALID_ARGUMENT` if asked to read at an 472 * offset that is not in the range [0,2^32-1], but it will generate 473 * `OUT_OF_RANGE` if asked to read from an offset past the current 474 * file size. 475 * There is a fair bit of overlap between `FAILED_PRECONDITION` and 476 * `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific 477 * error) when it applies so that callers who are iterating through 478 * a space can easily look for an `OUT_OF_RANGE` error to detect when 479 * they are done. 480 * HTTP Mapping: 400 Bad Request 481 * </pre> 482 * 483 * <code>OUT_OF_RANGE = 11;</code> 484 */ 485 public static final int OUT_OF_RANGE_VALUE = 11; 486 /** 487 * 488 * 489 * <pre> 490 * The operation is not implemented or is not supported/enabled in this 491 * service. 492 * HTTP Mapping: 501 Not Implemented 493 * </pre> 494 * 495 * <code>UNIMPLEMENTED = 12;</code> 496 */ 497 public static final int UNIMPLEMENTED_VALUE = 12; 498 /** 499 * 500 * 501 * <pre> 502 * Internal errors. This means that some invariants expected by the 503 * underlying system have been broken. This error code is reserved 504 * for serious errors. 505 * HTTP Mapping: 500 Internal Server Error 506 * </pre> 507 * 508 * <code>INTERNAL = 13;</code> 509 */ 510 public static final int INTERNAL_VALUE = 13; 511 /** 512 * 513 * 514 * <pre> 515 * The service is currently unavailable. This is most likely a 516 * transient condition, which can be corrected by retrying with 517 * a backoff. Note that it is not always safe to retry 518 * non-idempotent operations. 519 * See the guidelines above for deciding between `FAILED_PRECONDITION`, 520 * `ABORTED`, and `UNAVAILABLE`. 521 * HTTP Mapping: 503 Service Unavailable 522 * </pre> 523 * 524 * <code>UNAVAILABLE = 14;</code> 525 */ 526 public static final int UNAVAILABLE_VALUE = 14; 527 /** 528 * 529 * 530 * <pre> 531 * Unrecoverable data loss or corruption. 532 * HTTP Mapping: 500 Internal Server Error 533 * </pre> 534 * 535 * <code>DATA_LOSS = 15;</code> 536 */ 537 public static final int DATA_LOSS_VALUE = 15; 538 getNumber()539 public final int getNumber() { 540 if (this == UNRECOGNIZED) { 541 throw new java.lang.IllegalArgumentException( 542 "Can't get the number of an unknown enum value."); 543 } 544 return value; 545 } 546 547 /** 548 * @param value The numeric wire value of the corresponding enum entry. 549 * @return The enum associated with the given numeric wire value. 550 * @deprecated Use {@link #forNumber(int)} instead. 551 */ 552 @java.lang.Deprecated valueOf(int value)553 public static Code valueOf(int value) { 554 return forNumber(value); 555 } 556 557 /** 558 * @param value The numeric wire value of the corresponding enum entry. 559 * @return The enum associated with the given numeric wire value. 560 */ forNumber(int value)561 public static Code forNumber(int value) { 562 switch (value) { 563 case 0: 564 return OK; 565 case 1: 566 return CANCELLED; 567 case 2: 568 return UNKNOWN; 569 case 3: 570 return INVALID_ARGUMENT; 571 case 4: 572 return DEADLINE_EXCEEDED; 573 case 5: 574 return NOT_FOUND; 575 case 6: 576 return ALREADY_EXISTS; 577 case 7: 578 return PERMISSION_DENIED; 579 case 16: 580 return UNAUTHENTICATED; 581 case 8: 582 return RESOURCE_EXHAUSTED; 583 case 9: 584 return FAILED_PRECONDITION; 585 case 10: 586 return ABORTED; 587 case 11: 588 return OUT_OF_RANGE; 589 case 12: 590 return UNIMPLEMENTED; 591 case 13: 592 return INTERNAL; 593 case 14: 594 return UNAVAILABLE; 595 case 15: 596 return DATA_LOSS; 597 default: 598 return null; 599 } 600 } 601 internalGetValueMap()602 public static com.google.protobuf.Internal.EnumLiteMap<Code> internalGetValueMap() { 603 return internalValueMap; 604 } 605 606 private static final com.google.protobuf.Internal.EnumLiteMap<Code> internalValueMap = 607 new com.google.protobuf.Internal.EnumLiteMap<Code>() { 608 public Code findValueByNumber(int number) { 609 return Code.forNumber(number); 610 } 611 }; 612 getValueDescriptor()613 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 614 if (this == UNRECOGNIZED) { 615 throw new java.lang.IllegalStateException( 616 "Can't get the descriptor of an unrecognized enum value."); 617 } 618 return getDescriptor().getValues().get(ordinal()); 619 } 620 getDescriptorForType()621 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 622 return getDescriptor(); 623 } 624 getDescriptor()625 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 626 return com.google.rpc.CodeProto.getDescriptor().getEnumTypes().get(0); 627 } 628 629 private static final Code[] VALUES = values(); 630 valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)631 public static Code valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 632 if (desc.getType() != getDescriptor()) { 633 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 634 } 635 if (desc.getIndex() == -1) { 636 return UNRECOGNIZED; 637 } 638 return VALUES[desc.getIndex()]; 639 } 640 641 private final int value; 642 Code(int value)643 private Code(int value) { 644 this.value = value; 645 } 646 647 // @@protoc_insertion_point(enum_scope:google.rpc.Code) 648 } 649