1// Copyright 2022 Google LLC 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.appengine.v1; 18 19import "google/appengine/v1/network_settings.proto"; 20 21option csharp_namespace = "Google.Cloud.AppEngine.V1"; 22option go_package = "cloud.google.com/go/appengine/apiv1/appenginepb;appenginepb"; 23option java_multiple_files = true; 24option java_outer_classname = "ServiceProto"; 25option java_package = "com.google.appengine.v1"; 26option php_namespace = "Google\\Cloud\\AppEngine\\V1"; 27option ruby_package = "Google::Cloud::AppEngine::V1"; 28 29// A Service resource is a logical component of an application that can share 30// state and communicate in a secure fashion with other services. 31// For example, an application that handles customer requests might 32// include separate services to handle tasks such as backend data 33// analysis or API requests from mobile devices. Each service has a 34// collection of versions that define a specific set of code used to 35// implement the functionality of that service. 36message Service { 37 // Full path to the Service resource in the API. 38 // Example: `apps/myapp/services/default`. 39 // 40 // @OutputOnly 41 string name = 1; 42 43 // Relative name of the service within the application. 44 // Example: `default`. 45 // 46 // @OutputOnly 47 string id = 2; 48 49 // Mapping that defines fractional HTTP traffic diversion to 50 // different versions within the service. 51 TrafficSplit split = 3; 52 53 // A set of labels to apply to this service. Labels are key/value pairs that 54 // describe the service and all resources that belong to it (e.g., 55 // versions). The labels can be used to search and group resources, and are 56 // propagated to the usage and billing reports, enabling fine-grain analysis 57 // of costs. An example of using labels is to tag resources belonging to 58 // different environments (e.g., "env=prod", "env=qa"). 59 // 60 // <p>Label keys and values can be no longer than 63 characters and can only 61 // contain lowercase letters, numeric characters, underscores, dashes, and 62 // international characters. Label keys must start with a lowercase letter 63 // or an international character. Each service can have at most 32 labels. 64 map<string, string> labels = 4; 65 66 // Ingress settings for this service. Will apply to all versions. 67 NetworkSettings network_settings = 6; 68} 69 70// Traffic routing configuration for versions within a single service. Traffic 71// splits define how traffic directed to the service is assigned to versions. 72message TrafficSplit { 73 // Available sharding mechanisms. 74 enum ShardBy { 75 // Diversion method unspecified. 76 UNSPECIFIED = 0; 77 78 // Diversion based on a specially named cookie, "GOOGAPPUID." The cookie 79 // must be set by the application itself or no diversion will occur. 80 COOKIE = 1; 81 82 // Diversion based on applying the modulus operation to a fingerprint 83 // of the IP address. 84 IP = 2; 85 86 // Diversion based on weighted random assignment. An incoming request is 87 // randomly routed to a version in the traffic split, with probability 88 // proportional to the version's traffic share. 89 RANDOM = 3; 90 } 91 92 // Mechanism used to determine which version a request is sent to. 93 // The traffic selection algorithm will 94 // be stable for either type until allocations are changed. 95 ShardBy shard_by = 1; 96 97 // Mapping from version IDs within the service to fractional 98 // (0.000, 1] allocations of traffic for that version. Each version can 99 // be specified only once, but some versions in the service may not 100 // have any traffic allocation. Services that have traffic allocated 101 // cannot be deleted until either the service is deleted or 102 // their traffic allocation is removed. Allocations must sum to 1. 103 // Up to two decimal place precision is supported for IP-based splits and 104 // up to three decimal places is supported for cookie-based splits. 105 map<string, double> allocations = 2; 106} 107