resources.proto 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. // Copyright 2017 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.runtimeconfig.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/protobuf/duration.proto";
  18. import "google/protobuf/timestamp.proto";
  19. import "google/rpc/status.proto";
  20. option csharp_namespace = "Google.Cloud.RuntimeConfig.V1Beta1";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1;runtimeconfig";
  22. option java_multiple_files = true;
  23. option java_package = "com.google.cloud.runtimeconfig.v1beta1";
  24. option php_namespace = "Google\\Cloud\\RuntimeConfig\\V1beta1";
  25. // A RuntimeConfig resource is the primary resource in the Cloud RuntimeConfig
  26. // service. A RuntimeConfig resource consists of metadata and a hierarchy of
  27. // variables.
  28. message RuntimeConfig {
  29. // The resource name of a runtime config. The name must have the format:
  30. //
  31. // projects/[PROJECT_ID]/configs/[CONFIG_NAME]
  32. //
  33. // The `[PROJECT_ID]` must be a valid project ID, and `[CONFIG_NAME]` is an
  34. // arbitrary name that matches RFC 1035 segment specification. The length of
  35. // `[CONFIG_NAME]` must be less than 64 bytes.
  36. //
  37. // You pick the RuntimeConfig resource name, but the server will validate that
  38. // the name adheres to this format. After you create the resource, you cannot
  39. // change the resource's name.
  40. string name = 1;
  41. // An optional description of the RuntimeConfig object.
  42. string description = 2;
  43. }
  44. // Describes a single variable within a RuntimeConfig resource.
  45. // The name denotes the hierarchical variable name. For example,
  46. // `ports/serving_port` is a valid variable name. The variable value is an
  47. // opaque string and only leaf variables can have values (that is, variables
  48. // that do not have any child variables).
  49. message Variable {
  50. // The name of the variable resource, in the format:
  51. //
  52. // projects/[PROJECT_ID]/configs/[CONFIG_NAME]/variables/[VARIABLE_NAME]
  53. //
  54. // The `[PROJECT_ID]` must be a valid project ID, `[CONFIG_NAME]` must be a
  55. // valid RuntimeConfig reource and `[VARIABLE_NAME]` follows Unix file system
  56. // file path naming.
  57. //
  58. // The `[VARIABLE_NAME]` can contain ASCII letters, numbers, slashes and
  59. // dashes. Slashes are used as path element separators and are not part of the
  60. // `[VARIABLE_NAME]` itself, so `[VARIABLE_NAME]` must contain at least one
  61. // non-slash character. Multiple slashes are coalesced into single slash
  62. // character. Each path segment should follow RFC 1035 segment specification.
  63. // The length of a `[VARIABLE_NAME]` must be less than 256 bytes.
  64. //
  65. // Once you create a variable, you cannot change the variable name.
  66. string name = 1;
  67. // The value of the variable. It can be either a binary or a string
  68. // value. You must specify one of either `value` or `text`. Specifying both
  69. // will cause the server to return an error.
  70. oneof contents {
  71. // The binary value of the variable. The length of the value must be less
  72. // than 4096 bytes. Empty values are also accepted. The value must be
  73. // base64 encoded. Only one of `value` or `text` can be set.
  74. bytes value = 2;
  75. // The string value of the variable. The length of the value must be less
  76. // than 4096 bytes. Empty values are also accepted. For example,
  77. // `text: "my text value"`. The string must be valid UTF-8.
  78. string text = 5;
  79. }
  80. // [Output Only] The time of the last variable update.
  81. google.protobuf.Timestamp update_time = 3;
  82. // [Ouput only] The current state of the variable. The variable state
  83. // indicates the outcome of the `variables().watch` call and is visible
  84. // through the `get` and `list` calls.
  85. VariableState state = 4;
  86. }
  87. // The condition that a Waiter resource is waiting for.
  88. message EndCondition {
  89. // A Cardinality condition for the Waiter resource. A cardinality condition is
  90. // met when the number of variables under a specified path prefix reaches a
  91. // predefined number. For example, if you set a Cardinality condition where
  92. // the `path` is set to `/foo` and the number of paths is set to 2, the
  93. // following variables would meet the condition in a RuntimeConfig resource:
  94. //
  95. // + `/foo/variable1 = "value1"`
  96. // + `/foo/variable2 = "value2"`
  97. // + `/bar/variable3 = "value3"`
  98. //
  99. // It would not would not satisify the same condition with the `number` set to
  100. // 3, however, because there is only 2 paths that start with `/foo`.
  101. // Cardinality conditions are recursive; all subtrees under the specific
  102. // path prefix are counted.
  103. message Cardinality {
  104. // The root of the variable subtree to monitor. For example, `/foo`.
  105. string path = 1;
  106. // The number variables under the `path` that must exist to meet this
  107. // condition. Defaults to 1 if not specified.
  108. int32 number = 2;
  109. }
  110. // The condition oneof holds the available condition types for this
  111. // EndCondition. Currently, the only available type is Cardinality.
  112. oneof condition {
  113. // The cardinality of the `EndCondition`.
  114. Cardinality cardinality = 1;
  115. }
  116. }
  117. // A Waiter resource waits for some end condition within a RuntimeConfig
  118. // resource to be met before it returns. For example, assume you have a
  119. // distributed system where each node writes to a Variable resource indidicating
  120. // the node's readiness as part of the startup process.
  121. //
  122. // You then configure a Waiter resource with the success condition set to wait
  123. // until some number of nodes have checked in. Afterwards, your application
  124. // runs some arbitrary code after the condition has been met and the waiter
  125. // returns successfully.
  126. //
  127. // Once created, a Waiter resource is immutable.
  128. //
  129. // To learn more about using waiters, read the
  130. // [Creating a
  131. // Waiter](/deployment-manager/runtime-configurator/creating-a-waiter)
  132. // documentation.
  133. message Waiter {
  134. // The name of the Waiter resource, in the format:
  135. //
  136. // projects/[PROJECT_ID]/configs/[CONFIG_NAME]/waiters/[WAITER_NAME]
  137. //
  138. // The `[PROJECT_ID]` must be a valid Google Cloud project ID,
  139. // the `[CONFIG_NAME]` must be a valid RuntimeConfig resource, the
  140. // `[WAITER_NAME]` must match RFC 1035 segment specification, and the length
  141. // of `[WAITER_NAME]` must be less than 64 bytes.
  142. //
  143. // After you create a Waiter resource, you cannot change the resource name.
  144. string name = 1;
  145. // [Required] Specifies the timeout of the waiter in seconds, beginning from
  146. // the instant that `waiters().create` method is called. If this time elapses
  147. // before the success or failure conditions are met, the waiter fails and sets
  148. // the `error` code to `DEADLINE_EXCEEDED`.
  149. google.protobuf.Duration timeout = 2;
  150. // [Optional] The failure condition of this waiter. If this condition is met,
  151. // `done` will be set to `true` and the `error` code will be set to `ABORTED`.
  152. // The failure condition takes precedence over the success condition. If both
  153. // conditions are met, a failure will be indicated. This value is optional; if
  154. // no failure condition is set, the only failure scenario will be a timeout.
  155. EndCondition failure = 3;
  156. // [Required] The success condition. If this condition is met, `done` will be
  157. // set to `true` and the `error` value will remain unset. The failure
  158. // condition takes precedence over the success condition. If both conditions
  159. // are met, a failure will be indicated.
  160. EndCondition success = 4;
  161. // [Output Only] The instant at which this Waiter resource was created. Adding
  162. // the value of `timeout` to this instant yields the timeout deadline for the
  163. // waiter.
  164. google.protobuf.Timestamp create_time = 5;
  165. // [Output Only] If the value is `false`, it means the waiter is still waiting
  166. // for one of its conditions to be met.
  167. //
  168. // If true, the waiter has finished. If the waiter finished due to a timeout
  169. // or failure, `error` will be set.
  170. bool done = 6;
  171. // [Output Only] If the waiter ended due to a failure or timeout, this value
  172. // will be set.
  173. google.rpc.Status error = 7;
  174. }
  175. // The `VariableState` describes the last known state of the variable and is
  176. // used during a `variables().watch` call to distinguish the state of the
  177. // variable.
  178. enum VariableState {
  179. // Default variable state.
  180. VARIABLE_STATE_UNSPECIFIED = 0;
  181. // The variable was updated, while `variables().watch` was executing.
  182. UPDATED = 1;
  183. // The variable was deleted, while `variables().watch` was executing.
  184. DELETED = 2;
  185. }