service.proto 11 KB

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