xref: /aosp_15_r20/external/googleapis/google/appengine/v1beta/service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2021 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.v1beta;
18
19import "google/appengine/v1beta/network_settings.proto";
20
21option csharp_namespace = "Google.Cloud.AppEngine.V1Beta";
22option go_package = "google.golang.org/genproto/googleapis/appengine/v1beta;appengine";
23option java_multiple_files = true;
24option java_outer_classname = "ServiceProto";
25option java_package = "com.google.appengine.v1beta";
26option php_namespace = "Google\\Cloud\\AppEngine\\V1beta";
27option ruby_package = "Google::Cloud::AppEngine::V1beta";
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  // Ingress settings for this service. Will apply to all versions.
54  NetworkSettings network_settings = 6;
55}
56
57// Traffic routing configuration for versions within a single service. Traffic
58// splits define how traffic directed to the service is assigned to versions.
59message TrafficSplit {
60  // Available sharding mechanisms.
61  enum ShardBy {
62    // Diversion method unspecified.
63    UNSPECIFIED = 0;
64
65    // Diversion based on a specially named cookie, "GOOGAPPUID." The cookie
66    // must be set by the application itself or no diversion will occur.
67    COOKIE = 1;
68
69    // Diversion based on applying the modulus operation to a fingerprint
70    // of the IP address.
71    IP = 2;
72
73    // Diversion based on weighted random assignment. An incoming request is
74    // randomly routed to a version in the traffic split, with probability
75    // proportional to the version's traffic share.
76    RANDOM = 3;
77  }
78
79  // Mechanism used to determine which version a request is sent to.
80  // The traffic selection algorithm will
81  // be stable for either type until allocations are changed.
82  ShardBy shard_by = 1;
83
84  // Mapping from version IDs within the service to fractional
85  // (0.000, 1] allocations of traffic for that version. Each version can
86  // be specified only once, but some versions in the service may not
87  // have any traffic allocation. Services that have traffic allocated
88  // cannot be deleted until either the service is deleted or
89  // their traffic allocation is removed. Allocations must sum to 1.
90  // Up to two decimal place precision is supported for IP-based splits and
91  // up to three decimal places is supported for cookie-based splits.
92  map<string, double> allocations = 2;
93}
94