@@ -18,8 +18,13 @@ syntax = "proto3";
1818package google.cloud.asset.v1 ;
1919
2020import "google/api/annotations.proto" ;
21+ import "google/api/client.proto" ;
22+ import "google/api/field_behavior.proto" ;
23+ import "google/api/resource.proto" ;
2124import "google/cloud/asset/v1/assets.proto" ;
2225import "google/longrunning/operations.proto" ;
26+ import "google/protobuf/empty.proto" ;
27+ import "google/protobuf/field_mask.proto" ;
2328import "google/protobuf/timestamp.proto" ;
2429
2530option csharp_namespace = "Google.Cloud.Asset.V1" ;
@@ -29,9 +34,11 @@ option java_outer_classname = "AssetServiceProto";
2934option java_package = "com.google.cloud.asset.v1" ;
3035option php_namespace = "Google\\Cloud\\Asset\\V1" ;
3136
32-
3337// Asset service definition.
3438service AssetService {
39+ option (google.api.default_host ) = "cloudasset.googleapis.com" ;
40+ option (google.api.oauth_scopes ) = "https://www.googleapis.com/auth/cloud-platform" ;
41+
3542 // Exports assets with time and resource types to a given Cloud Storage
3643 // location. The output format is newline-delimited JSON.
3744 // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
@@ -41,6 +48,10 @@ service AssetService {
4148 post : "/v1/{parent=*/*}:exportAssets"
4249 body : "*"
4350 };
51+ option (google.longrunning.operation_info ) = {
52+ response_type : "google.cloud.asset.v1.ExportAssetsResponse"
53+ metadata_type : "google.cloud.asset.v1.ExportAssetsRequest"
54+ };
4455 }
4556
4657 // Batch gets the update history of assets that overlap a time window.
@@ -63,7 +74,12 @@ message ExportAssetsRequest {
6374 // organization number (such as "organizations/123"), a project ID (such as
6475 // "projects/my-project-id"), or a project number (such as "projects/12345"),
6576 // or a folder number (such as "folders/123").
66- string parent = 1 ;
77+ string parent = 1 [
78+ (google.api.field_behavior ) = REQUIRED ,
79+ (google.api.resource_reference ) = {
80+ child_type : "cloudasset.googleapis.com/Asset"
81+ }
82+ ];
6783
6884 // Timestamp to take an asset snapshot. This can only be set to a timestamp
6985 // between 2018-10-02 UTC (inclusive) and the current time. If not specified,
@@ -73,9 +89,9 @@ message ExportAssetsRequest {
7389 google.protobuf.Timestamp read_time = 2 ;
7490
7591 // A list of asset types of which to take a snapshot for. For example:
76- // "compute.googleapis.com/Disk". If specified, only matching assets will be returned.
77- // See [Introduction to Cloud Asset
78- // Inventory](https://cloud.google.com/resource-manager/docs/cloud- asset-inventory/overview)
92+ // "compute.googleapis.com/Disk". If specified, only matching assets will be
93+ // returned. See [Introduction to Cloud Asset
94+ // Inventory](https://cloud.google.com/asset-inventory/docs /overview)
7995 // for all supported asset types.
8096 repeated string asset_types = 3 ;
8197
@@ -85,7 +101,7 @@ message ExportAssetsRequest {
85101
86102 // Required. Output configuration indicating where the results will be output
87103 // to. All results will be in newline delimited JSON format.
88- OutputConfig output_config = 5 ;
104+ OutputConfig output_config = 5 [ (google.api .field_behavior ) = REQUIRED ] ;
89105}
90106
91107// The export asset response. This message is returned by the
@@ -105,29 +121,35 @@ message BatchGetAssetsHistoryRequest {
105121 // Required. The relative name of the root asset. It can only be an
106122 // organization number (such as "organizations/123"), a project ID (such as
107123 // "projects/my-project-id")", or a project number (such as "projects/12345").
108- string parent = 1 ;
124+ string parent = 1 [
125+ (google.api.field_behavior ) = REQUIRED ,
126+ (google.api.resource_reference ) = {
127+ child_type : "cloudasset.googleapis.com/Asset"
128+ }
129+ ];
109130
110131 // A list of the full names of the assets. For example:
111132 // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
112133 // See [Resource
113134 // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
114- // and [Resource Name Format](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/resource-name-format)
135+ // and [Resource Name
136+ // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format)
115137 // for more info.
116138 //
117139 // The request becomes a no-op if the asset name list is empty, and the max
118140 // size of the asset name list is 100 in one request.
119141 repeated string asset_names = 2 ;
120142
121- // Required . The content type.
122- ContentType content_type = 3 ;
143+ // Optional . The content type.
144+ ContentType content_type = 3 [ (google.api .field_behavior ) = OPTIONAL ] ;
123145
124146 // Optional. The time window for the asset history. Both start_time and
125147 // end_time are optional and if set, it must be after 2018-10-02 UTC. If
126148 // end_time is not set, it is default to current timestamp. If start_time is
127149 // not set, the snapshot of the assets at end_time will be returned. The
128150 // returned results contain all temporal assets whose time window overlap with
129151 // read_time_window.
130- TimeWindow read_time_window = 4 ;
152+ TimeWindow read_time_window = 4 [ (google.api .field_behavior ) = OPTIONAL ] ;
131153}
132154
133155// Batch get assets history response.
@@ -142,6 +164,12 @@ message OutputConfig {
142164 oneof destination {
143165 // Destination on Cloud Storage.
144166 GcsDestination gcs_destination = 1 ;
167+
168+ // Destination on BigQuery. The output table stores the fields in asset
169+ // proto as columns in BigQuery. The resource/iam_policy field is converted
170+ // to a record with each field to a column, except metadata to a single JSON
171+ // string.
172+ BigQueryDestination bigquery_destination = 2 ;
145173 }
146174}
147175
@@ -155,9 +183,40 @@ message GcsDestination {
155183 // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
156184 // for more information.
157185 string uri = 1 ;
186+
187+ // The uri prefix of all generated Cloud Storage objects. For example:
188+ // "gs://bucket_name/object_name_prefix". Each object uri is in format:
189+ // "gs://bucket_name/object_name_prefix/<asset type>/<shard number> and only
190+ // contains assets for that type. <shard number> starts from 0. For example:
191+ // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is
192+ // the first shard of output objects containing all
193+ // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be
194+ // returned if file with the same name "gs://bucket_name/object_name_prefix"
195+ // already exists.
196+ string uri_prefix = 2 ;
158197 }
159198}
160199
200+ // A BigQuery destination.
201+ message BigQueryDestination {
202+ // Required. The BigQuery dataset in format
203+ // "projects/projectId/datasets/datasetId", to which the snapshot result
204+ // should be exported. If this dataset does not exist, the export call returns
205+ // an error.
206+ string dataset = 1 [(google.api.field_behavior ) = REQUIRED ];
207+
208+ // Required. The BigQuery table to which the snapshot result should be
209+ // written. If this table does not exist, a new table with the given name
210+ // will be created.
211+ string table = 2 [(google.api.field_behavior ) = REQUIRED ];
212+
213+ // If the destination table already exists and this flag is `TRUE`, the
214+ // table will be overwritten by the contents of assets snapshot. If the flag
215+ // is not set and the destination table already exists, the export call
216+ // returns an error.
217+ bool force = 3 ;
218+ }
219+
161220// Asset content type.
162221enum ContentType {
163222 // Unspecified content type.
@@ -168,4 +227,10 @@ enum ContentType {
168227
169228 // The actual IAM policy set on a resource.
170229 IAM_POLICY = 2 ;
230+
231+ // The Cloud Organization Policy set on an asset.
232+ ORG_POLICY = 4 ;
233+
234+ // The Cloud Access context mananger Policy set on an asset.
235+ ACCESS_POLICY = 5 ;
171236}
0 commit comments