diff --git a/asset/snippets/generated/v1/asset_service.analyze_iam_policy.js b/asset/snippets/generated/v1/asset_service.analyze_iam_policy.js index 38fcd423fb0..e385da62df9 100644 --- a/asset/snippets/generated/v1/asset_service.analyze_iam_policy.js +++ b/asset/snippets/generated/v1/asset_service.analyze_iam_policy.js @@ -30,7 +30,24 @@ function main(analysisQuery) { */ // const analysisQuery = {} /** - * Optional. Amount of time executable has to complete. See JSON representation of + * Optional. The name of a saved query, which must be in the format of: + * * projects/project_number/savedQueries/saved_query_id + * * folders/folder_number/savedQueries/saved_query_id + * * organizations/organization_number/savedQueries/saved_query_id + * If both `analysis_query` and `saved_analysis_query` are provided, they + * will be merged together with the `saved_analysis_query` as base and + * the `analysis_query` as overrides. For more details of the merge behavior, + * please refer to the + * MergeFrom (https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details) + * page. + * Note that you cannot override primitive fields with default value, such as + * 0 or empty string, etc., because we use proto3, which doesn't support field + * presence yet. + */ + // const savedAnalysisQuery = 'abc123' + /** + * Optional. Amount of time executable has to complete. See JSON + * representation of * Duration (https://developers.google.com/protocol-buffers/docs/proto3#json). * If this field is set with a value less than the RPC deadline, and the * execution of your query hasn't finished in the specified diff --git a/asset/snippets/generated/v1/asset_service.analyze_iam_policy_longrunning.js b/asset/snippets/generated/v1/asset_service.analyze_iam_policy_longrunning.js index abb0aa3fdee..fbba9d86a41 100644 --- a/asset/snippets/generated/v1/asset_service.analyze_iam_policy_longrunning.js +++ b/asset/snippets/generated/v1/asset_service.analyze_iam_policy_longrunning.js @@ -30,7 +30,24 @@ function main(analysisQuery, outputConfig) { */ // const analysisQuery = {} /** - * Required. Output configuration indicating where the results will be output to. + * Optional. The name of a saved query, which must be in the format of: + * * projects/project_number/savedQueries/saved_query_id + * * folders/folder_number/savedQueries/saved_query_id + * * organizations/organization_number/savedQueries/saved_query_id + * If both `analysis_query` and `saved_analysis_query` are provided, they + * will be merged together with the `saved_analysis_query` as base and + * the `analysis_query` as overrides. For more details of the merge behavior, + * please refer to the + * MergeFrom (https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.message#Message.MergeFrom.details) + * doc. + * Note that you cannot override primitive fields with default value, such as + * 0 or empty string, etc., because we use proto3, which doesn't support field + * presence yet. + */ + // const savedAnalysisQuery = 'abc123' + /** + * Required. Output configuration indicating where the results will be output + * to. */ // const outputConfig = {} diff --git a/asset/snippets/generated/v1/asset_service.batch_get_effective_iam_policies.js b/asset/snippets/generated/v1/asset_service.batch_get_effective_iam_policies.js new file mode 100644 index 00000000000..033ae273f29 --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.batch_get_effective_iam_policies.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(scope, names) { + // [START cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Only IAM policies on or below the scope will be returned. + * This can only be an organization number (such as "organizations/123"), a + * folder number (such as "folders/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"). + * To know how to get organization id, visit here + * (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). + * To know how to get folder or project id, visit here + * (https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects). + */ + // const scope = 'abc123' + /** + * Required. The names refer to the full_resource_names + * (https://cloud.google.com/asset-inventory/docs/resource-name-format) + * of searchable asset + * types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). + * A maximum of 20 resources' effective policies can be retrieved in a batch. + */ + // const names = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callBatchGetEffectiveIamPolicies() { + // Construct request + const request = { + scope, + names, + }; + + // Run request + const response = await assetClient.batchGetEffectiveIamPolicies(request); + console.log(response); + } + + callBatchGetEffectiveIamPolicies(); + // [END cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/asset_service.create_feed.js b/asset/snippets/generated/v1/asset_service.create_feed.js index 20c0bf80b72..6d8067479e2 100644 --- a/asset/snippets/generated/v1/asset_service.create_feed.js +++ b/asset/snippets/generated/v1/asset_service.create_feed.js @@ -39,9 +39,8 @@ function main(parent, feedId, feed) { */ // const feedId = 'abc123' /** - * Required. The feed details. The field `name` must be empty and it will be generated - * in the format of: - * projects/project_number/feeds/feed_id + * Required. The feed details. The field `name` must be empty and it will be + * generated in the format of: projects/project_number/feeds/feed_id * folders/folder_number/feeds/feed_id * organizations/organization_number/feeds/feed_id */ diff --git a/asset/snippets/generated/v1/asset_service.create_saved_query.js b/asset/snippets/generated/v1/asset_service.create_saved_query.js new file mode 100644 index 00000000000..48130bd57d8 --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.create_saved_query.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, savedQuery, savedQueryId) { + // [START cloudasset_v1_generated_AssetService_CreateSavedQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project/folder/organization where this + * saved_query should be created in. It can only be an organization number + * (such as "organizations/123"), a folder number (such as "folders/123"), a + * project ID (such as "projects/my-project-id")", or a project number (such + * as "projects/12345"). + */ + // const parent = 'abc123' + /** + * Required. The saved_query details. The `name` field must be empty as it + * will be generated based on the parent and saved_query_id. + */ + // const savedQuery = {} + /** + * Required. The ID to use for the saved query, which must be unique in the + * specified parent. It will become the final component of the saved query's + * resource name. + * This value should be 4-63 characters, and valid characters + * are /[a-z][0-9]-/. + * Notice that this field is required in the saved query creation, and the + * `name` field of the `saved_query` will be ignored. + */ + // const savedQueryId = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callCreateSavedQuery() { + // Construct request + const request = { + parent, + savedQuery, + savedQueryId, + }; + + // Run request + const response = await assetClient.createSavedQuery(request); + console.log(response); + } + + callCreateSavedQuery(); + // [END cloudasset_v1_generated_AssetService_CreateSavedQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/asset_service.delete_saved_query.js b/asset/snippets/generated/v1/asset_service.delete_saved_query.js new file mode 100644 index 00000000000..0d1fb0c05cc --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.delete_saved_query.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudasset_v1_generated_AssetService_DeleteSavedQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the saved query to delete. It must be in the format + * of: + * * projects/project_number/savedQueries/saved_query_id + * * folders/folder_number/savedQueries/saved_query_id + * * organizations/organization_number/savedQueries/saved_query_id + */ + // const name = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callDeleteSavedQuery() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await assetClient.deleteSavedQuery(request); + console.log(response); + } + + callDeleteSavedQuery(); + // [END cloudasset_v1_generated_AssetService_DeleteSavedQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/asset_service.export_assets.js b/asset/snippets/generated/v1/asset_service.export_assets.js index 97fc5e5f3ed..c9a2107938d 100644 --- a/asset/snippets/generated/v1/asset_service.export_assets.js +++ b/asset/snippets/generated/v1/asset_service.export_assets.js @@ -63,7 +63,8 @@ function main(parent, outputConfig) { */ // const contentType = {} /** - * Required. Output configuration indicating where the results will be output to. + * Required. Output configuration indicating where the results will be output + * to. */ // const outputConfig = {} /** diff --git a/asset/snippets/generated/v1/asset_service.get_saved_query.js b/asset/snippets/generated/v1/asset_service.get_saved_query.js new file mode 100644 index 00000000000..c15cd1c395a --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.get_saved_query.js @@ -0,0 +1,61 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudasset_v1_generated_AssetService_GetSavedQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the saved query and it must be in the format of: + * * projects/project_number/savedQueries/saved_query_id + * * folders/folder_number/savedQueries/saved_query_id + * * organizations/organization_number/savedQueries/saved_query_id + */ + // const name = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callGetSavedQuery() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await assetClient.getSavedQuery(request); + console.log(response); + } + + callGetSavedQuery(); + // [END cloudasset_v1_generated_AssetService_GetSavedQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/asset_service.list_assets.js b/asset/snippets/generated/v1/asset_service.list_assets.js index 768cd0c6866..ae4c321b8d2 100644 --- a/asset/snippets/generated/v1/asset_service.list_assets.js +++ b/asset/snippets/generated/v1/asset_service.list_assets.js @@ -26,10 +26,11 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. Name of the organization or project the assets belong to. Format: - * "organizations/[organization-number]" (such as "organizations/123"), - * "projects/[project-id]" (such as "projects/my-project-id"), or - * "projects/[project-number]" (such as "projects/12345"). + * Required. Name of the organization, folder, or project the assets belong + * to. Format: "organizations/[organization-number]" (such as + * "organizations/123"), "projects/[project-id]" (such as + * "projects/my-project-id"), "projects/[project-number]" (such as + * "projects/12345"), or "folders/[folder-number]" (such as "folders/12345"). */ // const parent = 'abc123' /** diff --git a/asset/snippets/generated/v1/asset_service.list_saved_queries.js b/asset/snippets/generated/v1/asset_service.list_saved_queries.js new file mode 100644 index 00000000000..97b7a598922 --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.list_saved_queries.js @@ -0,0 +1,85 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudasset_v1_generated_AssetService_ListSavedQueries_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent project/folder/organization whose savedQueries are to + * be listed. It can only be using project/folder/organization number (such as + * "folders/12345")", or a project ID (such as "projects/my-project-id"). + */ + // const parent = 'abc123' + /** + * Optional. The expression to filter resources. + * The expression is a list of zero or more restrictions combined via logical + * operators `AND` and `OR`. When `AND` and `OR` are both used in the + * expression, parentheses must be appropriately used to group the + * combinations. The expression may also contain regular expressions. + * See https://google.aip.dev/160 for more information on the grammar. + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of saved queries to return per page. The + * service may return fewer than this value. If unspecified, at most 50 will + * be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Optional. A page token, received from a previous `ListSavedQueries` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListSavedQueries` must + * match the call that provided the page token. + */ + // const pageToken = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callListSavedQueries() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await assetClient.listSavedQueriesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSavedQueries(); + // [END cloudasset_v1_generated_AssetService_ListSavedQueries_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js b/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js index b0cd4dcc6b6..110dd00f85c 100644 --- a/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js +++ b/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js @@ -26,9 +26,9 @@ function main(scope) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. A scope can be a project, a folder, or an organization. The search is - * limited to the IAM policies within the `scope`. The caller must be granted - * the + * Required. A scope can be a project, a folder, or an organization. The + * search is limited to the IAM policies within the `scope`. The caller must + * be granted the * `cloudasset.assets.searchAllIamPolicies` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) * permission on the desired scope. * The allowed values are: @@ -43,7 +43,7 @@ function main(scope) { * query (https://cloud.google.com/asset-inventory/docs/searching-iam-policies#how_to_construct_a_query) * for more information. If not specified or empty, it will search all the * IAM policies within the specified `scope`. Note that the query string is - * compared against each Cloud IAM policy binding, including its members, + * compared against each Cloud IAM policy binding, including its principals, * roles, and Cloud IAM conditions. The returned Cloud IAM policies will only * contain the bindings that match your query. To learn more about the IAM * policy structure, see IAM policy @@ -77,27 +77,29 @@ function main(scope) { * "instance2" and also specify user "amy". * * `roles:roles/compute.admin` to find IAM policy bindings that specify the * Compute Admin role. - * * `memberTypes:user` to find IAM policy bindings that contain the "user" - * member type. + * * `memberTypes:user` to find IAM policy bindings that contain the + * principal type "user". */ // const query = 'abc123' /** - * Optional. The page size for search result pagination. Page size is capped at 500 even - * if a larger value is given. If set to zero, server will pick an appropriate - * default. Returned results may be fewer than requested. When this happens, - * there could be more results as long as `next_page_token` is returned. + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. */ // const pageSize = 1234 /** - * Optional. If present, retrieve the next batch of results from the preceding call to - * this method. `page_token` must be the value of `next_page_token` from the - * previous response. The values of all other method parameters must be - * identical to those in the previous call. + * Optional. If present, retrieve the next batch of results from the preceding + * call to this method. `page_token` must be the value of `next_page_token` + * from the previous response. The values of all other method parameters must + * be identical to those in the previous call. */ // const pageToken = 'abc123' /** - * Optional. A list of asset types that the IAM policies are attached to. If empty, it - * will search the IAM policies that are attached to all the searchable asset + * Optional. A list of asset types that the IAM policies are attached to. If + * empty, it will search the IAM policies that are attached to all the + * searchable asset * types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). * Regular expressions are also supported. For example: * * "compute.googleapis.com.*" snapshots IAM policies attached to asset type @@ -112,9 +114,9 @@ function main(scope) { */ // const assetTypes = 'abc123' /** - * Optional. A comma-separated list of fields specifying the sorting order of the - * results. The default order is ascending. Add " DESC" after the field name - * to indicate descending order. Redundant space characters are ignored. + * Optional. A comma-separated list of fields specifying the sorting order of + * the results. The default order is ascending. Add " DESC" after the field + * name to indicate descending order. Redundant space characters are ignored. * Example: "assetType DESC, resource". * Only singular primitive fields in the response are sortable: * * resource diff --git a/asset/snippets/generated/v1/asset_service.search_all_resources.js b/asset/snippets/generated/v1/asset_service.search_all_resources.js index 20fe964d82f..8c22917886c 100644 --- a/asset/snippets/generated/v1/asset_service.search_all_resources.js +++ b/asset/snippets/generated/v1/asset_service.search_all_resources.js @@ -26,8 +26,9 @@ function main(scope) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. A scope can be a project, a folder, or an organization. The search is - * limited to the resources within the `scope`. The caller must be granted the + * Required. A scope can be a project, a folder, or an organization. The + * search is limited to the resources within the `scope`. The caller must be + * granted the * `cloudasset.assets.searchAllResources` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) * permission on the desired scope. * The allowed values are: @@ -79,8 +80,8 @@ function main(scope) { */ // const query = 'abc123' /** - * Optional. A list of asset types that this request searches for. If empty, it will - * search all the searchable asset + * Optional. A list of asset types that this request searches for. If empty, + * it will search all the searchable asset * types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). * Regular expressions are also supported. For example: * * "compute.googleapis.com.*" snapshots resources whose asset type starts @@ -93,23 +94,24 @@ function main(scope) { */ // const assetTypes = 'abc123' /** - * Optional. The page size for search result pagination. Page size is capped at 500 even - * if a larger value is given. If set to zero, server will pick an appropriate - * default. Returned results may be fewer than requested. When this happens, - * there could be more results as long as `next_page_token` is returned. + * Optional. The page size for search result pagination. Page size is capped + * at 500 even if a larger value is given. If set to zero, server will pick an + * appropriate default. Returned results may be fewer than requested. When + * this happens, there could be more results as long as `next_page_token` is + * returned. */ // const pageSize = 1234 /** - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `page_token` must be the value of `next_page_token` from - * the previous response. The values of all other method parameters, must be - * identical to those in the previous call. + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of all other + * method parameters, must be identical to those in the previous call. */ // const pageToken = 'abc123' /** - * Optional. A comma-separated list of fields specifying the sorting order of the - * results. The default order is ascending. Add " DESC" after the field name - * to indicate descending order. Redundant space characters are ignored. + * Optional. A comma-separated list of fields specifying the sorting order of + * the results. The default order is ascending. Add " DESC" after the field + * name to indicate descending order. Redundant space characters are ignored. * Example: "location DESC, name". * Only singular primitive fields in the response are sortable: * * name @@ -130,10 +132,10 @@ function main(scope) { */ // const orderBy = 'abc123' /** - * Optional. A comma-separated list of fields specifying which fields to be returned in - * ResourceSearchResult. Only '*' or combination of top level fields can be - * specified. Field names of both snake_case and camelCase are supported. - * Examples: `"*"`, `"name,location"`, `"name,versionedResources"`. + * Optional. A comma-separated list of fields specifying which fields to be + * returned in ResourceSearchResult. Only '*' or combination of top level + * fields can be specified. Field names of both snake_case and camelCase are + * supported. Examples: `"*"`, `"name,location"`, `"name,versionedResources"`. * The read_mask paths must be valid field paths listed but not limited to * (both snake_case and camelCase are supported): * * name @@ -142,6 +144,9 @@ function main(scope) { * * displayName * * description * * location + * * tagKeys + * * tagValues + * * tagValueIds * * labels * * networkTags * * kmsKey diff --git a/asset/snippets/generated/v1/asset_service.update_feed.js b/asset/snippets/generated/v1/asset_service.update_feed.js index 2b51e15f699..2cbdd3610cc 100644 --- a/asset/snippets/generated/v1/asset_service.update_feed.js +++ b/asset/snippets/generated/v1/asset_service.update_feed.js @@ -26,8 +26,8 @@ function main(feed, updateMask) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The new values of feed details. It must match an existing feed and the - * field `name` must be in the format of: + * Required. The new values of feed details. It must match an existing feed + * and the field `name` must be in the format of: * projects/project_number/feeds/feed_id or * folders/folder_number/feeds/feed_id or * organizations/organization_number/feeds/feed_id. diff --git a/asset/snippets/generated/v1/asset_service.update_saved_query.js b/asset/snippets/generated/v1/asset_service.update_saved_query.js new file mode 100644 index 00000000000..c9c77ca777c --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.update_saved_query.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(savedQuery, updateMask) { + // [START cloudasset_v1_generated_AssetService_UpdateSavedQuery_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The saved query to update. + * The saved query's `name` field is used to identify the one to update, + * which has format as below: + * * projects/project_number/savedQueries/saved_query_id + * * folders/folder_number/savedQueries/saved_query_id + * * organizations/organization_number/savedQueries/saved_query_id + */ + // const savedQuery = {} + /** + * Required. The list of fields to update. + */ + // const updateMask = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callUpdateSavedQuery() { + // Construct request + const request = { + savedQuery, + updateMask, + }; + + // Run request + const response = await assetClient.updateSavedQuery(request); + console.log(response); + } + + callUpdateSavedQuery(); + // [END cloudasset_v1_generated_AssetService_UpdateSavedQuery_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json b/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json index ad5e39dd0f4..9b186674bfb 100644 --- a/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json +++ b/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json @@ -15,14 +15,14 @@ "regionTag": "cloudasset_v1_generated_AssetService_ExportAssets_async", "title": "AssetService exportAssets Sample", "origin": "API_DEFINITION", - "description": " Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table destinations, the output table stores the fields in asset proto as columns. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API , which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.", + "description": " Exports assets with time and resource types to a given Cloud Storage location/BigQuery table. For Cloud Storage location destinations, the output format is newline-delimited JSON. Each line represents a [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON format; for BigQuery table destinations, the output table stores the fields in asset Protobuf as columns. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API, which allows you to keep track of the export. We recommend intervals of at least 2 seconds with exponential retry to poll the export operation result. For regular-size resource parent, the export operation usually finishes within 5 minutes.", "canonical": true, "file": "asset_service.export_assets.js", "language": "JAVASCRIPT", "segments": [ { "start": 25, - "end": 107, + "end": 108, "type": "FULL" } ], @@ -82,7 +82,7 @@ "segments": [ { "start": 25, - "end": 114, + "end": 115, "type": "FULL" } ], @@ -202,7 +202,7 @@ "segments": [ { "start": 25, - "end": 69, + "end": 68, "type": "FULL" } ], @@ -414,7 +414,7 @@ "segments": [ { "start": 25, - "end": 180, + "end": 185, "type": "FULL" } ], @@ -478,7 +478,7 @@ "segments": [ { "start": 25, - "end": 147, + "end": 149, "type": "FULL" } ], @@ -538,7 +538,7 @@ "segments": [ { "start": 25, - "end": 61, + "end": 78, "type": "FULL" } ], @@ -551,6 +551,10 @@ "name": "analysis_query", "type": ".google.cloud.asset.v1.IamPolicyAnalysisQuery" }, + { + "name": "saved_analysis_query", + "type": "TYPE_STRING" + }, { "name": "execution_timeout", "type": ".google.protobuf.Duration" @@ -582,7 +586,7 @@ "segments": [ { "start": 25, - "end": 56, + "end": 73, "type": "FULL" } ], @@ -595,6 +599,10 @@ "name": "analysis_query", "type": ".google.cloud.asset.v1.IamPolicyAnalysisQuery" }, + { + "name": "saved_analysis_query", + "type": "TYPE_STRING" + }, { "name": "output_config", "type": ".google.cloud.asset.v1.IamPolicyAnalysisOutputConfig" @@ -662,6 +670,274 @@ } } } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_CreateSavedQuery_async", + "title": "AssetService createSavedQuery Sample", + "origin": "API_DEFINITION", + "description": " Creates a saved query in a parent project/folder/organization.", + "canonical": true, + "file": "asset_service.create_saved_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.CreateSavedQuery", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "saved_query", + "type": ".google.cloud.asset.v1.SavedQuery" + }, + { + "name": "saved_query_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1.SavedQuery", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "CreateSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.CreateSavedQuery", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_GetSavedQuery_async", + "title": "AssetService getSavedQuery Sample", + "origin": "API_DEFINITION", + "description": " Gets details about a saved query.", + "canonical": true, + "file": "asset_service.get_saved_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.GetSavedQuery", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1.SavedQuery", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "GetSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.GetSavedQuery", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_ListSavedQueries_async", + "title": "AssetService listSavedQueries Sample", + "origin": "API_DEFINITION", + "description": " Lists all saved queries in a parent project/folder/organization.", + "canonical": true, + "file": "asset_service.list_saved_queries.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSavedQueries", + "fullName": "google.cloud.asset.v1.AssetService.ListSavedQueries", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1.ListSavedQueriesResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "ListSavedQueries", + "fullName": "google.cloud.asset.v1.AssetService.ListSavedQueries", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_UpdateSavedQuery_async", + "title": "AssetService updateSavedQuery Sample", + "origin": "API_DEFINITION", + "description": " Updates a saved query.", + "canonical": true, + "file": "asset_service.update_saved_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.UpdateSavedQuery", + "async": true, + "parameters": [ + { + "name": "saved_query", + "type": ".google.cloud.asset.v1.SavedQuery" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.asset.v1.SavedQuery", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "UpdateSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.UpdateSavedQuery", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_DeleteSavedQuery_async", + "title": "AssetService deleteSavedQuery Sample", + "origin": "API_DEFINITION", + "description": " Deletes a saved query.", + "canonical": true, + "file": "asset_service.delete_saved_query.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.DeleteSavedQuery", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "DeleteSavedQuery", + "fullName": "google.cloud.asset.v1.AssetService.DeleteSavedQuery", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async", + "title": "AssetService batchGetEffectiveIamPolicies Sample", + "origin": "API_DEFINITION", + "description": " Gets effective IAM policies for a batch of resources.", + "canonical": true, + "file": "asset_service.batch_get_effective_iam_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchGetEffectiveIamPolicies", + "fullName": "google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies", + "async": true, + "parameters": [ + { + "name": "scope", + "type": "TYPE_STRING" + }, + { + "name": "names", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "BatchGetEffectiveIamPolicies", + "fullName": "google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } } ] } \ No newline at end of file