RateLimiterCountersMode.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_coordination.proto
  4. namespace Ydb\Coordination;
  5. use UnexpectedValueException;
  6. /**
  7. **
  8. * Counters mode
  9. *
  10. * Protobuf type <code>Ydb.Coordination.RateLimiterCountersMode</code>
  11. */
  12. class RateLimiterCountersMode
  13. {
  14. /**
  15. * The default or current value
  16. *
  17. * Generated from protobuf enum <code>RATE_LIMITER_COUNTERS_MODE_UNSET = 0;</code>
  18. */
  19. const RATE_LIMITER_COUNTERS_MODE_UNSET = 0;
  20. /**
  21. * Aggregated counters for resource tree
  22. *
  23. * Generated from protobuf enum <code>RATE_LIMITER_COUNTERS_MODE_AGGREGATED = 1;</code>
  24. */
  25. const RATE_LIMITER_COUNTERS_MODE_AGGREGATED = 1;
  26. /**
  27. * Counters on every resource
  28. *
  29. * Generated from protobuf enum <code>RATE_LIMITER_COUNTERS_MODE_DETAILED = 2;</code>
  30. */
  31. const RATE_LIMITER_COUNTERS_MODE_DETAILED = 2;
  32. private static $valueToName = [
  33. self::RATE_LIMITER_COUNTERS_MODE_UNSET => 'RATE_LIMITER_COUNTERS_MODE_UNSET',
  34. self::RATE_LIMITER_COUNTERS_MODE_AGGREGATED => 'RATE_LIMITER_COUNTERS_MODE_AGGREGATED',
  35. self::RATE_LIMITER_COUNTERS_MODE_DETAILED => 'RATE_LIMITER_COUNTERS_MODE_DETAILED',
  36. ];
  37. public static function name($value)
  38. {
  39. if (!isset(self::$valueToName[$value])) {
  40. throw new UnexpectedValueException(sprintf(
  41. 'Enum %s has no name defined for value %s', __CLASS__, $value));
  42. }
  43. return self::$valueToName[$value];
  44. }
  45. public static function value($name)
  46. {
  47. $const = __CLASS__ . '::' . strtoupper($name);
  48. if (!defined($const)) {
  49. throw new UnexpectedValueException(sprintf(
  50. 'Enum %s has no value defined for name %s', __CLASS__, $name));
  51. }
  52. return constant($const);
  53. }
  54. }