diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy.js index 9af8e276ba2..38fcd423fb0 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js index 74528a1eaf3..abb0aa3fdee 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_move.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_move.js index ce869443b95..5db1a709792 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_move.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.analyze_move.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.batch_get_assets_history.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.batch_get_assets_history.js index 9188cf99d62..3f098370933 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.batch_get_assets_history.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.batch_get_assets_history.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.create_feed.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.create_feed.js index e527f244a52..20c0bf80b72 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.create_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.create_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.delete_feed.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.delete_feed.js index 5e801047966..a812d1f86d0 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.delete_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.delete_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.export_assets.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.export_assets.js index 124cd269f04..97fc5e5f3ed 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.export_assets.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.export_assets.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.get_feed.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.get_feed.js index ebceb15c9b0..fa19d10604d 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.get_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.get_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.list_assets.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.list_assets.js index a9026022cbd..768cd0c6866 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.list_assets.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.list_assets.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.list_feeds.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.list_feeds.js index f9ac8720393..40f34be94c9 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.list_feeds.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.list_feeds.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js index 1b845d1f725..b0cd4dcc6b6 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_iam_policies.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js index c1f0367d00b..20fe964d82f 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.search_all_resources.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/asset_service.update_feed.js b/packages/google-cloud-asset/samples/generated/v1/asset_service.update_feed.js index 971c0a9073b..2b51e15f699 100644 --- a/packages/google-cloud-asset/samples/generated/v1/asset_service.update_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1/asset_service.update_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json b/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json new file mode 100644 index 00000000000..9cfd2648147 --- /dev/null +++ b/packages/google-cloud-asset/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json @@ -0,0 +1,667 @@ +{ + "clientLibrary": { + "name": "nodejs-asset", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.asset.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "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.", + "canonical": true, + "file": "asset_service.export_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 107, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportAssets", + "fullName": "google.cloud.asset.v1.AssetService.ExportAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "asset_types", + "type": "TYPE_STRING[]" + }, + { + "name": "content_type", + "type": ".google.cloud.asset.v1.ContentType" + }, + { + "name": "output_config", + "type": ".google.cloud.asset.v1.OutputConfig" + }, + { + "name": "relationship_types", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "ExportAssets", + "fullName": "google.cloud.asset.v1.AssetService.ExportAssets", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_ListAssets_async", + "title": "AssetService listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists assets with time and resource types and returns paged results in response.", + "canonical": true, + "file": "asset_service.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 114, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.asset.v1.AssetService.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "asset_types", + "type": "TYPE_STRING[]" + }, + { + "name": "content_type", + "type": ".google.cloud.asset.v1.ContentType" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "relationship_types", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.asset.v1.ListAssetsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.asset.v1.AssetService.ListAssets", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async", + "title": "AssetService batchGetAssetsHistory Sample", + "origin": "API_DEFINITION", + "description": " Batch gets the update history of assets that overlap a time window. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. Otherwise, this API outputs history with asset in both non-delete or deleted status. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.", + "canonical": true, + "file": "asset_service.batch_get_assets_history.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchGetAssetsHistory", + "fullName": "google.cloud.asset.v1.AssetService.BatchGetAssetsHistory", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "asset_names", + "type": "TYPE_STRING[]" + }, + { + "name": "content_type", + "type": ".google.cloud.asset.v1.ContentType" + }, + { + "name": "read_time_window", + "type": ".google.cloud.asset.v1.TimeWindow" + }, + { + "name": "relationship_types", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.cloud.asset.v1.BatchGetAssetsHistoryResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "BatchGetAssetsHistory", + "fullName": "google.cloud.asset.v1.AssetService.BatchGetAssetsHistory", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_CreateFeed_async", + "title": "AssetService createFeed Sample", + "origin": "API_DEFINITION", + "description": " Creates a feed in a parent project/folder/organization to listen to its asset updates.", + "canonical": true, + "file": "asset_service.create_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFeed", + "fullName": "google.cloud.asset.v1.AssetService.CreateFeed", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "feed_id", + "type": "TYPE_STRING" + }, + { + "name": "feed", + "type": ".google.cloud.asset.v1.Feed" + } + ], + "resultType": ".google.cloud.asset.v1.Feed", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "CreateFeed", + "fullName": "google.cloud.asset.v1.AssetService.CreateFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_GetFeed_async", + "title": "AssetService getFeed Sample", + "origin": "API_DEFINITION", + "description": " Gets details about an asset feed.", + "canonical": true, + "file": "asset_service.get_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFeed", + "fullName": "google.cloud.asset.v1.AssetService.GetFeed", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1.Feed", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "GetFeed", + "fullName": "google.cloud.asset.v1.AssetService.GetFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_ListFeeds_async", + "title": "AssetService listFeeds Sample", + "origin": "API_DEFINITION", + "description": " Lists all asset feeds in a parent project/folder/organization.", + "canonical": true, + "file": "asset_service.list_feeds.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFeeds", + "fullName": "google.cloud.asset.v1.AssetService.ListFeeds", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1.ListFeedsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "ListFeeds", + "fullName": "google.cloud.asset.v1.AssetService.ListFeeds", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_UpdateFeed_async", + "title": "AssetService updateFeed Sample", + "origin": "API_DEFINITION", + "description": " Updates an asset feed configuration.", + "canonical": true, + "file": "asset_service.update_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFeed", + "fullName": "google.cloud.asset.v1.AssetService.UpdateFeed", + "async": true, + "parameters": [ + { + "name": "feed", + "type": ".google.cloud.asset.v1.Feed" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.asset.v1.Feed", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "UpdateFeed", + "fullName": "google.cloud.asset.v1.AssetService.UpdateFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_DeleteFeed_async", + "title": "AssetService deleteFeed Sample", + "origin": "API_DEFINITION", + "description": " Deletes an asset feed.", + "canonical": true, + "file": "asset_service.delete_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFeed", + "fullName": "google.cloud.asset.v1.AssetService.DeleteFeed", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "DeleteFeed", + "fullName": "google.cloud.asset.v1.AssetService.DeleteFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_SearchAllResources_async", + "title": "AssetService searchAllResources Sample", + "origin": "API_DEFINITION", + "description": " Searches all Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the request will be rejected.", + "canonical": true, + "file": "asset_service.search_all_resources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 180, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAllResources", + "fullName": "google.cloud.asset.v1.AssetService.SearchAllResources", + "async": true, + "parameters": [ + { + "name": "scope", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "asset_types", + "type": "TYPE_STRING[]" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "read_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.asset.v1.SearchAllResourcesResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "SearchAllResources", + "fullName": "google.cloud.asset.v1.AssetService.SearchAllResources", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async", + "title": "AssetService searchAllIamPolicies Sample", + "origin": "API_DEFINITION", + "description": " Searches all IAM policies within the specified scope, such as a project, folder, or organization. The caller must be granted the `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the request will be rejected.", + "canonical": true, + "file": "asset_service.search_all_iam_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 147, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAllIamPolicies", + "fullName": "google.cloud.asset.v1.AssetService.SearchAllIamPolicies", + "async": true, + "parameters": [ + { + "name": "scope", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "asset_types", + "type": "TYPE_STRING[]" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1.SearchAllIamPoliciesResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "SearchAllIamPolicies", + "fullName": "google.cloud.asset.v1.AssetService.SearchAllIamPolicies", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async", + "title": "AssetService analyzeIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Analyzes IAM policies to answer which identities have what accesses on which resources.", + "canonical": true, + "file": "asset_service.analyze_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeIamPolicy", + "fullName": "google.cloud.asset.v1.AssetService.AnalyzeIamPolicy", + "async": true, + "parameters": [ + { + "name": "analysis_query", + "type": ".google.cloud.asset.v1.IamPolicyAnalysisQuery" + }, + { + "name": "execution_timeout", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.cloud.asset.v1.AnalyzeIamPolicyResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "AnalyzeIamPolicy", + "fullName": "google.cloud.asset.v1.AssetService.AnalyzeIamPolicy", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async", + "title": "AssetService analyzeIamPolicyLongrunning Sample", + "origin": "API_DEFINITION", + "description": " Analyzes IAM policies asynchronously to answer which identities have what accesses on which resources, and writes the analysis results to a Google Cloud Storage or a BigQuery destination. For Cloud Storage destination, the output format is the JSON format that represents a [AnalyzeIamPolicyResponse][google.cloud.asset.v1.AnalyzeIamPolicyResponse]. This method implements the [google.longrunning.Operation][google.longrunning.Operation], which allows you to track the operation status. We recommend intervals of at least 2 seconds with exponential backoff retry to poll the operation result. The metadata contains the metadata for the long-running operation.", + "canonical": true, + "file": "asset_service.analyze_iam_policy_longrunning.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeIamPolicyLongrunning", + "fullName": "google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning", + "async": true, + "parameters": [ + { + "name": "analysis_query", + "type": ".google.cloud.asset.v1.IamPolicyAnalysisQuery" + }, + { + "name": "output_config", + "type": ".google.cloud.asset.v1.IamPolicyAnalysisOutputConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "AnalyzeIamPolicyLongrunning", + "fullName": "google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_AnalyzeMove_async", + "title": "AssetService analyzeMove Sample", + "origin": "API_DEFINITION", + "description": " Analyze moving a resource to a specified destination without kicking off the actual move. The analysis is best effort depending on the user's permissions of viewing different hierarchical policies and configurations. The policies and configuration are subject to change before the actual resource migration takes place.", + "canonical": true, + "file": "asset_service.analyze_move.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeMove", + "fullName": "google.cloud.asset.v1.AssetService.AnalyzeMove", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "destination_parent", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.asset.v1.AnalyzeMoveRequest.AnalysisView" + } + ], + "resultType": ".google.cloud.asset.v1.AnalyzeMoveResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "AnalyzeMove", + "fullName": "google.cloud.asset.v1.AssetService.AnalyzeMove", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js b/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js index 41382c6cea2..efca9eea6a8 100644 --- a/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js +++ b/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_resources.js b/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_resources.js index 6e059aaf175..f61f89b07d9 100644 --- a/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_resources.js +++ b/packages/google-cloud-asset/samples/generated/v1p1beta1/asset_service.search_all_resources.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json b/packages/google-cloud-asset/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json new file mode 100644 index 00000000000..f1b632e5652 --- /dev/null +++ b/packages/google-cloud-asset/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json @@ -0,0 +1,127 @@ +{ + "clientLibrary": { + "name": "nodejs-asset", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.asset.v1p1beta1", + "version": "v1p1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async", + "title": "AssetService searchAllResources Sample", + "origin": "API_DEFINITION", + "description": " Searches all the resources under a given accessible CRM scope (project/folder/organization). This RPC gives callers especially admins the ability to search all the resources under a scope, even if they don't have .get permission of all the resources. Callers should have cloud.assets.SearchAllResources permission on the requested scope, otherwise it will be rejected.", + "canonical": true, + "file": "asset_service.search_all_resources.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAllResources", + "fullName": "google.cloud.asset.v1p1beta1.AssetService.SearchAllResources", + "async": true, + "parameters": [ + { + "name": "scope", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "asset_types", + "type": "TYPE_STRING[]" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1p1beta1.SearchAllResourcesResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p1beta1.AssetServiceClient" + }, + "method": { + "shortName": "SearchAllResources", + "fullName": "google.cloud.asset.v1p1beta1.AssetService.SearchAllResources", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p1beta1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async", + "title": "AssetService searchAllIamPolicies Sample", + "origin": "API_DEFINITION", + "description": " Searches all the IAM policies under a given accessible CRM scope (project/folder/organization). This RPC gives callers especially admins the ability to search all the IAM policies under a scope, even if they don't have .getIamPolicy permission of all the IAM policies. Callers should have cloud.assets.SearchAllIamPolicies permission on the requested scope, otherwise it will be rejected.", + "canonical": true, + "file": "asset_service.search_all_iam_policies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAllIamPolicies", + "fullName": "google.cloud.asset.v1p1beta1.AssetService.SearchAllIamPolicies", + "async": true, + "parameters": [ + { + "name": "scope", + "type": "TYPE_STRING" + }, + { + "name": "query", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1p1beta1.SearchAllIamPoliciesResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p1beta1.AssetServiceClient" + }, + "method": { + "shortName": "SearchAllIamPolicies", + "fullName": "google.cloud.asset.v1p1beta1.AssetService.SearchAllIamPolicies", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p1beta1.AssetService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.create_feed.js b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.create_feed.js index ac08a7406b5..3c5c9593d12 100644 --- a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.create_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.create_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.delete_feed.js b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.delete_feed.js index 7f5b63b5d1d..afb214a4735 100644 --- a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.delete_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.delete_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.get_feed.js b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.get_feed.js index 1d66a374f56..ceea2505f70 100644 --- a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.get_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.get_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.list_feeds.js b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.list_feeds.js index cfa0817c6e4..b4fb74eef3f 100644 --- a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.list_feeds.js +++ b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.list_feeds.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.update_feed.js b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.update_feed.js index 2b2665b0f58..b52f8607c19 100644 --- a/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.update_feed.js +++ b/packages/google-cloud-asset/samples/generated/v1p2beta1/asset_service.update_feed.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json b/packages/google-cloud-asset/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json new file mode 100644 index 00000000000..d2c511b580b --- /dev/null +++ b/packages/google-cloud-asset/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json @@ -0,0 +1,227 @@ +{ + "clientLibrary": { + "name": "nodejs-asset", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.asset.v1p2beta1", + "version": "v1p2beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async", + "title": "AssetService createFeed Sample", + "origin": "API_DEFINITION", + "description": " Creates a feed in a parent project/folder/organization to listen to its asset updates.", + "canonical": true, + "file": "asset_service.create_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.CreateFeed", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "feed_id", + "type": "TYPE_STRING" + }, + { + "name": "feed", + "type": ".google.cloud.asset.v1p2beta1.Feed" + } + ], + "resultType": ".google.cloud.asset.v1p2beta1.Feed", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p2beta1.AssetServiceClient" + }, + "method": { + "shortName": "CreateFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.CreateFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p2beta1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1p2beta1_generated_AssetService_GetFeed_async", + "title": "AssetService getFeed Sample", + "origin": "API_DEFINITION", + "description": " Gets details about an asset feed.", + "canonical": true, + "file": "asset_service.get_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.GetFeed", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1p2beta1.Feed", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p2beta1.AssetServiceClient" + }, + "method": { + "shortName": "GetFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.GetFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p2beta1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1p2beta1_generated_AssetService_ListFeeds_async", + "title": "AssetService listFeeds Sample", + "origin": "API_DEFINITION", + "description": " Lists all asset feeds in a parent project/folder/organization.", + "canonical": true, + "file": "asset_service.list_feeds.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFeeds", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.ListFeeds", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1p2beta1.ListFeedsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p2beta1.AssetServiceClient" + }, + "method": { + "shortName": "ListFeeds", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.ListFeeds", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p2beta1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async", + "title": "AssetService updateFeed Sample", + "origin": "API_DEFINITION", + "description": " Updates an asset feed configuration.", + "canonical": true, + "file": "asset_service.update_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.UpdateFeed", + "async": true, + "parameters": [ + { + "name": "feed", + "type": ".google.cloud.asset.v1p2beta1.Feed" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.asset.v1p2beta1.Feed", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p2beta1.AssetServiceClient" + }, + "method": { + "shortName": "UpdateFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.UpdateFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p2beta1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1p2beta1_generated_AssetService_DeleteFeed_async", + "title": "AssetService deleteFeed Sample", + "origin": "API_DEFINITION", + "description": " Deletes an asset feed.", + "canonical": true, + "file": "asset_service.delete_feed.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.DeleteFeed", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p2beta1.AssetServiceClient" + }, + "method": { + "shortName": "DeleteFeed", + "fullName": "google.cloud.asset.v1p2beta1.AssetService.DeleteFeed", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p2beta1.AssetService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.analyze_iam_policy.js b/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.analyze_iam_policy.js index ed513d717a4..0804e39187f 100644 --- a/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.analyze_iam_policy.js +++ b/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.analyze_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.export_iam_policy_analysis.js b/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.export_iam_policy_analysis.js index 448aaaf618e..2f900b530de 100644 --- a/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.export_iam_policy_analysis.js +++ b/packages/google-cloud-asset/samples/generated/v1p4beta1/asset_service.export_iam_policy_analysis.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p4beta1/snippet_metadata.google.cloud.asset.v1p4beta1.json b/packages/google-cloud-asset/samples/generated/v1p4beta1/snippet_metadata.google.cloud.asset.v1p4beta1.json new file mode 100644 index 00000000000..1793d3cb453 --- /dev/null +++ b/packages/google-cloud-asset/samples/generated/v1p4beta1/snippet_metadata.google.cloud.asset.v1p4beta1.json @@ -0,0 +1,107 @@ +{ + "clientLibrary": { + "name": "nodejs-asset", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.asset.v1p4beta1", + "version": "v1p4beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudasset_v1p4beta1_generated_AssetService_AnalyzeIamPolicy_async", + "title": "AssetService analyzeIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Analyzes IAM policies based on the specified request. Returns a list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the request.", + "canonical": true, + "file": "asset_service.analyze_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeIamPolicy", + "fullName": "google.cloud.asset.v1p4beta1.AssetService.AnalyzeIamPolicy", + "async": true, + "parameters": [ + { + "name": "analysis_query", + "type": ".google.cloud.asset.v1p4beta1.IamPolicyAnalysisQuery" + }, + { + "name": "options", + "type": ".google.cloud.asset.v1p4beta1.AnalyzeIamPolicyRequest.Options" + } + ], + "resultType": ".google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p4beta1.AssetServiceClient" + }, + "method": { + "shortName": "AnalyzeIamPolicy", + "fullName": "google.cloud.asset.v1p4beta1.AssetService.AnalyzeIamPolicy", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p4beta1.AssetService" + } + } + } + }, + { + "regionTag": "cloudasset_v1p4beta1_generated_AssetService_ExportIamPolicyAnalysis_async", + "title": "AssetService exportIamPolicyAnalysis Sample", + "origin": "API_DEFINITION", + "description": " Exports IAM policy analysis based on the specified request. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep track of the export. The metadata contains the request to help callers to map responses to requests.", + "canonical": true, + "file": "asset_service.export_iam_policy_analysis.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportIamPolicyAnalysis", + "fullName": "google.cloud.asset.v1p4beta1.AssetService.ExportIamPolicyAnalysis", + "async": true, + "parameters": [ + { + "name": "analysis_query", + "type": ".google.cloud.asset.v1p4beta1.IamPolicyAnalysisQuery" + }, + { + "name": "options", + "type": ".google.cloud.asset.v1p4beta1.ExportIamPolicyAnalysisRequest.Options" + }, + { + "name": "output_config", + "type": ".google.cloud.asset.v1p4beta1.IamPolicyAnalysisOutputConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p4beta1.AssetServiceClient" + }, + "method": { + "shortName": "ExportIamPolicyAnalysis", + "fullName": "google.cloud.asset.v1p4beta1.AssetService.ExportIamPolicyAnalysis", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p4beta1.AssetService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-asset/samples/generated/v1p5beta1/asset_service.list_assets.js b/packages/google-cloud-asset/samples/generated/v1p5beta1/asset_service.list_assets.js index 2690cf42a71..f009cb69c68 100644 --- a/packages/google-cloud-asset/samples/generated/v1p5beta1/asset_service.list_assets.js +++ b/packages/google-cloud-asset/samples/generated/v1p5beta1/asset_service.list_assets.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// 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 // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/packages/google-cloud-asset/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json b/packages/google-cloud-asset/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json new file mode 100644 index 00000000000..0f3a6b108d7 --- /dev/null +++ b/packages/google-cloud-asset/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json @@ -0,0 +1,75 @@ +{ + "clientLibrary": { + "name": "nodejs-asset", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.asset.v1p5beta1", + "version": "v1p5beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudasset_v1p5beta1_generated_AssetService_ListAssets_async", + "title": "AssetService listAssets Sample", + "origin": "API_DEFINITION", + "description": " Lists assets with time and resource types and returns paged results in response.", + "canonical": true, + "file": "asset_service.list_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAssets", + "fullName": "google.cloud.asset.v1p5beta1.AssetService.ListAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "asset_types", + "type": "TYPE_STRING[]" + }, + { + "name": "content_type", + "type": ".google.cloud.asset.v1p5beta1.ContentType" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.asset.v1p5beta1.ListAssetsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1p5beta1.AssetServiceClient" + }, + "method": { + "shortName": "ListAssets", + "fullName": "google.cloud.asset.v1p5beta1.AssetService.ListAssets", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1p5beta1.AssetService" + } + } + } + } + ] +} diff --git a/packages/google-cloud-asset/src/v1/asset_service_client.ts b/packages/google-cloud-asset/src/v1/asset_service_client.ts index 42e6f815929..1d1725ec543 100644 --- a/packages/google-cloud-asset/src/v1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1/asset_service_client.ts @@ -3154,9 +3154,8 @@ export class AssetServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.assetServiceStub!.then(stub => { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts index 2c48b86567d..b6c159dd5b0 100644 --- a/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p1beta1/asset_service_client.ts @@ -817,9 +817,8 @@ export class AssetServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.assetServiceStub!.then(stub => { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts index 0dd41509be8..202899c3822 100644 --- a/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p2beta1/asset_service_client.ts @@ -885,9 +885,8 @@ export class AssetServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.assetServiceStub!.then(stub => { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts index 818e203b832..6074a83eb71 100644 --- a/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p4beta1/asset_service_client.ts @@ -573,9 +573,8 @@ export class AssetServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.assetServiceStub!.then(stub => { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts b/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts index 34d540d0d2b..f262b6f9298 100644 --- a/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts +++ b/packages/google-cloud-asset/src/v1p5beta1/asset_service_client.ts @@ -684,9 +684,8 @@ export class AssetServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.assetServiceStub!.then(stub => { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1.ts index 30d83ff8683..d33830697af 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1.ts @@ -183,12 +183,27 @@ describe('v1.AssetServiceClient', () => { assert(client.assetServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new assetserviceModule.v1.AssetServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.assetServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -338,6 +353,25 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes batchGetAssetsHistory with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.batchGetAssetsHistory(request), + expectedError + ); + }); }); describe('createFeed', () => { @@ -449,6 +483,22 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createFeed with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.CreateFeedRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFeed(request), expectedError); + }); }); describe('getFeed', () => { @@ -557,6 +607,22 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getFeed with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.GetFeedRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeed(request), expectedError); + }); }); describe('listFeeds', () => { @@ -665,6 +731,22 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes listFeeds with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.ListFeedsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFeeds(request), expectedError); + }); }); describe('updateFeed', () => { @@ -779,6 +861,23 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateFeed with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.UpdateFeedRequest() + ); + request.feed = {}; + request.feed.name = ''; + const expectedHeaderRequestParams = 'feed.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFeed(request), expectedError); + }); }); describe('deleteFeed', () => { @@ -890,6 +989,22 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteFeed with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.DeleteFeedRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteFeed(request), expectedError); + }); }); describe('analyzeIamPolicy', () => { @@ -1004,6 +1119,23 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes analyzeIamPolicy with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.AnalyzeIamPolicyRequest() + ); + request.analysisQuery = {}; + request.analysisQuery.scope = ''; + const expectedHeaderRequestParams = 'analysis_query.scope='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeIamPolicy(request), expectedError); + }); }); describe('analyzeMove', () => { @@ -1115,6 +1247,22 @@ describe('v1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes analyzeMove with closed client', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1.AnalyzeMoveRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeMove(request), expectedError); + }); }); describe('exportAssets', () => { diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts index b5bec5f99bf..09f86e7f2f1 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p1beta1.ts @@ -153,12 +153,27 @@ describe('v1p1beta1.AssetServiceClient', () => { assert(client.assetServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.assetServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts index 7908021622e..01dff776f25 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p2beta1.ts @@ -90,12 +90,27 @@ describe('v1p2beta1.AssetServiceClient', () => { assert(client.assetServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.assetServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -241,6 +256,22 @@ describe('v1p2beta1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createFeed with closed client', async () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.CreateFeedRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFeed(request), expectedError); + }); }); describe('getFeed', () => { @@ -349,6 +380,22 @@ describe('v1p2beta1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes getFeed with closed client', async () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.GetFeedRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeed(request), expectedError); + }); }); describe('listFeeds', () => { @@ -457,6 +504,22 @@ describe('v1p2beta1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes listFeeds with closed client', async () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.ListFeedsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFeeds(request), expectedError); + }); }); describe('updateFeed', () => { @@ -571,6 +634,23 @@ describe('v1p2beta1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes updateFeed with closed client', async () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.UpdateFeedRequest() + ); + request.feed = {}; + request.feed.name = ''; + const expectedHeaderRequestParams = 'feed.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFeed(request), expectedError); + }); }); describe('deleteFeed', () => { @@ -682,6 +762,22 @@ describe('v1p2beta1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes deleteFeed with closed client', async () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.DeleteFeedRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteFeed(request), expectedError); + }); }); describe('Path templates', () => { diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts index b618aa9556c..509d597b226 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p4beta1.ts @@ -122,12 +122,27 @@ describe('v1p4beta1.AssetServiceClient', () => { assert(client.assetServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new assetserviceModule.v1p4beta1.AssetServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.assetServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new assetserviceModule.v1p4beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -276,6 +291,23 @@ describe('v1p4beta1.AssetServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes analyzeIamPolicy with closed client', async () => { + const client = new assetserviceModule.v1p4beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p4beta1.AnalyzeIamPolicyRequest() + ); + request.analysisQuery = {}; + request.analysisQuery.parent = ''; + const expectedHeaderRequestParams = 'analysis_query.parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeIamPolicy(request), expectedError); + }); }); describe('exportIamPolicyAnalysis', () => { diff --git a/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts b/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts index 93e094962db..40c82a12fef 100644 --- a/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts +++ b/packages/google-cloud-asset/test/gapic_asset_service_v1p5beta1.ts @@ -153,12 +153,27 @@ describe('v1p5beta1.AssetServiceClient', () => { assert(client.assetServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.assetServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => {