MeteringMode.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. # Generated by the protocol buffer compiler. DO NOT EDIT!
  3. # source: protos/ydb_topic.proto
  4. namespace Ydb\Topic;
  5. use UnexpectedValueException;
  6. /**
  7. * Metering mode specifies the method used to determine consumption of resources by the topic.
  8. * This settings will have an effect only in a serverless database.
  9. *
  10. * Protobuf type <code>Ydb.Topic.MeteringMode</code>
  11. */
  12. class MeteringMode
  13. {
  14. /**
  15. * Use default
  16. *
  17. * Generated from protobuf enum <code>METERING_MODE_UNSPECIFIED = 0;</code>
  18. */
  19. const METERING_MODE_UNSPECIFIED = 0;
  20. /**
  21. * Metering based on resource reservation
  22. *
  23. * Generated from protobuf enum <code>METERING_MODE_RESERVED_CAPACITY = 1;</code>
  24. */
  25. const METERING_MODE_RESERVED_CAPACITY = 1;
  26. /**
  27. * Metering based on actual consumption. Default.
  28. *
  29. * Generated from protobuf enum <code>METERING_MODE_REQUEST_UNITS = 2;</code>
  30. */
  31. const METERING_MODE_REQUEST_UNITS = 2;
  32. private static $valueToName = [
  33. self::METERING_MODE_UNSPECIFIED => 'METERING_MODE_UNSPECIFIED',
  34. self::METERING_MODE_RESERVED_CAPACITY => 'METERING_MODE_RESERVED_CAPACITY',
  35. self::METERING_MODE_REQUEST_UNITS => 'METERING_MODE_REQUEST_UNITS',
  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. }