asset_service.proto 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.cloud.asset.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/cloud/asset/v1/assets.proto";
  21. import "google/longrunning/operations.proto";
  22. import "google/protobuf/duration.proto";
  23. import "google/protobuf/empty.proto";
  24. import "google/protobuf/field_mask.proto";
  25. import "google/protobuf/struct.proto";
  26. import "google/protobuf/timestamp.proto";
  27. import "google/rpc/status.proto";
  28. import "google/type/expr.proto";
  29. option csharp_namespace = "Google.Cloud.Asset.V1";
  30. option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset";
  31. option java_multiple_files = true;
  32. option java_outer_classname = "AssetServiceProto";
  33. option java_package = "com.google.cloud.asset.v1";
  34. option php_namespace = "Google\\Cloud\\Asset\\V1";
  35. // Asset service definition.
  36. service AssetService {
  37. option (google.api.default_host) = "cloudasset.googleapis.com";
  38. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  39. // Exports assets with time and resource types to a given Cloud Storage
  40. // location/BigQuery table. For Cloud Storage location destinations, the
  41. // output format is newline-delimited JSON. Each line represents a
  42. // [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table
  43. // destinations, the output table stores the fields in asset proto as columns.
  44. // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API
  45. // , which allows you to keep track of the export. We recommend intervals of
  46. // at least 2 seconds with exponential retry to poll the export operation
  47. // result. For regular-size resource parent, the export operation usually
  48. // finishes within 5 minutes.
  49. rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) {
  50. option (google.api.http) = {
  51. post: "/v1/{parent=*/*}:exportAssets"
  52. body: "*"
  53. };
  54. option (google.longrunning.operation_info) = {
  55. response_type: "google.cloud.asset.v1.ExportAssetsResponse"
  56. metadata_type: "google.cloud.asset.v1.ExportAssetsRequest"
  57. };
  58. }
  59. // Lists assets with time and resource types and returns paged results in
  60. // response.
  61. rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) {
  62. option (google.api.http) = {
  63. get: "/v1/{parent=*/*}/assets"
  64. };
  65. option (google.api.method_signature) = "parent";
  66. }
  67. // Batch gets the update history of assets that overlap a time window.
  68. // For IAM_POLICY content, this API outputs history when the asset and its
  69. // attached IAM POLICY both exist. This can create gaps in the output history.
  70. // Otherwise, this API outputs history with asset in both non-delete or
  71. // deleted status.
  72. // If a specified asset does not exist, this API returns an INVALID_ARGUMENT
  73. // error.
  74. rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) {
  75. option (google.api.http) = {
  76. get: "/v1/{parent=*/*}:batchGetAssetsHistory"
  77. };
  78. }
  79. // Creates a feed in a parent project/folder/organization to listen to its
  80. // asset updates.
  81. rpc CreateFeed(CreateFeedRequest) returns (Feed) {
  82. option (google.api.http) = {
  83. post: "/v1/{parent=*/*}/feeds"
  84. body: "*"
  85. };
  86. option (google.api.method_signature) = "parent";
  87. }
  88. // Gets details about an asset feed.
  89. rpc GetFeed(GetFeedRequest) returns (Feed) {
  90. option (google.api.http) = {
  91. get: "/v1/{name=*/*/feeds/*}"
  92. };
  93. option (google.api.method_signature) = "name";
  94. }
  95. // Lists all asset feeds in a parent project/folder/organization.
  96. rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) {
  97. option (google.api.http) = {
  98. get: "/v1/{parent=*/*}/feeds"
  99. };
  100. option (google.api.method_signature) = "parent";
  101. }
  102. // Updates an asset feed configuration.
  103. rpc UpdateFeed(UpdateFeedRequest) returns (Feed) {
  104. option (google.api.http) = {
  105. patch: "/v1/{feed.name=*/*/feeds/*}"
  106. body: "*"
  107. };
  108. option (google.api.method_signature) = "feed";
  109. }
  110. // Deletes an asset feed.
  111. rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) {
  112. option (google.api.http) = {
  113. delete: "/v1/{name=*/*/feeds/*}"
  114. };
  115. option (google.api.method_signature) = "name";
  116. }
  117. // Searches all Cloud resources within the specified scope, such as a project,
  118. // folder, or organization. The caller must be granted the
  119. // `cloudasset.assets.searchAllResources` permission on the desired scope,
  120. // otherwise the request will be rejected.
  121. rpc SearchAllResources(SearchAllResourcesRequest) returns (SearchAllResourcesResponse) {
  122. option (google.api.http) = {
  123. get: "/v1/{scope=*/*}:searchAllResources"
  124. };
  125. option (google.api.method_signature) = "scope,query,asset_types";
  126. }
  127. // Searches all IAM policies within the specified scope, such as a project,
  128. // folder, or organization. The caller must be granted the
  129. // `cloudasset.assets.searchAllIamPolicies` permission on the desired scope,
  130. // otherwise the request will be rejected.
  131. rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) returns (SearchAllIamPoliciesResponse) {
  132. option (google.api.http) = {
  133. get: "/v1/{scope=*/*}:searchAllIamPolicies"
  134. };
  135. option (google.api.method_signature) = "scope,query";
  136. }
  137. // Analyzes IAM policies to answer which identities have what accesses on
  138. // which resources.
  139. rpc AnalyzeIamPolicy(AnalyzeIamPolicyRequest) returns (AnalyzeIamPolicyResponse) {
  140. option (google.api.http) = {
  141. get: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicy"
  142. };
  143. }
  144. // Analyzes IAM policies asynchronously to answer which identities have what
  145. // accesses on which resources, and writes the analysis results to a Google
  146. // Cloud Storage or a BigQuery destination. For Cloud Storage destination, the
  147. // output format is the JSON format that represents a
  148. // [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method implements the
  149. // [google.longrunning.Operation][google.longrunning.Operation], which allows you to track the operation
  150. // status. We recommend intervals of at least 2 seconds with exponential
  151. // backoff retry to poll the operation result. The metadata contains the
  152. // metadata for the long-running operation.
  153. rpc AnalyzeIamPolicyLongrunning(AnalyzeIamPolicyLongrunningRequest) returns (google.longrunning.Operation) {
  154. option (google.api.http) = {
  155. post: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicyLongrunning"
  156. body: "*"
  157. };
  158. option (google.longrunning.operation_info) = {
  159. response_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse"
  160. metadata_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata"
  161. };
  162. }
  163. // Analyze moving a resource to a specified destination without kicking off
  164. // the actual move. The analysis is best effort depending on the user's
  165. // permissions of viewing different hierarchical policies and configurations.
  166. // The policies and configuration are subject to change before the actual
  167. // resource migration takes place.
  168. rpc AnalyzeMove(AnalyzeMoveRequest) returns (AnalyzeMoveResponse) {
  169. option (google.api.http) = {
  170. get: "/v1/{resource=*/*}:analyzeMove"
  171. };
  172. }
  173. }
  174. // Represents the metadata of the longrunning operation for the
  175. // AnalyzeIamPolicyLongrunning rpc.
  176. message AnalyzeIamPolicyLongrunningMetadata {
  177. // The time the operation was created.
  178. google.protobuf.Timestamp create_time = 1
  179. [(google.api.field_behavior) = OUTPUT_ONLY];
  180. }
  181. // Export asset request.
  182. message ExportAssetsRequest {
  183. // Required. The relative name of the root asset. This can only be an
  184. // organization number (such as "organizations/123"), a project ID (such as
  185. // "projects/my-project-id"), or a project number (such as "projects/12345"),
  186. // or a folder number (such as "folders/123").
  187. string parent = 1 [
  188. (google.api.field_behavior) = REQUIRED,
  189. (google.api.resource_reference) = {
  190. child_type: "cloudasset.googleapis.com/Asset"
  191. }
  192. ];
  193. // Timestamp to take an asset snapshot. This can only be set to a timestamp
  194. // between the current time and the current time minus 35 days (inclusive).
  195. // If not specified, the current time will be used. Due to delays in resource
  196. // data collection and indexing, there is a volatile window during which
  197. // running the same query may get different results.
  198. google.protobuf.Timestamp read_time = 2;
  199. // A list of asset types to take a snapshot for. For example:
  200. // "compute.googleapis.com/Disk".
  201. //
  202. // Regular expressions are also supported. For example:
  203. //
  204. // * "compute.googleapis.com.*" snapshots resources whose asset type starts
  205. // with "compute.googleapis.com".
  206. // * ".*Instance" snapshots resources whose asset type ends with "Instance".
  207. // * ".*Instance.*" snapshots resources whose asset type contains "Instance".
  208. //
  209. // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
  210. // regular expression syntax. If the regular expression does not match any
  211. // supported asset type, an INVALID_ARGUMENT error will be returned.
  212. //
  213. // If specified, only matching assets will be returned, otherwise, it will
  214. // snapshot all asset types. See [Introduction to Cloud Asset
  215. // Inventory](https://cloud.google.com/asset-inventory/docs/overview)
  216. // for all supported asset types.
  217. repeated string asset_types = 3;
  218. // Asset content type. If not specified, no content but the asset name will be
  219. // returned.
  220. ContentType content_type = 4;
  221. // Required. Output configuration indicating where the results will be output to.
  222. OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED];
  223. }
  224. // The export asset response. This message is returned by the
  225. // [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned
  226. // [google.longrunning.Operation.response][google.longrunning.Operation.response] field.
  227. message ExportAssetsResponse {
  228. // Time the snapshot was taken.
  229. google.protobuf.Timestamp read_time = 1;
  230. // Output configuration indicating where the results were output to.
  231. OutputConfig output_config = 2;
  232. // Output result indicating where the assets were exported to. For example, a
  233. // set of actual Google Cloud Storage object uris where the assets are
  234. // exported to. The uris can be different from what [output_config] has
  235. // specified, as the service will split the output object into multiple ones
  236. // once it exceeds a single Google Cloud Storage object limit.
  237. OutputResult output_result = 3;
  238. }
  239. // ListAssets request.
  240. message ListAssetsRequest {
  241. // Required. Name of the organization or project the assets belong to. Format:
  242. // "organizations/[organization-number]" (such as "organizations/123"),
  243. // "projects/[project-id]" (such as "projects/my-project-id"), or
  244. // "projects/[project-number]" (such as "projects/12345").
  245. string parent = 1 [
  246. (google.api.field_behavior) = REQUIRED,
  247. (google.api.resource_reference) = {
  248. child_type: "cloudasset.googleapis.com/Asset"
  249. }
  250. ];
  251. // Timestamp to take an asset snapshot. This can only be set to a timestamp
  252. // between the current time and the current time minus 35 days (inclusive).
  253. // If not specified, the current time will be used. Due to delays in resource
  254. // data collection and indexing, there is a volatile window during which
  255. // running the same query may get different results.
  256. google.protobuf.Timestamp read_time = 2;
  257. // A list of asset types to take a snapshot for. For example:
  258. // "compute.googleapis.com/Disk".
  259. //
  260. // Regular expression is also supported. For example:
  261. //
  262. // * "compute.googleapis.com.*" snapshots resources whose asset type starts
  263. // with "compute.googleapis.com".
  264. // * ".*Instance" snapshots resources whose asset type ends with "Instance".
  265. // * ".*Instance.*" snapshots resources whose asset type contains "Instance".
  266. //
  267. // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
  268. // regular expression syntax. If the regular expression does not match any
  269. // supported asset type, an INVALID_ARGUMENT error will be returned.
  270. //
  271. // If specified, only matching assets will be returned, otherwise, it will
  272. // snapshot all asset types. See [Introduction to Cloud Asset
  273. // Inventory](https://cloud.google.com/asset-inventory/docs/overview)
  274. // for all supported asset types.
  275. repeated string asset_types = 3;
  276. // Asset content type. If not specified, no content but the asset name will
  277. // be returned.
  278. ContentType content_type = 4;
  279. // The maximum number of assets to be returned in a single response. Default
  280. // is 100, minimum is 1, and maximum is 1000.
  281. int32 page_size = 5;
  282. // The `next_page_token` returned from the previous `ListAssetsResponse`, or
  283. // unspecified for the first `ListAssetsRequest`. It is a continuation of a
  284. // prior `ListAssets` call, and the API should return the next page of assets.
  285. string page_token = 6;
  286. }
  287. // ListAssets response.
  288. message ListAssetsResponse {
  289. // Time the snapshot was taken.
  290. google.protobuf.Timestamp read_time = 1;
  291. // Assets.
  292. repeated Asset assets = 2;
  293. // Token to retrieve the next page of results. It expires 72 hours after the
  294. // page token for the first page is generated. Set to empty if there are no
  295. // remaining results.
  296. string next_page_token = 3;
  297. }
  298. // Batch get assets history request.
  299. message BatchGetAssetsHistoryRequest {
  300. // Required. The relative name of the root asset. It can only be an
  301. // organization number (such as "organizations/123"), a project ID (such as
  302. // "projects/my-project-id")", or a project number (such as "projects/12345").
  303. string parent = 1 [
  304. (google.api.field_behavior) = REQUIRED,
  305. (google.api.resource_reference) = {
  306. child_type: "cloudasset.googleapis.com/Asset"
  307. }
  308. ];
  309. // A list of the full names of the assets.
  310. // See: https://cloud.google.com/asset-inventory/docs/resource-name-format
  311. // Example:
  312. //
  313. // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
  314. //
  315. // The request becomes a no-op if the asset name list is empty, and the max
  316. // size of the asset name list is 100 in one request.
  317. repeated string asset_names = 2;
  318. // Optional. The content type.
  319. ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL];
  320. // Optional. The time window for the asset history. Both start_time and
  321. // end_time are optional and if set, it must be after the current time minus
  322. // 35 days. If end_time is not set, it is default to current timestamp.
  323. // If start_time is not set, the snapshot of the assets at end_time will be
  324. // returned. The returned results contain all temporal assets whose time
  325. // window overlap with read_time_window.
  326. TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL];
  327. }
  328. // Batch get assets history response.
  329. message BatchGetAssetsHistoryResponse {
  330. // A list of assets with valid time windows.
  331. repeated TemporalAsset assets = 1;
  332. }
  333. // Create asset feed request.
  334. message CreateFeedRequest {
  335. // Required. The name of the project/folder/organization where this feed
  336. // should be created in. It can only be an organization number (such as
  337. // "organizations/123"), a folder number (such as "folders/123"), a project ID
  338. // (such as "projects/my-project-id")", or a project number (such as
  339. // "projects/12345").
  340. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  341. // Required. This is the client-assigned asset feed identifier and it needs to
  342. // be unique under a specific parent project/folder/organization.
  343. string feed_id = 2 [(google.api.field_behavior) = REQUIRED];
  344. // Required. The feed details. The field `name` must be empty and it will be generated
  345. // in the format of:
  346. // projects/project_number/feeds/feed_id
  347. // folders/folder_number/feeds/feed_id
  348. // organizations/organization_number/feeds/feed_id
  349. Feed feed = 3 [(google.api.field_behavior) = REQUIRED];
  350. }
  351. // Get asset feed request.
  352. message GetFeedRequest {
  353. // Required. The name of the Feed and it must be in the format of:
  354. // projects/project_number/feeds/feed_id
  355. // folders/folder_number/feeds/feed_id
  356. // organizations/organization_number/feeds/feed_id
  357. string name = 1 [
  358. (google.api.field_behavior) = REQUIRED,
  359. (google.api.resource_reference) = {
  360. type: "cloudasset.googleapis.com/Feed"
  361. }
  362. ];
  363. }
  364. // List asset feeds request.
  365. message ListFeedsRequest {
  366. // Required. The parent project/folder/organization whose feeds are to be
  367. // listed. It can only be using project/folder/organization number (such as
  368. // "folders/12345")", or a project ID (such as "projects/my-project-id").
  369. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  370. }
  371. message ListFeedsResponse {
  372. // A list of feeds.
  373. repeated Feed feeds = 1;
  374. }
  375. // Update asset feed request.
  376. message UpdateFeedRequest {
  377. // Required. The new values of feed details. It must match an existing feed and the
  378. // field `name` must be in the format of:
  379. // projects/project_number/feeds/feed_id or
  380. // folders/folder_number/feeds/feed_id or
  381. // organizations/organization_number/feeds/feed_id.
  382. Feed feed = 1 [(google.api.field_behavior) = REQUIRED];
  383. // Required. Only updates the `feed` fields indicated by this mask.
  384. // The field mask must not be empty, and it must not contain fields that
  385. // are immutable or only set by the server.
  386. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
  387. }
  388. message DeleteFeedRequest {
  389. // Required. The name of the feed and it must be in the format of:
  390. // projects/project_number/feeds/feed_id
  391. // folders/folder_number/feeds/feed_id
  392. // organizations/organization_number/feeds/feed_id
  393. string name = 1 [
  394. (google.api.field_behavior) = REQUIRED,
  395. (google.api.resource_reference) = {
  396. type: "cloudasset.googleapis.com/Feed"
  397. }
  398. ];
  399. }
  400. // Output configuration for export assets destination.
  401. message OutputConfig {
  402. // Asset export destination.
  403. oneof destination {
  404. // Destination on Cloud Storage.
  405. GcsDestination gcs_destination = 1;
  406. // Destination on BigQuery. The output table stores the fields in asset
  407. // proto as columns in BigQuery.
  408. BigQueryDestination bigquery_destination = 2;
  409. }
  410. }
  411. // Output result of export assets.
  412. message OutputResult {
  413. // Asset export result.
  414. oneof result {
  415. // Export result on Cloud Storage.
  416. GcsOutputResult gcs_result = 1;
  417. }
  418. }
  419. // A Cloud Storage output result.
  420. message GcsOutputResult {
  421. // List of uris of the Cloud Storage objects. Example:
  422. // "gs://bucket_name/object_name".
  423. repeated string uris = 1;
  424. }
  425. // A Cloud Storage location.
  426. message GcsDestination {
  427. // Required.
  428. oneof object_uri {
  429. // The uri of the Cloud Storage object. It's the same uri that is used by
  430. // gsutil. Example: "gs://bucket_name/object_name". See [Viewing and
  431. // Editing Object
  432. // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
  433. // for more information.
  434. //
  435. // If the specified Cloud Storage object already exists and there is no
  436. // [hold](https://cloud.google.com/storage/docs/object-holds), it will be
  437. // overwritten with the exported result.
  438. string uri = 1;
  439. // The uri prefix of all generated Cloud Storage objects. Example:
  440. // "gs://bucket_name/object_name_prefix". Each object uri is in format:
  441. // "gs://bucket_name/object_name_prefix/<asset type>/<shard number> and only
  442. // contains assets for that type. <shard number> starts from 0. Example:
  443. // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is
  444. // the first shard of output objects containing all
  445. // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be
  446. // returned if file with the same name "gs://bucket_name/object_name_prefix"
  447. // already exists.
  448. string uri_prefix = 2;
  449. }
  450. }
  451. // A BigQuery destination for exporting assets to.
  452. message BigQueryDestination {
  453. // Required. The BigQuery dataset in format
  454. // "projects/projectId/datasets/datasetId", to which the snapshot result
  455. // should be exported. If this dataset does not exist, the export call returns
  456. // an INVALID_ARGUMENT error.
  457. string dataset = 1 [(google.api.field_behavior) = REQUIRED];
  458. // Required. The BigQuery table to which the snapshot result should be
  459. // written. If this table does not exist, a new table with the given name
  460. // will be created.
  461. string table = 2 [(google.api.field_behavior) = REQUIRED];
  462. // If the destination table already exists and this flag is `TRUE`, the
  463. // table will be overwritten by the contents of assets snapshot. If the flag
  464. // is `FALSE` or unset and the destination table already exists, the export
  465. // call returns an INVALID_ARGUMEMT error.
  466. bool force = 3;
  467. // [partition_spec] determines whether to export to partitioned table(s) and
  468. // how to partition the data.
  469. //
  470. // If [partition_spec] is unset or [partition_spec.partition_key] is unset or
  471. // `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to
  472. // non-partitioned table(s). [force] will decide whether to overwrite existing
  473. // table(s).
  474. //
  475. // If [partition_spec] is specified. First, the snapshot results will be
  476. // written to partitioned table(s) with two additional timestamp columns,
  477. // readTime and requestTime, one of which will be the partition key. Secondly,
  478. // in the case when any destination table already exists, it will first try to
  479. // update existing table's schema as necessary by appending additional
  480. // columns. Then, if [force] is `TRUE`, the corresponding partition will be
  481. // overwritten by the snapshot results (data in different partitions will
  482. // remain intact); if [force] is unset or `FALSE`, it will append the data. An
  483. // error will be returned if the schema update or data appension fails.
  484. PartitionSpec partition_spec = 4;
  485. // If this flag is `TRUE`, the snapshot results will be written to one or
  486. // multiple tables, each of which contains results of one asset type. The
  487. // [force] and [partition_spec] fields will apply to each of them.
  488. //
  489. // Field [table] will be concatenated with "_" and the asset type names (see
  490. // https://cloud.google.com/asset-inventory/docs/supported-asset-types for
  491. // supported asset types) to construct per-asset-type table names, in which
  492. // all non-alphanumeric characters like "." and "/" will be substituted by
  493. // "_". Example: if field [table] is "mytable" and snapshot results
  494. // contain "storage.googleapis.com/Bucket" assets, the corresponding table
  495. // name will be "mytable_storage_googleapis_com_Bucket". If any of these
  496. // tables does not exist, a new table with the concatenated name will be
  497. // created.
  498. //
  499. // When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of
  500. // each table will include RECORD-type columns mapped to the nested fields in
  501. // the Asset.resource.data field of that asset type (up to the 15 nested level
  502. // BigQuery supports
  503. // (https://cloud.google.com/bigquery/docs/nested-repeated#limitations)). The
  504. // fields in >15 nested levels will be stored in JSON format string as a child
  505. // column of its parent RECORD column.
  506. //
  507. // If error occurs when exporting to any table, the whole export call will
  508. // return an error but the export results that already succeed will persist.
  509. // Example: if exporting to table_type_A succeeds when exporting to
  510. // table_type_B fails during one export call, the results in table_type_A will
  511. // persist and there will not be partial results persisting in a table.
  512. bool separate_tables_per_asset_type = 5;
  513. }
  514. // Specifications of BigQuery partitioned table as export destination.
  515. message PartitionSpec {
  516. // This enum is used to determine the partition key column when exporting
  517. // assets to BigQuery partitioned table(s). Note that, if the partition key is
  518. // a timestamp column, the actual partition is based on its date value
  519. // (expressed in UTC. see details in
  520. // https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables).
  521. enum PartitionKey {
  522. // Unspecified partition key. If used, it means using non-partitioned table.
  523. PARTITION_KEY_UNSPECIFIED = 0;
  524. // The time when the snapshot is taken. If specified as partition key, the
  525. // result table(s) is partitoned by the additional timestamp column,
  526. // readTime. If [read_time] in ExportAssetsRequest is specified, the
  527. // readTime column's value will be the same as it. Otherwise, its value will
  528. // be the current time that is used to take the snapshot.
  529. READ_TIME = 1;
  530. // The time when the request is received and started to be processed. If
  531. // specified as partition key, the result table(s) is partitoned by the
  532. // requestTime column, an additional timestamp column representing when the
  533. // request was received.
  534. REQUEST_TIME = 2;
  535. }
  536. // The partition key for BigQuery partitioned table.
  537. PartitionKey partition_key = 1;
  538. }
  539. // A Pub/Sub destination.
  540. message PubsubDestination {
  541. // The name of the Pub/Sub topic to publish to.
  542. // Example: `projects/PROJECT_ID/topics/TOPIC_ID`.
  543. string topic = 1;
  544. }
  545. // Output configuration for asset feed destination.
  546. message FeedOutputConfig {
  547. // Asset feed destination.
  548. oneof destination {
  549. // Destination on Pub/Sub.
  550. PubsubDestination pubsub_destination = 1;
  551. }
  552. }
  553. // An asset feed used to export asset updates to a destinations.
  554. // An asset feed filter controls what updates are exported.
  555. // The asset feed must be created within a project, organization, or
  556. // folder. Supported destinations are:
  557. // Pub/Sub topics.
  558. message Feed {
  559. option (google.api.resource) = {
  560. type: "cloudasset.googleapis.com/Feed"
  561. pattern: "projects/{project}/feeds/{feed}"
  562. pattern: "folders/{folder}/feeds/{feed}"
  563. pattern: "organizations/{organization}/feeds/{feed}"
  564. history: ORIGINALLY_SINGLE_PATTERN
  565. };
  566. // Required. The format will be
  567. // projects/{project_number}/feeds/{client-assigned_feed_identifier} or
  568. // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or
  569. // organizations/{organization_number}/feeds/{client-assigned_feed_identifier}
  570. //
  571. // The client-assigned feed identifier must be unique within the parent
  572. // project/folder/organization.
  573. string name = 1 [(google.api.field_behavior) = REQUIRED];
  574. // A list of the full names of the assets to receive updates. You must specify
  575. // either or both of asset_names and asset_types. Only asset updates matching
  576. // specified asset_names or asset_types are exported to the feed.
  577. // Example:
  578. // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`.
  579. // See [Resource
  580. // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
  581. // for more info.
  582. repeated string asset_names = 2;
  583. // A list of types of the assets to receive updates. You must specify either
  584. // or both of asset_names and asset_types. Only asset updates matching
  585. // specified asset_names or asset_types are exported to the feed.
  586. // Example: `"compute.googleapis.com/Disk"`
  587. //
  588. // See [this
  589. // topic](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
  590. // for a list of all supported asset types.
  591. repeated string asset_types = 3;
  592. // Asset content type. If not specified, no content but the asset name and
  593. // type will be returned.
  594. ContentType content_type = 4;
  595. // Required. Feed output configuration defining where the asset updates are
  596. // published to.
  597. FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED];
  598. // A condition which determines whether an asset update should be published.
  599. // If specified, an asset will be returned only when the expression evaluates
  600. // to true.
  601. // When set, `expression` field in the `Expr` must be a valid [CEL expression]
  602. // (https://github.com/google/cel-spec) on a TemporalAsset with name
  603. // `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted
  604. // == true") will only publish Asset deletions. Other fields of `Expr` are
  605. // optional.
  606. //
  607. // See our [user
  608. // guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition)
  609. // for detailed instructions.
  610. google.type.Expr condition = 6;
  611. }
  612. // Search all resources request.
  613. message SearchAllResourcesRequest {
  614. // Required. A scope can be a project, a folder, or an organization. The search is
  615. // limited to the resources within the `scope`. The caller must be granted the
  616. // [`cloudasset.assets.searchAllResources`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
  617. // permission on the desired scope.
  618. //
  619. // The allowed values are:
  620. //
  621. // * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
  622. // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
  623. // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
  624. // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
  625. string scope = 1 [(google.api.field_behavior) = REQUIRED];
  626. // Optional. The query statement. See [how to construct a
  627. // query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query)
  628. // for more information. If not specified or empty, it will search all the
  629. // resources within the specified `scope`.
  630. //
  631. // Examples:
  632. //
  633. // * `name:Important` to find Cloud resources whose name contains
  634. // "Important" as a word.
  635. // * `name=Important` to find the Cloud resource whose name is exactly
  636. // "Important".
  637. // * `displayName:Impor*` to find Cloud resources whose display name
  638. // contains "Impor" as a prefix of any word in the field.
  639. // * `location:us-west*` to find Cloud resources whose location contains both
  640. // "us" and "west" as prefixes.
  641. // * `labels:prod` to find Cloud resources whose labels contain "prod" as
  642. // a key or value.
  643. // * `labels.env:prod` to find Cloud resources that have a label "env"
  644. // and its value is "prod".
  645. // * `labels.env:*` to find Cloud resources that have a label "env".
  646. // * `kmsKey:key` to find Cloud resources encrypted with a customer-managed
  647. // encryption key whose name contains the word "key".
  648. // * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a
  649. // word.
  650. // * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain
  651. // "ACTIVE" as a word.
  652. // * `createTime<1609459200` to find Cloud resources that were created before
  653. // "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of
  654. // "2021-01-01 00:00:00 UTC" in seconds.
  655. // * `updateTime>1609459200` to find Cloud resources that were updated after
  656. // "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of
  657. // "2021-01-01 00:00:00 UTC" in seconds.
  658. // * `Important` to find Cloud resources that contain "Important" as a word
  659. // in any of the searchable fields.
  660. // * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any
  661. // word in any of the searchable fields.
  662. // * `Important location:(us-west1 OR global)` to find Cloud
  663. // resources that contain "Important" as a word in any of the searchable
  664. // fields and are also located in the "us-west1" region or the "global"
  665. // location.
  666. string query = 2 [(google.api.field_behavior) = OPTIONAL];
  667. // Optional. A list of asset types that this request searches for. If empty, it will
  668. // search all the [searchable asset
  669. // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
  670. //
  671. // Regular expressions are also supported. For example:
  672. //
  673. // * "compute.googleapis.com.*" snapshots resources whose asset type starts
  674. // with "compute.googleapis.com".
  675. // * ".*Instance" snapshots resources whose asset type ends with "Instance".
  676. // * ".*Instance.*" snapshots resources whose asset type contains "Instance".
  677. //
  678. // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
  679. // regular expression syntax. If the regular expression does not match any
  680. // supported asset type, an INVALID_ARGUMENT error will be returned.
  681. repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL];
  682. // Optional. The page size for search result pagination. Page size is capped at 500 even
  683. // if a larger value is given. If set to zero, server will pick an appropriate
  684. // default. Returned results may be fewer than requested. When this happens,
  685. // there could be more results as long as `next_page_token` is returned.
  686. int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL];
  687. // Optional. If present, then retrieve the next batch of results from the preceding call
  688. // to this method. `page_token` must be the value of `next_page_token` from
  689. // the previous response. The values of all other method parameters, must be
  690. // identical to those in the previous call.
  691. string page_token = 5 [(google.api.field_behavior) = OPTIONAL];
  692. // Optional. A comma-separated list of fields specifying the sorting order of the
  693. // results. The default order is ascending. Add " DESC" after the field name
  694. // to indicate descending order. Redundant space characters are ignored.
  695. // Example: "location DESC, name".
  696. // Only singular primitive fields in the response are sortable:
  697. //
  698. // * name
  699. // * assetType
  700. // * project
  701. // * displayName
  702. // * description
  703. // * location
  704. // * kmsKey
  705. // * createTime
  706. // * updateTime
  707. // * state
  708. // * parentFullResourceName
  709. // * parentAssetType
  710. //
  711. // All the other fields such as repeated fields (e.g., `networkTags`), map
  712. // fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`)
  713. // are not supported.
  714. string order_by = 6 [(google.api.field_behavior) = OPTIONAL];
  715. // Optional. A comma-separated list of fields specifying which fields to be returned in
  716. // ResourceSearchResult. Only '*' or combination of top level fields can be
  717. // specified. Field names of both snake_case and camelCase are supported.
  718. // Examples: `"*"`, `"name,location"`, `"name,versionedResources"`.
  719. //
  720. // The read_mask paths must be valid field paths listed but not limited to
  721. // (both snake_case and camelCase are supported):
  722. //
  723. // * name
  724. // * assetType
  725. // * project
  726. // * displayName
  727. // * description
  728. // * location
  729. // * labels
  730. // * networkTags
  731. // * kmsKey
  732. // * createTime
  733. // * updateTime
  734. // * state
  735. // * additionalAttributes
  736. // * versionedResources
  737. //
  738. // If read_mask is not specified, all fields except versionedResources will
  739. // be returned.
  740. // If only '*' is specified, all fields including versionedResources will be
  741. // returned.
  742. // Any invalid field path will trigger INVALID_ARGUMENT error.
  743. google.protobuf.FieldMask read_mask = 8 [(google.api.field_behavior) = OPTIONAL];
  744. }
  745. // Search all resources response.
  746. message SearchAllResourcesResponse {
  747. // A list of Resources that match the search query. It contains the resource
  748. // standard metadata information.
  749. repeated ResourceSearchResult results = 1;
  750. // If there are more results than those appearing in this response, then
  751. // `next_page_token` is included. To get the next set of results, call this
  752. // method again using the value of `next_page_token` as `page_token`.
  753. string next_page_token = 2;
  754. }
  755. // Search all IAM policies request.
  756. message SearchAllIamPoliciesRequest {
  757. // Required. A scope can be a project, a folder, or an organization. The search is
  758. // limited to the IAM policies within the `scope`. The caller must be granted
  759. // the
  760. // [`cloudasset.assets.searchAllIamPolicies`](https://cloud.google.com/asset-inventory/docs/access-control#required_permissions)
  761. // permission on the desired scope.
  762. //
  763. // The allowed values are:
  764. //
  765. // * projects/{PROJECT_ID} (e.g., "projects/foo-bar")
  766. // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678")
  767. // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567")
  768. // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456")
  769. string scope = 1 [(google.api.field_behavior) = REQUIRED];
  770. // Optional. The query statement. See [how to construct a
  771. // query](https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query)
  772. // for more information. If not specified or empty, it will search all the
  773. // IAM policies within the specified `scope`. Note that the query string is
  774. // compared against each Cloud IAM policy binding, including its members,
  775. // roles, and Cloud IAM conditions. The returned Cloud IAM policies will only
  776. // contain the bindings that match your query. To learn more about the IAM
  777. // policy structure, see [IAM policy
  778. // doc](https://cloud.google.com/iam/docs/policies#structure).
  779. //
  780. // Examples:
  781. //
  782. // * `policy:amy@gmail.com` to find IAM policy bindings that specify user
  783. // "amy@gmail.com".
  784. // * `policy:roles/compute.admin` to find IAM policy bindings that specify
  785. // the Compute Admin role.
  786. // * `policy:comp*` to find IAM policy bindings that contain "comp" as a
  787. // prefix of any word in the binding.
  788. // * `policy.role.permissions:storage.buckets.update` to find IAM policy
  789. // bindings that specify a role containing "storage.buckets.update"
  790. // permission. Note that if callers don't have `iam.roles.get` access to a
  791. // role's included permissions, policy bindings that specify this role will
  792. // be dropped from the search results.
  793. // * `policy.role.permissions:upd*` to find IAM policy bindings that specify a
  794. // role containing "upd" as a prefix of any word in the role permission.
  795. // Note that if callers don't have `iam.roles.get` access to a role's
  796. // included permissions, policy bindings that specify this role will be
  797. // dropped from the search results.
  798. // * `resource:organizations/123456` to find IAM policy bindings
  799. // that are set on "organizations/123456".
  800. // * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to
  801. // find IAM policy bindings that are set on the project named "myproject".
  802. // * `Important` to find IAM policy bindings that contain "Important" as a
  803. // word in any of the searchable fields (except for the included
  804. // permissions).
  805. // * `resource:(instance1 OR instance2) policy:amy` to find
  806. // IAM policy bindings that are set on resources "instance1" or
  807. // "instance2" and also specify user "amy".
  808. // * `roles:roles/compute.admin` to find IAM policy bindings that specify the
  809. // Compute Admin role.
  810. // * `memberTypes:user` to find IAM policy bindings that contain the "user"
  811. // member type.
  812. string query = 2 [(google.api.field_behavior) = OPTIONAL];
  813. // Optional. The page size for search result pagination. Page size is capped at 500 even
  814. // if a larger value is given. If set to zero, server will pick an appropriate
  815. // default. Returned results may be fewer than requested. When this happens,
  816. // there could be more results as long as `next_page_token` is returned.
  817. int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
  818. // Optional. If present, retrieve the next batch of results from the preceding call to
  819. // this method. `page_token` must be the value of `next_page_token` from the
  820. // previous response. The values of all other method parameters must be
  821. // identical to those in the previous call.
  822. string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
  823. // Optional. A list of asset types that the IAM policies are attached to. If empty, it
  824. // will search the IAM policies that are attached to all the [searchable asset
  825. // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types).
  826. //
  827. // Regular expressions are also supported. For example:
  828. //
  829. // * "compute.googleapis.com.*" snapshots IAM policies attached to asset type
  830. // starts with "compute.googleapis.com".
  831. // * ".*Instance" snapshots IAM policies attached to asset type ends with
  832. // "Instance".
  833. // * ".*Instance.*" snapshots IAM policies attached to asset type contains
  834. // "Instance".
  835. //
  836. // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported
  837. // regular expression syntax. If the regular expression does not match any
  838. // supported asset type, an INVALID_ARGUMENT error will be returned.
  839. repeated string asset_types = 5 [(google.api.field_behavior) = OPTIONAL];
  840. // Optional. A comma-separated list of fields specifying the sorting order of the
  841. // results. The default order is ascending. Add " DESC" after the field name
  842. // to indicate descending order. Redundant space characters are ignored.
  843. // Example: "assetType DESC, resource".
  844. // Only singular primitive fields in the response are sortable:
  845. // * resource
  846. // * assetType
  847. // * project
  848. // All the other fields such as repeated fields (e.g., `folders`) and
  849. // non-primitive fields (e.g., `policy`) are not supported.
  850. string order_by = 7 [(google.api.field_behavior) = OPTIONAL];
  851. }
  852. // Search all IAM policies response.
  853. message SearchAllIamPoliciesResponse {
  854. // A list of IamPolicy that match the search query. Related information such
  855. // as the associated resource is returned along with the policy.
  856. repeated IamPolicySearchResult results = 1;
  857. // Set if there are more results than those appearing in this response; to get
  858. // the next set of results, call this method again, using this value as the
  859. // `page_token`.
  860. string next_page_token = 2;
  861. }
  862. // ## IAM policy analysis query message.
  863. message IamPolicyAnalysisQuery {
  864. // Specifies the resource to analyze for access policies, which may be set
  865. // directly on the resource, or on ancestors such as organizations, folders or
  866. // projects.
  867. message ResourceSelector {
  868. // Required. The [full resource name]
  869. // (https://cloud.google.com/asset-inventory/docs/resource-name-format)
  870. // of a resource of [supported resource
  871. // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types).
  872. string full_resource_name = 1 [(google.api.field_behavior) = REQUIRED];
  873. }
  874. // Specifies an identity for which to determine resource access, based on
  875. // roles assigned either directly to them or to the groups they belong to,
  876. // directly or indirectly.
  877. message IdentitySelector {
  878. // Required. The identity appear in the form of members in
  879. // [IAM policy
  880. // binding](https://cloud.google.com/iam/reference/rest/v1/Binding).
  881. //
  882. // The examples of supported forms are:
  883. // "user:mike@example.com",
  884. // "group:admins@example.com",
  885. // "domain:google.com",
  886. // "serviceAccount:my-project-id@appspot.gserviceaccount.com".
  887. //
  888. // Notice that wildcard characters (such as * and ?) are not supported.
  889. // You must give a specific identity.
  890. string identity = 1 [(google.api.field_behavior) = REQUIRED];
  891. }
  892. // Specifies roles and/or permissions to analyze, to determine both the
  893. // identities possessing them and the resources they control. If multiple
  894. // values are specified, results will include roles or permissions matching
  895. // any of them. The total number of roles and permissions should be equal or
  896. // less than 10.
  897. message AccessSelector {
  898. // Optional. The roles to appear in result.
  899. repeated string roles = 1 [(google.api.field_behavior) = OPTIONAL];
  900. // Optional. The permissions to appear in result.
  901. repeated string permissions = 2 [(google.api.field_behavior) = OPTIONAL];
  902. }
  903. // Contains query options.
  904. message Options {
  905. // Optional. If true, the identities section of the result will expand any
  906. // Google groups appearing in an IAM policy binding.
  907. //
  908. // If [IamPolicyAnalysisQuery.identity_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector] is specified, the
  909. // identity in the result will be determined by the selector, and this flag
  910. // is not allowed to set.
  911. //
  912. // Default is false.
  913. bool expand_groups = 1 [(google.api.field_behavior) = OPTIONAL];
  914. // Optional. If true, the access section of result will expand any roles
  915. // appearing in IAM policy bindings to include their permissions.
  916. //
  917. // If [IamPolicyAnalysisQuery.access_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector] is specified, the access
  918. // section of the result will be determined by the selector, and this flag
  919. // is not allowed to set.
  920. //
  921. // Default is false.
  922. bool expand_roles = 2 [(google.api.field_behavior) = OPTIONAL];
  923. // Optional. If true and [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] is not
  924. // specified, the resource section of the result will expand any resource
  925. // attached to an IAM policy to include resources lower in the resource
  926. // hierarchy.
  927. //
  928. // For example, if the request analyzes for which resources user A has
  929. // permission P, and the results include an IAM policy with P on a GCP
  930. // folder, the results will also include resources in that folder with
  931. // permission P.
  932. //
  933. // If true and [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] is specified,
  934. // the resource section of the result will expand the specified resource to
  935. // include resources lower in the resource hierarchy. Only project or
  936. // lower resources are supported. Folder and organization resource cannot be
  937. // used together with this option.
  938. //
  939. // For example, if the request analyzes for which users have permission P on
  940. // a GCP project with this option enabled, the results will include all
  941. // users who have permission P on that project or any lower resource.
  942. //
  943. // Default is false.
  944. bool expand_resources = 3 [(google.api.field_behavior) = OPTIONAL];
  945. // Optional. If true, the result will output resource edges, starting
  946. // from the policy attached resource, to any expanded resources.
  947. // Default is false.
  948. bool output_resource_edges = 4 [(google.api.field_behavior) = OPTIONAL];
  949. // Optional. If true, the result will output group identity edges, starting
  950. // from the binding's group members, to any expanded identities.
  951. // Default is false.
  952. bool output_group_edges = 5 [(google.api.field_behavior) = OPTIONAL];
  953. // Optional. If true, the response will include access analysis from identities to
  954. // resources via service account impersonation. This is a very expensive
  955. // operation, because many derived queries will be executed. We highly
  956. // recommend you use [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] rpc
  957. // instead.
  958. //
  959. // For example, if the request analyzes for which resources user A has
  960. // permission P, and there's an IAM policy states user A has
  961. // iam.serviceAccounts.getAccessToken permission to a service account SA,
  962. // and there's another IAM policy states service account SA has permission P
  963. // to a GCP folder F, then user A potentially has access to the GCP folder
  964. // F. And those advanced analysis results will be included in
  965. // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].
  966. //
  967. // Another example, if the request analyzes for who has
  968. // permission P to a GCP folder F, and there's an IAM policy states user A
  969. // has iam.serviceAccounts.actAs permission to a service account SA, and
  970. // there's another IAM policy states service account SA has permission P to
  971. // the GCP folder F, then user A potentially has access to the GCP folder
  972. // F. And those advanced analysis results will be included in
  973. // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis].
  974. //
  975. // Default is false.
  976. bool analyze_service_account_impersonation = 6 [(google.api.field_behavior) = OPTIONAL];
  977. }
  978. // The IAM conditions context.
  979. message ConditionContext {
  980. // The IAM conditions time context.
  981. oneof TimeContext {
  982. // The hypothetical access timestamp to evaluate IAM conditions. Note that
  983. // this value must not be earlier than the current time; otherwise, an
  984. // INVALID_ARGUMENT error will be returned.
  985. google.protobuf.Timestamp access_time = 1;
  986. }
  987. }
  988. // Required. The relative name of the root asset. Only resources and IAM policies within
  989. // the scope will be analyzed.
  990. //
  991. // This can only be an organization number (such as "organizations/123"), a
  992. // folder number (such as "folders/123"), a project ID (such as
  993. // "projects/my-project-id"), or a project number (such as "projects/12345").
  994. //
  995. // To know how to get organization id, visit [here
  996. // ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
  997. //
  998. // To know how to get folder or project id, visit [here
  999. // ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
  1000. string scope = 1 [(google.api.field_behavior) = REQUIRED];
  1001. // Optional. Specifies a resource for analysis.
  1002. ResourceSelector resource_selector = 2 [(google.api.field_behavior) = OPTIONAL];
  1003. // Optional. Specifies an identity for analysis.
  1004. IdentitySelector identity_selector = 3 [(google.api.field_behavior) = OPTIONAL];
  1005. // Optional. Specifies roles or permissions for analysis. This is optional.
  1006. AccessSelector access_selector = 4 [(google.api.field_behavior) = OPTIONAL];
  1007. // Optional. The query options.
  1008. Options options = 5 [(google.api.field_behavior) = OPTIONAL];
  1009. // Optional. The hypothetical context for IAM conditions evaluation.
  1010. ConditionContext condition_context = 6 [(google.api.field_behavior) = OPTIONAL];
  1011. }
  1012. // A request message for [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
  1013. message AnalyzeIamPolicyRequest {
  1014. // Required. The request query.
  1015. IamPolicyAnalysisQuery analysis_query = 1 [(google.api.field_behavior) = REQUIRED];
  1016. // Optional. Amount of time executable has to complete. See JSON representation of
  1017. // [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json).
  1018. //
  1019. // If this field is set with a value less than the RPC deadline, and the
  1020. // execution of your query hasn't finished in the specified
  1021. // execution timeout, you will get a response with partial result.
  1022. // Otherwise, your query's execution will continue until the RPC deadline.
  1023. // If it's not finished until then, you will get a DEADLINE_EXCEEDED error.
  1024. //
  1025. // Default is empty.
  1026. google.protobuf.Duration execution_timeout = 2 [(google.api.field_behavior) = OPTIONAL];
  1027. }
  1028. // A response message for [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
  1029. message AnalyzeIamPolicyResponse {
  1030. // An analysis message to group the query and results.
  1031. message IamPolicyAnalysis {
  1032. // The analysis query.
  1033. IamPolicyAnalysisQuery analysis_query = 1;
  1034. // A list of [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult] that matches the analysis query, or
  1035. // empty if no result is found.
  1036. repeated IamPolicyAnalysisResult analysis_results = 2;
  1037. // Represents whether all entries in the [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results] have been
  1038. // fully explored to answer the query.
  1039. bool fully_explored = 3;
  1040. // A list of non-critical errors happened during the query handling.
  1041. repeated IamPolicyAnalysisState non_critical_errors = 5;
  1042. }
  1043. // The main analysis that matches the original request.
  1044. IamPolicyAnalysis main_analysis = 1;
  1045. // The service account impersonation analysis if
  1046. // [AnalyzeIamPolicyRequest.analyze_service_account_impersonation][] is
  1047. // enabled.
  1048. repeated IamPolicyAnalysis service_account_impersonation_analysis = 2;
  1049. // Represents whether all entries in the [main_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis] and
  1050. // [service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis] have been fully explored to
  1051. // answer the query in the request.
  1052. bool fully_explored = 3;
  1053. }
  1054. // Output configuration for export IAM policy analysis destination.
  1055. message IamPolicyAnalysisOutputConfig {
  1056. // A Cloud Storage location.
  1057. message GcsDestination {
  1058. // Required. The uri of the Cloud Storage object. It's the same uri that is used by
  1059. // gsutil. Example: "gs://bucket_name/object_name". See [Viewing and
  1060. // Editing Object
  1061. // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata)
  1062. // for more information.
  1063. //
  1064. // If the specified Cloud Storage object already exists and there is no
  1065. // [hold](https://cloud.google.com/storage/docs/object-holds), it will be
  1066. // overwritten with the analysis result.
  1067. string uri = 1 [(google.api.field_behavior) = REQUIRED];
  1068. }
  1069. // A BigQuery destination.
  1070. message BigQueryDestination {
  1071. // This enum determines the partition key column for the bigquery tables.
  1072. // Partitioning can improve query performance and reduce query cost by
  1073. // filtering partitions. Refer to
  1074. // https://cloud.google.com/bigquery/docs/partitioned-tables for details.
  1075. enum PartitionKey {
  1076. // Unspecified partition key. Tables won't be partitioned using this
  1077. // option.
  1078. PARTITION_KEY_UNSPECIFIED = 0;
  1079. // The time when the request is received. If specified as partition key,
  1080. // the result table(s) is partitoned by the RequestTime column, an
  1081. // additional timestamp column representing when the request was received.
  1082. REQUEST_TIME = 1;
  1083. }
  1084. // Required. The BigQuery dataset in format "projects/projectId/datasets/datasetId",
  1085. // to which the analysis results should be exported. If this dataset does
  1086. // not exist, the export call will return an INVALID_ARGUMENT error.
  1087. string dataset = 1 [(google.api.field_behavior) = REQUIRED];
  1088. // Required. The prefix of the BigQuery tables to which the analysis results will be
  1089. // written. Tables will be created based on this table_prefix if not exist:
  1090. // * <table_prefix>_analysis table will contain export operation's metadata.
  1091. // * <table_prefix>_analysis_result will contain all the
  1092. // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult].
  1093. // When [partition_key] is specified, both tables will be partitioned based
  1094. // on the [partition_key].
  1095. string table_prefix = 2 [(google.api.field_behavior) = REQUIRED];
  1096. // The partition key for BigQuery partitioned table.
  1097. PartitionKey partition_key = 3;
  1098. // Optional. Specifies the action that occurs if the destination table or partition
  1099. // already exists. The following values are supported:
  1100. //
  1101. // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery
  1102. // overwrites the entire table or all the partitions data.
  1103. // * WRITE_APPEND: If the table or partition already exists, BigQuery
  1104. // appends the data to the table or the latest partition.
  1105. // * WRITE_EMPTY: If the table already exists and contains data, an error is
  1106. // returned.
  1107. //
  1108. // The default value is WRITE_APPEND. Each action is atomic and only occurs
  1109. // if BigQuery is able to complete the job successfully. Details are at
  1110. // https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file.
  1111. string write_disposition = 4 [(google.api.field_behavior) = OPTIONAL];
  1112. }
  1113. // IAM policy analysis export destination.
  1114. oneof destination {
  1115. // Destination on Cloud Storage.
  1116. GcsDestination gcs_destination = 1;
  1117. // Destination on BigQuery.
  1118. BigQueryDestination bigquery_destination = 2;
  1119. }
  1120. }
  1121. // A request message for [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
  1122. message AnalyzeIamPolicyLongrunningRequest {
  1123. // Required. The request query.
  1124. IamPolicyAnalysisQuery analysis_query = 1 [(google.api.field_behavior) = REQUIRED];
  1125. // Required. Output configuration indicating where the results will be output to.
  1126. IamPolicyAnalysisOutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED];
  1127. }
  1128. // A response message for [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
  1129. message AnalyzeIamPolicyLongrunningResponse {
  1130. }
  1131. // The request message for performing resource move analysis.
  1132. message AnalyzeMoveRequest {
  1133. // View enum for supporting partial analysis responses.
  1134. enum AnalysisView {
  1135. // The default/unset value.
  1136. // The API will default to the FULL view.
  1137. ANALYSIS_VIEW_UNSPECIFIED = 0;
  1138. // Full analysis including all level of impacts of the specified resource
  1139. // move.
  1140. FULL = 1;
  1141. // Basic analysis only including blockers which will prevent the specified
  1142. // resource move at runtime.
  1143. BASIC = 2;
  1144. }
  1145. // Required. Name of the resource to perform the analysis against.
  1146. // Only GCP Project are supported as of today. Hence, this can only be Project
  1147. // ID (such as "projects/my-project-id") or a Project Number (such as
  1148. // "projects/12345").
  1149. string resource = 1 [(google.api.field_behavior) = REQUIRED];
  1150. // Required. Name of the GCP Folder or Organization to reparent the target
  1151. // resource. The analysis will be performed against hypothetically moving the
  1152. // resource to this specified desitination parent. This can only be a Folder
  1153. // number (such as "folders/123") or an Organization number (such as
  1154. // "organizations/123").
  1155. string destination_parent = 2 [(google.api.field_behavior) = REQUIRED];
  1156. // Analysis view indicating what information should be included in the
  1157. // analysis response. If unspecified, the default view is FULL.
  1158. AnalysisView view = 3;
  1159. }
  1160. // The response message for resource move analysis.
  1161. message AnalyzeMoveResponse {
  1162. // The list of analyses returned from performing the intended resource move
  1163. // analysis. The analysis is grouped by different Cloud services.
  1164. repeated MoveAnalysis move_analysis = 1;
  1165. }
  1166. // A message to group the analysis information.
  1167. message MoveAnalysis {
  1168. // The user friendly display name of the analysis. E.g. IAM, Organization
  1169. // Policy etc.
  1170. string display_name = 1;
  1171. oneof result {
  1172. // Analysis result of moving the target resource.
  1173. MoveAnalysisResult analysis = 2;
  1174. // Description of error encountered when performing the analysis.
  1175. google.rpc.Status error = 3;
  1176. }
  1177. }
  1178. // An analysis result including blockers and warnings.
  1179. message MoveAnalysisResult {
  1180. // Blocking information that would prevent the target resource from moving
  1181. // to the specified destination at runtime.
  1182. repeated MoveImpact blockers = 1;
  1183. // Warning information indicating that moving the target resource to the
  1184. // specified destination might be unsafe. This can include important policy
  1185. // information and configuration changes, but will not block moves at runtime.
  1186. repeated MoveImpact warnings = 2;
  1187. }
  1188. // A message to group impacts of moving the target resource.
  1189. message MoveImpact {
  1190. // User friendly impact detail in a free form message.
  1191. string detail = 1;
  1192. }
  1193. // Asset content type.
  1194. enum ContentType {
  1195. // Unspecified content type.
  1196. CONTENT_TYPE_UNSPECIFIED = 0;
  1197. // Resource metadata.
  1198. RESOURCE = 1;
  1199. // The actual IAM policy set on a resource.
  1200. IAM_POLICY = 2;
  1201. // The Cloud Organization Policy set on an asset.
  1202. ORG_POLICY = 4;
  1203. // The Cloud Access context manager Policy set on an asset.
  1204. ACCESS_POLICY = 5;
  1205. // The runtime OS Inventory information.
  1206. OS_INVENTORY = 6;
  1207. }