|
| 1 | +// Copyright 2018 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 | + |
| 17 | +package google.cloud.asset.v1beta1; |
| 18 | + |
| 19 | +import "google/api/annotations.proto"; |
| 20 | +import "google/cloud/asset/v1beta1/assets.proto"; |
| 21 | +import "google/longrunning/operations.proto"; |
| 22 | +import "google/protobuf/timestamp.proto"; |
| 23 | + |
| 24 | +option csharp_namespace = "Google.Cloud.Asset.V1Beta1"; |
| 25 | +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1beta1;asset"; |
| 26 | +option java_multiple_files = true; |
| 27 | +option java_outer_classname = "AssetServiceProto"; |
| 28 | +option java_package = "com.google.cloud.asset.v1beta1"; |
| 29 | +option php_namespace = "Google\\Cloud\\Asset\\V1beta1"; |
| 30 | + |
| 31 | + |
| 32 | +// Asset service definition. |
| 33 | +service AssetService { |
| 34 | + // Exports assets with time and resource types to a given Google Cloud Storage |
| 35 | + // location. The output format is newline delimited JSON. |
| 36 | + // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing users |
| 37 | + // to keep track of the export. |
| 38 | + rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { |
| 39 | + option (google.api.http) = { |
| 40 | + post: "/v1beta1/{parent=projects/*}:exportAssets" |
| 41 | + body: "*" |
| 42 | + additional_bindings { |
| 43 | + post: "/v1beta1/{parent=organizations/*}:exportAssets" |
| 44 | + body: "*" |
| 45 | + } |
| 46 | + }; |
| 47 | + } |
| 48 | + |
| 49 | + // Batch gets assets update history that overlaps a time window. |
| 50 | + // For RESOURCE content, this API outputs history with asset in both |
| 51 | + // non-delete or deleted status. |
| 52 | + // For IAM_POLICY content, this API only outputs history when asset and its |
| 53 | + // attached IAM POLICY both exist. So there may be gaps in the output history. |
| 54 | + rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) { |
| 55 | + option (google.api.http) = { |
| 56 | + get: "/v1beta1/{parent=projects/*}:batchGetAssetsHistory" |
| 57 | + additional_bindings { |
| 58 | + get: "/v1beta1/{parent=organizations/*}:batchGetAssetHistory" |
| 59 | + } |
| 60 | + }; |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +// Export asset request. |
| 65 | +message ExportAssetsRequest { |
| 66 | + // Required. The relative name of the root asset. It can only be an |
| 67 | + // organization number (e.g. "organizations/123") or a project number |
| 68 | + // (e.g. "projects/12345"). |
| 69 | + string parent = 1; |
| 70 | + |
| 71 | + // Timestamp to take an asset snapshot. This can only be current or past |
| 72 | + // time. If not specified, the current time will be used. Due to delays in |
| 73 | + // resource data collection and indexing, there is a volatile window during |
| 74 | + // which running the same query may get different results. |
| 75 | + google.protobuf.Timestamp read_time = 2; |
| 76 | + |
| 77 | + // A list of asset types to take a snapshot for. Example: |
| 78 | + // "google.compute.disk". If specified, only matching assets will be returned. |
| 79 | + repeated string asset_types = 3; |
| 80 | + |
| 81 | + // A list of asset content types. If specified, only matching content will be |
| 82 | + // returned. Otherwise, no content but the asset name will be returned. |
| 83 | + repeated ContentType content_types = 4; |
| 84 | + |
| 85 | + // Required. Output configuration indicating where the results will be output |
| 86 | + // to. All results will be in newline delimited JSON format. |
| 87 | + OutputConfig output_config = 5; |
| 88 | +} |
| 89 | + |
| 90 | +// The export asset response. This message is returned by the |
| 91 | +// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned |
| 92 | +// [google.longrunning.Operation.response][google.longrunning.Operation.response] field. |
| 93 | +message ExportAssetsResponse { |
| 94 | + // Required. Time the snapshot was taken. |
| 95 | + google.protobuf.Timestamp read_time = 1; |
| 96 | + |
| 97 | + // Required. Output configuration indicating where the results were output to. |
| 98 | + // All results are in JSON format. |
| 99 | + OutputConfig output_config = 2; |
| 100 | +} |
| 101 | + |
| 102 | +// Batch get assets history request. |
| 103 | +message BatchGetAssetsHistoryRequest { |
| 104 | + // Required. The relative name of the root asset. It can only be an |
| 105 | + // organization ID (e.g. "organizations/123") or a project ID |
| 106 | + // (e.g. "projects/12345"). |
| 107 | + string parent = 1; |
| 108 | + |
| 109 | + // A list of the full names of the assets. See: |
| 110 | + // https://cloud.google.com/apis/design/resource_names#full_resource_name |
| 111 | + // Example: |
| 112 | + // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1". |
| 113 | + // |
| 114 | + // The request becomes a no-op if the asset name list is empty. |
| 115 | + repeated string asset_names = 2; |
| 116 | + |
| 117 | + // Required. The content type. |
| 118 | + ContentType content_type = 3; |
| 119 | + |
| 120 | + // Required. The time window for the asset history. The returned results |
| 121 | + // contain all temporal assets whose time window overlap with |
| 122 | + // read_time_window. |
| 123 | + TimeWindow read_time_window = 4; |
| 124 | +} |
| 125 | + |
| 126 | +// Batch get assets history response. |
| 127 | +message BatchGetAssetsHistoryResponse { |
| 128 | + // A list of assets with valid time windows. |
| 129 | + repeated TemporalAsset assets = 1; |
| 130 | +} |
| 131 | + |
| 132 | +// Output configuration for export assets destination. |
| 133 | +message OutputConfig { |
| 134 | + // Asset export destination. |
| 135 | + oneof destination { |
| 136 | + // Destination on Google Cloud Storage (GCS). |
| 137 | + GcsDestination gcs_destination = 1; |
| 138 | + } |
| 139 | +} |
| 140 | + |
| 141 | +// A Google Cloud Storage (GCS) location. |
| 142 | +message GcsDestination { |
| 143 | + // The path of the GCS objects. It's the same path that is used by gsutil, for |
| 144 | + // example: "gs://bucket_name/object_path". See: |
| 145 | + // https://cloud.google.com/storage/docs/viewing-editing-metadata for more |
| 146 | + // information. |
| 147 | + string uri = 1; |
| 148 | +} |
| 149 | + |
| 150 | +// Asset content type. |
| 151 | +enum ContentType { |
| 152 | + // Unspecified content type. |
| 153 | + CONTENT_TYPE_UNSPECIFIED = 0; |
| 154 | + |
| 155 | + // Resource metadata. |
| 156 | + RESOURCE = 1; |
| 157 | + |
| 158 | + // The actual IAM policy set on a resource. |
| 159 | + IAM_POLICY = 2; |
| 160 | +} |
0 commit comments