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