service_controller.proto 9.8 KB

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