service_controller.proto 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // Copyright 2016 Google Inc.
  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/servicecontrol/v1/check_error.proto";
  18. import "google/api/servicecontrol/v1/operation.proto";
  19. import "google/rpc/status.proto";
  20. option cc_enable_arenas = true;
  21. option java_multiple_files = true;
  22. option java_outer_classname = "ServiceControllerProto";
  23. option java_package = "com.google.api.servicecontrol.v1";
  24. option objc_class_prefix = "GASC";
  25. // [Google Service Control API](/service-control/overview)
  26. //
  27. // Lets clients check and report operations against
  28. // a [managed service][google.api.servicemanagement.v1.ManagedService].
  29. service ServiceController {
  30. // Checks an operation with Google Service Control to decide whether
  31. // the given operation should proceed. It should be called before the
  32. // operation is executed.
  33. //
  34. // This method requires the `servicemanagement.services.check` permission
  35. // on the specified service. For more information, see
  36. // [Google Cloud IAM](https://cloud.google.com/iam).
  37. rpc Check(CheckRequest) returns (CheckResponse) {
  38. option (google.api.http) = { post: "/v1/services/{service_name}:check" body: "*" };
  39. }
  40. // Reports operations to Google Service Control. It should be called
  41. // after the operation is completed.
  42. //
  43. // This method requires the `servicemanagement.services.report` permission
  44. // on the specified service. For more information, see
  45. // [Google Cloud IAM](https://cloud.google.com/iam).
  46. rpc Report(ReportRequest) returns (ReportResponse) {
  47. option (google.api.http) = { post: "/v1/services/{service_name}:report" body: "*" };
  48. }
  49. }
  50. // Request message for the Check method.
  51. message CheckRequest {
  52. // The service name as specified in its service configuration. For example,
  53. // `"pubsub.googleapis.com"`.
  54. //
  55. // See [google.api.Service][google.api.Service] for the definition of a service name.
  56. string service_name = 1;
  57. // The operation to be checked.
  58. Operation operation = 2;
  59. }
  60. // Response message for the Check method.
  61. message CheckResponse {
  62. // The same operation_id value used in the CheckRequest.
  63. // Used for logging and diagnostics purposes.
  64. string operation_id = 1;
  65. // Indicate the decision of the check.
  66. //
  67. // If no check errors are present, the service should process the operation.
  68. // Otherwise the service should use the list of errors to determine the
  69. // appropriate action.
  70. repeated CheckError check_errors = 2;
  71. // The actual config id used to process the request.
  72. string service_config_id = 5;
  73. }
  74. // Request message for the Report method.
  75. message ReportRequest {
  76. // The service name as specified in its service configuration. For example,
  77. // `"pubsub.googleapis.com"`.
  78. //
  79. // See [google.api.Service][google.api.Service] for the definition of a service name.
  80. string service_name = 1;
  81. // Operations to be reported.
  82. //
  83. // Typically the service should report one operation per request.
  84. // Putting multiple operations into a single request is allowed, but should
  85. // be used only when multiple operations are natually available at the time
  86. // of the report.
  87. //
  88. // If multiple operations are in a single request, the total request size
  89. // should be no larger than 1MB. See [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] for
  90. // partial failure behavior.
  91. repeated Operation operations = 2;
  92. }
  93. // Response message for the Report method.
  94. message ReportResponse {
  95. // Represents the processing error of one `Operation` in the request.
  96. message ReportError {
  97. // The [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id] value from the request.
  98. string operation_id = 1;
  99. // Details of the error when processing the `Operation`.
  100. google.rpc.Status status = 2;
  101. }
  102. // Partial failures, one for each `Operation` in the request that failed
  103. // processing. There are three possible combinations of the RPC status:
  104. //
  105. // 1. The combination of a successful RPC status and an empty `report_errors`
  106. // list indicates a complete success where all `Operations` in the
  107. // request are processed successfully.
  108. // 2. The combination of a successful RPC status and a non-empty
  109. // `report_errors` list indicates a partial success where some
  110. // `Operations` in the request succeeded. Each
  111. // `Operation` that failed processing has a corresponding item
  112. // in this list.
  113. // 3. A failed RPC status indicates a complete failure where none of the
  114. // `Operations` in the request succeeded.
  115. repeated ReportError report_errors = 1;
  116. // The actual config id used to process the request.
  117. string service_config_id = 2;
  118. }