xref: /aosp_15_r20/external/googleapis/google/cloud/apigateway/v1/apigateway.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.cloud.apigateway.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/field_mask.proto";
22import "google/protobuf/timestamp.proto";
23
24option csharp_namespace = "Google.Cloud.ApiGateway.V1";
25option go_package = "cloud.google.com/go/apigateway/apiv1/apigatewaypb;apigatewaypb";
26option java_multiple_files = true;
27option java_package = "com.google.cloud.apigateway.v1";
28option php_namespace = "Google\\Cloud\\ApiGateway\\V1";
29option ruby_package = "Google::Cloud::ApiGateway::V1";
30option (google.api.resource_definition) = {
31  type: "iam.googleapis.com/ServiceAccount"
32  pattern: "projects/{project}/serviceAccounts/{service_account}"
33};
34option (google.api.resource_definition) = {
35  type: "servicemanagement.googleapis.com/ManagedService"
36  pattern: "services/{service}"
37};
38option (google.api.resource_definition) = {
39  type: "servicemanagement.googleapis.com/Service"
40  pattern: "services/{service}/configs/{config}"
41};
42
43// An API that can be served by one or more Gateways.
44message Api {
45  option (google.api.resource) = {
46    type: "apigateway.googleapis.com/Api"
47    pattern: "projects/{project}/locations/global/apis/{api}"
48  };
49
50  // All the possible API states.
51  enum State {
52    // API does not have a state yet.
53    STATE_UNSPECIFIED = 0;
54
55    // API is being created.
56    CREATING = 1;
57
58    // API is active.
59    ACTIVE = 2;
60
61    // API creation failed.
62    FAILED = 3;
63
64    // API is being deleted.
65    DELETING = 4;
66
67    // API is being updated.
68    UPDATING = 5;
69  }
70
71  // Output only. Resource name of the API.
72  // Format: projects/{project}/locations/global/apis/{api}
73  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
74
75  // Output only. Created time.
76  google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
77
78  // Output only. Updated time.
79  google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
80
81  // Optional. Resource labels to represent user-provided metadata.
82  // Refer to cloud documentation on labels for more details.
83  // https://cloud.google.com/compute/docs/labeling-resources
84  map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];
85
86  // Optional. Display name.
87  string display_name = 5 [(google.api.field_behavior) = OPTIONAL];
88
89  // Optional. Immutable. The name of a Google Managed Service (
90  // https://cloud.google.com/service-infrastructure/docs/glossary#managed). If
91  // not specified, a new Service will automatically be created in the same
92  // project as this API.
93  string managed_service = 7 [
94    (google.api.field_behavior) = IMMUTABLE,
95    (google.api.field_behavior) = OPTIONAL,
96    (google.api.resource_reference) = {
97      type: "servicemanagement.googleapis.com/ManagedService"
98    }
99  ];
100
101  // Output only. State of the API.
102  State state = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
103}
104
105// An API Configuration is a combination of settings for both the Managed
106// Service and Gateways serving this API Config.
107message ApiConfig {
108  option (google.api.resource) = {
109    type: "apigateway.googleapis.com/ApiConfig"
110    pattern: "projects/{project}/locations/global/apis/{api}/configs/{api_config}"
111  };
112
113  // A lightweight description of a file.
114  message File {
115    // The file path (full or relative path). This is typically the path of the
116    // file when it is uploaded.
117    string path = 1;
118
119    // The bytes that constitute the file.
120    bytes contents = 2;
121  }
122
123  // An OpenAPI Specification Document describing an API.
124  message OpenApiDocument {
125    // The OpenAPI Specification document file.
126    File document = 1;
127  }
128
129  // A gRPC service definition.
130  message GrpcServiceDefinition {
131    // Input only. File descriptor set, generated by protoc.
132    //
133    // To generate, use protoc with imports and source info included.
134    // For an example test.proto file, the following command would put the value
135    // in a new file named out.pb.
136    //
137    // $ protoc --include_imports --include_source_info test.proto -o out.pb
138    File file_descriptor_set = 1 [(google.api.field_behavior) = INPUT_ONLY];
139
140    // Optional. Uncompiled proto files associated with the descriptor set, used for
141    // display purposes (server-side compilation is not supported). These
142    // should match the inputs to 'protoc' command used to generate
143    // file_descriptor_set.
144    repeated File source = 2 [(google.api.field_behavior) = OPTIONAL];
145  }
146
147  // All the possible API Config states.
148  enum State {
149    // API Config does not have a state yet.
150    STATE_UNSPECIFIED = 0;
151
152    // API Config is being created and deployed to the API Controller.
153    CREATING = 1;
154
155    // API Config is ready for use by Gateways.
156    ACTIVE = 2;
157
158    // API Config creation failed.
159    FAILED = 3;
160
161    // API Config is being deleted.
162    DELETING = 4;
163
164    // API Config is being updated.
165    UPDATING = 5;
166
167    // API Config settings are being activated in downstream systems.
168    // API Configs in this state cannot be used by Gateways.
169    ACTIVATING = 6;
170  }
171
172  // Output only. Resource name of the API Config.
173  // Format: projects/{project}/locations/global/apis/{api}/configs/{api_config}
174  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
175
176  // Output only. Created time.
177  google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
178
179  // Output only. Updated time.
180  google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
181
182  // Optional. Resource labels to represent user-provided metadata.
183  // Refer to cloud documentation on labels for more details.
184  // https://cloud.google.com/compute/docs/labeling-resources
185  map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];
186
187  // Optional. Display name.
188  string display_name = 5 [(google.api.field_behavior) = OPTIONAL];
189
190  // Immutable. The Google Cloud IAM Service Account that Gateways serving this config
191  // should use to authenticate to other services. This may either be the
192  // Service Account's email
193  // (`{ACCOUNT_ID}@{PROJECT}.iam.gserviceaccount.com`) or its full resource
194  // name (`projects/{PROJECT}/accounts/{UNIQUE_ID}`). This is most often used
195  // when the service is a GCP resource such as a Cloud Run Service or an
196  // IAP-secured service.
197  string gateway_service_account = 14 [
198    (google.api.field_behavior) = IMMUTABLE,
199    (google.api.resource_reference) = {
200      type: "iam.googleapis.com/ServiceAccount"
201    }
202  ];
203
204  // Output only. The ID of the associated Service Config (
205  // https://cloud.google.com/service-infrastructure/docs/glossary#config).
206  string service_config_id = 12 [
207    (google.api.field_behavior) = OUTPUT_ONLY,
208    (google.api.resource_reference) = {
209      type: "servicemanagement.googleapis.com/Service"
210    }
211  ];
212
213  // Output only. State of the API Config.
214  State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
215
216  // Optional. OpenAPI specification documents. If specified, grpc_services and
217  // managed_service_configs must not be included.
218  repeated OpenApiDocument openapi_documents = 9 [(google.api.field_behavior) = OPTIONAL];
219
220  // Optional. gRPC service definition files. If specified, openapi_documents must
221  // not be included.
222  repeated GrpcServiceDefinition grpc_services = 10 [(google.api.field_behavior) = OPTIONAL];
223
224  // Optional. Service Configuration files. At least one must be included when using gRPC
225  // service definitions. See
226  // https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#service_configuration_overview
227  // for the expected file contents.
228  //
229  // If multiple files are specified, the files are merged with the following
230  // rules:
231  // * All singular scalar fields are merged using "last one wins" semantics in
232  // the order of the files uploaded.
233  // * Repeated fields are concatenated.
234  // * Singular embedded messages are merged using these rules for nested
235  // fields.
236  repeated File managed_service_configs = 11 [(google.api.field_behavior) = OPTIONAL];
237}
238
239// A Gateway is an API-aware HTTP proxy. It performs API-Method and/or
240// API-Consumer specific actions based on an API Config such as authentication,
241// policy enforcement, and backend selection.
242message Gateway {
243  option (google.api.resource) = {
244    type: "apigateway.googleapis.com/Gateway"
245    pattern: "projects/{project}/locations/{location}/gateways/{gateway}"
246  };
247
248  // All the possible Gateway states.
249  enum State {
250    // Gateway does not have a state yet.
251    STATE_UNSPECIFIED = 0;
252
253    // Gateway is being created.
254    CREATING = 1;
255
256    // Gateway is running and ready for requests.
257    ACTIVE = 2;
258
259    // Gateway creation failed.
260    FAILED = 3;
261
262    // Gateway is being deleted.
263    DELETING = 4;
264
265    // Gateway is being updated.
266    UPDATING = 5;
267  }
268
269  // Output only. Resource name of the Gateway.
270  // Format: projects/{project}/locations/{location}/gateways/{gateway}
271  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
272
273  // Output only. Created time.
274  google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
275
276  // Output only. Updated time.
277  google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
278
279  // Optional. Resource labels to represent user-provided metadata.
280  // Refer to cloud documentation on labels for more details.
281  // https://cloud.google.com/compute/docs/labeling-resources
282  map<string, string> labels = 4 [(google.api.field_behavior) = OPTIONAL];
283
284  // Optional. Display name.
285  string display_name = 5 [(google.api.field_behavior) = OPTIONAL];
286
287  // Required. Resource name of the API Config for this Gateway.
288  // Format: projects/{project}/locations/global/apis/{api}/configs/{apiConfig}
289  string api_config = 6 [
290    (google.api.field_behavior) = REQUIRED,
291    (google.api.resource_reference) = {
292      type: "apigateway.googleapis.com/ApiConfig"
293    }
294  ];
295
296  // Output only. The current state of the Gateway.
297  State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
298
299  // Output only. The default API Gateway host name of the form
300  // `{gateway_id}-{hash}.{region_code}.gateway.dev`.
301  string default_hostname = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
302}
303
304// Request message for ApiGatewayService.ListGateways
305message ListGatewaysRequest {
306  // Required. Parent resource of the Gateway, of the form:
307  // `projects/*/locations/*`
308  string parent = 1 [
309    (google.api.field_behavior) = REQUIRED,
310    (google.api.resource_reference) = {
311      type: "locations.googleapis.com/Location"
312    }
313  ];
314
315  // Page size.
316  int32 page_size = 2;
317
318  // Page token.
319  string page_token = 3;
320
321  // Filter.
322  string filter = 4;
323
324  // Order by parameters.
325  string order_by = 5;
326}
327
328// Response message for ApiGatewayService.ListGateways
329message ListGatewaysResponse {
330  // Gateways.
331  repeated Gateway gateways = 1;
332
333  // Next page token.
334  string next_page_token = 2;
335
336  // Locations that could not be reached.
337  repeated string unreachable_locations = 3;
338}
339
340// Request message for ApiGatewayService.GetGateway
341message GetGatewayRequest {
342  // Required. Resource name of the form:
343  // `projects/*/locations/*/gateways/*`
344  string name = 1 [
345    (google.api.field_behavior) = REQUIRED,
346    (google.api.resource_reference) = {
347      type: "apigateway.googleapis.com/Gateway"
348    }
349  ];
350}
351
352// Request message for ApiGatewayService.CreateGateway
353message CreateGatewayRequest {
354  // Required. Parent resource of the Gateway, of the form:
355  // `projects/*/locations/*`
356  string parent = 1 [
357    (google.api.field_behavior) = REQUIRED,
358    (google.api.resource_reference) = {
359      type: "locations.googleapis.com/Location"
360    }
361  ];
362
363  // Required. Identifier to assign to the Gateway. Must be unique within scope of
364  // the parent resource.
365  string gateway_id = 2 [(google.api.field_behavior) = REQUIRED];
366
367  // Required. Gateway resource.
368  Gateway gateway = 3 [(google.api.field_behavior) = REQUIRED];
369}
370
371// Request message for ApiGatewayService.UpdateGateway
372message UpdateGatewayRequest {
373  // Field mask is used to specify the fields to be overwritten in the
374  // Gateway resource by the update.
375  // The fields specified in the update_mask are relative to the resource, not
376  // the full request. A field will be overwritten if it is in the mask. If the
377  // user does not provide a mask then all fields will be overwritten.
378  google.protobuf.FieldMask update_mask = 1;
379
380  // Required. Gateway resource.
381  Gateway gateway = 2 [(google.api.field_behavior) = REQUIRED];
382}
383
384// Request message for ApiGatewayService.DeleteGateway
385message DeleteGatewayRequest {
386  // Required. Resource name of the form:
387  // `projects/*/locations/*/gateways/*`
388  string name = 1 [
389    (google.api.field_behavior) = REQUIRED,
390    (google.api.resource_reference) = {
391      type: "apigateway.googleapis.com/Gateway"
392    }
393  ];
394}
395
396// Request message for ApiGatewayService.ListApis
397message ListApisRequest {
398  // Required. Parent resource of the API, of the form:
399  // `projects/*/locations/global`
400  string parent = 1 [
401    (google.api.field_behavior) = REQUIRED,
402    (google.api.resource_reference) = {
403      type: "locations.googleapis.com/Location"
404    }
405  ];
406
407  // Page size.
408  int32 page_size = 2;
409
410  // Page token.
411  string page_token = 3;
412
413  // Filter.
414  string filter = 4;
415
416  // Order by parameters.
417  string order_by = 5;
418}
419
420// Response message for ApiGatewayService.ListApis
421message ListApisResponse {
422  // APIs.
423  repeated Api apis = 1;
424
425  // Next page token.
426  string next_page_token = 2;
427
428  // Locations that could not be reached.
429  repeated string unreachable_locations = 3;
430}
431
432// Request message for ApiGatewayService.GetApi
433message GetApiRequest {
434  // Required. Resource name of the form:
435  // `projects/*/locations/global/apis/*`
436  string name = 1 [
437    (google.api.field_behavior) = REQUIRED,
438    (google.api.resource_reference) = {
439      type: "apigateway.googleapis.com/Api"
440    }
441  ];
442}
443
444// Request message for ApiGatewayService.CreateApi
445message CreateApiRequest {
446  // Required. Parent resource of the API, of the form:
447  // `projects/*/locations/global`
448  string parent = 1 [
449    (google.api.field_behavior) = REQUIRED,
450    (google.api.resource_reference) = {
451      type: "locations.googleapis.com/Location"
452    }
453  ];
454
455  // Required. Identifier to assign to the API. Must be unique within scope of
456  // the parent resource.
457  string api_id = 2 [(google.api.field_behavior) = REQUIRED];
458
459  // Required. API resource.
460  Api api = 3 [(google.api.field_behavior) = REQUIRED];
461}
462
463// Request message for ApiGatewayService.UpdateApi
464message UpdateApiRequest {
465  // Field mask is used to specify the fields to be overwritten in the
466  // Api resource by the update.
467  // The fields specified in the update_mask are relative to the resource, not
468  // the full request. A field will be overwritten if it is in the mask. If the
469  // user does not provide a mask then all fields will be overwritten.
470  google.protobuf.FieldMask update_mask = 1;
471
472  // Required. API resource.
473  Api api = 2 [(google.api.field_behavior) = REQUIRED];
474}
475
476// Request message for ApiGatewayService.DeleteApi
477message DeleteApiRequest {
478  // Required. Resource name of the form:
479  // `projects/*/locations/global/apis/*`
480  string name = 1 [
481    (google.api.field_behavior) = REQUIRED,
482    (google.api.resource_reference) = {
483      type: "apigateway.googleapis.com/Api"
484    }
485  ];
486}
487
488// Request message for ApiGatewayService.ListApiConfigs
489message ListApiConfigsRequest {
490  // Required. Parent resource of the API Config, of the form:
491  // `projects/*/locations/global/apis/*`
492  string parent = 1 [
493    (google.api.field_behavior) = REQUIRED,
494    (google.api.resource_reference) = {
495      type: "apigateway.googleapis.com/Api"
496    }
497  ];
498
499  // Page size.
500  int32 page_size = 2;
501
502  // Page token.
503  string page_token = 3;
504
505  // Filter.
506  string filter = 4;
507
508  // Order by parameters.
509  string order_by = 5;
510}
511
512// Response message for ApiGatewayService.ListApiConfigs
513message ListApiConfigsResponse {
514  // API Configs.
515  repeated ApiConfig api_configs = 1;
516
517  // Next page token.
518  string next_page_token = 2;
519
520  // Locations that could not be reached.
521  repeated string unreachable_locations = 3;
522}
523
524// Request message for ApiGatewayService.GetApiConfig
525message GetApiConfigRequest {
526  // Enum to control which fields should be included in the response.
527  enum ConfigView {
528    CONFIG_VIEW_UNSPECIFIED = 0;
529
530    // Do not include configuration source files.
531    BASIC = 1;
532
533    // Include configuration source files.
534    FULL = 2;
535  }
536
537  // Required. Resource name of the form:
538  // `projects/*/locations/global/apis/*/configs/*`
539  string name = 1 [
540    (google.api.field_behavior) = REQUIRED,
541    (google.api.resource_reference) = {
542      type: "apigateway.googleapis.com/ApiConfig"
543    }
544  ];
545
546  // Specifies which fields of the API Config are returned in the response.
547  // Defaults to `BASIC` view.
548  ConfigView view = 3;
549}
550
551// Request message for ApiGatewayService.CreateApiConfig
552message CreateApiConfigRequest {
553  // Required. Parent resource of the API Config, of the form:
554  // `projects/*/locations/global/apis/*`
555  string parent = 1 [
556    (google.api.field_behavior) = REQUIRED,
557    (google.api.resource_reference) = {
558      type: "apigateway.googleapis.com/Api"
559    }
560  ];
561
562  // Required. Identifier to assign to the API Config. Must be unique within scope of
563  // the parent resource.
564  string api_config_id = 2 [(google.api.field_behavior) = REQUIRED];
565
566  // Required. API resource.
567  ApiConfig api_config = 3 [(google.api.field_behavior) = REQUIRED];
568}
569
570// Request message for ApiGatewayService.UpdateApiConfig
571message UpdateApiConfigRequest {
572  // Field mask is used to specify the fields to be overwritten in the
573  // ApiConfig resource by the update.
574  // The fields specified in the update_mask are relative to the resource, not
575  // the full request. A field will be overwritten if it is in the mask. If the
576  // user does not provide a mask then all fields will be overwritten.
577  google.protobuf.FieldMask update_mask = 1;
578
579  // Required. API Config resource.
580  ApiConfig api_config = 2 [(google.api.field_behavior) = REQUIRED];
581}
582
583// Request message for ApiGatewayService.DeleteApiConfig
584message DeleteApiConfigRequest {
585  // Required. Resource name of the form:
586  // `projects/*/locations/global/apis/*/configs/*`
587  string name = 1 [
588    (google.api.field_behavior) = REQUIRED,
589    (google.api.resource_reference) = {
590      type: "apigateway.googleapis.com/ApiConfig"
591    }
592  ];
593}
594
595// Represents the metadata of the long-running operation.
596message OperationMetadata {
597  // Diagnostic information from configuration processing.
598  message Diagnostic {
599    // Location of the diagnostic.
600    string location = 1;
601
602    // The diagnostic message.
603    string message = 2;
604  }
605
606  // Output only. The time the operation was created.
607  google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
608
609  // Output only. The time the operation finished running.
610  google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
611
612  // Output only. Server-defined resource path for the target of the operation.
613  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
614
615  // Output only. Name of the verb executed by the operation.
616  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
617
618  // Output only. Human-readable status of the operation, if any.
619  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
620
621  // Output only. Identifies whether the user has requested cancellation
622  // of the operation. Operations that have successfully been cancelled
623  // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
624  // corresponding to `Code.CANCELLED`.
625  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
626
627  // Output only. API version used to start the operation.
628  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
629
630  // Output only. Diagnostics generated during processing of configuration source files.
631  repeated Diagnostic diagnostics = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
632}
633