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