backend.proto 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. // Copyright 2024 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. syntax = "proto3";
  15. package google.api;
  16. option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "BackendProto";
  19. option java_package = "com.google.api";
  20. option objc_class_prefix = "GAPI";
  21. // `Backend` defines the backend configuration for a service.
  22. message Backend {
  23. // A list of API backend rules that apply to individual API methods.
  24. //
  25. // **NOTE:** All service configuration rules follow "last one wins" order.
  26. repeated BackendRule rules = 1;
  27. }
  28. // A backend rule provides configuration for an individual API element.
  29. message BackendRule {
  30. // Path Translation specifies how to combine the backend address with the
  31. // request path in order to produce the appropriate forwarding URL for the
  32. // request.
  33. //
  34. // Path Translation is applicable only to HTTP-based backends. Backends which
  35. // do not accept requests over HTTP/HTTPS should leave `path_translation`
  36. // unspecified.
  37. enum PathTranslation {
  38. PATH_TRANSLATION_UNSPECIFIED = 0;
  39. // Use the backend address as-is, with no modification to the path. If the
  40. // URL pattern contains variables, the variable names and values will be
  41. // appended to the query string. If a query string parameter and a URL
  42. // pattern variable have the same name, this may result in duplicate keys in
  43. // the query string.
  44. //
  45. // # Examples
  46. //
  47. // Given the following operation config:
  48. //
  49. // Method path: /api/company/{cid}/user/{uid}
  50. // Backend address: https://example.cloudfunctions.net/getUser
  51. //
  52. // Requests to the following request paths will call the backend at the
  53. // translated path:
  54. //
  55. // Request path: /api/company/widgetworks/user/johndoe
  56. // Translated:
  57. // https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe
  58. //
  59. // Request path: /api/company/widgetworks/user/johndoe?timezone=EST
  60. // Translated:
  61. // https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe
  62. CONSTANT_ADDRESS = 1;
  63. // The request path will be appended to the backend address.
  64. //
  65. // # Examples
  66. //
  67. // Given the following operation config:
  68. //
  69. // Method path: /api/company/{cid}/user/{uid}
  70. // Backend address: https://example.appspot.com
  71. //
  72. // Requests to the following request paths will call the backend at the
  73. // translated path:
  74. //
  75. // Request path: /api/company/widgetworks/user/johndoe
  76. // Translated:
  77. // https://example.appspot.com/api/company/widgetworks/user/johndoe
  78. //
  79. // Request path: /api/company/widgetworks/user/johndoe?timezone=EST
  80. // Translated:
  81. // https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST
  82. APPEND_PATH_TO_ADDRESS = 2;
  83. }
  84. // Selects the methods to which this rule applies.
  85. //
  86. // Refer to [selector][google.api.DocumentationRule.selector] for syntax
  87. // details.
  88. string selector = 1;
  89. // The address of the API backend.
  90. //
  91. // The scheme is used to determine the backend protocol and security.
  92. // The following schemes are accepted:
  93. //
  94. // SCHEME PROTOCOL SECURITY
  95. // http:// HTTP None
  96. // https:// HTTP TLS
  97. // grpc:// gRPC None
  98. // grpcs:// gRPC TLS
  99. //
  100. // It is recommended to explicitly include a scheme. Leaving out the scheme
  101. // may cause constrasting behaviors across platforms.
  102. //
  103. // If the port is unspecified, the default is:
  104. // - 80 for schemes without TLS
  105. // - 443 for schemes with TLS
  106. //
  107. // For HTTP backends, use [protocol][google.api.BackendRule.protocol]
  108. // to specify the protocol version.
  109. string address = 2;
  110. // The number of seconds to wait for a response from a request. The default
  111. // varies based on the request protocol and deployment environment.
  112. double deadline = 3;
  113. // Deprecated, do not use.
  114. double min_deadline = 4 [deprecated = true];
  115. // The number of seconds to wait for the completion of a long running
  116. // operation. The default is no deadline.
  117. double operation_deadline = 5;
  118. PathTranslation path_translation = 6;
  119. // Authentication settings used by the backend.
  120. //
  121. // These are typically used to provide service management functionality to
  122. // a backend served on a publicly-routable URL. The `authentication`
  123. // details should match the authentication behavior used by the backend.
  124. //
  125. // For example, specifying `jwt_audience` implies that the backend expects
  126. // authentication via a JWT.
  127. //
  128. // When authentication is unspecified, the resulting behavior is the same
  129. // as `disable_auth` set to `true`.
  130. //
  131. // Refer to https://developers.google.com/identity/protocols/OpenIDConnect for
  132. // JWT ID token.
  133. oneof authentication {
  134. // The JWT audience is used when generating a JWT ID token for the backend.
  135. // This ID token will be added in the HTTP "authorization" header, and sent
  136. // to the backend.
  137. string jwt_audience = 7;
  138. // When disable_auth is true, a JWT ID token won't be generated and the
  139. // original "Authorization" HTTP header will be preserved. If the header is
  140. // used to carry the original token and is expected by the backend, this
  141. // field must be set to true to preserve the header.
  142. bool disable_auth = 8;
  143. }
  144. // The protocol used for sending a request to the backend.
  145. // The supported values are "http/1.1" and "h2".
  146. //
  147. // The default value is inferred from the scheme in the
  148. // [address][google.api.BackendRule.address] field:
  149. //
  150. // SCHEME PROTOCOL
  151. // http:// http/1.1
  152. // https:// http/1.1
  153. // grpc:// h2
  154. // grpcs:// h2
  155. //
  156. // For secure HTTP backends (https://) that support HTTP/2, set this field
  157. // to "h2" for improved performance.
  158. //
  159. // Configuring this field to non-default values is only supported for secure
  160. // HTTP backends. This field will be ignored for all other backends.
  161. //
  162. // See
  163. // https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids
  164. // for more details on the supported values.
  165. string protocol = 9;
  166. // The map between request protocol and the backend address.
  167. map<string, BackendRule> overrides_by_request_protocol = 10;
  168. }