StatusCode.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_status_codes.proto
  4. namespace Ydb\StatusIds;
  5. use UnexpectedValueException;
  6. /**
  7. * reserved range [400000, 400999]
  8. *
  9. * Protobuf type <code>Ydb.StatusIds.StatusCode</code>
  10. */
  11. class StatusCode
  12. {
  13. /**
  14. * Generated from protobuf enum <code>STATUS_CODE_UNSPECIFIED = 0;</code>
  15. */
  16. const STATUS_CODE_UNSPECIFIED = 0;
  17. /**
  18. * Generated from protobuf enum <code>SUCCESS = 400000;</code>
  19. */
  20. const SUCCESS = 400000;
  21. /**
  22. * Generated from protobuf enum <code>BAD_REQUEST = 400010;</code>
  23. */
  24. const BAD_REQUEST = 400010;
  25. /**
  26. * Generated from protobuf enum <code>UNAUTHORIZED = 400020;</code>
  27. */
  28. const UNAUTHORIZED = 400020;
  29. /**
  30. * Generated from protobuf enum <code>INTERNAL_ERROR = 400030;</code>
  31. */
  32. const INTERNAL_ERROR = 400030;
  33. /**
  34. * Generated from protobuf enum <code>ABORTED = 400040;</code>
  35. */
  36. const ABORTED = 400040;
  37. /**
  38. * Generated from protobuf enum <code>UNAVAILABLE = 400050;</code>
  39. */
  40. const UNAVAILABLE = 400050;
  41. /**
  42. * Generated from protobuf enum <code>OVERLOADED = 400060;</code>
  43. */
  44. const OVERLOADED = 400060;
  45. /**
  46. * Generated from protobuf enum <code>SCHEME_ERROR = 400070;</code>
  47. */
  48. const SCHEME_ERROR = 400070;
  49. /**
  50. * Generated from protobuf enum <code>GENERIC_ERROR = 400080;</code>
  51. */
  52. const GENERIC_ERROR = 400080;
  53. /**
  54. * Generated from protobuf enum <code>TIMEOUT = 400090;</code>
  55. */
  56. const TIMEOUT = 400090;
  57. /**
  58. * Generated from protobuf enum <code>BAD_SESSION = 400100;</code>
  59. */
  60. const BAD_SESSION = 400100;
  61. /**
  62. * Generated from protobuf enum <code>PRECONDITION_FAILED = 400120;</code>
  63. */
  64. const PRECONDITION_FAILED = 400120;
  65. /**
  66. * Generated from protobuf enum <code>ALREADY_EXISTS = 400130;</code>
  67. */
  68. const ALREADY_EXISTS = 400130;
  69. /**
  70. * Generated from protobuf enum <code>NOT_FOUND = 400140;</code>
  71. */
  72. const NOT_FOUND = 400140;
  73. /**
  74. * Generated from protobuf enum <code>SESSION_EXPIRED = 400150;</code>
  75. */
  76. const SESSION_EXPIRED = 400150;
  77. /**
  78. * Generated from protobuf enum <code>CANCELLED = 400160;</code>
  79. */
  80. const CANCELLED = 400160;
  81. /**
  82. * Generated from protobuf enum <code>UNDETERMINED = 400170;</code>
  83. */
  84. const UNDETERMINED = 400170;
  85. /**
  86. * Generated from protobuf enum <code>UNSUPPORTED = 400180;</code>
  87. */
  88. const UNSUPPORTED = 400180;
  89. /**
  90. * Generated from protobuf enum <code>SESSION_BUSY = 400190;</code>
  91. */
  92. const SESSION_BUSY = 400190;
  93. private static $valueToName = [
  94. self::STATUS_CODE_UNSPECIFIED => 'STATUS_CODE_UNSPECIFIED',
  95. self::SUCCESS => 'SUCCESS',
  96. self::BAD_REQUEST => 'BAD_REQUEST',
  97. self::UNAUTHORIZED => 'UNAUTHORIZED',
  98. self::INTERNAL_ERROR => 'INTERNAL_ERROR',
  99. self::ABORTED => 'ABORTED',
  100. self::UNAVAILABLE => 'UNAVAILABLE',
  101. self::OVERLOADED => 'OVERLOADED',
  102. self::SCHEME_ERROR => 'SCHEME_ERROR',
  103. self::GENERIC_ERROR => 'GENERIC_ERROR',
  104. self::TIMEOUT => 'TIMEOUT',
  105. self::BAD_SESSION => 'BAD_SESSION',
  106. self::PRECONDITION_FAILED => 'PRECONDITION_FAILED',
  107. self::ALREADY_EXISTS => 'ALREADY_EXISTS',
  108. self::NOT_FOUND => 'NOT_FOUND',
  109. self::SESSION_EXPIRED => 'SESSION_EXPIRED',
  110. self::CANCELLED => 'CANCELLED',
  111. self::UNDETERMINED => 'UNDETERMINED',
  112. self::UNSUPPORTED => 'UNSUPPORTED',
  113. self::SESSION_BUSY => 'SESSION_BUSY',
  114. ];
  115. public static function name($value)
  116. {
  117. if (!isset(self::$valueToName[$value])) {
  118. throw new UnexpectedValueException(sprintf(
  119. 'Enum %s has no name defined for value %s', __CLASS__, $value));
  120. }
  121. return self::$valueToName[$value];
  122. }
  123. public static function value($name)
  124. {
  125. $const = __CLASS__ . '::' . strtoupper($name);
  126. if (!defined($const)) {
  127. throw new UnexpectedValueException(sprintf(
  128. 'Enum %s has no value defined for name %s', __CLASS__, $name));
  129. }
  130. return constant($const);
  131. }
  132. }
  133. // Adding a class alias for backwards compatibility with the previous class name.
  134. class_alias(StatusCode::class, \Ydb\StatusIds_StatusCode::class);