context.proto 3.2 KB

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