service_controller.proto 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. // Copyright 2021 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.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/servicecontrol/v1/check_error.proto";
  19. import "google/api/servicecontrol/v1/operation.proto";
  20. import "google/protobuf/timestamp.proto";
  21. import "google/rpc/status.proto";
  22. option cc_enable_arenas = true;
  23. option csharp_namespace = "Google.Cloud.ServiceControl.V1";
  24. option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "ServiceControllerProto";
  27. option java_package = "com.google.api.servicecontrol.v1";
  28. option objc_class_prefix = "GASC";
  29. option php_namespace = "Google\\Cloud\\ServiceControl\\V1";
  30. option ruby_package = "Google::Cloud::ServiceControl::V1";
  31. // [Google Service Control API](/service-control/overview)
  32. //
  33. // Lets clients check and report operations against a [managed
  34. // service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).
  35. service ServiceController {
  36. option (google.api.default_host) = "servicecontrol.googleapis.com";
  37. option (google.api.oauth_scopes) =
  38. "https://www.googleapis.com/auth/cloud-platform,"
  39. "https://www.googleapis.com/auth/servicecontrol";
  40. // Checks whether an operation on a service should be allowed to proceed
  41. // based on the configuration of the service and related policies. It must be
  42. // called before the operation is executed.
  43. //
  44. // If feasible, the client should cache the check results and reuse them for
  45. // 60 seconds. In case of any server errors, the client should rely on the
  46. // cached results for much longer time to avoid outage.
  47. // WARNING: There is general 60s delay for the configuration and policy
  48. // propagation, therefore callers MUST NOT depend on the `Check` method having
  49. // the latest policy information.
  50. //
  51. // NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has
  52. // the size limit (wire-format byte size) of 1MB.
  53. //
  54. // This method requires the `servicemanagement.services.check` permission
  55. // on the specified service. For more information, see
  56. // [Cloud IAM](https://cloud.google.com/iam).
  57. rpc Check(CheckRequest) returns (CheckResponse) {
  58. option (google.api.http) = {
  59. post: "/v1/services/{service_name}:check"
  60. body: "*"
  61. };
  62. }
  63. // Reports operation results to Google Service Control, such as logs and
  64. // metrics. It should be called after an operation is completed.
  65. //
  66. // If feasible, the client should aggregate reporting data for up to 5
  67. // seconds to reduce API traffic. Limiting aggregation to 5 seconds is to
  68. // reduce data loss during client crashes. Clients should carefully choose
  69. // the aggregation time window to avoid data loss risk more than 0.01%
  70. // for business and compliance reasons.
  71. //
  72. // NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has
  73. // the size limit (wire-format byte size) of 1MB.
  74. //
  75. // This method requires the `servicemanagement.services.report` permission
  76. // on the specified service. For more information, see
  77. // [Google Cloud IAM](https://cloud.google.com/iam).
  78. rpc Report(ReportRequest) returns (ReportResponse) {
  79. option (google.api.http) = {
  80. post: "/v1/services/{service_name}:report"
  81. body: "*"
  82. };
  83. }
  84. }
  85. // Request message for the Check method.
  86. message CheckRequest {
  87. // The service name as specified in its service configuration. For example,
  88. // `"pubsub.googleapis.com"`.
  89. //
  90. // See
  91. // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
  92. // for the definition of a service name.
  93. string service_name = 1;
  94. // The operation to be checked.
  95. Operation operation = 2;
  96. // Specifies which version of service configuration should be used to process
  97. // the request.
  98. //
  99. // If unspecified or no matching version can be found, the
  100. // latest one will be used.
  101. string service_config_id = 4;
  102. }
  103. // Response message for the Check method.
  104. message CheckResponse {
  105. // Contains additional information about the check operation.
  106. message CheckInfo {
  107. // A list of fields and label keys that are ignored by the server.
  108. // The client doesn't need to send them for following requests to improve
  109. // performance and allow better aggregation.
  110. repeated string unused_arguments = 1;
  111. // Consumer info of this check.
  112. ConsumerInfo consumer_info = 2;
  113. }
  114. // `ConsumerInfo` provides information about the consumer.
  115. message ConsumerInfo {
  116. // The type of the consumer as defined in
  117. // [Google Resource Manager](https://cloud.google.com/resource-manager/).
  118. enum ConsumerType {
  119. // This is never used.
  120. CONSUMER_TYPE_UNSPECIFIED = 0;
  121. // The consumer is a Google Cloud Project.
  122. PROJECT = 1;
  123. // The consumer is a Google Cloud Folder.
  124. FOLDER = 2;
  125. // The consumer is a Google Cloud Organization.
  126. ORGANIZATION = 3;
  127. // Service-specific resource container which is defined by the service
  128. // producer to offer their users the ability to manage service control
  129. // functionalities at a finer level of granularity than the PROJECT.
  130. SERVICE_SPECIFIC = 4;
  131. }
  132. // The Google cloud project number, e.g. 1234567890. A value of 0 indicates
  133. // no project number is found.
  134. //
  135. // NOTE: This field is deprecated after we support flexible consumer
  136. // id. New code should not depend on this field anymore.
  137. int64 project_number = 1;
  138. // The type of the consumer which should have been defined in
  139. // [Google Resource Manager](https://cloud.google.com/resource-manager/).
  140. ConsumerType type = 2;
  141. // The consumer identity number, can be Google cloud project number, folder
  142. // number or organization number e.g. 1234567890. A value of 0 indicates no
  143. // consumer number is found.
  144. int64 consumer_number = 3;
  145. }
  146. // The same operation_id value used in the
  147. // [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging
  148. // and diagnostics purposes.
  149. string operation_id = 1;
  150. // Indicate the decision of the check.
  151. //
  152. // If no check errors are present, the service should process the operation.
  153. // Otherwise the service should use the list of errors to determine the
  154. // appropriate action.
  155. repeated CheckError check_errors = 2;
  156. // The actual config id used to process the request.
  157. string service_config_id = 5;
  158. // The current service rollout id used to process the request.
  159. string service_rollout_id = 11;
  160. // Feedback data returned from the server during processing a Check request.
  161. CheckInfo check_info = 6;
  162. }
  163. // Request message for the Report method.
  164. message ReportRequest {
  165. // The service name as specified in its service configuration. For example,
  166. // `"pubsub.googleapis.com"`.
  167. //
  168. // See
  169. // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
  170. // for the definition of a service name.
  171. string service_name = 1;
  172. // Operations to be reported.
  173. //
  174. // Typically the service should report one operation per request.
  175. // Putting multiple operations into a single request is allowed, but should
  176. // be used only when multiple operations are natually available at the time
  177. // of the report.
  178. //
  179. // There is no limit on the number of operations in the same ReportRequest,
  180. // however the ReportRequest size should be no larger than 1MB. See
  181. // [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors]
  182. // for partial failure behavior.
  183. repeated Operation operations = 2;
  184. // Specifies which version of service config should be used to process the
  185. // request.
  186. //
  187. // If unspecified or no matching version can be found, the
  188. // latest one will be used.
  189. string service_config_id = 3;
  190. }
  191. // Response message for the Report method.
  192. message ReportResponse {
  193. // Represents the processing error of one
  194. // [Operation][google.api.servicecontrol.v1.Operation] in the request.
  195. message ReportError {
  196. // The
  197. // [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id]
  198. // value from the request.
  199. string operation_id = 1;
  200. // Details of the error when processing the
  201. // [Operation][google.api.servicecontrol.v1.Operation].
  202. google.rpc.Status status = 2;
  203. }
  204. // Partial failures, one for each `Operation` in the request that failed
  205. // processing. There are three possible combinations of the RPC status:
  206. //
  207. // 1. The combination of a successful RPC status and an empty `report_errors`
  208. // list indicates a complete success where all `Operations` in the
  209. // request are processed successfully.
  210. // 2. The combination of a successful RPC status and a non-empty
  211. // `report_errors` list indicates a partial success where some
  212. // `Operations` in the request succeeded. Each
  213. // `Operation` that failed processing has a corresponding item
  214. // in this list.
  215. // 3. A failed RPC status indicates a general non-deterministic failure.
  216. // When this happens, it's impossible to know which of the
  217. // 'Operations' in the request succeeded or failed.
  218. repeated ReportError report_errors = 1;
  219. // The actual config id used to process the request.
  220. string service_config_id = 2;
  221. // The current service rollout id used to process the request.
  222. string service_rollout_id = 4;
  223. }