asset_service.proto 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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.cloud.asset.v1p2beta1;
  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/cloud/asset/v1p2beta1/assets.proto";
  22. import "google/protobuf/empty.proto";
  23. import "google/protobuf/field_mask.proto";
  24. option csharp_namespace = "Google.Cloud.Asset.V1p2Beta1";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "AssetServiceProto";
  28. option java_package = "com.google.cloud.asset.v1p2beta1";
  29. option php_namespace = "Google\\Cloud\\Asset\\V1p2beta1";
  30. // Asset service definition.
  31. service AssetService {
  32. option (google.api.default_host) = "cloudasset.googleapis.com";
  33. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  34. // Creates a feed in a parent project/folder/organization to listen to its
  35. // asset updates.
  36. rpc CreateFeed(CreateFeedRequest) returns (Feed) {
  37. option (google.api.http) = {
  38. post: "/v1p2beta1/{parent=*/*}/feeds"
  39. body: "*"
  40. };
  41. option (google.api.method_signature) = "parent";
  42. }
  43. // Gets details about an asset feed.
  44. rpc GetFeed(GetFeedRequest) returns (Feed) {
  45. option (google.api.http) = {
  46. get: "/v1p2beta1/{name=*/*/feeds/*}"
  47. };
  48. option (google.api.method_signature) = "name";
  49. }
  50. // Lists all asset feeds in a parent project/folder/organization.
  51. rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) {
  52. option (google.api.http) = {
  53. get: "/v1p2beta1/{parent=*/*}/feeds"
  54. };
  55. option (google.api.method_signature) = "parent";
  56. }
  57. // Updates an asset feed configuration.
  58. rpc UpdateFeed(UpdateFeedRequest) returns (Feed) {
  59. option (google.api.http) = {
  60. patch: "/v1p2beta1/{feed.name=*/*/feeds/*}"
  61. body: "*"
  62. };
  63. option (google.api.method_signature) = "feed";
  64. }
  65. // Deletes an asset feed.
  66. rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) {
  67. option (google.api.http) = {
  68. delete: "/v1p2beta1/{name=*/*/feeds/*}"
  69. };
  70. option (google.api.method_signature) = "name";
  71. }
  72. }
  73. // Create asset feed request.
  74. message CreateFeedRequest {
  75. // Required. The name of the project/folder/organization where this feed
  76. // should be created in. It can only be an organization number (such as
  77. // "organizations/123"), a folder number (such as "folders/123"), a project ID
  78. // (such as "projects/my-project-id")", or a project number (such as
  79. // "projects/12345").
  80. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  81. // Required. This is the client-assigned asset feed identifier and it needs to
  82. // be unique under a specific parent project/folder/organization.
  83. string feed_id = 2 [(google.api.field_behavior) = REQUIRED];
  84. // Required. The feed details. The field `name` must be empty and it will be generated
  85. // in the format of:
  86. // projects/project_number/feeds/feed_id
  87. // folders/folder_number/feeds/feed_id
  88. // organizations/organization_number/feeds/feed_id
  89. Feed feed = 3 [(google.api.field_behavior) = REQUIRED];
  90. }
  91. // Get asset feed request.
  92. message GetFeedRequest {
  93. // Required. The name of the Feed and it must be in the format of:
  94. // projects/project_number/feeds/feed_id
  95. // folders/folder_number/feeds/feed_id
  96. // organizations/organization_number/feeds/feed_id
  97. string name = 1 [
  98. (google.api.field_behavior) = REQUIRED,
  99. (google.api.resource_reference) = {
  100. type: "cloudasset.googleapis.com/Feed"
  101. }
  102. ];
  103. }
  104. // List asset feeds request.
  105. message ListFeedsRequest {
  106. // Required. The parent project/folder/organization whose feeds are to be
  107. // listed. It can only be using project/folder/organization number (such as
  108. // "folders/12345")", or a project ID (such as "projects/my-project-id").
  109. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  110. }
  111. message ListFeedsResponse {
  112. // A list of feeds.
  113. repeated Feed feeds = 1;
  114. }
  115. // Update asset feed request.
  116. message UpdateFeedRequest {
  117. // Required. The new values of feed details. It must match an existing feed and the
  118. // field `name` must be in the format of:
  119. // projects/project_number/feeds/feed_id or
  120. // folders/folder_number/feeds/feed_id or
  121. // organizations/organization_number/feeds/feed_id.
  122. Feed feed = 1 [(google.api.field_behavior) = REQUIRED];
  123. // Required. Only updates the `feed` fields indicated by this mask.
  124. // The field mask must not be empty, and it must not contain fields that
  125. // are immutable or only set by the server.
  126. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
  127. }
  128. message DeleteFeedRequest {
  129. // Required. The name of the feed and it must be in the format of:
  130. // projects/project_number/feeds/feed_id
  131. // folders/folder_number/feeds/feed_id
  132. // organizations/organization_number/feeds/feed_id
  133. string name = 1 [
  134. (google.api.field_behavior) = REQUIRED,
  135. (google.api.resource_reference) = {
  136. type: "cloudasset.googleapis.com/Feed"
  137. }
  138. ];
  139. }
  140. // Output configuration for export assets destination.
  141. message OutputConfig {
  142. // Asset export destination.
  143. oneof destination {
  144. // Destination on Cloud Storage.
  145. GcsDestination gcs_destination = 1;
  146. }
  147. }
  148. // A Cloud Storage location.
  149. message GcsDestination {
  150. // Required.
  151. oneof object_uri {
  152. // The uri of the Cloud Storage object. It's the same uri that is used by
  153. // gsutil. For example: "gs://bucket_name/object_name". See [Viewing and
  154. // Editing Object
  155. // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
  156. // for more information.
  157. string uri = 1;
  158. }
  159. }
  160. // A Cloud Pubsub destination.
  161. message PubsubDestination {
  162. // The name of the Cloud Pub/Sub topic to publish to.
  163. // For example: `projects/PROJECT_ID/topics/TOPIC_ID`.
  164. string topic = 1;
  165. }
  166. // Output configuration for asset feed destination.
  167. message FeedOutputConfig {
  168. // Asset feed destination.
  169. oneof destination {
  170. // Destination on Cloud Pubsub.
  171. PubsubDestination pubsub_destination = 1;
  172. }
  173. }
  174. // An asset feed used to export asset updates to a destinations.
  175. // An asset feed filter controls what updates are exported.
  176. // The asset feed must be created within a project, organization, or
  177. // folder. Supported destinations are:
  178. // Cloud Pub/Sub topics.
  179. message Feed {
  180. option (google.api.resource) = {
  181. type: "cloudasset.googleapis.com/Feed"
  182. pattern: "projects/{project}/feeds/{feed}"
  183. pattern: "folders/{folder}/feeds/{feed}"
  184. pattern: "organizations/{organization}/feeds/{feed}"
  185. history: ORIGINALLY_SINGLE_PATTERN
  186. };
  187. // Required. The format will be
  188. // projects/{project_number}/feeds/{client-assigned_feed_identifier} or
  189. // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or
  190. // organizations/{organization_number}/feeds/{client-assigned_feed_identifier}
  191. //
  192. // The client-assigned feed identifier must be unique within the parent
  193. // project/folder/organization.
  194. string name = 1 [(google.api.field_behavior) = REQUIRED];
  195. // A list of the full names of the assets to receive updates. You must specify
  196. // either or both of asset_names and asset_types. Only asset updates matching
  197. // specified asset_names and asset_types are exported to the feed. For
  198. // example:
  199. // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
  200. // See [Resource
  201. // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
  202. // for more info.
  203. repeated string asset_names = 2;
  204. // A list of types of the assets to receive updates. You must specify either
  205. // or both of asset_names and asset_types. Only asset updates matching
  206. // specified asset_names and asset_types are exported to the feed.
  207. // For example:
  208. // "compute.googleapis.com/Disk" See [Introduction to Cloud Asset
  209. // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview)
  210. // for all supported asset types.
  211. repeated string asset_types = 3;
  212. // Asset content type. If not specified, no content but the asset name and
  213. // type will be returned.
  214. ContentType content_type = 4;
  215. // Required. Feed output configuration defining where the asset updates are
  216. // published to.
  217. FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED];
  218. }
  219. // Asset content type.
  220. enum ContentType {
  221. // Unspecified content type.
  222. CONTENT_TYPE_UNSPECIFIED = 0;
  223. // Resource metadata.
  224. RESOURCE = 1;
  225. // The actual IAM policy set on a resource.
  226. IAM_POLICY = 2;
  227. }