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