service_controller.proto 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. // Copyright 2022 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.servicecontrol.v2;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/rpc/context/attribute_context.proto";
  19. import "google/rpc/status.proto";
  20. option cc_enable_arenas = true;
  21. option csharp_namespace = "Google.Cloud.ServiceControl.V2";
  22. option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v2;servicecontrol";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "ServiceControllerProto";
  25. option java_package = "com.google.api.servicecontrol.v2";
  26. option objc_class_prefix = "GASC";
  27. option php_namespace = "Google\\Cloud\\ServiceControl\\V2";
  28. option ruby_package = "Google::Cloud::ServiceControl::V2";
  29. // [Service Control API
  30. // v2](https://cloud.google.com/service-infrastructure/docs/service-control/access-control)
  31. //
  32. // Private Preview. This feature is only available for approved services.
  33. //
  34. // This API provides admission control and telemetry reporting for services
  35. // that are integrated with [Service
  36. // Infrastructure](https://cloud.google.com/service-infrastructure).
  37. service ServiceController {
  38. option (google.api.default_host) = "servicecontrol.googleapis.com";
  39. option (google.api.oauth_scopes) =
  40. "https://www.googleapis.com/auth/cloud-platform,"
  41. "https://www.googleapis.com/auth/servicecontrol";
  42. // Private Preview. This feature is only available for approved services.
  43. //
  44. // This method provides admission control for services that are integrated
  45. // with [Service
  46. // Infrastructure](https://cloud.google.com/service-infrastructure). It checks
  47. // whether an operation should be allowed based on the service configuration
  48. // and relevant policies. It must be called before the operation is executed.
  49. // For more information, see
  50. // [Admission
  51. // Control](https://cloud.google.com/service-infrastructure/docs/admission-control).
  52. //
  53. // NOTE: The admission control has an expected policy propagation delay of
  54. // 60s. The caller **must** not depend on the most recent policy changes.
  55. //
  56. // NOTE: The admission control has a hard limit of 1 referenced resources
  57. // per call. If an operation refers to more than 1 resources, the caller
  58. // must call the Check method multiple times.
  59. //
  60. // This method requires the `servicemanagement.services.check` permission
  61. // on the specified service. For more information, see
  62. // [Service Control API Access
  63. // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
  64. rpc Check(CheckRequest) returns (CheckResponse) {
  65. option (google.api.http) = {
  66. post: "/v2/services/{service_name}:check"
  67. body: "*"
  68. };
  69. }
  70. // Private Preview. This feature is only available for approved services.
  71. //
  72. // This method provides telemetry reporting for services that are integrated
  73. // with [Service
  74. // Infrastructure](https://cloud.google.com/service-infrastructure). It
  75. // reports a list of operations that have occurred on a service. It must be
  76. // called after the operations have been executed. For more information, see
  77. // [Telemetry
  78. // Reporting](https://cloud.google.com/service-infrastructure/docs/telemetry-reporting).
  79. //
  80. // NOTE: The telemetry reporting has a hard limit of 1000 operations and 1MB
  81. // per Report call. It is recommended to have no more than 100 operations per
  82. // call.
  83. //
  84. // This method requires the `servicemanagement.services.report` permission
  85. // on the specified service. For more information, see
  86. // [Service Control API Access
  87. // Control](https://cloud.google.com/service-infrastructure/docs/service-control/access-control).
  88. rpc Report(ReportRequest) returns (ReportResponse) {
  89. option (google.api.http) = {
  90. post: "/v2/services/{service_name}:report"
  91. body: "*"
  92. };
  93. }
  94. }
  95. // Request message for the Check method.
  96. message CheckRequest {
  97. // The service name as specified in its service configuration. For example,
  98. // `"pubsub.googleapis.com"`.
  99. //
  100. // See
  101. // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
  102. // for the definition of a service name.
  103. string service_name = 1;
  104. // Specifies the version of the service configuration that should be used to
  105. // process the request. Must not be empty. Set this field to 'latest' to
  106. // specify using the latest configuration.
  107. string service_config_id = 2;
  108. // Describes attributes about the operation being executed by the service.
  109. google.rpc.context.AttributeContext attributes = 3;
  110. // Describes the resources and the policies applied to each resource.
  111. repeated ResourceInfo resources = 4;
  112. // Optional. Contains a comma-separated list of flags.
  113. string flags = 5;
  114. }
  115. // Describes a resource referenced in the request.
  116. message ResourceInfo {
  117. // The name of the resource referenced in the request.
  118. string name = 1;
  119. // The resource type in the format of "{service}/{kind}".
  120. string type = 2;
  121. // The resource permission needed for this request.
  122. // The format must be "{service}/{plural}.{verb}".
  123. string permission = 3;
  124. // Optional. The identifier of the container of this resource. For Google
  125. // Cloud APIs, the resource container must be one of the following formats:
  126. // - `projects/<project-id or project-number>`
  127. // - `folders/<folder-id>`
  128. // - `organizations/<organization-id>`
  129. // For the policy enforcement on the container level (VPCSC and Location
  130. // Policy check), this field takes precedence on the container extracted from
  131. // name when presents.
  132. string container = 4;
  133. // Optional. The location of the resource. The value must be a valid zone,
  134. // region or multiregion. For example: "europe-west4" or
  135. // "northamerica-northeast1-a"
  136. string location = 5;
  137. }
  138. // Response message for the Check method.
  139. message CheckResponse {
  140. // Operation is allowed when this field is not set. Any non-'OK' status
  141. // indicates a denial; [google.rpc.Status.details][google.rpc.Status.details]
  142. // would contain additional details about the denial.
  143. google.rpc.Status status = 1;
  144. // Returns a set of request contexts generated from the `CheckRequest`.
  145. map<string, string> headers = 2;
  146. }
  147. // Request message for the Report method.
  148. message ReportRequest {
  149. // The service name as specified in its service configuration. For example,
  150. // `"pubsub.googleapis.com"`.
  151. //
  152. // See
  153. // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
  154. // for the definition of a service name.
  155. string service_name = 1;
  156. // Specifies the version of the service configuration that should be used to
  157. // process the request. Must not be empty. Set this field to 'latest' to
  158. // specify using the latest configuration.
  159. string service_config_id = 2;
  160. // Describes the list of operations to be reported. Each operation is
  161. // represented as an AttributeContext, and contains all attributes around an
  162. // API access.
  163. repeated google.rpc.context.AttributeContext operations = 3;
  164. }
  165. // Response message for the Report method.
  166. // If the request contains any invalid data, the server returns an RPC error.
  167. message ReportResponse {}