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