xref: /aosp_15_r20/external/googleapis/google/cloud/run/v2/service.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.cloud.run.v2;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/launch_stage.proto";
23import "google/api/resource.proto";
24import "google/api/routing.proto";
25import "google/cloud/run/v2/condition.proto";
26import "google/cloud/run/v2/revision_template.proto";
27import "google/cloud/run/v2/traffic_target.proto";
28import "google/cloud/run/v2/vendor_settings.proto";
29import "google/iam/v1/iam_policy.proto";
30import "google/iam/v1/policy.proto";
31import "google/longrunning/operations.proto";
32import "google/protobuf/timestamp.proto";
33
34option go_package = "cloud.google.com/go/run/apiv2/runpb;runpb";
35option java_multiple_files = true;
36option java_outer_classname = "ServiceProto";
37option java_package = "com.google.cloud.run.v2";
38
39// Cloud Run Service Control Plane API
40service Services {
41  option (google.api.default_host) = "run.googleapis.com";
42  option (google.api.oauth_scopes) =
43      "https://www.googleapis.com/auth/cloud-platform";
44
45  // Creates a new Service in a given project and location.
46  rpc CreateService(CreateServiceRequest)
47      returns (google.longrunning.Operation) {
48    option (google.api.http) = {
49      post: "/v2/{parent=projects/*/locations/*}/services"
50      body: "service"
51    };
52    option (google.api.routing) = {
53      routing_parameters {
54        field: "parent"
55        path_template: "projects/*/locations/{location=*}"
56      }
57    };
58    option (google.api.method_signature) = "parent,service,service_id";
59    option (google.longrunning.operation_info) = {
60      response_type: "Service"
61      metadata_type: "Service"
62    };
63  }
64
65  // Gets information about a Service.
66  rpc GetService(GetServiceRequest) returns (Service) {
67    option (google.api.http) = {
68      get: "/v2/{name=projects/*/locations/*/services/*}"
69    };
70    option (google.api.routing) = {
71      routing_parameters {
72        field: "name"
73        path_template: "projects/*/locations/{location=*}/**"
74      }
75    };
76    option (google.api.method_signature) = "name";
77  }
78
79  // Lists Services.
80  rpc ListServices(ListServicesRequest) returns (ListServicesResponse) {
81    option (google.api.http) = {
82      get: "/v2/{parent=projects/*/locations/*}/services"
83    };
84    option (google.api.routing) = {
85      routing_parameters {
86        field: "parent"
87        path_template: "projects/*/locations/{location=*}"
88      }
89    };
90    option (google.api.method_signature) = "parent";
91  }
92
93  // Updates a Service.
94  rpc UpdateService(UpdateServiceRequest)
95      returns (google.longrunning.Operation) {
96    option (google.api.http) = {
97      patch: "/v2/{service.name=projects/*/locations/*/services/*}"
98      body: "service"
99    };
100    option (google.api.routing) = {
101      routing_parameters {
102        field: "service.name"
103        path_template: "projects/*/locations/{location=*}/**"
104      }
105    };
106    option (google.api.method_signature) = "service";
107    option (google.longrunning.operation_info) = {
108      response_type: "Service"
109      metadata_type: "Service"
110    };
111  }
112
113  // Deletes a Service.
114  // This will cause the Service to stop serving traffic and will delete all
115  // revisions.
116  rpc DeleteService(DeleteServiceRequest)
117      returns (google.longrunning.Operation) {
118    option (google.api.http) = {
119      delete: "/v2/{name=projects/*/locations/*/services/*}"
120    };
121    option (google.api.routing) = {
122      routing_parameters {
123        field: "name"
124        path_template: "projects/*/locations/{location=*}/**"
125      }
126    };
127    option (google.api.method_signature) = "name";
128    option (google.longrunning.operation_info) = {
129      response_type: "Service"
130      metadata_type: "Service"
131    };
132  }
133
134  // Gets the IAM Access Control policy currently in effect for the given
135  // Cloud Run Service. This result does not include any inherited policies.
136  rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
137      returns (google.iam.v1.Policy) {
138    option (google.api.http) = {
139      get: "/v2/{resource=projects/*/locations/*/services/*}:getIamPolicy"
140    };
141  }
142
143  // Sets the IAM Access control policy for the specified Service. Overwrites
144  // any existing policy.
145  rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
146      returns (google.iam.v1.Policy) {
147    option (google.api.http) = {
148      post: "/v2/{resource=projects/*/locations/*/services/*}:setIamPolicy"
149      body: "*"
150    };
151  }
152
153  // Returns permissions that a caller has on the specified Project.
154  //
155  // There are no permissions required for making this API call.
156  rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
157      returns (google.iam.v1.TestIamPermissionsResponse) {
158    option (google.api.http) = {
159      post: "/v2/{resource=projects/*/locations/*/services/*}:testIamPermissions"
160      body: "*"
161    };
162  }
163}
164
165// Request message for creating a Service.
166message CreateServiceRequest {
167  // Required. The location and project in which this service should be created.
168  // Format: projects/{project}/locations/{location}, where {project} can be
169  // project id or number. Only lowercase characters, digits, and hyphens.
170  string parent = 1 [
171    (google.api.field_behavior) = REQUIRED,
172    (google.api.resource_reference) = {
173      child_type: "run.googleapis.com/Service"
174    }
175  ];
176
177  // Required. The Service instance to create.
178  Service service = 2 [(google.api.field_behavior) = REQUIRED];
179
180  // Required. The unique identifier for the Service. It must begin with letter,
181  // and cannot end with hyphen; must contain fewer than 50 characters.
182  // The name of the service becomes {parent}/services/{service_id}.
183  string service_id = 3 [(google.api.field_behavior) = REQUIRED];
184
185  // Indicates that the request should be validated and default values
186  // populated, without persisting the request or creating any resources.
187  bool validate_only = 4;
188}
189
190// Request message for updating a service.
191message UpdateServiceRequest {
192  // Required. The Service to be updated.
193  Service service = 1 [(google.api.field_behavior) = REQUIRED];
194
195  // Indicates that the request should be validated and default values
196  // populated, without persisting the request or updating any resources.
197  bool validate_only = 3;
198
199  // If set to true, and if the Service does not exist, it will create a new
200  // one. The caller must have 'run.services.create' permissions if this is set
201  // to true and the Service does not exist.
202  bool allow_missing = 4;
203}
204
205// Request message for retrieving a list of Services.
206message ListServicesRequest {
207  // Required. The location and project to list resources on.
208  // Location must be a valid Google Cloud region, and cannot be the "-"
209  // wildcard. Format: projects/{project}/locations/{location}, where {project}
210  // can be project id or number.
211  string parent = 1 [
212    (google.api.field_behavior) = REQUIRED,
213    (google.api.resource_reference) = {
214      child_type: "run.googleapis.com/Service"
215    }
216  ];
217
218  // Maximum number of Services to return in this call.
219  int32 page_size = 2;
220
221  // A page token received from a previous call to ListServices.
222  // All other parameters must match.
223  string page_token = 3;
224
225  // If true, returns deleted (but unexpired) resources along with active ones.
226  bool show_deleted = 4;
227}
228
229// Response message containing a list of Services.
230message ListServicesResponse {
231  // The resulting list of Services.
232  repeated Service services = 1;
233
234  // A token indicating there are more items than page_size. Use it in the next
235  // ListServices request to continue.
236  string next_page_token = 2;
237}
238
239// Request message for obtaining a Service by its full name.
240message GetServiceRequest {
241  // Required. The full name of the Service.
242  // Format: projects/{project}/locations/{location}/services/{service}, where
243  // {project} can be project id or number.
244  string name = 1 [
245    (google.api.field_behavior) = REQUIRED,
246    (google.api.resource_reference) = { type: "run.googleapis.com/Service" }
247  ];
248}
249
250// Request message to delete a Service by its full name.
251message DeleteServiceRequest {
252  // Required. The full name of the Service.
253  // Format: projects/{project}/locations/{location}/services/{service}, where
254  // {project} can be project id or number.
255  string name = 1 [
256    (google.api.field_behavior) = REQUIRED,
257    (google.api.resource_reference) = { type: "run.googleapis.com/Service" }
258  ];
259
260  // Indicates that the request should be validated without actually
261  // deleting any resources.
262  bool validate_only = 2;
263
264  // A system-generated fingerprint for this version of the
265  // resource. May be used to detect modification conflict during updates.
266  string etag = 3;
267}
268
269// Service acts as a top-level container that manages a set of
270// configurations and revision templates which implement a network service.
271// Service exists to provide a singular abstraction which can be access
272// controlled, reasoned about, and which encapsulates software lifecycle
273// decisions such as rollout policy and team resource ownership.
274message Service {
275  option (google.api.resource) = {
276    type: "run.googleapis.com/Service"
277    pattern: "projects/{project}/locations/{location}/services/{service}"
278    style: DECLARATIVE_FRIENDLY
279  };
280
281  // The fully qualified name of this Service. In CreateServiceRequest, this
282  // field is ignored, and instead composed from CreateServiceRequest.parent and
283  // CreateServiceRequest.service_id.
284  //
285  // Format:
286  // projects/{project}/locations/{location}/services/{service_id}
287  string name = 1;
288
289  // User-provided description of the Service. This field currently has a
290  // 512-character limit.
291  string description = 2;
292
293  // Output only. Server assigned unique identifier for the trigger. The value
294  // is a UUID4 string and guaranteed to remain unchanged until the resource is
295  // deleted.
296  string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
297
298  // Output only. A number that monotonically increases every time the user
299  // modifies the desired state.
300  // Please note that unlike v1, this is an int64 value. As with most Google
301  // APIs, its JSON representation will be a `string` instead of an `integer`.
302  int64 generation = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
303
304  // Optional. Unstructured key value map that can be used to organize and
305  // categorize objects. User-provided labels are shared with Google's billing
306  // system, so they can be used to filter, or break down billing charges by
307  // team, component, environment, state, etc. For more information, visit
308  // https://cloud.google.com/resource-manager/docs/creating-managing-labels or
309  // https://cloud.google.com/run/docs/configuring/labels.
310  //
311  // <p>Cloud Run API v2 does not support labels with  `run.googleapis.com`,
312  // `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
313  // namespaces, and they will be rejected. All system labels in v1 now have a
314  // corresponding field in v2 Service.
315  map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL];
316
317  // Optional. Unstructured key value map that may be set by external tools to
318  // store and arbitrary metadata. They are not queryable and should be
319  // preserved when modifying objects.
320  //
321  // <p>Cloud Run API v2 does not support annotations with `run.googleapis.com`,
322  // `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
323  // namespaces, and they will be rejected in new resources. All system
324  // annotations in v1 now have a corresponding field in v2 Service.
325  //
326  // <p>This field follows Kubernetes
327  // annotations' namespacing, limits, and rules.
328  map<string, string> annotations = 6 [(google.api.field_behavior) = OPTIONAL];
329
330  // Output only. The creation time.
331  google.protobuf.Timestamp create_time = 7
332      [(google.api.field_behavior) = OUTPUT_ONLY];
333
334  // Output only. The last-modified time.
335  google.protobuf.Timestamp update_time = 8
336      [(google.api.field_behavior) = OUTPUT_ONLY];
337
338  // Output only. The deletion time.
339  google.protobuf.Timestamp delete_time = 9
340      [(google.api.field_behavior) = OUTPUT_ONLY];
341
342  // Output only. For a deleted resource, the time after which it will be
343  // permamently deleted.
344  google.protobuf.Timestamp expire_time = 10
345      [(google.api.field_behavior) = OUTPUT_ONLY];
346
347  // Output only. Email address of the authenticated creator.
348  string creator = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
349
350  // Output only. Email address of the last authenticated modifier.
351  string last_modifier = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
352
353  // Arbitrary identifier for the API client.
354  string client = 13;
355
356  // Arbitrary version identifier for the API client.
357  string client_version = 14;
358
359  // Provides the ingress settings for this Service. On output, returns the
360  // currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no
361  // revision is active.
362  IngressTraffic ingress = 15;
363
364  // The launch stage as defined by [Google Cloud Platform
365  // Launch Stages](https://cloud.google.com/terms/launch-stages).
366  // Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
367  // is assumed.
368  // Set the launch stage to a preview stage on input to allow use of preview
369  // features in that stage. On read (or output), describes whether the resource
370  // uses preview features.
371  // <p>
372  // For example, if ALPHA is provided as input, but only BETA and GA-level
373  // features are used, this field will be BETA on output.
374  google.api.LaunchStage launch_stage = 16;
375
376  // Settings for the Binary Authorization feature.
377  BinaryAuthorization binary_authorization = 17;
378
379  // Required. The template used to create revisions for this Service.
380  RevisionTemplate template = 18 [(google.api.field_behavior) = REQUIRED];
381
382  // Specifies how to distribute traffic over a collection of Revisions
383  // belonging to the Service. If traffic is empty or not provided, defaults to
384  // 100% traffic to the latest `Ready` Revision.
385  repeated TrafficTarget traffic = 19;
386
387  // Optional. Specifies service-level scaling settings
388  ServiceScaling scaling = 20 [(google.api.field_behavior) = OPTIONAL];
389
390  // Optional. Disables public resolution of the default URI of this service.
391  bool default_uri_disabled = 22 [(google.api.field_behavior) = OPTIONAL];
392
393  // Output only. The generation of this Service currently serving traffic. See
394  // comments in `reconciling` for additional information on reconciliation
395  // process in Cloud Run. Please note that unlike v1, this is an int64 value.
396  // As with most Google APIs, its JSON representation will be a `string`
397  // instead of an `integer`.
398  int64 observed_generation = 30 [(google.api.field_behavior) = OUTPUT_ONLY];
399
400  // Output only. The Condition of this Service, containing its readiness
401  // status, and detailed error information in case it did not reach a serving
402  // state. See comments in `reconciling` for additional information on
403  // reconciliation process in Cloud Run.
404  Condition terminal_condition = 31 [(google.api.field_behavior) = OUTPUT_ONLY];
405
406  // Output only. The Conditions of all other associated sub-resources. They
407  // contain additional diagnostics information in case the Service does not
408  // reach its Serving state. See comments in `reconciling` for additional
409  // information on reconciliation process in Cloud Run.
410  repeated Condition conditions = 32
411      [(google.api.field_behavior) = OUTPUT_ONLY];
412
413  // Output only. Name of the latest revision that is serving traffic. See
414  // comments in `reconciling` for additional information on reconciliation
415  // process in Cloud Run.
416  string latest_ready_revision = 33 [
417    (google.api.field_behavior) = OUTPUT_ONLY,
418    (google.api.resource_reference) = { type: "run.googleapis.com/Revision" }
419  ];
420
421  // Output only. Name of the last created revision. See comments in
422  // `reconciling` for additional information on reconciliation process in Cloud
423  // Run.
424  string latest_created_revision = 34 [
425    (google.api.field_behavior) = OUTPUT_ONLY,
426    (google.api.resource_reference) = { type: "run.googleapis.com/Revision" }
427  ];
428
429  // Output only. Detailed status information for corresponding traffic targets.
430  // See comments in `reconciling` for additional information on reconciliation
431  // process in Cloud Run.
432  repeated TrafficTargetStatus traffic_statuses = 35
433      [(google.api.field_behavior) = OUTPUT_ONLY];
434
435  // Output only. The main URI in which this Service is serving traffic.
436  string uri = 36 [(google.api.field_behavior) = OUTPUT_ONLY];
437
438  // One or more custom audiences that you want this service to support. Specify
439  // each custom audience as the full URL in a string. The custom audiences are
440  // encoded in the token and used to authenticate requests. For more
441  // information, see
442  // https://cloud.google.com/run/docs/configuring/custom-audiences.
443  repeated string custom_audiences = 37;
444
445  // Output only. Reserved for future use.
446  bool satisfies_pzs = 38 [(google.api.field_behavior) = OUTPUT_ONLY];
447
448  // Output only. Returns true if the Service is currently being acted upon by
449  // the system to bring it into the desired state.
450  //
451  // When a new Service is created, or an existing one is updated, Cloud Run
452  // will asynchronously perform all necessary steps to bring the Service to the
453  // desired serving state. This process is called reconciliation.
454  // While reconciliation is in process, `observed_generation`,
455  // `latest_ready_revison`, `traffic_statuses`, and `uri` will have transient
456  // values that might mismatch the intended state: Once reconciliation is over
457  // (and this field is false), there are two possible outcomes: reconciliation
458  // succeeded and the serving state matches the Service, or there was an error,
459  // and reconciliation failed. This state can be found in
460  // `terminal_condition.state`.
461  //
462  // If reconciliation succeeded, the following fields will match: `traffic` and
463  // `traffic_statuses`, `observed_generation` and `generation`,
464  // `latest_ready_revision` and `latest_created_revision`.
465  //
466  // If reconciliation failed, `traffic_statuses`, `observed_generation`, and
467  // `latest_ready_revision` will have the state of the last serving revision,
468  // or empty for newly created Services. Additional information on the failure
469  // can be found in `terminal_condition` and `conditions`.
470  bool reconciling = 98 [(google.api.field_behavior) = OUTPUT_ONLY];
471
472  // Output only. A system-generated fingerprint for this version of the
473  // resource. May be used to detect modification conflict during updates.
474  string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY];
475}
476