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