1 // Copyright 2019 Google LLC.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 package google.cloud.asset.v1;
20 import "google/api/annotations.proto";
21 import "google/cloud/asset/v1/assets.proto";
22 import "google/longrunning/operations.proto";
23 import "google/protobuf/timestamp.proto";
25 option csharp_namespace = "Google.Cloud.Asset.V1";
26 option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset";
27 option java_multiple_files = true;
28 option java_outer_classname = "AssetServiceProto";
29 option java_package = "com.google.cloud.asset.v1";
30 option php_namespace = "Google\\Cloud\\Asset\\V1";
33 // Asset service definition.
34 service AssetService {
35 // Exports assets with time and resource types to a given Cloud Storage
36 // location. The output format is newline-delimited JSON.
37 // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you
38 // to keep track of the export.
39 rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) {
40 option (google.api.http) = {
41 post: "/v1/{parent=*/*}:exportAssets"
46 // Batch gets the update history of assets that overlap a time window.
47 // For RESOURCE content, this API outputs history with asset in both
48 // non-delete or deleted status.
49 // For IAM_POLICY content, this API outputs history when the asset and its
50 // attached IAM POLICY both exist. This can create gaps in the output history.
51 // If a specified asset does not exist, this API returns an INVALID_ARGUMENT
53 rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) {
54 option (google.api.http) = {
55 get: "/v1/{parent=*/*}:batchGetAssetsHistory"
60 // Export asset request.
61 message ExportAssetsRequest {
62 // Required. The relative name of the root asset. This can only be an
63 // organization number (such as "organizations/123"), a project ID (such as
64 // "projects/my-project-id"), or a project number (such as "projects/12345"),
65 // or a folder number (such as "folders/123").
68 // Timestamp to take an asset snapshot. This can only be set to a timestamp
69 // between 2018-10-02 UTC (inclusive) and the current time. If not specified,
70 // the current time will be used. Due to delays in resource data collection
71 // and indexing, there is a volatile window during which running the same
72 // query may get different results.
73 google.protobuf.Timestamp read_time = 2;
75 // 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)
79 // for all supported asset types.
80 repeated string asset_types = 3;
82 // Asset content type. If not specified, no content but the asset name will be
84 ContentType content_type = 4;
86 // Required. Output configuration indicating where the results will be output
87 // to. All results will be in newline delimited JSON format.
88 OutputConfig output_config = 5;
91 // The export asset response. This message is returned by the
92 // [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned
93 // [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
94 message ExportAssetsResponse {
95 // Time the snapshot was taken.
96 google.protobuf.Timestamp read_time = 1;
98 // Output configuration indicating where the results were output to.
99 // All results are in JSON format.
100 OutputConfig output_config = 2;
103 // Batch get assets history request.
104 message BatchGetAssetsHistoryRequest {
105 // Required. The relative name of the root asset. It can only be an
106 // organization number (such as "organizations/123"), a project ID (such as
107 // "projects/my-project-id")", or a project number (such as "projects/12345").
110 // A list of the full names of the assets. For example:
111 // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
113 // 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)
117 // The request becomes a no-op if the asset name list is empty, and the max
118 // size of the asset name list is 100 in one request.
119 repeated string asset_names = 2;
121 // Required. The content type.
122 ContentType content_type = 3;
124 // Optional. The time window for the asset history. Both start_time and
125 // end_time are optional and if set, it must be after 2018-10-02 UTC. If
126 // end_time is not set, it is default to current timestamp. If start_time is
127 // not set, the snapshot of the assets at end_time will be returned. The
128 // returned results contain all temporal assets whose time window overlap with
130 TimeWindow read_time_window = 4;
133 // Batch get assets history response.
134 message BatchGetAssetsHistoryResponse {
135 // A list of assets with valid time windows.
136 repeated TemporalAsset assets = 1;
139 // Output configuration for export assets destination.
140 message OutputConfig {
141 // Asset export destination.
143 // Destination on Cloud Storage.
144 GcsDestination gcs_destination = 1;
148 // A Cloud Storage location.
149 message GcsDestination {
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
155 // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
156 // for more information.
161 // Asset content type.
163 // Unspecified content type.
164 CONTENT_TYPE_UNSPECIFIED = 0;
166 // Resource metadata.
169 // The actual IAM policy set on a resource.