containeranalysis.proto 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. // Copyright 2019 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. package google.devtools.containeranalysis.v1beta1;
  17. import "google/api/annotations.proto";
  18. import "google/api/client.proto";
  19. import "google/api/field_behavior.proto";
  20. import "google/api/resource.proto";
  21. import "google/iam/v1/iam_policy.proto";
  22. import "google/iam/v1/policy.proto";
  23. import "google/protobuf/timestamp.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1;containeranalysis";
  25. option java_multiple_files = true;
  26. option java_package = "com.google.containeranalysis.v1beta1";
  27. option objc_class_prefix = "GCA";
  28. // Retrieves analysis results of Cloud components such as Docker container
  29. // images. The Container Analysis API is an implementation of the
  30. // [Grafeas](grafeas.io) API.
  31. //
  32. // Analysis results are stored as a series of occurrences. An `Occurrence`
  33. // contains information about a specific analysis instance on a resource. An
  34. // occurrence refers to a `Note`. A note contains details describing the
  35. // analysis and is generally stored in a separate project, called a `Provider`.
  36. // Multiple occurrences can refer to the same note.
  37. //
  38. // For example, an SSL vulnerability could affect multiple images. In this case,
  39. // there would be one note for the vulnerability and an occurrence for each
  40. // image with the vulnerability referring to that note.
  41. service ContainerAnalysisV1Beta1 {
  42. option (google.api.default_host) = "containeranalysis.googleapis.com";
  43. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  44. // Sets the access control policy on the specified note or occurrence.
  45. // Requires `containeranalysis.notes.setIamPolicy` or
  46. // `containeranalysis.occurrences.setIamPolicy` permission if the resource is
  47. // a note or an occurrence, respectively.
  48. //
  49. // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
  50. // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
  51. // occurrences.
  52. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  53. option (google.api.http) = {
  54. post: "/v1beta1/{resource=projects/*/notes/*}:setIamPolicy"
  55. body: "*"
  56. additional_bindings {
  57. post: "/v1beta1/{resource=projects/*/occurrences/*}:setIamPolicy"
  58. body: "*"
  59. }
  60. };
  61. option (google.api.method_signature) = "resource,policy";
  62. }
  63. // Gets the access control policy for a note or an occurrence resource.
  64. // Requires `containeranalysis.notes.setIamPolicy` or
  65. // `containeranalysis.occurrences.setIamPolicy` permission if the resource is
  66. // a note or occurrence, respectively.
  67. //
  68. // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
  69. // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
  70. // occurrences.
  71. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  72. option (google.api.http) = {
  73. post: "/v1beta1/{resource=projects/*/notes/*}:getIamPolicy"
  74. body: "*"
  75. additional_bindings {
  76. post: "/v1beta1/{resource=projects/*/occurrences/*}:getIamPolicy"
  77. body: "*"
  78. }
  79. };
  80. option (google.api.method_signature) = "resource";
  81. }
  82. // Returns the permissions that a caller has on the specified note or
  83. // occurrence. Requires list permission on the project (for example,
  84. // `containeranalysis.notes.list`).
  85. //
  86. // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
  87. // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
  88. // occurrences.
  89. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  90. option (google.api.http) = {
  91. post: "/v1beta1/{resource=projects/*/notes/*}:testIamPermissions"
  92. body: "*"
  93. additional_bindings {
  94. post: "/v1beta1/{resource=projects/*/occurrences/*}:testIamPermissions"
  95. body: "*"
  96. }
  97. };
  98. option (google.api.method_signature) = "resource,permissions";
  99. }
  100. // Gets the specified scan configuration.
  101. rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) {
  102. option (google.api.http) = {
  103. get: "/v1beta1/{name=projects/*/scanConfigs/*}"
  104. };
  105. option (google.api.method_signature) = "name";
  106. }
  107. // Lists scan configurations for the specified project.
  108. rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) {
  109. option (google.api.http) = {
  110. get: "/v1beta1/{parent=projects/*}/scanConfigs"
  111. };
  112. option (google.api.method_signature) = "parent,filter";
  113. }
  114. // Updates the specified scan configuration.
  115. rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) {
  116. option (google.api.http) = {
  117. put: "/v1beta1/{name=projects/*/scanConfigs/*}"
  118. body: "scan_config"
  119. };
  120. option (google.api.method_signature) = "name,scan_config";
  121. }
  122. }
  123. // A scan configuration specifies whether Cloud components in a project have a
  124. // particular type of analysis being run. For example, it can configure whether
  125. // vulnerability scanning is being done on Docker images or not.
  126. message ScanConfig {
  127. option (google.api.resource) = {
  128. type: "containeranalysis.googleapis.com/ScanConfig"
  129. pattern: "projects/{project}/scanConfigs/{scan_config}"
  130. };
  131. // Output only. The name of the scan configuration in the form of
  132. // `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.
  133. string name = 1;
  134. // Output only. A human-readable description of what the scan configuration
  135. // does.
  136. string description = 2;
  137. // Whether the scan is enabled.
  138. bool enabled = 3;
  139. // Output only. The time this scan config was created.
  140. google.protobuf.Timestamp create_time = 4;
  141. // Output only. The time this scan config was last updated.
  142. google.protobuf.Timestamp update_time = 5;
  143. }
  144. // Request to get a scan configuration.
  145. message GetScanConfigRequest {
  146. // Required. The name of the scan configuration in the form of
  147. // `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.
  148. string name = 1 [
  149. (google.api.field_behavior) = REQUIRED,
  150. (google.api.resource_reference) = {
  151. type: "containeranalysis.googleapis.com/ScanConfig"
  152. }
  153. ];
  154. }
  155. // Request to list scan configurations.
  156. message ListScanConfigsRequest {
  157. // Required. The name of the project to list scan configurations for in the form of
  158. // `projects/[PROJECT_ID]`.
  159. string parent = 1 [
  160. (google.api.field_behavior) = REQUIRED,
  161. (google.api.resource_reference) = {
  162. type: "cloudresourcemanager.googleapis.com/Project"
  163. }
  164. ];
  165. // Required. The filter expression.
  166. string filter = 2 [(google.api.field_behavior) = REQUIRED];
  167. // The number of scan configs to return in the list.
  168. int32 page_size = 3;
  169. // Token to provide to skip to a particular spot in the list.
  170. string page_token = 4;
  171. }
  172. // Response for listing scan configurations.
  173. message ListScanConfigsResponse {
  174. // The scan configurations requested.
  175. repeated ScanConfig scan_configs = 1;
  176. // The next pagination token in the list response. It should be used as
  177. // `page_token` for the following request. An empty value means no more
  178. // results.
  179. string next_page_token = 2;
  180. }
  181. // A request to update a scan configuration.
  182. message UpdateScanConfigRequest {
  183. // Required. The name of the scan configuration in the form of
  184. // `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`.
  185. string name = 1 [
  186. (google.api.field_behavior) = REQUIRED,
  187. (google.api.resource_reference) = {
  188. type: "containeranalysis.googleapis.com/ScanConfig"
  189. }
  190. ];
  191. // Required. The updated scan configuration.
  192. ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED];
  193. }