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