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.v1; 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/v1/assets.proto"; 24import "google/iam/v1/policy.proto"; 25import "google/longrunning/operations.proto"; 26import "google/protobuf/duration.proto"; 27import "google/protobuf/empty.proto"; 28import "google/protobuf/field_mask.proto"; 29import "google/protobuf/struct.proto"; 30import "google/protobuf/timestamp.proto"; 31import "google/rpc/status.proto"; 32import "google/type/expr.proto"; 33 34option csharp_namespace = "Google.Cloud.Asset.V1"; 35option go_package = "cloud.google.com/go/asset/apiv1/assetpb;assetpb"; 36option java_multiple_files = true; 37option java_outer_classname = "AssetServiceProto"; 38option java_package = "com.google.cloud.asset.v1"; 39option php_namespace = "Google\\Cloud\\Asset\\V1"; 40 41// Asset service definition. 42service AssetService { 43 option (google.api.default_host) = "cloudasset.googleapis.com"; 44 option (google.api.oauth_scopes) = 45 "https://www.googleapis.com/auth/cloud-platform"; 46 47 // Exports assets with time and resource types to a given Cloud Storage 48 // location/BigQuery table. For Cloud Storage location destinations, the 49 // output format is newline-delimited JSON. Each line represents a 50 // [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON 51 // format; for BigQuery table destinations, the output table stores the fields 52 // in asset Protobuf as columns. This API implements the 53 // [google.longrunning.Operation][google.longrunning.Operation] API, which 54 // allows you to keep track of the export. We recommend intervals of at least 55 // 2 seconds with exponential retry to poll the export operation result. For 56 // regular-size resource parent, the export operation usually finishes within 57 // 5 minutes. 58 rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { 59 option (google.api.http) = { 60 post: "/v1/{parent=*/*}:exportAssets" 61 body: "*" 62 }; 63 option (google.longrunning.operation_info) = { 64 response_type: "google.cloud.asset.v1.ExportAssetsResponse" 65 metadata_type: "google.cloud.asset.v1.ExportAssetsRequest" 66 }; 67 } 68 69 // Lists assets with time and resource types and returns paged results in 70 // response. 71 rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { 72 option (google.api.http) = { 73 get: "/v1/{parent=*/*}/assets" 74 }; 75 option (google.api.method_signature) = "parent"; 76 } 77 78 // Batch gets the update history of assets that overlap a time window. 79 // For IAM_POLICY content, this API outputs history when the asset and its 80 // attached IAM POLICY both exist. This can create gaps in the output history. 81 // Otherwise, this API outputs history with asset in both non-delete or 82 // deleted status. 83 // If a specified asset does not exist, this API returns an INVALID_ARGUMENT 84 // error. 85 rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) 86 returns (BatchGetAssetsHistoryResponse) { 87 option (google.api.http) = { 88 get: "/v1/{parent=*/*}:batchGetAssetsHistory" 89 }; 90 } 91 92 // Creates a feed in a parent project/folder/organization to listen to its 93 // asset updates. 94 rpc CreateFeed(CreateFeedRequest) returns (Feed) { 95 option (google.api.http) = { 96 post: "/v1/{parent=*/*}/feeds" 97 body: "*" 98 }; 99 option (google.api.method_signature) = "parent"; 100 } 101 102 // Gets details about an asset feed. 103 rpc GetFeed(GetFeedRequest) returns (Feed) { 104 option (google.api.http) = { 105 get: "/v1/{name=*/*/feeds/*}" 106 }; 107 option (google.api.method_signature) = "name"; 108 } 109 110 // Lists all asset feeds in a parent project/folder/organization. 111 rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { 112 option (google.api.http) = { 113 get: "/v1/{parent=*/*}/feeds" 114 }; 115 option (google.api.method_signature) = "parent"; 116 } 117 118 // Updates an asset feed configuration. 119 rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { 120 option (google.api.http) = { 121 patch: "/v1/{feed.name=*/*/feeds/*}" 122 body: "*" 123 }; 124 option (google.api.method_signature) = "feed"; 125 } 126 127 // Deletes an asset feed. 128 rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { 129 option (google.api.http) = { 130 delete: "/v1/{name=*/*/feeds/*}" 131 }; 132 option (google.api.method_signature) = "name"; 133 } 134 135 // Searches all Google Cloud resources within the specified scope, such as a 136 // project, folder, or organization. The caller must be granted the 137 // `cloudasset.assets.searchAllResources` permission on the desired scope, 138 // otherwise the request will be rejected. 139 rpc SearchAllResources(SearchAllResourcesRequest) 140 returns (SearchAllResourcesResponse) { 141 option (google.api.http) = { 142 get: "/v1/{scope=*/*}:searchAllResources" 143 }; 144 option (google.api.method_signature) = "scope,query,asset_types"; 145 } 146 147 // Searches all IAM policies within the specified scope, such as a project, 148 // folder, or organization. The caller must be granted the 149 // `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, 150 // otherwise the request will be rejected. 151 rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) 152 returns (SearchAllIamPoliciesResponse) { 153 option (google.api.http) = { 154 get: "/v1/{scope=*/*}:searchAllIamPolicies" 155 }; 156 option (google.api.method_signature) = "scope,query"; 157 } 158 159 // Analyzes IAM policies to answer which identities have what accesses on 160 // which resources. 161 rpc AnalyzeIamPolicy(AnalyzeIamPolicyRequest) 162 returns (AnalyzeIamPolicyResponse) { 163 option (google.api.http) = { 164 get: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicy" 165 }; 166 } 167 168 // Analyzes IAM policies asynchronously to answer which identities have what 169 // accesses on which resources, and writes the analysis results to a Google 170 // Cloud Storage or a BigQuery destination. For Cloud Storage destination, the 171 // output format is the JSON format that represents a 172 // [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. 173 // This method implements the 174 // [google.longrunning.Operation][google.longrunning.Operation], which allows 175 // you to track the operation status. We recommend intervals of at least 2 176 // seconds with exponential backoff retry to poll the operation result. The 177 // metadata contains the metadata for the long-running operation. 178 rpc AnalyzeIamPolicyLongrunning(AnalyzeIamPolicyLongrunningRequest) 179 returns (google.longrunning.Operation) { 180 option (google.api.http) = { 181 post: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicyLongrunning" 182 body: "*" 183 }; 184 option (google.longrunning.operation_info) = { 185 response_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse" 186 metadata_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata" 187 }; 188 } 189 190 // Analyze moving a resource to a specified destination without kicking off 191 // the actual move. The analysis is best effort depending on the user's 192 // permissions of viewing different hierarchical policies and configurations. 193 // The policies and configuration are subject to change before the actual 194 // resource migration takes place. 195 rpc AnalyzeMove(AnalyzeMoveRequest) returns (AnalyzeMoveResponse) { 196 option (google.api.http) = { 197 get: "/v1/{resource=*/*}:analyzeMove" 198 }; 199 } 200 201 // Issue a job that queries assets using a SQL statement compatible with 202 // [BigQuery Standard 203 // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). 204 // 205 // If the query execution finishes within timeout and there's no pagination, 206 // the full query results will be returned in the `QueryAssetsResponse`. 207 // 208 // Otherwise, full query results can be obtained by issuing extra requests 209 // with the `job_reference` from the a previous `QueryAssets` call. 210 // 211 // Note, the query result has approximately 10 GB limitation enforced by 212 // BigQuery 213 // https://cloud.google.com/bigquery/docs/best-practices-performance-output, 214 // queries return larger results will result in errors. 215 rpc QueryAssets(QueryAssetsRequest) returns (QueryAssetsResponse) { 216 option (google.api.http) = { 217 post: "/v1/{parent=*/*}:queryAssets" 218 body: "*" 219 }; 220 } 221 222 // Creates a saved query in a parent project/folder/organization. 223 rpc CreateSavedQuery(CreateSavedQueryRequest) returns (SavedQuery) { 224 option (google.api.http) = { 225 post: "/v1/{parent=*/*}/savedQueries" 226 body: "saved_query" 227 }; 228 option (google.api.method_signature) = "parent,saved_query,saved_query_id"; 229 } 230 231 // Gets details about a saved query. 232 rpc GetSavedQuery(GetSavedQueryRequest) returns (SavedQuery) { 233 option (google.api.http) = { 234 get: "/v1/{name=*/*/savedQueries/*}" 235 }; 236 option (google.api.method_signature) = "name"; 237 } 238 239 // Lists all saved queries in a parent project/folder/organization. 240 rpc ListSavedQueries(ListSavedQueriesRequest) 241 returns (ListSavedQueriesResponse) { 242 option (google.api.http) = { 243 get: "/v1/{parent=*/*}/savedQueries" 244 }; 245 option (google.api.method_signature) = "parent"; 246 } 247 248 // Updates a saved query. 249 rpc UpdateSavedQuery(UpdateSavedQueryRequest) returns (SavedQuery) { 250 option (google.api.http) = { 251 patch: "/v1/{saved_query.name=*/*/savedQueries/*}" 252 body: "saved_query" 253 }; 254 option (google.api.method_signature) = "saved_query,update_mask"; 255 } 256 257 // Deletes a saved query. 258 rpc DeleteSavedQuery(DeleteSavedQueryRequest) 259 returns (google.protobuf.Empty) { 260 option (google.api.http) = { 261 delete: "/v1/{name=*/*/savedQueries/*}" 262 }; 263 option (google.api.method_signature) = "name"; 264 } 265 266 // Gets effective IAM policies for a batch of resources. 267 rpc BatchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest) 268 returns (BatchGetEffectiveIamPoliciesResponse) { 269 option (google.api.http) = { 270 get: "/v1/{scope=*/*}/effectiveIamPolicies:batchGet" 271 }; 272 } 273 274 // Analyzes organization policies under a scope. 275 rpc AnalyzeOrgPolicies(AnalyzeOrgPoliciesRequest) 276 returns (AnalyzeOrgPoliciesResponse) { 277 option (google.api.http) = { 278 get: "/v1/{scope=*/*}:analyzeOrgPolicies" 279 }; 280 option (google.api.method_signature) = "scope,constraint,filter"; 281 } 282 283 // Analyzes organization policies governed containers (projects, folders or 284 // organization) under a scope. 285 rpc AnalyzeOrgPolicyGovernedContainers( 286 AnalyzeOrgPolicyGovernedContainersRequest) 287 returns (AnalyzeOrgPolicyGovernedContainersResponse) { 288 option (google.api.http) = { 289 get: "/v1/{scope=*/*}:analyzeOrgPolicyGovernedContainers" 290 }; 291 option (google.api.method_signature) = "scope,constraint,filter"; 292 } 293 294 // Analyzes organization policies governed assets (Google Cloud resources or 295 // policies) under a scope. This RPC supports custom constraints and the 296 // following 10 canned constraints: 297 // 298 // * storage.uniformBucketLevelAccess 299 // * iam.disableServiceAccountKeyCreation 300 // * iam.allowedPolicyMemberDomains 301 // * compute.vmExternalIpAccess 302 // * appengine.enforceServiceAccountActAsCheck 303 // * gcp.resourceLocations 304 // * compute.trustedImageProjects 305 // * compute.skipDefaultNetworkCreation 306 // * compute.requireOsLogin 307 // * compute.disableNestedVirtualization 308 // 309 // This RPC only returns either resources of types supported by [searchable 310 // asset 311 // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types), 312 // or IAM policies. 313 rpc AnalyzeOrgPolicyGovernedAssets(AnalyzeOrgPolicyGovernedAssetsRequest) 314 returns (AnalyzeOrgPolicyGovernedAssetsResponse) { 315 option (google.api.http) = { 316 get: "/v1/{scope=*/*}:analyzeOrgPolicyGovernedAssets" 317 }; 318 option (google.api.method_signature) = "scope,constraint,filter"; 319 } 320} 321 322// Represents the metadata of the longrunning operation for the 323// AnalyzeIamPolicyLongrunning RPC. 324message AnalyzeIamPolicyLongrunningMetadata { 325 // Output only. The time the operation was created. 326 google.protobuf.Timestamp create_time = 1 327 [(google.api.field_behavior) = OUTPUT_ONLY]; 328} 329 330// Export asset request. 331message ExportAssetsRequest { 332 // Required. The relative name of the root asset. This can only be an 333 // organization number (such as "organizations/123"), a project ID (such as 334 // "projects/my-project-id"), or a project number (such as "projects/12345"), 335 // or a folder number (such as "folders/123"). 336 string parent = 1 [ 337 (google.api.field_behavior) = REQUIRED, 338 (google.api.resource_reference) = { 339 child_type: "cloudasset.googleapis.com/Asset" 340 } 341 ]; 342 343 // Timestamp to take an asset snapshot. This can only be set to a timestamp 344 // between the current time and the current time minus 35 days (inclusive). 345 // If not specified, the current time will be used. Due to delays in resource 346 // data collection and indexing, there is a volatile window during which 347 // running the same query may get different results. 348 google.protobuf.Timestamp read_time = 2; 349 350 // A list of asset types to take a snapshot for. For example: 351 // "compute.googleapis.com/Disk". 352 // 353 // Regular expressions are also supported. For example: 354 // 355 // * "compute.googleapis.com.*" snapshots resources whose asset type starts 356 // with "compute.googleapis.com". 357 // * ".*Instance" snapshots resources whose asset type ends with "Instance". 358 // * ".*Instance.*" snapshots resources whose asset type contains "Instance". 359 // 360 // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported 361 // regular expression syntax. If the regular expression does not match any 362 // supported asset type, an INVALID_ARGUMENT error will be returned. 363 // 364 // If specified, only matching assets will be returned, otherwise, it will 365 // snapshot all asset types. See [Introduction to Cloud Asset 366 // Inventory](https://cloud.google.com/asset-inventory/docs/overview) 367 // for all supported asset types. 368 repeated string asset_types = 3; 369 370 // Asset content type. If not specified, no content but the asset name will be 371 // returned. 372 ContentType content_type = 4; 373 374 // Required. Output configuration indicating where the results will be output 375 // to. 376 OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED]; 377 378 // A list of relationship types to export, for example: 379 // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if 380 // content_type=RELATIONSHIP. 381 // * If specified: 382 // it snapshots specified relationships. It returns an error if 383 // any of the [relationship_types] doesn't belong to the supported 384 // relationship types of the [asset_types] or if any of the [asset_types] 385 // doesn't belong to the source types of the [relationship_types]. 386 // * Otherwise: 387 // it snapshots the supported relationships for all [asset_types] or returns 388 // an error if any of the [asset_types] has no relationship support. 389 // An unspecified asset types field means all supported asset_types. 390 // See [Introduction to Cloud Asset 391 // Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all 392 // supported asset types and relationship types. 393 repeated string relationship_types = 6; 394} 395 396// The export asset response. This message is returned by the 397// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] 398// method in the returned 399// [google.longrunning.Operation.response][google.longrunning.Operation.response] 400// field. 401message ExportAssetsResponse { 402 // Time the snapshot was taken. 403 google.protobuf.Timestamp read_time = 1; 404 405 // Output configuration indicating where the results were output to. 406 OutputConfig output_config = 2; 407 408 // Output result indicating where the assets were exported to. For example, a 409 // set of actual Cloud Storage object URIs where the assets are exported to. 410 // The URIs can be different from what [output_config] has specified, as the 411 // service will split the output object into multiple ones once it exceeds a 412 // single Cloud Storage object limit. 413 OutputResult output_result = 3; 414} 415 416// ListAssets request. 417message ListAssetsRequest { 418 // Required. Name of the organization, folder, or project the assets belong 419 // to. Format: "organizations/[organization-number]" (such as 420 // "organizations/123"), "projects/[project-id]" (such as 421 // "projects/my-project-id"), "projects/[project-number]" (such as 422 // "projects/12345"), or "folders/[folder-number]" (such as "folders/12345"). 423 string parent = 1 [ 424 (google.api.field_behavior) = REQUIRED, 425 (google.api.resource_reference) = { 426 child_type: "cloudasset.googleapis.com/Asset" 427 } 428 ]; 429 430 // Timestamp to take an asset snapshot. This can only be set to a timestamp 431 // between the current time and the current time minus 35 days (inclusive). 432 // If not specified, the current time will be used. Due to delays in resource 433 // data collection and indexing, there is a volatile window during which 434 // running the same query may get different results. 435 google.protobuf.Timestamp read_time = 2; 436 437 // A list of asset types to take a snapshot for. For example: 438 // "compute.googleapis.com/Disk". 439 // 440 // Regular expression is also supported. For example: 441 // 442 // * "compute.googleapis.com.*" snapshots resources whose asset type starts 443 // with "compute.googleapis.com". 444 // * ".*Instance" snapshots resources whose asset type ends with "Instance". 445 // * ".*Instance.*" snapshots resources whose asset type contains "Instance". 446 // 447 // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported 448 // regular expression syntax. If the regular expression does not match any 449 // supported asset type, an INVALID_ARGUMENT error will be returned. 450 // 451 // If specified, only matching assets will be returned, otherwise, it will 452 // snapshot all asset types. See [Introduction to Cloud Asset 453 // Inventory](https://cloud.google.com/asset-inventory/docs/overview) 454 // for all supported asset types. 455 repeated string asset_types = 3; 456 457 // Asset content type. If not specified, no content but the asset name will 458 // be returned. 459 ContentType content_type = 4; 460 461 // The maximum number of assets to be returned in a single response. Default 462 // is 100, minimum is 1, and maximum is 1000. 463 int32 page_size = 5; 464 465 // The `next_page_token` returned from the previous `ListAssetsResponse`, or 466 // unspecified for the first `ListAssetsRequest`. It is a continuation of a 467 // prior `ListAssets` call, and the API should return the next page of assets. 468 string page_token = 6; 469 470 // A list of relationship types to output, for example: 471 // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if 472 // content_type=RELATIONSHIP. 473 // * If specified: 474 // it snapshots specified relationships. It returns an error if 475 // any of the [relationship_types] doesn't belong to the supported 476 // relationship types of the [asset_types] or if any of the [asset_types] 477 // doesn't belong to the source types of the [relationship_types]. 478 // * Otherwise: 479 // it snapshots the supported relationships for all [asset_types] or returns 480 // an error if any of the [asset_types] has no relationship support. 481 // An unspecified asset types field means all supported asset_types. 482 // See [Introduction to Cloud Asset 483 // Inventory](https://cloud.google.com/asset-inventory/docs/overview) 484 // for all supported asset types and relationship types. 485 repeated string relationship_types = 7; 486} 487 488// ListAssets response. 489message ListAssetsResponse { 490 // Time the snapshot was taken. 491 google.protobuf.Timestamp read_time = 1; 492 493 // Assets. 494 repeated Asset assets = 2; 495 496 // Token to retrieve the next page of results. It expires 72 hours after the 497 // page token for the first page is generated. Set to empty if there are no 498 // remaining results. 499 string next_page_token = 3; 500} 501 502// Batch get assets history request. 503message BatchGetAssetsHistoryRequest { 504 // Required. The relative name of the root asset. It can only be an 505 // organization number (such as "organizations/123"), a project ID (such as 506 // "projects/my-project-id")", or a project number (such as "projects/12345"). 507 string parent = 1 [ 508 (google.api.field_behavior) = REQUIRED, 509 (google.api.resource_reference) = { 510 child_type: "cloudasset.googleapis.com/Asset" 511 } 512 ]; 513 514 // A list of the full names of the assets. 515 // See: https://cloud.google.com/asset-inventory/docs/resource-name-format 516 // Example: 517 // 518 // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. 519 // 520 // The request becomes a no-op if the asset name list is empty, and the max 521 // size of the asset name list is 100 in one request. 522 repeated string asset_names = 2; 523 524 // Optional. The content type. 525 ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL]; 526 527 // Optional. The time window for the asset history. Both start_time and 528 // end_time are optional and if set, it must be after the current time minus 529 // 35 days. If end_time is not set, it is default to current timestamp. 530 // If start_time is not set, the snapshot of the assets at end_time will be 531 // returned. The returned results contain all temporal assets whose time 532 // window overlap with read_time_window. 533 TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL]; 534 535 // Optional. A list of relationship types to output, for example: 536 // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if 537 // content_type=RELATIONSHIP. 538 // * If specified: 539 // it outputs specified relationships' history on the [asset_names]. It 540 // returns an error if any of the [relationship_types] doesn't belong to the 541 // supported relationship types of the [asset_names] or if any of the 542 // [asset_names]'s types doesn't belong to the source types of the 543 // [relationship_types]. 544 // * Otherwise: 545 // it outputs the supported relationships' history on the [asset_names] or 546 // returns an error if any of the [asset_names]'s types has no relationship 547 // support. 548 // See [Introduction to Cloud Asset 549 // Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all 550 // supported asset types and relationship types. 551 repeated string relationship_types = 5 552 [(google.api.field_behavior) = OPTIONAL]; 553} 554 555// Batch get assets history response. 556message BatchGetAssetsHistoryResponse { 557 // A list of assets with valid time windows. 558 repeated TemporalAsset assets = 1; 559} 560 561// Create asset feed request. 562message CreateFeedRequest { 563 // Required. The name of the project/folder/organization where this feed 564 // should be created in. It can only be an organization number (such as 565 // "organizations/123"), a folder number (such as "folders/123"), a project ID 566 // (such as "projects/my-project-id"), or a project number (such as 567 // "projects/12345"). 568 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 569 570 // Required. This is the client-assigned asset feed identifier and it needs to 571 // be unique under a specific parent project/folder/organization. 572 string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; 573 574 // Required. The feed details. The field `name` must be empty and it will be 575 // generated in the format of: projects/project_number/feeds/feed_id 576 // folders/folder_number/feeds/feed_id 577 // organizations/organization_number/feeds/feed_id 578 Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; 579} 580 581// Get asset feed request. 582message GetFeedRequest { 583 // Required. The name of the Feed and it must be in the format of: 584 // projects/project_number/feeds/feed_id 585 // folders/folder_number/feeds/feed_id 586 // organizations/organization_number/feeds/feed_id 587 string name = 1 [ 588 (google.api.field_behavior) = REQUIRED, 589 (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } 590 ]; 591} 592 593// List asset feeds request. 594message ListFeedsRequest { 595 // Required. The parent project/folder/organization whose feeds are to be 596 // listed. It can only be using project/folder/organization number (such as 597 // "folders/12345")", or a project ID (such as "projects/my-project-id"). 598 string parent = 1 [(google.api.field_behavior) = REQUIRED]; 599} 600 601message ListFeedsResponse { 602 // A list of feeds. 603 repeated Feed feeds = 1; 604} 605 606// Update asset feed request. 607message UpdateFeedRequest { 608 // Required. The new values of feed details. It must match an existing feed 609 // and the field `name` must be in the format of: 610 // projects/project_number/feeds/feed_id or 611 // folders/folder_number/feeds/feed_id or 612 // organizations/organization_number/feeds/feed_id. 613 Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; 614 615 // Required. Only updates the `feed` fields indicated by this mask. 616 // The field mask must not be empty, and it must not contain fields that 617 // are immutable or only set by the server. 618 google.protobuf.FieldMask update_mask = 2 619 [(google.api.field_behavior) = REQUIRED]; 620} 621 622message DeleteFeedRequest { 623 // Required. The name of the feed and it must be in the format of: 624 // projects/project_number/feeds/feed_id 625 // folders/folder_number/feeds/feed_id 626 // organizations/organization_number/feeds/feed_id 627 string name = 1 [ 628 (google.api.field_behavior) = REQUIRED, 629 (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } 630 ]; 631} 632 633// Output configuration for export assets destination. 634message OutputConfig { 635 // Asset export destination. 636 oneof destination { 637 // Destination on Cloud Storage. 638 GcsDestination gcs_destination = 1; 639 640 // Destination on BigQuery. The output table stores the fields in asset 641 // Protobuf as columns in BigQuery. 642 BigQueryDestination bigquery_destination = 2; 643 } 644} 645 646// Output result of export assets. 647message OutputResult { 648 // Asset export result. 649 oneof result { 650 // Export result on Cloud Storage. 651 GcsOutputResult gcs_result = 1; 652 } 653} 654 655// A Cloud Storage output result. 656message GcsOutputResult { 657 // List of URIs of the Cloud Storage objects. Example: 658 // "gs://bucket_name/object_name". 659 repeated string uris = 1; 660} 661 662// A Cloud Storage location. 663message GcsDestination { 664 // Required. 665 oneof object_uri { 666 // The URI of the Cloud Storage object. It's the same URI that is used by 667 // gsutil. Example: "gs://bucket_name/object_name". See [Viewing and 668 // Editing Object 669 // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) 670 // for more information. 671 // 672 // If the specified Cloud Storage object already exists and there is no 673 // [hold](https://cloud.google.com/storage/docs/object-holds), it will be 674 // overwritten with the exported result. 675 string uri = 1; 676 677 // The URI prefix of all generated Cloud Storage objects. Example: 678 // "gs://bucket_name/object_name_prefix". Each object URI is in format: 679 // "gs://bucket_name/object_name_prefix/<asset type>/<shard number> and only 680 // contains assets for that type. <shard number> starts from 0. Example: 681 // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is 682 // the first shard of output objects containing all 683 // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be 684 // returned if file with the same name "gs://bucket_name/object_name_prefix" 685 // already exists. 686 string uri_prefix = 2; 687 } 688} 689 690// A BigQuery destination for exporting assets to. 691message BigQueryDestination { 692 // Required. The BigQuery dataset in format 693 // "projects/projectId/datasets/datasetId", to which the snapshot result 694 // should be exported. If this dataset does not exist, the export call returns 695 // an INVALID_ARGUMENT error. Setting the `contentType` for `exportAssets` 696 // determines the 697 // [schema](/asset-inventory/docs/exporting-to-bigquery#bigquery-schema) 698 // of the BigQuery table. Setting `separateTablesPerAssetType` to `TRUE` also 699 // influences the schema. 700 string dataset = 1 [(google.api.field_behavior) = REQUIRED]; 701 702 // Required. The BigQuery table to which the snapshot result should be 703 // written. If this table does not exist, a new table with the given name 704 // will be created. 705 string table = 2 [(google.api.field_behavior) = REQUIRED]; 706 707 // If the destination table already exists and this flag is `TRUE`, the 708 // table will be overwritten by the contents of assets snapshot. If the flag 709 // is `FALSE` or unset and the destination table already exists, the export 710 // call returns an INVALID_ARGUMEMT error. 711 bool force = 3; 712 713 // [partition_spec] determines whether to export to partitioned table(s) and 714 // how to partition the data. 715 // 716 // If [partition_spec] is unset or [partition_spec.partition_key] is unset or 717 // `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to 718 // non-partitioned table(s). [force] will decide whether to overwrite existing 719 // table(s). 720 // 721 // If [partition_spec] is specified. First, the snapshot results will be 722 // written to partitioned table(s) with two additional timestamp columns, 723 // readTime and requestTime, one of which will be the partition key. Secondly, 724 // in the case when any destination table already exists, it will first try to 725 // update existing table's schema as necessary by appending additional 726 // columns. Then, if [force] is `TRUE`, the corresponding partition will be 727 // overwritten by the snapshot results (data in different partitions will 728 // remain intact); if [force] is unset or `FALSE`, it will append the data. An 729 // error will be returned if the schema update or data appension fails. 730 PartitionSpec partition_spec = 4; 731 732 // If this flag is `TRUE`, the snapshot results will be written to one or 733 // multiple tables, each of which contains results of one asset type. The 734 // [force] and [partition_spec] fields will apply to each of them. 735 // 736 // Field [table] will be concatenated with "_" and the asset type names (see 737 // https://cloud.google.com/asset-inventory/docs/supported-asset-types for 738 // supported asset types) to construct per-asset-type table names, in which 739 // all non-alphanumeric characters like "." and "/" will be substituted by 740 // "_". Example: if field [table] is "mytable" and snapshot results 741 // contain "storage.googleapis.com/Bucket" assets, the corresponding table 742 // name will be "mytable_storage_googleapis_com_Bucket". If any of these 743 // tables does not exist, a new table with the concatenated name will be 744 // created. 745 // 746 // When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of 747 // each table will include RECORD-type columns mapped to the nested fields in 748 // the Asset.resource.data field of that asset type (up to the 15 nested level 749 // BigQuery supports 750 // (https://cloud.google.com/bigquery/docs/nested-repeated#limitations)). The 751 // fields in >15 nested levels will be stored in JSON format string as a child 752 // column of its parent RECORD column. 753 // 754 // If error occurs when exporting to any table, the whole export call will 755 // return an error but the export results that already succeed will persist. 756 // Example: if exporting to table_type_A succeeds when exporting to 757 // table_type_B fails during one export call, the results in table_type_A will 758 // persist and there will not be partial results persisting in a table. 759 bool separate_tables_per_asset_type = 5; 760} 761 762// Specifications of BigQuery partitioned table as export destination. 763message PartitionSpec { 764 // This enum is used to determine the partition key column when exporting 765 // assets to BigQuery partitioned table(s). Note that, if the partition key is 766 // a timestamp column, the actual partition is based on its date value 767 // (expressed in UTC. see details in 768 // https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables). 769 enum PartitionKey { 770 // Unspecified partition key. If used, it means using non-partitioned table. 771 PARTITION_KEY_UNSPECIFIED = 0; 772 773 // The time when the snapshot is taken. If specified as partition key, the 774 // result table(s) is partitoned by the additional timestamp column, 775 // readTime. If [read_time] in ExportAssetsRequest is specified, the 776 // readTime column's value will be the same as it. Otherwise, its value will 777 // be the current time that is used to take the snapshot. 778 READ_TIME = 1; 779 780 // The time when the request is received and started to be processed. If 781 // specified as partition key, the result table(s) is partitoned by the 782 // requestTime column, an additional timestamp column representing when the 783 // request was received. 784 REQUEST_TIME = 2; 785 } 786 787 // The partition key for BigQuery partitioned table. 788 PartitionKey partition_key = 1; 789} 790 791// A Pub/Sub destination. 792message PubsubDestination { 793 // The name of the Pub/Sub topic to publish to. 794 // Example: `projects/PROJECT_ID/topics/TOPIC_ID`. 795 string topic = 1; 796} 797 798// Output configuration for asset feed destination. 799message FeedOutputConfig { 800 // Asset feed destination. 801 oneof destination { 802 // Destination on Pub/Sub. 803 PubsubDestination pubsub_destination = 1; 804 } 805} 806 807// An asset feed used to export asset updates to a destinations. 808// An asset feed filter controls what updates are exported. 809// The asset feed must be created within a project, organization, or 810// folder. Supported destinations are: 811// Pub/Sub topics. 812message Feed { 813 option (google.api.resource) = { 814 type: "cloudasset.googleapis.com/Feed" 815 pattern: "projects/{project}/feeds/{feed}" 816 pattern: "folders/{folder}/feeds/{feed}" 817 pattern: "organizations/{organization}/feeds/{feed}" 818 history: ORIGINALLY_SINGLE_PATTERN 819 }; 820 821 // Required. The format will be 822 // projects/{project_number}/feeds/{client-assigned_feed_identifier} or 823 // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or 824 // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} 825 // 826 // The client-assigned feed identifier must be unique within the parent 827 // project/folder/organization. 828 string name = 1 [(google.api.field_behavior) = REQUIRED]; 829 830 // A list of the full names of the assets to receive updates. You must specify 831 // either or both of asset_names and asset_types. Only asset updates matching 832 // specified asset_names or asset_types are exported to the feed. 833 // Example: 834 // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. 835 // For a list of the full names for supported asset types, see [Resource 836 // name format](/asset-inventory/docs/resource-name-format). 837 repeated string asset_names = 2; 838 839 // A list of types of the assets to receive updates. You must specify either 840 // or both of asset_names and asset_types. Only asset updates matching 841 // specified asset_names or asset_types are exported to the feed. 842 // Example: `"compute.googleapis.com/Disk"` 843 // 844 // For a list of all supported asset types, see 845 // [Supported asset types](/asset-inventory/docs/supported-asset-types). 846 repeated string asset_types = 3; 847 848 // Asset content type. If not specified, no content but the asset name and 849 // type will be returned. 850 ContentType content_type = 4; 851 852 // Required. Feed output configuration defining where the asset updates are 853 // published to. 854 FeedOutputConfig feed_output_config = 5 855 [(google.api.field_behavior) = REQUIRED]; 856 857 // A condition which determines whether an asset update should be published. 858 // If specified, an asset will be returned only when the expression evaluates 859 // to true. 860 // When set, `expression` field in the `Expr` must be a valid [CEL expression] 861 // (https://github.com/google/cel-spec) on a TemporalAsset with name 862 // `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted 863 // == true") will only publish Asset deletions. Other fields of `Expr` are 864 // optional. 865 // 866 // See our [user 867 // guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition) 868 // for detailed instructions. 869 google.type.Expr condition = 6; 870 871 // A list of relationship types to output, for example: 872 // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if 873 // content_type=RELATIONSHIP. 874 // * If specified: 875 // it outputs specified relationship updates on the [asset_names] or the 876 // [asset_types]. It returns an error if any of the [relationship_types] 877 // doesn't belong to the supported relationship types of the [asset_names] or 878 // [asset_types], or any of the [asset_names] or the [asset_types] doesn't 879 // belong to the source types of the [relationship_types]. 880 // * Otherwise: 881 // it outputs the supported relationships of the types of [asset_names] and 882 // [asset_types] or returns an error if any of the [asset_names] or the 883 // [asset_types] has no replationship support. 884 // See [Introduction to Cloud Asset 885 // Inventory](https://cloud.google.com/asset-inventory/docs/overview) 886 // for all supported asset types and relationship types. 887 repeated string relationship_types = 7; 888} 889 890// Search all resources request. 891message SearchAllResourcesRequest { 892 // Required. A scope can be a project, a folder, or an organization. The 893 // search is limited to the resources within the `scope`. The caller must be 894 // granted the 895 // [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) 896 // permission on the desired scope. 897 // 898 // The allowed values are: 899 // 900 // * projects/{PROJECT_ID} (e.g., "projects/foo-bar") 901 // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") 902 // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") 903 // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") 904 string scope = 1 [(google.api.field_behavior) = REQUIRED]; 905 906 // Optional. The query statement. See [how to construct a 907 // query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) 908 // for more information. If not specified or empty, it will search all the 909 // resources within the specified `scope`. 910 // 911 // Examples: 912 // 913 // * `name:Important` to find Google Cloud resources whose name contains 914 // "Important" as a word. 915 // * `name=Important` to find the Google Cloud resource whose name is exactly 916 // "Important". 917 // * `displayName:Impor*` to find Google Cloud resources whose display name 918 // contains "Impor" as a prefix of any word in the field. 919 // * `location:us-west*` to find Google Cloud resources whose location 920 // contains both "us" and "west" as prefixes. 921 // * `labels:prod` to find Google Cloud resources whose labels contain "prod" 922 // as a key or value. 923 // * `labels.env:prod` to find Google Cloud resources that have a label "env" 924 // and its value is "prod". 925 // * `labels.env:*` to find Google Cloud resources that have a label "env". 926 // * `kmsKey:key` to find Google Cloud resources encrypted with a 927 // customer-managed encryption key whose name contains "key" as a word. This 928 // field is deprecated. Please use the `kmsKeys` field to retrieve Cloud KMS 929 // key information. 930 // * `kmsKeys:key` to find Google Cloud resources encrypted with 931 // customer-managed encryption keys whose name contains the word "key". 932 // * `relationships:instance-group-1` to find Google Cloud resources that have 933 // relationships with "instance-group-1" in the related resource name. 934 // * `relationships:INSTANCE_TO_INSTANCEGROUP` to find Compute Engine 935 // instances that have relationships of type "INSTANCE_TO_INSTANCEGROUP". 936 // * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find 937 // Compute Engine instances that have relationships with "instance-group-1" 938 // in the Compute Engine instance group resource name, for relationship type 939 // "INSTANCE_TO_INSTANCEGROUP". 940 // * `state:ACTIVE` to find Google Cloud resources whose state contains 941 // "ACTIVE" as a word. 942 // * `NOT state:ACTIVE` to find Google Cloud resources whose state doesn't 943 // contain "ACTIVE" as a word. 944 // * `createTime<1609459200` to find Google Cloud resources that were created 945 // before "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of 946 // "2021-01-01 00:00:00 UTC" in seconds. 947 // * `updateTime>1609459200` to find Google Cloud resources that were updated 948 // after "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of 949 // "2021-01-01 00:00:00 UTC" in seconds. 950 // * `Important` to find Google Cloud resources that contain "Important" as a 951 // word in any of the searchable fields. 952 // * `Impor*` to find Google Cloud resources that contain "Impor" as a prefix 953 // of any word in any of the searchable fields. 954 // * `Important location:(us-west1 OR global)` to find Google Cloud 955 // resources that contain "Important" as a word in any of the searchable 956 // fields and are also located in the "us-west1" region or the "global" 957 // location. 958 string query = 2 [(google.api.field_behavior) = OPTIONAL]; 959 960 // Optional. A list of asset types that this request searches for. If empty, 961 // it will search all the [searchable asset 962 // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). 963 // 964 // Regular expressions are also supported. For example: 965 // 966 // * "compute.googleapis.com.*" snapshots resources whose asset type starts 967 // with "compute.googleapis.com". 968 // * ".*Instance" snapshots resources whose asset type ends with "Instance". 969 // * ".*Instance.*" snapshots resources whose asset type contains "Instance". 970 // 971 // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported 972 // regular expression syntax. If the regular expression does not match any 973 // supported asset type, an INVALID_ARGUMENT error will be returned. 974 repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; 975 976 // Optional. The page size for search result pagination. Page size is capped 977 // at 500 even if a larger value is given. If set to zero, server will pick an 978 // appropriate default. Returned results may be fewer than requested. When 979 // this happens, there could be more results as long as `next_page_token` is 980 // returned. 981 int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; 982 983 // Optional. If present, then retrieve the next batch of results from the 984 // preceding call to this method. `page_token` must be the value of 985 // `next_page_token` from the previous response. The values of all other 986 // method parameters, must be identical to those in the previous call. 987 string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; 988 989 // Optional. A comma-separated list of fields specifying the sorting order of 990 // the results. The default order is ascending. Add " DESC" after the field 991 // name to indicate descending order. Redundant space characters are ignored. 992 // Example: "location DESC, name". 993 // Only singular primitive fields in the response are sortable: 994 // 995 // * name 996 // * assetType 997 // * project 998 // * displayName 999 // * description 1000 // * location 1001 // * createTime 1002 // * updateTime 1003 // * state 1004 // * parentFullResourceName 1005 // * parentAssetType 1006 // 1007 // All the other fields such as repeated fields (e.g., `networkTags`, 1008 // `kmsKeys`), map fields (e.g., `labels`) and struct fields (e.g., 1009 // `additionalAttributes`) are not supported. 1010 string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; 1011 1012 // Optional. A comma-separated list of fields specifying which fields to be 1013 // returned in ResourceSearchResult. Only '*' or combination of top level 1014 // fields can be specified. Field names of both snake_case and camelCase are 1015 // supported. Examples: `"*"`, `"name,location"`, `"name,versionedResources"`. 1016 // 1017 // The read_mask paths must be valid field paths listed but not limited to 1018 // (both snake_case and camelCase are supported): 1019 // 1020 // * name 1021 // * assetType 1022 // * project 1023 // * displayName 1024 // * description 1025 // * location 1026 // * tagKeys 1027 // * tagValues 1028 // * tagValueIds 1029 // * labels 1030 // * networkTags 1031 // * kmsKey (This field is deprecated. Please use the `kmsKeys` field to 1032 // retrieve Cloud KMS key information.) 1033 // * kmsKeys 1034 // * createTime 1035 // * updateTime 1036 // * state 1037 // * additionalAttributes 1038 // * versionedResources 1039 // 1040 // If read_mask is not specified, all fields except versionedResources will 1041 // be returned. 1042 // If only '*' is specified, all fields including versionedResources will be 1043 // returned. 1044 // Any invalid field path will trigger INVALID_ARGUMENT error. 1045 google.protobuf.FieldMask read_mask = 8 1046 [(google.api.field_behavior) = OPTIONAL]; 1047} 1048 1049// Search all resources response. 1050message SearchAllResourcesResponse { 1051 // A list of Resources that match the search query. It contains the resource 1052 // standard metadata information. 1053 repeated ResourceSearchResult results = 1; 1054 1055 // If there are more results than those appearing in this response, then 1056 // `next_page_token` is included. To get the next set of results, call this 1057 // method again using the value of `next_page_token` as `page_token`. 1058 string next_page_token = 2; 1059} 1060 1061// Search all IAM policies request. 1062message SearchAllIamPoliciesRequest { 1063 // Required. A scope can be a project, a folder, or an organization. The 1064 // search is limited to the IAM policies within the `scope`. The caller must 1065 // be granted the 1066 // [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) 1067 // permission on the desired scope. 1068 // 1069 // The allowed values are: 1070 // 1071 // * projects/{PROJECT_ID} (e.g., "projects/foo-bar") 1072 // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") 1073 // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") 1074 // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") 1075 string scope = 1 [(google.api.field_behavior) = REQUIRED]; 1076 1077 // Optional. The query statement. See [how to construct a 1078 // query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) 1079 // for more information. If not specified or empty, it will search all the 1080 // IAM policies within the specified `scope`. Note that the query string is 1081 // compared against each IAM policy binding, including its principals, 1082 // roles, and IAM conditions. The returned IAM policies will only 1083 // contain the bindings that match your query. To learn more about the IAM 1084 // policy structure, see the [IAM policy 1085 // documentation](https://cloud.google.com/iam/help/allow-policies/structure). 1086 // 1087 // Examples: 1088 // 1089 // * `policy:[email protected]` to find IAM policy bindings that specify user 1090 // "[email protected]". 1091 // * `policy:roles/compute.admin` to find IAM policy bindings that specify 1092 // the Compute Admin role. 1093 // * `policy:comp*` to find IAM policy bindings that contain "comp" as a 1094 // prefix of any word in the binding. 1095 // * `policy.role.permissions:storage.buckets.update` to find IAM policy 1096 // bindings that specify a role containing "storage.buckets.update" 1097 // permission. Note that if callers don't have `iam.roles.get` access to a 1098 // role's included permissions, policy bindings that specify this role will 1099 // be dropped from the search results. 1100 // * `policy.role.permissions:upd*` to find IAM policy bindings that specify a 1101 // role containing "upd" as a prefix of any word in the role permission. 1102 // Note that if callers don't have `iam.roles.get` access to a role's 1103 // included permissions, policy bindings that specify this role will be 1104 // dropped from the search results. 1105 // * `resource:organizations/123456` to find IAM policy bindings 1106 // that are set on "organizations/123456". 1107 // * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to 1108 // find IAM policy bindings that are set on the project named "myproject". 1109 // * `Important` to find IAM policy bindings that contain "Important" as a 1110 // word in any of the searchable fields (except for the included 1111 // permissions). 1112 // * `resource:(instance1 OR instance2) policy:amy` to find 1113 // IAM policy bindings that are set on resources "instance1" or 1114 // "instance2" and also specify user "amy". 1115 // * `roles:roles/compute.admin` to find IAM policy bindings that specify the 1116 // Compute Admin role. 1117 // * `memberTypes:user` to find IAM policy bindings that contain the 1118 // principal type "user". 1119 string query = 2 [(google.api.field_behavior) = OPTIONAL]; 1120 1121 // Optional. The page size for search result pagination. Page size is capped 1122 // at 500 even if a larger value is given. If set to zero, server will pick an 1123 // appropriate default. Returned results may be fewer than requested. When 1124 // this happens, there could be more results as long as `next_page_token` is 1125 // returned. 1126 int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; 1127 1128 // Optional. If present, retrieve the next batch of results from the preceding 1129 // call to this method. `page_token` must be the value of `next_page_token` 1130 // from the previous response. The values of all other method parameters must 1131 // be identical to those in the previous call. 1132 string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; 1133 1134 // Optional. A list of asset types that the IAM policies are attached to. If 1135 // empty, it will search the IAM policies that are attached to all the 1136 // [searchable asset 1137 // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). 1138 // 1139 // Regular expressions are also supported. For example: 1140 // 1141 // * "compute.googleapis.com.*" snapshots IAM policies attached to asset type 1142 // starts with "compute.googleapis.com". 1143 // * ".*Instance" snapshots IAM policies attached to asset type ends with 1144 // "Instance". 1145 // * ".*Instance.*" snapshots IAM policies attached to asset type contains 1146 // "Instance". 1147 // 1148 // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported 1149 // regular expression syntax. If the regular expression does not match any 1150 // supported asset type, an INVALID_ARGUMENT error will be returned. 1151 repeated string asset_types = 5 [(google.api.field_behavior) = OPTIONAL]; 1152 1153 // Optional. A comma-separated list of fields specifying the sorting order of 1154 // the results. The default order is ascending. Add " DESC" after the field 1155 // name to indicate descending order. Redundant space characters are ignored. 1156 // Example: "assetType DESC, resource". 1157 // Only singular primitive fields in the response are sortable: 1158 // * resource 1159 // * assetType 1160 // * project 1161 // All the other fields such as repeated fields (e.g., `folders`) and 1162 // non-primitive fields (e.g., `policy`) are not supported. 1163 string order_by = 7 [(google.api.field_behavior) = OPTIONAL]; 1164} 1165 1166// Search all IAM policies response. 1167message SearchAllIamPoliciesResponse { 1168 // A list of IAM policies that match the search query. Related information 1169 // such as the associated resource is returned along with the policy. 1170 repeated IamPolicySearchResult results = 1; 1171 1172 // Set if there are more results than those appearing in this response; to get 1173 // the next set of results, call this method again, using this value as the 1174 // `page_token`. 1175 string next_page_token = 2; 1176} 1177 1178// IAM policy analysis query message. 1179message IamPolicyAnalysisQuery { 1180 // Specifies the resource to analyze for access policies, which may be set 1181 // directly on the resource, or on ancestors such as organizations, folders or 1182 // projects. 1183 message ResourceSelector { 1184 // Required. The [full resource name] 1185 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) 1186 // of a resource of [supported resource 1187 // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types). 1188 string full_resource_name = 1 [(google.api.field_behavior) = REQUIRED]; 1189 } 1190 1191 // Specifies an identity for which to determine resource access, based on 1192 // roles assigned either directly to them or to the groups they belong to, 1193 // directly or indirectly. 1194 message IdentitySelector { 1195 // Required. The identity appear in the form of principals in 1196 // [IAM policy 1197 // binding](https://cloud.google.com/iam/reference/rest/v1/Binding). 1198 // 1199 // The examples of supported forms are: 1200 // "user:[email protected]", 1201 // "group:[email protected]", 1202 // "domain:google.com", 1203 // "serviceAccount:[email protected]". 1204 // 1205 // Notice that wildcard characters (such as * and ?) are not supported. 1206 // You must give a specific identity. 1207 string identity = 1 [(google.api.field_behavior) = REQUIRED]; 1208 } 1209 1210 // Specifies roles and/or permissions to analyze, to determine both the 1211 // identities possessing them and the resources they control. If multiple 1212 // values are specified, results will include roles or permissions matching 1213 // any of them. The total number of roles and permissions should be equal or 1214 // less than 10. 1215 message AccessSelector { 1216 // Optional. The roles to appear in result. 1217 repeated string roles = 1 [(google.api.field_behavior) = OPTIONAL]; 1218 1219 // Optional. The permissions to appear in result. 1220 repeated string permissions = 2 [(google.api.field_behavior) = OPTIONAL]; 1221 } 1222 1223 // Contains query options. 1224 message Options { 1225 // Optional. If true, the identities section of the result will expand any 1226 // Google groups appearing in an IAM policy binding. 1227 // 1228 // If 1229 // [IamPolicyAnalysisQuery.identity_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector] 1230 // is specified, the identity in the result will be determined by the 1231 // selector, and this flag is not allowed to set. 1232 // 1233 // If true, the default max expansion per group is 1000 for 1234 // AssetService.AnalyzeIamPolicy][]. 1235 // 1236 // Default is false. 1237 bool expand_groups = 1 [(google.api.field_behavior) = OPTIONAL]; 1238 1239 // Optional. If true, the access section of result will expand any roles 1240 // appearing in IAM policy bindings to include their permissions. 1241 // 1242 // If 1243 // [IamPolicyAnalysisQuery.access_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector] 1244 // is specified, the access section of the result will be determined by the 1245 // selector, and this flag is not allowed to set. 1246 // 1247 // Default is false. 1248 bool expand_roles = 2 [(google.api.field_behavior) = OPTIONAL]; 1249 1250 // Optional. If true and 1251 // [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] 1252 // is not specified, the resource section of the result will expand any 1253 // resource attached to an IAM policy to include resources lower in the 1254 // resource hierarchy. 1255 // 1256 // For example, if the request analyzes for which resources user A has 1257 // permission P, and the results include an IAM policy with P on a Google 1258 // Cloud folder, the results will also include resources in that folder with 1259 // permission P. 1260 // 1261 // If true and 1262 // [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] 1263 // is specified, the resource section of the result will expand the 1264 // specified resource to include resources lower in the resource hierarchy. 1265 // Only project or lower resources are supported. Folder and organization 1266 // resources cannot be used together with this option. 1267 // 1268 // For example, if the request analyzes for which users have permission P on 1269 // a Google Cloud project with this option enabled, the results will include 1270 // all users who have permission P on that project or any lower resource. 1271 // 1272 // If true, the default max expansion per resource is 1000 for 1273 // AssetService.AnalyzeIamPolicy][] and 100000 for 1274 // AssetService.AnalyzeIamPolicyLongrunning][]. 1275 // 1276 // Default is false. 1277 bool expand_resources = 3 [(google.api.field_behavior) = OPTIONAL]; 1278 1279 // Optional. If true, the result will output the relevant parent/child 1280 // relationships between resources. Default is false. 1281 bool output_resource_edges = 4 [(google.api.field_behavior) = OPTIONAL]; 1282 1283 // Optional. If true, the result will output the relevant membership 1284 // relationships between groups and other groups, and between groups and 1285 // principals. Default is false. 1286 bool output_group_edges = 5 [(google.api.field_behavior) = OPTIONAL]; 1287 1288 // Optional. If true, the response will include access analysis from 1289 // identities to resources via service account impersonation. This is a very 1290 // expensive operation, because many derived queries will be executed. We 1291 // highly recommend you use 1292 // [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] 1293 // RPC instead. 1294 // 1295 // For example, if the request analyzes for which resources user A has 1296 // permission P, and there's an IAM policy states user A has 1297 // iam.serviceAccounts.getAccessToken permission to a service account SA, 1298 // and there's another IAM policy states service account SA has permission P 1299 // to a Google Cloud folder F, then user A potentially has access to the 1300 // Google Cloud folder F. And those advanced analysis results will be 1301 // included in 1302 // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]. 1303 // 1304 // Another example, if the request analyzes for who has 1305 // permission P to a Google Cloud folder F, and there's an IAM policy states 1306 // user A has iam.serviceAccounts.actAs permission to a service account SA, 1307 // and there's another IAM policy states service account SA has permission P 1308 // to the Google Cloud folder F, then user A potentially has access to the 1309 // Google Cloud folder F. And those advanced analysis results will be 1310 // included in 1311 // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]. 1312 // 1313 // Only the following permissions are considered in this analysis: 1314 // 1315 // * `iam.serviceAccounts.actAs` 1316 // * `iam.serviceAccounts.signBlob` 1317 // * `iam.serviceAccounts.signJwt` 1318 // * `iam.serviceAccounts.getAccessToken` 1319 // * `iam.serviceAccounts.getOpenIdToken` 1320 // * `iam.serviceAccounts.implicitDelegation` 1321 // 1322 // Default is false. 1323 bool analyze_service_account_impersonation = 6 1324 [(google.api.field_behavior) = OPTIONAL]; 1325 } 1326 1327 // The IAM conditions context. 1328 message ConditionContext { 1329 // The IAM conditions time context. 1330 oneof TimeContext { 1331 // The hypothetical access timestamp to evaluate IAM conditions. Note that 1332 // this value must not be earlier than the current time; otherwise, an 1333 // INVALID_ARGUMENT error will be returned. 1334 google.protobuf.Timestamp access_time = 1; 1335 } 1336 } 1337 1338 // Required. The relative name of the root asset. Only resources and IAM 1339 // policies within the scope will be analyzed. 1340 // 1341 // This can only be an organization number (such as "organizations/123"), a 1342 // folder number (such as "folders/123"), a project ID (such as 1343 // "projects/my-project-id"), or a project number (such as "projects/12345"). 1344 // 1345 // To know how to get organization id, visit [here 1346 // ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). 1347 // 1348 // To know how to get folder or project id, visit [here 1349 // ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects). 1350 string scope = 1 [(google.api.field_behavior) = REQUIRED]; 1351 1352 // Optional. Specifies a resource for analysis. 1353 ResourceSelector resource_selector = 2 1354 [(google.api.field_behavior) = OPTIONAL]; 1355 1356 // Optional. Specifies an identity for analysis. 1357 IdentitySelector identity_selector = 3 1358 [(google.api.field_behavior) = OPTIONAL]; 1359 1360 // Optional. Specifies roles or permissions for analysis. This is optional. 1361 AccessSelector access_selector = 4 [(google.api.field_behavior) = OPTIONAL]; 1362 1363 // Optional. The query options. 1364 Options options = 5 [(google.api.field_behavior) = OPTIONAL]; 1365 1366 // Optional. The hypothetical context for IAM conditions evaluation. 1367 ConditionContext condition_context = 6 1368 [(google.api.field_behavior) = OPTIONAL]; 1369} 1370 1371// A request message for 1372// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. 1373message AnalyzeIamPolicyRequest { 1374 // Required. The request query. 1375 IamPolicyAnalysisQuery analysis_query = 1 1376 [(google.api.field_behavior) = REQUIRED]; 1377 1378 // Optional. The name of a saved query, which must be in the format of: 1379 // 1380 // * projects/project_number/savedQueries/saved_query_id 1381 // * folders/folder_number/savedQueries/saved_query_id 1382 // * organizations/organization_number/savedQueries/saved_query_id 1383 // 1384 // If both `analysis_query` and `saved_analysis_query` are provided, they 1385 // will be merged together with the `saved_analysis_query` as base and 1386 // the `analysis_query` as overrides. For more details of the merge behavior, 1387 // please refer to the 1388 // [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details) 1389 // page. 1390 // 1391 // Note that you cannot override primitive fields with default value, such as 1392 // 0 or empty string, etc., because we use proto3, which doesn't support field 1393 // presence yet. 1394 string saved_analysis_query = 3 [(google.api.field_behavior) = OPTIONAL]; 1395 1396 // Optional. Amount of time executable has to complete. See JSON 1397 // representation of 1398 // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json). 1399 // 1400 // If this field is set with a value less than the RPC deadline, and the 1401 // execution of your query hasn't finished in the specified 1402 // execution timeout, you will get a response with partial result. 1403 // Otherwise, your query's execution will continue until the RPC deadline. 1404 // If it's not finished until then, you will get a DEADLINE_EXCEEDED error. 1405 // 1406 // Default is empty. 1407 google.protobuf.Duration execution_timeout = 2 1408 [(google.api.field_behavior) = OPTIONAL]; 1409} 1410 1411// A response message for 1412// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. 1413message AnalyzeIamPolicyResponse { 1414 // An analysis message to group the query and results. 1415 message IamPolicyAnalysis { 1416 // The analysis query. 1417 IamPolicyAnalysisQuery analysis_query = 1; 1418 1419 // A list of 1420 // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult] 1421 // that matches the analysis query, or empty if no result is found. 1422 repeated IamPolicyAnalysisResult analysis_results = 2; 1423 1424 // Represents whether all entries in the 1425 // [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results] 1426 // have been fully explored to answer the query. 1427 bool fully_explored = 3; 1428 1429 // A list of non-critical errors happened during the query handling. 1430 repeated IamPolicyAnalysisState non_critical_errors = 5; 1431 } 1432 1433 // The main analysis that matches the original request. 1434 IamPolicyAnalysis main_analysis = 1; 1435 1436 // The service account impersonation analysis if 1437 // [AnalyzeIamPolicyRequest.analyze_service_account_impersonation][] is 1438 // enabled. 1439 repeated IamPolicyAnalysis service_account_impersonation_analysis = 2; 1440 1441 // Represents whether all entries in the 1442 // [main_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis] 1443 // and 1444 // [service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis] 1445 // have been fully explored to answer the query in the request. 1446 bool fully_explored = 3; 1447} 1448 1449// Output configuration for export IAM policy analysis destination. 1450message IamPolicyAnalysisOutputConfig { 1451 // A Cloud Storage location. 1452 message GcsDestination { 1453 // Required. The URI of the Cloud Storage object. It's the same URI that is 1454 // used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and 1455 // Editing Object 1456 // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) 1457 // for more information. 1458 // 1459 // If the specified Cloud Storage object already exists and there is no 1460 // [hold](https://cloud.google.com/storage/docs/object-holds), it will be 1461 // overwritten with the analysis result. 1462 string uri = 1 [(google.api.field_behavior) = REQUIRED]; 1463 } 1464 1465 // A BigQuery destination. 1466 message BigQueryDestination { 1467 // This enum determines the partition key column for the bigquery tables. 1468 // Partitioning can improve query performance and reduce query cost by 1469 // filtering partitions. Refer to 1470 // https://cloud.google.com/bigquery/docs/partitioned-tables for details. 1471 enum PartitionKey { 1472 // Unspecified partition key. Tables won't be partitioned using this 1473 // option. 1474 PARTITION_KEY_UNSPECIFIED = 0; 1475 1476 // The time when the request is received. If specified as partition key, 1477 // the result table(s) is partitoned by the RequestTime column, an 1478 // additional timestamp column representing when the request was received. 1479 REQUEST_TIME = 1; 1480 } 1481 1482 // Required. The BigQuery dataset in format 1483 // "projects/projectId/datasets/datasetId", to which the analysis results 1484 // should be exported. If this dataset does not exist, the export call will 1485 // return an INVALID_ARGUMENT error. 1486 string dataset = 1 [(google.api.field_behavior) = REQUIRED]; 1487 1488 // Required. The prefix of the BigQuery tables to which the analysis results 1489 // will be written. Tables will be created based on this table_prefix if not 1490 // exist: 1491 // * <table_prefix>_analysis table will contain export operation's metadata. 1492 // * <table_prefix>_analysis_result will contain all the 1493 // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult]. 1494 // When [partition_key] is specified, both tables will be partitioned based 1495 // on the [partition_key]. 1496 string table_prefix = 2 [(google.api.field_behavior) = REQUIRED]; 1497 1498 // The partition key for BigQuery partitioned table. 1499 PartitionKey partition_key = 3; 1500 1501 // Optional. Specifies the action that occurs if the destination table or 1502 // partition already exists. The following values are supported: 1503 // 1504 // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery 1505 // overwrites the entire table or all the partitions data. 1506 // * WRITE_APPEND: If the table or partition already exists, BigQuery 1507 // appends the data to the table or the latest partition. 1508 // * WRITE_EMPTY: If the table already exists and contains data, an error is 1509 // returned. 1510 // 1511 // The default value is WRITE_APPEND. Each action is atomic and only occurs 1512 // if BigQuery is able to complete the job successfully. Details are at 1513 // https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file. 1514 string write_disposition = 4 [(google.api.field_behavior) = OPTIONAL]; 1515 } 1516 1517 // IAM policy analysis export destination. 1518 oneof destination { 1519 // Destination on Cloud Storage. 1520 GcsDestination gcs_destination = 1; 1521 1522 // Destination on BigQuery. 1523 BigQueryDestination bigquery_destination = 2; 1524 } 1525} 1526 1527// A request message for 1528// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. 1529message AnalyzeIamPolicyLongrunningRequest { 1530 // Required. The request query. 1531 IamPolicyAnalysisQuery analysis_query = 1 1532 [(google.api.field_behavior) = REQUIRED]; 1533 1534 // Optional. The name of a saved query, which must be in the format of: 1535 // 1536 // * projects/project_number/savedQueries/saved_query_id 1537 // * folders/folder_number/savedQueries/saved_query_id 1538 // * organizations/organization_number/savedQueries/saved_query_id 1539 // 1540 // If both `analysis_query` and `saved_analysis_query` are provided, they 1541 // will be merged together with the `saved_analysis_query` as base and 1542 // the `analysis_query` as overrides. For more details of the merge behavior, 1543 // please refer to the 1544 // [MergeFrom](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details) 1545 // doc. 1546 // 1547 // Note that you cannot override primitive fields with default value, such as 1548 // 0 or empty string, etc., because we use proto3, which doesn't support field 1549 // presence yet. 1550 string saved_analysis_query = 3 [(google.api.field_behavior) = OPTIONAL]; 1551 1552 // Required. Output configuration indicating where the results will be output 1553 // to. 1554 IamPolicyAnalysisOutputConfig output_config = 2 1555 [(google.api.field_behavior) = REQUIRED]; 1556} 1557 1558// A response message for 1559// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. 1560message AnalyzeIamPolicyLongrunningResponse {} 1561 1562// A saved query which can be shared with others or used later. 1563message SavedQuery { 1564 option (google.api.resource) = { 1565 type: "cloudasset.googleapis.com/SavedQuery" 1566 pattern: "projects/{project}/savedQueries/{saved_query}" 1567 pattern: "folders/{folder}/savedQueries/{saved_query}" 1568 pattern: "organizations/{organization}/savedQueries/{saved_query}" 1569 }; 1570 1571 // The query content. 1572 message QueryContent { 1573 oneof query_content { 1574 // An IAM Policy Analysis query, which could be used in 1575 // the 1576 // [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy] 1577 // RPC or the 1578 // [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] 1579 // RPC. 1580 IamPolicyAnalysisQuery iam_policy_analysis_query = 1; 1581 } 1582 } 1583 1584 // The resource name of the saved query. The format must be: 1585 // 1586 // * projects/project_number/savedQueries/saved_query_id 1587 // * folders/folder_number/savedQueries/saved_query_id 1588 // * organizations/organization_number/savedQueries/saved_query_id 1589 string name = 1; 1590 1591 // The description of this saved query. This value should be fewer than 255 1592 // characters. 1593 string description = 2; 1594 1595 // Output only. The create time of this saved query. 1596 google.protobuf.Timestamp create_time = 3 1597 [(google.api.field_behavior) = OUTPUT_ONLY]; 1598 1599 // Output only. The account's email address who has created this saved query. 1600 string creator = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 1601 1602 // Output only. The last update time of this saved query. 1603 google.protobuf.Timestamp last_update_time = 5 1604 [(google.api.field_behavior) = OUTPUT_ONLY]; 1605 1606 // Output only. The account's email address who has updated this saved query 1607 // most recently. 1608 string last_updater = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; 1609 1610 // Labels applied on the resource. 1611 // This value should not contain more than 10 entries. The key and value of 1612 // each entry must be non-empty and fewer than 64 characters. 1613 map<string, string> labels = 7; 1614 1615 // The query content. 1616 QueryContent content = 8; 1617} 1618 1619// Request to create a saved query. 1620message CreateSavedQueryRequest { 1621 // Required. The name of the project/folder/organization where this 1622 // saved_query should be created in. It can only be an organization number 1623 // (such as "organizations/123"), a folder number (such as "folders/123"), a 1624 // project ID (such as "projects/my-project-id"), or a project number (such as 1625 // "projects/12345"). 1626 string parent = 1 [ 1627 (google.api.field_behavior) = REQUIRED, 1628 (google.api.resource_reference) = { 1629 child_type: "cloudasset.googleapis.com/SavedQuery" 1630 } 1631 ]; 1632 1633 // Required. The saved_query details. The `name` field must be empty as it 1634 // will be generated based on the parent and saved_query_id. 1635 SavedQuery saved_query = 2 [(google.api.field_behavior) = REQUIRED]; 1636 1637 // Required. The ID to use for the saved query, which must be unique in the 1638 // specified parent. It will become the final component of the saved query's 1639 // resource name. 1640 // 1641 // This value should be 4-63 characters, and valid characters 1642 // are `[a-z][0-9]-`. 1643 // 1644 // Notice that this field is required in the saved query creation, and the 1645 // `name` field of the `saved_query` will be ignored. 1646 string saved_query_id = 3 [(google.api.field_behavior) = REQUIRED]; 1647} 1648 1649// Request to get a saved query. 1650message GetSavedQueryRequest { 1651 // Required. The name of the saved query and it must be in the format of: 1652 // 1653 // * projects/project_number/savedQueries/saved_query_id 1654 // * folders/folder_number/savedQueries/saved_query_id 1655 // * organizations/organization_number/savedQueries/saved_query_id 1656 string name = 1 [ 1657 (google.api.field_behavior) = REQUIRED, 1658 (google.api.resource_reference) = { 1659 type: "cloudasset.googleapis.com/SavedQuery" 1660 } 1661 ]; 1662} 1663 1664// Request to list saved queries. 1665message ListSavedQueriesRequest { 1666 // Required. The parent project/folder/organization whose savedQueries are to 1667 // be listed. It can only be using project/folder/organization number (such as 1668 // "folders/12345")", or a project ID (such as "projects/my-project-id"). 1669 string parent = 1 [ 1670 (google.api.field_behavior) = REQUIRED, 1671 (google.api.resource_reference) = { 1672 child_type: "cloudasset.googleapis.com/SavedQuery" 1673 } 1674 ]; 1675 1676 // Optional. The expression to filter resources. 1677 // The expression is a list of zero or more restrictions combined via logical 1678 // operators `AND` and `OR`. When `AND` and `OR` are both used in the 1679 // expression, parentheses must be appropriately used to group the 1680 // combinations. The expression may also contain regular expressions. 1681 // 1682 // See https://google.aip.dev/160 for more information on the grammar. 1683 string filter = 4 [(google.api.field_behavior) = OPTIONAL]; 1684 1685 // Optional. The maximum number of saved queries to return per page. The 1686 // service may return fewer than this value. If unspecified, at most 50 will 1687 // be returned. The maximum value is 1000; values above 1000 will be coerced 1688 // to 1000. 1689 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 1690 1691 // Optional. A page token, received from a previous `ListSavedQueries` call. 1692 // Provide this to retrieve the subsequent page. 1693 // 1694 // When paginating, all other parameters provided to `ListSavedQueries` must 1695 // match the call that provided the page token. 1696 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 1697} 1698 1699// Response of listing saved queries. 1700message ListSavedQueriesResponse { 1701 // A list of savedQueries. 1702 repeated SavedQuery saved_queries = 1; 1703 1704 // A token, which can be sent as `page_token` to retrieve the next page. 1705 // If this field is omitted, there are no subsequent pages. 1706 string next_page_token = 2; 1707} 1708 1709// Request to update a saved query. 1710message UpdateSavedQueryRequest { 1711 // Required. The saved query to update. 1712 // 1713 // The saved query's `name` field is used to identify the one to update, 1714 // which has format as below: 1715 // 1716 // * projects/project_number/savedQueries/saved_query_id 1717 // * folders/folder_number/savedQueries/saved_query_id 1718 // * organizations/organization_number/savedQueries/saved_query_id 1719 SavedQuery saved_query = 1 [(google.api.field_behavior) = REQUIRED]; 1720 1721 // Required. The list of fields to update. 1722 google.protobuf.FieldMask update_mask = 2 1723 [(google.api.field_behavior) = REQUIRED]; 1724} 1725 1726// Request to delete a saved query. 1727message DeleteSavedQueryRequest { 1728 // Required. The name of the saved query to delete. It must be in the format 1729 // of: 1730 // 1731 // * projects/project_number/savedQueries/saved_query_id 1732 // * folders/folder_number/savedQueries/saved_query_id 1733 // * organizations/organization_number/savedQueries/saved_query_id 1734 string name = 1 [ 1735 (google.api.field_behavior) = REQUIRED, 1736 (google.api.resource_reference) = { 1737 type: "cloudasset.googleapis.com/SavedQuery" 1738 } 1739 ]; 1740} 1741 1742// The request message for performing resource move analysis. 1743message AnalyzeMoveRequest { 1744 // View enum for supporting partial analysis responses. 1745 enum AnalysisView { 1746 // The default/unset value. 1747 // The API will default to the FULL view. 1748 ANALYSIS_VIEW_UNSPECIFIED = 0; 1749 1750 // Full analysis including all level of impacts of the specified resource 1751 // move. 1752 FULL = 1; 1753 1754 // Basic analysis only including blockers which will prevent the specified 1755 // resource move at runtime. 1756 BASIC = 2; 1757 } 1758 1759 // Required. Name of the resource to perform the analysis against. 1760 // Only Google Cloud projects are supported as of today. Hence, this can only 1761 // be a project ID (such as "projects/my-project-id") or a project number 1762 // (such as "projects/12345"). 1763 string resource = 1 [(google.api.field_behavior) = REQUIRED]; 1764 1765 // Required. Name of the Google Cloud folder or organization to reparent the 1766 // target resource. The analysis will be performed against hypothetically 1767 // moving the resource to this specified desitination parent. This can only be 1768 // a folder number (such as "folders/123") or an organization number (such as 1769 // "organizations/123"). 1770 string destination_parent = 2 [(google.api.field_behavior) = REQUIRED]; 1771 1772 // Analysis view indicating what information should be included in the 1773 // analysis response. If unspecified, the default view is FULL. 1774 AnalysisView view = 3; 1775} 1776 1777// The response message for resource move analysis. 1778message AnalyzeMoveResponse { 1779 // The list of analyses returned from performing the intended resource move 1780 // analysis. The analysis is grouped by different Google Cloud services. 1781 repeated MoveAnalysis move_analysis = 1; 1782} 1783 1784// A message to group the analysis information. 1785message MoveAnalysis { 1786 // The user friendly display name of the analysis. E.g. IAM, organization 1787 // policy etc. 1788 string display_name = 1; 1789 1790 oneof result { 1791 // Analysis result of moving the target resource. 1792 MoveAnalysisResult analysis = 2; 1793 1794 // Description of error encountered when performing the analysis. 1795 google.rpc.Status error = 3; 1796 } 1797} 1798 1799// An analysis result including blockers and warnings. 1800message MoveAnalysisResult { 1801 // Blocking information that would prevent the target resource from moving 1802 // to the specified destination at runtime. 1803 repeated MoveImpact blockers = 1; 1804 1805 // Warning information indicating that moving the target resource to the 1806 // specified destination might be unsafe. This can include important policy 1807 // information and configuration changes, but will not block moves at runtime. 1808 repeated MoveImpact warnings = 2; 1809} 1810 1811// A message to group impacts of moving the target resource. 1812message MoveImpact { 1813 // User friendly impact detail in a free form message. 1814 string detail = 1; 1815} 1816 1817// Output configuration query assets. 1818message QueryAssetsOutputConfig { 1819 // BigQuery destination. 1820 message BigQueryDestination { 1821 // Required. The BigQuery dataset where the query results will be saved. It 1822 // has the format of "projects/{projectId}/datasets/{datasetId}". 1823 string dataset = 1 [(google.api.field_behavior) = REQUIRED]; 1824 1825 // Required. The BigQuery table where the query results will be saved. If 1826 // this table does not exist, a new table with the given name will be 1827 // created. 1828 string table = 2 [(google.api.field_behavior) = REQUIRED]; 1829 1830 // Specifies the action that occurs if the destination table or partition 1831 // already exists. The following values are supported: 1832 // 1833 // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery 1834 // overwrites the entire table or all the partitions data. 1835 // * WRITE_APPEND: If the table or partition already exists, BigQuery 1836 // appends the data to the table or the latest partition. 1837 // * WRITE_EMPTY: If the table already exists and contains data, a 1838 // 'duplicate' error is returned in the job result. 1839 // 1840 // The default value is WRITE_EMPTY. 1841 string write_disposition = 3; 1842 } 1843 1844 // BigQuery destination where the query results will be saved. 1845 BigQueryDestination bigquery_destination = 1; 1846} 1847 1848// QueryAssets request. 1849message QueryAssetsRequest { 1850 // Required. The relative name of the root asset. This can only be an 1851 // organization number (such as "organizations/123"), a project ID (such as 1852 // "projects/my-project-id"), or a project number (such as "projects/12345"), 1853 // or a folder number (such as "folders/123"). 1854 // 1855 // Only assets belonging to the `parent` will be returned. 1856 string parent = 1 [ 1857 (google.api.field_behavior) = REQUIRED, 1858 (google.api.resource_reference) = { 1859 child_type: "cloudasset.googleapis.com/Asset" 1860 } 1861 ]; 1862 1863 oneof query { 1864 // Optional. A SQL statement that's compatible with [BigQuery Standard 1865 // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). 1866 string statement = 2 [(google.api.field_behavior) = OPTIONAL]; 1867 1868 // Optional. Reference to the query job, which is from the 1869 // `QueryAssetsResponse` of previous `QueryAssets` call. 1870 string job_reference = 3 [(google.api.field_behavior) = OPTIONAL]; 1871 } 1872 1873 // Optional. The maximum number of rows to return in the results. Responses 1874 // are limited to 10 MB and 1000 rows. 1875 // 1876 // By default, the maximum row count is 1000. When the byte or row count limit 1877 // is reached, the rest of the query results will be paginated. 1878 // 1879 // The field will be ignored when [output_config] is specified. 1880 int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; 1881 1882 // Optional. A page token received from previous `QueryAssets`. 1883 // 1884 // The field will be ignored when [output_config] is specified. 1885 string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; 1886 1887 // Optional. Specifies the maximum amount of time that the client is willing 1888 // to wait for the query to complete. By default, this limit is 5 min for the 1889 // first query, and 1 minute for the following queries. If the query is 1890 // complete, the `done` field in the `QueryAssetsResponse` is true, otherwise 1891 // false. 1892 // 1893 // Like BigQuery [jobs.query 1894 // API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) 1895 // The call is not guaranteed to wait for the specified timeout; it typically 1896 // returns after around 200 seconds (200,000 milliseconds), even if the query 1897 // is not complete. 1898 // 1899 // The field will be ignored when [output_config] is specified. 1900 google.protobuf.Duration timeout = 6 [(google.api.field_behavior) = OPTIONAL]; 1901 1902 // Specifies what time period or point in time to query asset metadata at. 1903 // * unset - query asset metadata as it is right now 1904 // * [read_time_window] - query asset metadata as it was at any point in time 1905 // between [start_time] and [end_time]. 1906 // * [read_time] - query asset metadata as it was at that point in time. 1907 // If data for the timestamp/date range selected does not exist, 1908 // it will simply return a valid response with no rows. 1909 oneof time { 1910 // Optional. [start_time] is required. [start_time] must be less than 1911 // [end_time] Defaults [end_time] to now if [start_time] is set and 1912 // [end_time] isn't. Maximum permitted time range is 7 days. 1913 TimeWindow read_time_window = 7 [(google.api.field_behavior) = OPTIONAL]; 1914 1915 // Optional. Queries cloud assets as they appeared at the specified point in 1916 // time. 1917 google.protobuf.Timestamp read_time = 8 1918 [(google.api.field_behavior) = OPTIONAL]; 1919 } 1920 1921 // Optional. Destination where the query results will be saved. 1922 // 1923 // When this field is specified, the query results won't be saved in the 1924 // [QueryAssetsResponse.query_result]. Instead 1925 // [QueryAssetsResponse.output_config] will be set. 1926 // 1927 // Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used 1928 // to check the status of the query job when passed to a following 1929 // [QueryAssets] API call. 1930 QueryAssetsOutputConfig output_config = 9 1931 [(google.api.field_behavior) = OPTIONAL]; 1932} 1933 1934// QueryAssets response. 1935message QueryAssetsResponse { 1936 // Reference to a query job. 1937 string job_reference = 1; 1938 1939 // The query response, which can be either an `error` or a valid `response`. 1940 // 1941 // If `done` == `false` and the query result is being saved in a output, the 1942 // output_config field will be set. 1943 // If `done` == `true`, exactly one of 1944 // `error`, `query_result` or `output_config` will be set. 1945 bool done = 2; 1946 1947 oneof response { 1948 // Error status. 1949 google.rpc.Status error = 3; 1950 1951 // Result of the query. 1952 QueryResult query_result = 4; 1953 1954 // Output configuration which indicates instead of being returned in API 1955 // response on the fly, the query result will be saved in a specific output. 1956 QueryAssetsOutputConfig output_config = 5; 1957 } 1958} 1959 1960// Execution results of the query. 1961// 1962// The result is formatted as rows represented by BigQuery compatible [schema]. 1963// When pagination is necessary, it will contains the page token to retrieve 1964// the results of following pages. 1965message QueryResult { 1966 // Each row hold a query result in the format of `Struct`. 1967 repeated google.protobuf.Struct rows = 1; 1968 1969 // Describes the format of the [rows]. 1970 TableSchema schema = 2; 1971 1972 // Token to retrieve the next page of the results. 1973 string next_page_token = 3; 1974 1975 // Total rows of the whole query results. 1976 int64 total_rows = 4; 1977} 1978 1979// BigQuery Compatible table schema. 1980message TableSchema { 1981 // Describes the fields in a table. 1982 repeated TableFieldSchema fields = 1; 1983} 1984 1985// A field in TableSchema. 1986message TableFieldSchema { 1987 // The field name. The name must contain only letters (a-z, A-Z), 1988 // numbers (0-9), or underscores (_), and must start with a letter or 1989 // underscore. The maximum length is 128 characters. 1990 string field = 1; 1991 1992 // The field data type. Possible values include 1993 // * STRING 1994 // * BYTES 1995 // * INTEGER 1996 // * FLOAT 1997 // * BOOLEAN 1998 // * TIMESTAMP 1999 // * DATE 2000 // * TIME 2001 // * DATETIME 2002 // * GEOGRAPHY, 2003 // * NUMERIC, 2004 // * BIGNUMERIC, 2005 // * RECORD 2006 // (where RECORD indicates that the field contains a nested schema). 2007 string type = 2; 2008 2009 // The field mode. Possible values include NULLABLE, REQUIRED and 2010 // REPEATED. The default value is NULLABLE. 2011 string mode = 3; 2012 2013 // Describes the nested schema fields if the type property is set 2014 // to RECORD. 2015 repeated TableFieldSchema fields = 4; 2016} 2017 2018// A request message for 2019// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]. 2020message BatchGetEffectiveIamPoliciesRequest { 2021 // Required. Only IAM policies on or below the scope will be returned. 2022 // 2023 // This can only be an organization number (such as "organizations/123"), a 2024 // folder number (such as "folders/123"), a project ID (such as 2025 // "projects/my-project-id"), or a project number (such as "projects/12345"). 2026 // 2027 // To know how to get organization id, visit [here 2028 // ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). 2029 // 2030 // To know how to get folder or project id, visit [here 2031 // ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects). 2032 string scope = 1 [ 2033 (google.api.field_behavior) = REQUIRED, 2034 (google.api.resource_reference) = { child_type: "*" } 2035 ]; 2036 2037 // Required. The names refer to the [full_resource_names] 2038 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) 2039 // of [searchable asset 2040 // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). 2041 // A maximum of 20 resources' effective policies can be retrieved in a batch. 2042 repeated string names = 3 [ 2043 (google.api.field_behavior) = REQUIRED, 2044 (google.api.resource_reference) = { type: "*" } 2045 ]; 2046} 2047 2048// A response message for 2049// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]. 2050message BatchGetEffectiveIamPoliciesResponse { 2051 // The effective IAM policies on one resource. 2052 message EffectiveIamPolicy { 2053 // The IAM policy and its attached resource. 2054 message PolicyInfo { 2055 // The full resource name the 2056 // [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy] 2057 // is directly attached to. 2058 string attached_resource = 1; 2059 2060 // The IAM policy that's directly attached to the 2061 // [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]. 2062 google.iam.v1.Policy policy = 2; 2063 } 2064 2065 // The [full_resource_name] 2066 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) 2067 // for which the 2068 // [policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies] 2069 // are computed. This is one of the 2070 // [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names] 2071 // the caller provides in the request. 2072 string full_resource_name = 1; 2073 2074 // The effective policies for the 2075 // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]. 2076 // 2077 // These policies include the policy set on the 2078 // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name] 2079 // and those set on its parents and ancestors up to the 2080 // [BatchGetEffectiveIamPoliciesRequest.scope][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope]. 2081 // Note that these policies are not filtered according to the resource type 2082 // of the 2083 // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]. 2084 // 2085 // These policies are hierarchically ordered by 2086 // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource] 2087 // starting from 2088 // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name] 2089 // itself to its parents and ancestors, such that policies[i]'s 2090 // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource] 2091 // is the child of policies[i+1]'s 2092 // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource], 2093 // if policies[i+1] exists. 2094 repeated PolicyInfo policies = 2; 2095 } 2096 2097 // The effective policies for a batch of resources. Note that the results 2098 // order is the same as the order of 2099 // [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]. 2100 // When a resource does not have any effective IAM policies, its corresponding 2101 // policy_result will contain empty 2102 // [EffectiveIamPolicy.policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]. 2103 repeated EffectiveIamPolicy policy_results = 2; 2104} 2105 2106// This organization policy message is a modified version of the one defined in 2107// the Organization Policy system. This message contains several fields defined 2108// in the original organization policy with some new fields for analysis 2109// purpose. 2110message AnalyzerOrgPolicy { 2111 // Represents a rule defined in an organization policy 2112 message Rule { 2113 // The string values for the list constraints. 2114 message StringValues { 2115 // List of values allowed at this resource. 2116 repeated string allowed_values = 1; 2117 2118 // List of values denied at this resource. 2119 repeated string denied_values = 2; 2120 } 2121 2122 oneof kind { 2123 // List of values to be used for this PolicyRule. This field can be set 2124 // only in Policies for list constraints. 2125 StringValues values = 3; 2126 2127 // Setting this to true means that all values are allowed. This field can 2128 // be set only in Policies for list constraints. 2129 bool allow_all = 4; 2130 2131 // Setting this to true means that all values are denied. This field can 2132 // be set only in Policies for list constraints. 2133 bool deny_all = 5; 2134 2135 // If `true`, then the `Policy` is enforced. If `false`, then any 2136 // configuration is acceptable. 2137 // This field can be set only in Policies for boolean constraints. 2138 bool enforce = 6; 2139 } 2140 2141 // The evaluating condition for this rule. 2142 google.type.Expr condition = 7; 2143 } 2144 2145 // The [full resource name] 2146 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) of 2147 // an organization/folder/project resource where this organization policy is 2148 // set. 2149 // 2150 // Notice that some type of constraints are defined with default policy. This 2151 // field will be empty for them. 2152 string attached_resource = 1; 2153 2154 // The [full resource name] 2155 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) of 2156 // an organization/folder/project resource where this organization policy 2157 // applies to. 2158 // 2159 // For any user defined org policies, this field has the same value as 2160 // the [attached_resource] field. Only for default policy, this field has 2161 // the different value. 2162 string applied_resource = 5; 2163 2164 // List of rules for this organization policy. 2165 repeated Rule rules = 2; 2166 2167 // If `inherit_from_parent` is true, Rules set higher up in the 2168 // hierarchy (up to the closest root) are inherited and present in the 2169 // effective policy. If it is false, then no rules are inherited, and this 2170 // policy becomes the effective root for evaluation. 2171 bool inherit_from_parent = 3; 2172 2173 // Ignores policies set above this resource and restores the default behavior 2174 // of the constraint at this resource. 2175 // This field can be set in policies for either list or boolean 2176 // constraints. If set, `rules` must be empty and `inherit_from_parent` 2177 // must be set to false. 2178 bool reset = 4; 2179} 2180 2181// The organization policy constraint definition. 2182message AnalyzerOrgPolicyConstraint { 2183 // The definition of a constraint. 2184 message Constraint { 2185 // Specifies the default behavior in the absence of any `Policy` for the 2186 // `Constraint`. This must not be `CONSTRAINT_DEFAULT_UNSPECIFIED`. 2187 enum ConstraintDefault { 2188 // This is only used for distinguishing unset values and should never be 2189 // used. 2190 CONSTRAINT_DEFAULT_UNSPECIFIED = 0; 2191 2192 // Indicate that all values are allowed for list constraints. 2193 // Indicate that enforcement is off for boolean constraints. 2194 ALLOW = 1; 2195 2196 // Indicate that all values are denied for list constraints. 2197 // Indicate that enforcement is on for boolean constraints. 2198 DENY = 2; 2199 } 2200 2201 // A `Constraint` that allows or disallows a list of string values, which 2202 // are configured by an organization's policy administrator with a `Policy`. 2203 message ListConstraint { 2204 // Indicates whether values grouped into categories can be used in 2205 // `Policy.allowed_values` and `Policy.denied_values`. For example, 2206 // `"in:Python"` would match any value in the 'Python' group. 2207 bool supports_in = 1; 2208 2209 // Indicates whether subtrees of Cloud Resource Manager resource hierarchy 2210 // can be used in `Policy.allowed_values` and `Policy.denied_values`. For 2211 // example, `"under:folders/123"` would match any resource under the 2212 // 'folders/123' folder. 2213 bool supports_under = 2; 2214 } 2215 2216 // A `Constraint` that is either enforced or not. 2217 // 2218 // For example a constraint `constraints/compute.disableSerialPortAccess`. 2219 // If it is enforced on a VM instance, serial port connections will not be 2220 // opened to that instance. 2221 message BooleanConstraint {} 2222 2223 // The unique name of the constraint. Format of the name should be 2224 // * `constraints/{constraint_name}` 2225 // 2226 // For example, `constraints/compute.disableSerialPortAccess`. 2227 string name = 1; 2228 2229 // The human readable name of the constraint. 2230 string display_name = 2; 2231 2232 // Detailed description of what this `Constraint` controls as well as how 2233 // and where it is enforced. 2234 string description = 3; 2235 2236 // The evaluation behavior of this constraint in the absence of 'Policy'. 2237 ConstraintDefault constraint_default = 4; 2238 2239 // The type of restrictions for this `Constraint`. 2240 // 2241 // Immutable after creation. 2242 oneof constraint_type { 2243 // Defines this constraint as being a ListConstraint. 2244 ListConstraint list_constraint = 5; 2245 2246 // Defines this constraint as being a BooleanConstraint. 2247 BooleanConstraint boolean_constraint = 6; 2248 } 2249 } 2250 2251 // The definition of a custom constraint. 2252 message CustomConstraint { 2253 // The operation in which this constraint will be applied. For example: 2254 // If the constraint applies only when create VMs, the method_types will be 2255 // "CREATE" only. If the constraint applied when create or delete VMs, the 2256 // method_types will be "CREATE" and "DELETE". 2257 enum MethodType { 2258 // Unspecified. Will results in user error. 2259 METHOD_TYPE_UNSPECIFIED = 0; 2260 2261 // Constraint applied when creating the resource. 2262 CREATE = 1; 2263 2264 // Constraint applied when updating the resource. 2265 UPDATE = 2; 2266 2267 // Constraint applied when deleting the resource. 2268 DELETE = 3; 2269 } 2270 2271 // Allow or deny type. 2272 enum ActionType { 2273 // Unspecified. Will results in user error. 2274 ACTION_TYPE_UNSPECIFIED = 0; 2275 2276 // Allowed action type. 2277 ALLOW = 1; 2278 2279 // Deny action type. 2280 DENY = 2; 2281 } 2282 2283 // Name of the constraint. This is unique within the organization. Format of 2284 // the name should be 2285 // * `organizations/{organization_id}/customConstraints/{custom_constraint_id}` 2286 // 2287 // Example : 2288 // "organizations/123/customConstraints/custom.createOnlyE2TypeVms" 2289 string name = 1; 2290 2291 // The Resource Instance type on which this policy applies to. Format will 2292 // be of the form : "<canonical service name>/<type>" Example: 2293 // * `compute.googleapis.com/Instance`. 2294 repeated string resource_types = 2; 2295 2296 // All the operations being applied for this constraint. 2297 repeated MethodType method_types = 3; 2298 2299 // Organization Policy condition/expression. For example: 2300 // `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or, 2301 // `resource.management.auto_upgrade == true` 2302 string condition = 4; 2303 2304 // Allow or deny type. 2305 ActionType action_type = 5; 2306 2307 // One line display name for the UI. 2308 string display_name = 6; 2309 2310 // Detailed information about this custom policy constraint. 2311 string description = 7; 2312 } 2313 2314 oneof constraint_definition { 2315 // The definition of the canned constraint defined by Google. 2316 Constraint google_defined_constraint = 1; 2317 2318 // The definition of the custom constraint. 2319 CustomConstraint custom_constraint = 2; 2320 } 2321} 2322 2323// A request message for 2324// [AssetService.AnalyzeOrgPolicies][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies]. 2325message AnalyzeOrgPoliciesRequest { 2326 // Required. The organization to scope the request. Only organization 2327 // policies within the scope will be analyzed. 2328 // 2329 // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") 2330 string scope = 1 [(google.api.field_behavior) = REQUIRED]; 2331 2332 // Required. The name of the constraint to analyze organization policies for. 2333 // The response only contains analyzed organization policies for the provided 2334 // constraint. 2335 string constraint = 2 [(google.api.field_behavior) = REQUIRED]; 2336 2337 // The expression to filter 2338 // [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]. 2339 // The only supported field is `consolidated_policy.attached_resource`, and 2340 // the only supported operator is `=`. 2341 // 2342 // Example: 2343 // consolidated_policy.attached_resource="//cloudresourcemanager.googleapis.com/folders/001" 2344 // will return the org policy results of"folders/001". 2345 string filter = 3; 2346 2347 // The maximum number of items to return per page. If unspecified, 2348 // [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results] 2349 // will contain 20 items with a maximum of 200. 2350 optional int32 page_size = 4; 2351 2352 // The pagination token to retrieve the next page. 2353 string page_token = 5; 2354} 2355 2356// The response message for 2357// [AssetService.AnalyzeOrgPolicies][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicies]. 2358message AnalyzeOrgPoliciesResponse { 2359 // The organization policy result to the query. 2360 message OrgPolicyResult { 2361 // The consolidated organization policy for the analyzed resource. The 2362 // consolidated organization policy is computed by merging and evaluating 2363 // [AnalyzeOrgPoliciesResponse.policy_bundle][]. 2364 // The evaluation will respect the organization policy [hierarchy 2365 // rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy). 2366 AnalyzerOrgPolicy consolidated_policy = 1; 2367 2368 // The ordered list of all organization policies from the 2369 // [AnalyzeOrgPoliciesResponse.OrgPolicyResult.consolidated_policy.attached_resource][]. 2370 // to the scope specified in the request. 2371 // 2372 // If the constraint is defined with default policy, it will also appear in 2373 // the list. 2374 repeated AnalyzerOrgPolicy policy_bundle = 2; 2375 } 2376 2377 // The organization policies under the 2378 // [AnalyzeOrgPoliciesRequest.scope][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.scope] 2379 // with the 2380 // [AnalyzeOrgPoliciesRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPoliciesRequest.constraint]. 2381 repeated OrgPolicyResult org_policy_results = 1; 2382 2383 // The definition of the constraint in the request. 2384 AnalyzerOrgPolicyConstraint constraint = 2; 2385 2386 // The page token to fetch the next page for 2387 // [AnalyzeOrgPoliciesResponse.org_policy_results][google.cloud.asset.v1.AnalyzeOrgPoliciesResponse.org_policy_results]. 2388 string next_page_token = 3; 2389} 2390 2391// A request message for 2392// [AssetService.AnalyzeOrgPolicyGovernedContainers][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers]. 2393message AnalyzeOrgPolicyGovernedContainersRequest { 2394 // Required. The organization to scope the request. Only organization 2395 // policies within the scope will be analyzed. The output containers will 2396 // also be limited to the ones governed by those in-scope organization 2397 // policies. 2398 // 2399 // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") 2400 string scope = 1 [(google.api.field_behavior) = REQUIRED]; 2401 2402 // Required. The name of the constraint to analyze governed containers for. 2403 // The analysis only contains organization policies for the provided 2404 // constraint. 2405 string constraint = 2 [(google.api.field_behavior) = REQUIRED]; 2406 2407 // The expression to filter the governed containers in result. 2408 // The only supported field is `parent`, and the only supported operator is 2409 // `=`. 2410 // 2411 // Example: 2412 // parent="//cloudresourcemanager.googleapis.com/folders/001" will return all 2413 // containers under "folders/001". 2414 string filter = 3; 2415 2416 // The maximum number of items to return per page. If unspecified, 2417 // [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers] 2418 // will contain 100 items with a maximum of 200. 2419 optional int32 page_size = 4; 2420 2421 // The pagination token to retrieve the next page. 2422 string page_token = 5; 2423} 2424 2425// The response message for 2426// [AssetService.AnalyzeOrgPolicyGovernedContainers][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedContainers]. 2427message AnalyzeOrgPolicyGovernedContainersResponse { 2428 // The organization/folder/project resource governed by organization policies 2429 // of 2430 // [AnalyzeOrgPolicyGovernedContainersRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersRequest.constraint]. 2431 message GovernedContainer { 2432 // The [full resource name] 2433 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) of 2434 // an organization/folder/project resource. 2435 string full_resource_name = 1; 2436 2437 // The [full resource name] 2438 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) of 2439 // the parent of 2440 // [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.full_resource_name]. 2441 string parent = 2; 2442 2443 // The consolidated organization policy for the analyzed resource. The 2444 // consolidated organization policy is computed by merging and evaluating 2445 // [AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.GovernedContainer.policy_bundle]. 2446 // The evaluation will respect the organization policy [hierarchy 2447 // rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy). 2448 AnalyzerOrgPolicy consolidated_policy = 3; 2449 2450 // The ordered list of all organization policies from the 2451 // [AnalyzeOrgPoliciesResponse.OrgPolicyResult.consolidated_policy.attached_resource][]. 2452 // to the scope specified in the request. 2453 // 2454 // If the constraint is defined with default policy, it will also appear in 2455 // the list. 2456 repeated AnalyzerOrgPolicy policy_bundle = 4; 2457 } 2458 2459 // The list of the analyzed governed containers. 2460 repeated GovernedContainer governed_containers = 1; 2461 2462 // The definition of the constraint in the request. 2463 AnalyzerOrgPolicyConstraint constraint = 2; 2464 2465 // The page token to fetch the next page for 2466 // [AnalyzeOrgPolicyGovernedContainersResponse.governed_containers][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedContainersResponse.governed_containers]. 2467 string next_page_token = 3; 2468} 2469 2470// A request message for 2471// [AssetService.AnalyzeOrgPolicyGovernedAssets][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets]. 2472message AnalyzeOrgPolicyGovernedAssetsRequest { 2473 // Required. The organization to scope the request. Only organization 2474 // policies within the scope will be analyzed. The output assets will 2475 // also be limited to the ones governed by those in-scope organization 2476 // policies. 2477 // 2478 // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") 2479 string scope = 1 [(google.api.field_behavior) = REQUIRED]; 2480 2481 // Required. The name of the constraint to analyze governed assets for. The 2482 // analysis only contains analyzed organization policies for the provided 2483 // constraint. 2484 string constraint = 2 [(google.api.field_behavior) = REQUIRED]; 2485 2486 // The expression to filter the governed assets in result. The only supported 2487 // fields for governed resources are `governed_resource.project` and 2488 // `governed_resource.folders`. The only supported fields for governed iam 2489 // policies are `governed_iam_policy.project` and 2490 // `governed_iam_policy.folders`. The only supported operator is `=`. 2491 // 2492 // Example 1: governed_resource.project="projects/12345678" filter will return 2493 // all governed resources under projects/12345678 including the project 2494 // ifself, if applicable. 2495 // 2496 // Example 2: governed_iam_policy.folders="folders/12345678" filter will 2497 // return all governed iam policies under folders/12345678, if applicable. 2498 string filter = 3; 2499 2500 // The maximum number of items to return per page. If unspecified, 2501 // [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets] 2502 // will contain 100 items with a maximum of 200. 2503 optional int32 page_size = 4; 2504 2505 // The pagination token to retrieve the next page. 2506 string page_token = 5; 2507} 2508 2509// The response message for 2510// [AssetService.AnalyzeOrgPolicyGovernedAssets][google.cloud.asset.v1.AssetService.AnalyzeOrgPolicyGovernedAssets]. 2511message AnalyzeOrgPolicyGovernedAssetsResponse { 2512 // The Google Cloud resources governed by the organization policies of the 2513 // [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]. 2514 message GovernedResource { 2515 // The [full resource name] 2516 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) of 2517 // the Google Cloud resource. 2518 string full_resource_name = 1; 2519 2520 // The [full resource name] 2521 // (https://cloud.google.com/asset-inventory/docs/resource-name-format) of 2522 // the parent of 2523 // [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedResource.full_resource_name]. 2524 string parent = 2; 2525 2526 // The project that this resource belongs to, in the format of 2527 // projects/{PROJECT_NUMBER}. This field is available when the resource 2528 // belongs to a project. 2529 string project = 5; 2530 2531 // The folder(s) that this resource belongs to, in the format of 2532 // folders/{FOLDER_NUMBER}. This field is available when the resource 2533 // belongs (directly or cascadingly) to one or more folders. 2534 repeated string folders = 6; 2535 2536 // The organization that this resource belongs to, in the format of 2537 // organizations/{ORGANIZATION_NUMBER}. This field is available when the 2538 // resource belongs (directly or cascadingly) to an organization. 2539 string organization = 7; 2540 } 2541 2542 // The IAM policies governed by the organization policies of the 2543 // [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]. 2544 message GovernedIamPolicy { 2545 // The full resource name of the resource associated with this IAM policy. 2546 // Example: 2547 // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. 2548 // See [Cloud Asset Inventory Resource Name 2549 // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) 2550 // for more information. 2551 string attached_resource = 1; 2552 2553 // The IAM policy directly set on the given resource. 2554 google.iam.v1.Policy policy = 2; 2555 2556 // The project that this IAM policy belongs to, in the format of 2557 // projects/{PROJECT_NUMBER}. This field is available when the IAM policy 2558 // belongs to a project. 2559 string project = 5; 2560 2561 // The folder(s) that this IAM policy belongs to, in the format of 2562 // folders/{FOLDER_NUMBER}. This field is available when the IAM policy 2563 // belongs (directly or cascadingly) to one or more folders. 2564 repeated string folders = 6; 2565 2566 // The organization that this IAM policy belongs to, in the format of 2567 // organizations/{ORGANIZATION_NUMBER}. This field is available when the 2568 // IAM policy belongs (directly or cascadingly) to an organization. 2569 string organization = 7; 2570 } 2571 2572 // Represents a Google Cloud asset(resource or IAM policy) governed by the 2573 // organization policies of the 2574 // [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]. 2575 message GovernedAsset { 2576 oneof governed_asset { 2577 // A Google Cloud resource governed by the organization 2578 // policies of the 2579 // [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]. 2580 GovernedResource governed_resource = 1; 2581 2582 // An IAM policy governed by the organization 2583 // policies of the 2584 // [AnalyzeOrgPolicyGovernedAssetsRequest.constraint][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsRequest.constraint]. 2585 GovernedIamPolicy governed_iam_policy = 2; 2586 } 2587 2588 // The consolidated policy for the analyzed asset. The consolidated 2589 // policy is computed by merging and evaluating 2590 // [AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.GovernedAsset.policy_bundle]. 2591 // The evaluation will respect the organization policy [hierarchy 2592 // rules](https://cloud.google.com/resource-manager/docs/organization-policy/understanding-hierarchy). 2593 AnalyzerOrgPolicy consolidated_policy = 3; 2594 2595 // The ordered list of all organization policies from the 2596 // [AnalyzeOrgPoliciesResponse.OrgPolicyResult.consolidated_policy.attached_resource][] 2597 // to the scope specified in the request. 2598 // 2599 // If the constraint is defined with default policy, it will also appear in 2600 // the list. 2601 repeated AnalyzerOrgPolicy policy_bundle = 4; 2602 } 2603 2604 // The list of the analyzed governed assets. 2605 repeated GovernedAsset governed_assets = 1; 2606 2607 // The definition of the constraint in the request. 2608 AnalyzerOrgPolicyConstraint constraint = 2; 2609 2610 // The page token to fetch the next page for 2611 // [AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets][google.cloud.asset.v1.AnalyzeOrgPolicyGovernedAssetsResponse.governed_assets]. 2612 string next_page_token = 3; 2613} 2614 2615// Asset content type. 2616enum ContentType { 2617 // Unspecified content type. 2618 CONTENT_TYPE_UNSPECIFIED = 0; 2619 2620 // Resource metadata. 2621 RESOURCE = 1; 2622 2623 // The actual IAM policy set on a resource. 2624 IAM_POLICY = 2; 2625 2626 // The organization policy set on an asset. 2627 ORG_POLICY = 4; 2628 2629 // The Access Context Manager policy set on an asset. 2630 ACCESS_POLICY = 5; 2631 2632 // The runtime OS Inventory information. 2633 OS_INVENTORY = 6; 2634 2635 // The related resources. 2636 RELATIONSHIP = 7; 2637} 2638