xref: /aosp_15_r20/external/googleapis/google/api/servicemanagement/v1/resources.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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.api.servicemanagement.v1;
18
19import "google/api/config_change.proto";
20import "google/api/field_behavior.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.ServiceManagement.V1";
24option go_package = "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb;servicemanagementpb";
25option java_multiple_files = true;
26option java_outer_classname = "ResourcesProto";
27option java_package = "com.google.api.servicemanagement.v1";
28option objc_class_prefix = "GASM";
29option php_namespace = "Google\\Cloud\\ServiceManagement\\V1";
30option ruby_package = "Google::Cloud::ServiceManagement::V1";
31
32// The full representation of a Service that is managed by
33// Google Service Management.
34message ManagedService {
35  // The name of the service. See the
36  // [overview](https://cloud.google.com/service-infrastructure/docs/overview)
37  // for naming requirements.
38  string service_name = 2;
39
40  // ID of the project that produces and owns this service.
41  string producer_project_id = 3;
42}
43
44// The metadata associated with a long running operation resource.
45message OperationMetadata {
46  // Represents the status of one operation step.
47  message Step {
48    // The short description of the step.
49    string description = 2;
50
51    // The status code.
52    Status status = 4;
53  }
54
55  // Code describes the status of the operation (or one of its steps).
56  enum Status {
57    // Unspecifed code.
58    STATUS_UNSPECIFIED = 0;
59
60    // The operation or step has completed without errors.
61    DONE = 1;
62
63    // The operation or step has not started yet.
64    NOT_STARTED = 2;
65
66    // The operation or step is in progress.
67    IN_PROGRESS = 3;
68
69    // The operation or step has completed with errors. If the operation is
70    // rollbackable, the rollback completed with errors too.
71    FAILED = 4;
72
73    // The operation or step has completed with cancellation.
74    CANCELLED = 5;
75  }
76
77  // The full name of the resources that this operation is directly
78  // associated with.
79  repeated string resource_names = 1;
80
81  // Detailed status information for each step. The order is undetermined.
82  repeated Step steps = 2;
83
84  // Percentage of completion of this operation, ranging from 0 to 100.
85  int32 progress_percentage = 3;
86
87  // The start time of the operation.
88  google.protobuf.Timestamp start_time = 4;
89}
90
91// Represents a diagnostic message (error or warning)
92message Diagnostic {
93  // The kind of diagnostic information possible.
94  enum Kind {
95    // Warnings and errors
96    WARNING = 0;
97
98    // Only errors
99    ERROR = 1;
100  }
101
102  // File name and line number of the error or warning.
103  string location = 1;
104
105  // The kind of diagnostic information provided.
106  Kind kind = 2;
107
108  // Message describing the error or warning.
109  string message = 3;
110}
111
112// Represents a source file which is used to generate the service configuration
113// defined by `google.api.Service`.
114message ConfigSource {
115  // A unique ID for a specific instance of this message, typically assigned
116  // by the client for tracking purpose. If empty, the server may choose to
117  // generate one instead.
118  string id = 5;
119
120  // Set of source configuration files that are used to generate a service
121  // configuration (`google.api.Service`).
122  repeated ConfigFile files = 2;
123}
124
125// Generic specification of a source configuration file
126message ConfigFile {
127  enum FileType {
128    // Unknown file type.
129    FILE_TYPE_UNSPECIFIED = 0;
130
131    // YAML-specification of service.
132    SERVICE_CONFIG_YAML = 1;
133
134    // OpenAPI specification, serialized in JSON.
135    OPEN_API_JSON = 2;
136
137    // OpenAPI specification, serialized in YAML.
138    OPEN_API_YAML = 3;
139
140    // FileDescriptorSet, generated by protoc.
141    //
142    // To generate, use protoc with imports and source info included.
143    // For an example test.proto file, the following command would put the value
144    // in a new file named out.pb.
145    //
146    // $protoc --include_imports --include_source_info test.proto -o out.pb
147    FILE_DESCRIPTOR_SET_PROTO = 4;
148
149    // Uncompiled Proto file. Used for storage and display purposes only,
150    // currently server-side compilation is not supported. Should match the
151    // inputs to 'protoc' command used to generated FILE_DESCRIPTOR_SET_PROTO. A
152    // file of this type can only be included if at least one file of type
153    // FILE_DESCRIPTOR_SET_PROTO is included.
154    PROTO_FILE = 6;
155  }
156
157  // The file name of the configuration file (full or relative path).
158  string file_path = 1;
159
160  // The bytes that constitute the file.
161  bytes file_contents = 3;
162
163  // The type of configuration file this represents.
164  FileType file_type = 4;
165}
166
167// Represents a service configuration with its name and id.
168message ConfigRef {
169  // Resource name of a service config. It must have the following
170  // format: "services/{service name}/configs/{config id}".
171  string name = 1;
172}
173
174// Change report associated with a particular service configuration.
175//
176// It contains a list of ConfigChanges based on the comparison between
177// two service configurations.
178message ChangeReport {
179  // List of changes between two service configurations.
180  // The changes will be alphabetically sorted based on the identifier
181  // of each change.
182  // A ConfigChange identifier is a dot separated path to the configuration.
183  // Example: visibility.rules[selector='LibraryService.CreateBook'].restriction
184  repeated google.api.ConfigChange config_changes = 1;
185}
186
187// A rollout resource that defines how service configuration versions are pushed
188// to control plane systems. Typically, you create a new version of the
189// service config, and then create a Rollout to push the service config.
190message Rollout {
191  // Strategy that specifies how clients of Google Service Controller want to
192  // send traffic to use different config versions. This is generally
193  // used by API proxy to split traffic based on your configured percentage for
194  // each config version.
195  //
196  // One example of how to gradually rollout a new service configuration using
197  // this
198  // strategy:
199  // Day 1
200  //
201  //     Rollout {
202  //       id: "example.googleapis.com/rollout_20160206"
203  //       traffic_percent_strategy {
204  //         percentages: {
205  //           "example.googleapis.com/20160201": 70.00
206  //           "example.googleapis.com/20160206": 30.00
207  //         }
208  //       }
209  //     }
210  //
211  // Day 2
212  //
213  //     Rollout {
214  //       id: "example.googleapis.com/rollout_20160207"
215  //       traffic_percent_strategy: {
216  //         percentages: {
217  //           "example.googleapis.com/20160206": 100.00
218  //         }
219  //       }
220  //     }
221  message TrafficPercentStrategy {
222    // Maps service configuration IDs to their corresponding traffic percentage.
223    // Key is the service configuration ID, Value is the traffic percentage
224    // which must be greater than 0.0 and the sum must equal to 100.0.
225    map<string, double> percentages = 1;
226  }
227
228  // Strategy used to delete a service. This strategy is a placeholder only
229  // used by the system generated rollout to delete a service.
230  message DeleteServiceStrategy {}
231
232  // Status of a Rollout.
233  enum RolloutStatus {
234    // No status specified.
235    ROLLOUT_STATUS_UNSPECIFIED = 0;
236
237    // The Rollout is in progress.
238    IN_PROGRESS = 1;
239
240    // The Rollout has completed successfully.
241    SUCCESS = 2;
242
243    // The Rollout has been cancelled. This can happen if you have overlapping
244    // Rollout pushes, and the previous ones will be cancelled.
245    CANCELLED = 3;
246
247    // The Rollout has failed and the rollback attempt has failed too.
248    FAILED = 4;
249
250    // The Rollout has not started yet and is pending for execution.
251    PENDING = 5;
252
253    // The Rollout has failed and rolled back to the previous successful
254    // Rollout.
255    FAILED_ROLLED_BACK = 6;
256  }
257
258  // Optional. Unique identifier of this Rollout. Must be no longer than 63
259  // characters and only lower case letters, digits, '.', '_' and '-' are
260  // allowed.
261  //
262  // If not specified by client, the server will generate one. The generated id
263  // will have the form of <date><revision number>, where "date" is the create
264  // date in ISO 8601 format.  "revision number" is a monotonically increasing
265  // positive number that is reset every day for each service.
266  // An example of the generated rollout_id is '2016-02-16r1'
267  string rollout_id = 1 [(google.api.field_behavior) = OPTIONAL];
268
269  // Creation time of the rollout. Readonly.
270  google.protobuf.Timestamp create_time = 2;
271
272  // The user who created the Rollout. Readonly.
273  string created_by = 3;
274
275  // The status of this rollout. Readonly. In case of a failed rollout,
276  // the system will automatically rollback to the current Rollout
277  // version. Readonly.
278  RolloutStatus status = 4;
279
280  // Strategy that defines which versions of service configurations should be
281  // pushed
282  // and how they should be used at runtime.
283  oneof strategy {
284    // Google Service Control selects service configurations based on
285    // traffic percentage.
286    TrafficPercentStrategy traffic_percent_strategy = 5;
287
288    // The strategy associated with a rollout to delete a `ManagedService`.
289    // Readonly.
290    DeleteServiceStrategy delete_service_strategy = 200;
291  }
292
293  // The name of the service associated with this Rollout.
294  string service_name = 8;
295}
296