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.cloud.binaryauthorization.v1beta1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/binaryauthorization/v1beta1/resources.proto"; 24import "google/protobuf/empty.proto"; 25 26option cc_enable_arenas = true; 27option csharp_namespace = "Google.Cloud.BinaryAuthorization.V1Beta1"; 28option go_package = "cloud.google.com/go/binaryauthorization/apiv1beta1/binaryauthorizationpb;binaryauthorizationpb"; 29option java_multiple_files = true; 30option java_outer_classname = "BinaryAuthorizationServiceProto"; 31option java_package = "com.google.cloud.binaryauthorization.v1beta1"; 32option php_namespace = "Google\\Cloud\\BinaryAuthorization\\V1beta1"; 33option ruby_package = "Google::Cloud::BinaryAuthorization::V1beta1"; 34 35// Customer-facing API for Cloud Binary Authorization. 36 37// Google Cloud Management Service for Binary Authorization admission policies 38// and attestation authorities. 39// 40// This API implements a REST model with the following objects: 41// 42// * [Policy][google.cloud.binaryauthorization.v1beta1.Policy] 43// * [Attestor][google.cloud.binaryauthorization.v1beta1.Attestor] 44service BinauthzManagementServiceV1Beta1 { 45 option (google.api.default_host) = "binaryauthorization.googleapis.com"; 46 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; 47 48 // A [policy][google.cloud.binaryauthorization.v1beta1.Policy] specifies the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] that must attest to 49 // a container image, before the project is allowed to deploy that 50 // image. There is at most one policy per project. All image admission 51 // requests are permitted if a project has no policy. 52 // 53 // Gets the [policy][google.cloud.binaryauthorization.v1beta1.Policy] for this project. Returns a default 54 // [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one. 55 rpc GetPolicy(GetPolicyRequest) returns (Policy) { 56 option (google.api.http) = { 57 get: "/v1beta1/{name=projects/*/policy}" 58 }; 59 option (google.api.method_signature) = "name"; 60 } 61 62 // Creates or updates a project's [policy][google.cloud.binaryauthorization.v1beta1.Policy], and returns a copy of the 63 // new [policy][google.cloud.binaryauthorization.v1beta1.Policy]. A policy is always updated as a whole, to avoid race 64 // conditions with concurrent policy enforcement (or management!) 65 // requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT 66 // if the request is malformed. 67 rpc UpdatePolicy(UpdatePolicyRequest) returns (Policy) { 68 option (google.api.http) = { 69 put: "/v1beta1/{policy.name=projects/*/policy}" 70 body: "policy" 71 }; 72 option (google.api.method_signature) = "policy"; 73 } 74 75 // Creates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor], and returns a copy of the new 76 // [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the project does not exist, 77 // INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the 78 // [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists. 79 rpc CreateAttestor(CreateAttestorRequest) returns (Attestor) { 80 option (google.api.http) = { 81 post: "/v1beta1/{parent=projects/*}/attestors" 82 body: "attestor" 83 }; 84 option (google.api.method_signature) = "parent,attestor_id,attestor"; 85 } 86 87 // Gets an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. 88 // Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. 89 rpc GetAttestor(GetAttestorRequest) returns (Attestor) { 90 option (google.api.http) = { 91 get: "/v1beta1/{name=projects/*/attestors/*}" 92 }; 93 option (google.api.method_signature) = "name"; 94 } 95 96 // Updates an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. 97 // Returns NOT_FOUND if the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. 98 rpc UpdateAttestor(UpdateAttestorRequest) returns (Attestor) { 99 option (google.api.http) = { 100 put: "/v1beta1/{attestor.name=projects/*/attestors/*}" 101 body: "attestor" 102 }; 103 option (google.api.method_signature) = "attestor"; 104 } 105 106 // Lists [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. 107 // Returns INVALID_ARGUMENT if the project does not exist. 108 rpc ListAttestors(ListAttestorsRequest) returns (ListAttestorsResponse) { 109 option (google.api.http) = { 110 get: "/v1beta1/{parent=projects/*}/attestors" 111 }; 112 option (google.api.method_signature) = "parent"; 113 } 114 115 // Deletes an [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns NOT_FOUND if the 116 // [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. 117 rpc DeleteAttestor(DeleteAttestorRequest) returns (google.protobuf.Empty) { 118 option (google.api.http) = { 119 delete: "/v1beta1/{name=projects/*/attestors/*}" 120 }; 121 option (google.api.method_signature) = "name"; 122 } 123} 124 125// Request message for [BinauthzManagementService.GetPolicy][]. 126message GetPolicyRequest { 127 // Required. The resource name of the [policy][google.cloud.binaryauthorization.v1beta1.Policy] to retrieve, 128 // in the format `projects/*/policy`. 129 string name = 1 [ 130 (google.api.field_behavior) = REQUIRED, 131 (google.api.resource_reference) = { 132 type: "binaryauthorization.googleapis.com/Policy" 133 } 134 ]; 135} 136 137// API for working with the system policy. 138service SystemPolicyV1Beta1 { 139 option (google.api.default_host) = "binaryauthorization.googleapis.com"; 140 option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; 141 142 // Gets the current system policy in the specified location. 143 rpc GetSystemPolicy(GetSystemPolicyRequest) returns (Policy) { 144 option (google.api.http) = { 145 get: "/v1beta1/{name=locations/*/policy}" 146 }; 147 option (google.api.method_signature) = "name"; 148 } 149} 150 151// Request message for [BinauthzManagementService.UpdatePolicy][]. 152message UpdatePolicyRequest { 153 // Required. A new or updated [policy][google.cloud.binaryauthorization.v1beta1.Policy] value. The service will 154 // overwrite the [policy name][google.cloud.binaryauthorization.v1beta1.Policy.name] field with the resource name in 155 // the request URL, in the format `projects/*/policy`. 156 Policy policy = 1 [(google.api.field_behavior) = REQUIRED]; 157} 158 159// Request message for [BinauthzManagementService.CreateAttestor][]. 160message CreateAttestorRequest { 161 // Required. The parent of this [attestor][google.cloud.binaryauthorization.v1beta1.Attestor]. 162 string parent = 1 [ 163 (google.api.field_behavior) = REQUIRED, 164 (google.api.resource_reference) = { 165 type: "cloudresourcemanager.googleapis.com/Project" 166 } 167 ]; 168 169 // Required. The [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] ID. 170 string attestor_id = 2 [(google.api.field_behavior) = REQUIRED]; 171 172 // Required. The initial [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The service will 173 // overwrite the [attestor name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with the resource name, 174 // in the format `projects/*/attestors/*`. 175 Attestor attestor = 3 [(google.api.field_behavior) = REQUIRED]; 176} 177 178// Request message for [BinauthzManagementService.GetAttestor][]. 179message GetAttestorRequest { 180 // Required. The name of the [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] to retrieve, in the format 181 // `projects/*/attestors/*`. 182 string name = 1 [ 183 (google.api.field_behavior) = REQUIRED, 184 (google.api.resource_reference) = { 185 type: "binaryauthorization.googleapis.com/Attestor" 186 } 187 ]; 188} 189 190// Request message for [BinauthzManagementService.UpdateAttestor][]. 191message UpdateAttestorRequest { 192 // Required. The updated [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] value. The service will 193 // overwrite the [attestor name][google.cloud.binaryauthorization.v1beta1.Attestor.name] field with the resource name 194 // in the request URL, in the format `projects/*/attestors/*`. 195 Attestor attestor = 1 [(google.api.field_behavior) = REQUIRED]; 196} 197 198// Request message for [BinauthzManagementService.ListAttestors][]. 199message ListAttestorsRequest { 200 // Required. The resource name of the project associated with the 201 // [attestors][google.cloud.binaryauthorization.v1beta1.Attestor], in the format `projects/*`. 202 string parent = 1 [ 203 (google.api.field_behavior) = REQUIRED, 204 (google.api.resource_reference) = { 205 type: "cloudresourcemanager.googleapis.com/Project" 206 } 207 ]; 208 209 // Requested page size. The server may return fewer results than requested. If 210 // unspecified, the server will pick an appropriate default. 211 int32 page_size = 2; 212 213 // A token identifying a page of results the server should return. Typically, 214 // this is the value of [ListAttestorsResponse.next_page_token][google.cloud.binaryauthorization.v1beta1.ListAttestorsResponse.next_page_token] returned 215 // from the previous call to the `ListAttestors` method. 216 string page_token = 3; 217} 218 219// Response message for [BinauthzManagementService.ListAttestors][]. 220message ListAttestorsResponse { 221 // The list of [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. 222 repeated Attestor attestors = 1; 223 224 // A token to retrieve the next page of results. Pass this value in the 225 // [ListAttestorsRequest.page_token][google.cloud.binaryauthorization.v1beta1.ListAttestorsRequest.page_token] field in the subsequent call to the 226 // `ListAttestors` method to retrieve the next page of results. 227 string next_page_token = 2; 228} 229 230// Request message for [BinauthzManagementService.DeleteAttestor][]. 231message DeleteAttestorRequest { 232 // Required. The name of the [attestors][google.cloud.binaryauthorization.v1beta1.Attestor] to delete, in the format 233 // `projects/*/attestors/*`. 234 string name = 1 [ 235 (google.api.field_behavior) = REQUIRED, 236 (google.api.resource_reference) = { 237 type: "binaryauthorization.googleapis.com/Attestor" 238 } 239 ]; 240} 241 242// Request to read the current system policy. 243message GetSystemPolicyRequest { 244 // Required. The resource name, in the format `locations/*/policy`. 245 // Note that the system policy is not associated with a project. 246 string name = 1 [ 247 (google.api.field_behavior) = REQUIRED, 248 (google.api.resource_reference) = { 249 type: "binaryauthorization.googleapis.com/Policy" 250 } 251 ]; 252} 253