| 1 |
// Copyright 2026 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 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package google.api; |
| 18 |
|
| 19 |
option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; |
| 20 |
option java_multiple_files = true; |
| 21 |
option java_outer_classname = "ContextProto"; |
| 22 |
option java_package = "com.google.api"; |
| 23 |
option objc_class_prefix = "GAPI"; |
| 24 |
|
| 25 |
// `Context` defines which contexts an API requests. |
| 26 |
// |
| 27 |
// Example: |
| 28 |
// |
| 29 |
// context: |
| 30 |
// rules: |
| 31 |
// - selector: "*" |
| 32 |
// requested: |
| 33 |
// - google.rpc.context.ProjectContext |
| 34 |
// - google.rpc.context.OriginContext |
| 35 |
// |
| 36 |
// The above specifies that all methods in the API request |
| 37 |
// `google.rpc.context.ProjectContext` and |
| 38 |
// `google.rpc.context.OriginContext`. |
| 39 |
// |
| 40 |
// Available context types are defined in package |
| 41 |
// `google.rpc.context`. |
| 42 |
// |
| 43 |
// This also provides mechanism to allowlist any protobuf message extension that |
| 44 |
// can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and |
| 45 |
// “x-goog-ext-<extension_id>-jspb” format. For example, list any service |
| 46 |
// specific protobuf types that can appear in grpc metadata as follows in your |
| 47 |
// yaml file: |
| 48 |
// |
| 49 |
// Example: |
| 50 |
// |
| 51 |
// context: |
| 52 |
// rules: |
| 53 |
// - selector: "google.example.library.v1.LibraryService.CreateBook" |
| 54 |
// allowed_request_extensions: |
| 55 |
// - google.foo.v1.NewExtension |
| 56 |
// allowed_response_extensions: |
| 57 |
// - google.foo.v1.NewExtension |
| 58 |
// |
| 59 |
// You can also specify extension ID instead of fully qualified extension name |
| 60 |
// here. |
| 61 |
message Context { |
| 62 |
// A list of RPC context rules that apply to individual API methods. |
| 63 |
// |
| 64 |
// **NOTE:** All service configuration rules follow "last one wins" order. |
| 65 |
repeated ContextRule rules = 1; |
| 66 |
} |
| 67 |
|
| 68 |
// A context rule provides information about the context for an individual API |
| 69 |
// element. |
| 70 |
message ContextRule { |
| 71 |
// Selects the methods to which this rule applies. |
| 72 |
// |
| 73 |
// Refer to [selector][google.api.DocumentationRule.selector] for syntax |
| 74 |
// details. |
| 75 |
string selector = 1; |
| 76 |
|
| 77 |
// A list of full type names of requested contexts, only the requested context |
| 78 |
// will be made available to the backend. |
| 79 |
repeated string requested = 2; |
| 80 |
|
| 81 |
// A list of full type names of provided contexts. It is used to support |
| 82 |
// propagating HTTP headers and ETags from the response extension. |
| 83 |
repeated string provided = 3; |
| 84 |
|
| 85 |
// A list of full type names or extension IDs of extensions allowed in grpc |
| 86 |
// side channel from client to backend. |
| 87 |
repeated string allowed_request_extensions = 4; |
| 88 |
|
| 89 |
// A list of full type names or extension IDs of extensions allowed in grpc |
| 90 |
// side channel from backend to client. |
| 91 |
repeated string allowed_response_extensions = 5; |
| 92 |
} |