xref: /aosp_15_r20/external/googleapis/google/api/system_parameter.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;
18
19option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
20option java_multiple_files = true;
21option java_outer_classname = "SystemParameterProto";
22option java_package = "com.google.api";
23option objc_class_prefix = "GAPI";
24
25// ### System parameter configuration
26//
27// A system parameter is a special kind of parameter defined by the API
28// system, not by an individual API. It is typically mapped to an HTTP header
29// and/or a URL query parameter. This configuration specifies which methods
30// change the names of the system parameters.
31message SystemParameters {
32  // Define system parameters.
33  //
34  // The parameters defined here will override the default parameters
35  // implemented by the system. If this field is missing from the service
36  // config, default system parameters will be used. Default system parameters
37  // and names is implementation-dependent.
38  //
39  // Example: define api key for all methods
40  //
41  //     system_parameters
42  //       rules:
43  //         - selector: "*"
44  //           parameters:
45  //             - name: api_key
46  //               url_query_parameter: api_key
47  //
48  //
49  // Example: define 2 api key names for a specific method.
50  //
51  //     system_parameters
52  //       rules:
53  //         - selector: "/ListShelves"
54  //           parameters:
55  //             - name: api_key
56  //               http_header: Api-Key1
57  //             - name: api_key
58  //               http_header: Api-Key2
59  //
60  // **NOTE:** All service configuration rules follow "last one wins" order.
61  repeated SystemParameterRule rules = 1;
62}
63
64// Define a system parameter rule mapping system parameter definitions to
65// methods.
66message SystemParameterRule {
67  // Selects the methods to which this rule applies. Use '*' to indicate all
68  // methods in all APIs.
69  //
70  // Refer to [selector][google.api.DocumentationRule.selector] for syntax
71  // details.
72  string selector = 1;
73
74  // Define parameters. Multiple names may be defined for a parameter.
75  // For a given method call, only one of them should be used. If multiple
76  // names are used the behavior is implementation-dependent.
77  // If none of the specified names are present the behavior is
78  // parameter-dependent.
79  repeated SystemParameter parameters = 2;
80}
81
82// Define a parameter's name and location. The parameter may be passed as either
83// an HTTP header or a URL query parameter, and if both are passed the behavior
84// is implementation-dependent.
85message SystemParameter {
86  // Define the name of the parameter, such as "api_key" . It is case sensitive.
87  string name = 1;
88
89  // Define the HTTP header name to use for the parameter. It is case
90  // insensitive.
91  string http_header = 2;
92
93  // Define the URL query parameter name to use for the parameter. It is case
94  // sensitive.
95  string url_query_parameter = 3;
96}
97