From 1cc1335c596d3e41c7db4198b7b75b829040708e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 19 Sep 2022 21:59:32 +0000 Subject: [PATCH 1/3] feat: Add client library support for AssetService v1 SavedQuery APIs Committer: jeffreyai@ PiperOrigin-RevId: 475366952 Source-Link: https://github.com/googleapis/googleapis/commit/7428dad9f642a1b74fe4c4a23efe2d84234ac27f Source-Link: https://github.com/googleapis/googleapis-gen/commit/5629e2ab728443a1a6abb03f34f925d5cd4e0c47 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTYyOWUyYWI3Mjg0NDNhMWE2YWJiMDNmMzRmOTI1ZDVjZDRlMGM0NyJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../google/cloud/asset/v1/asset_service.proto | 2072 +++++++++ .../protos/google/cloud/asset/v1/assets.proto | 919 ++++ .../google/cloud/osconfig/v1/inventory.proto | 384 ++ .../google/cloud/osconfig/v1/os_policy.proto | 548 +++ .../v1/os_policy_assignment_reports.proto | 296 ++ .../osconfig/v1/os_policy_assignments.proto | 386 ++ .../cloud/osconfig/v1/osconfig_common.proto | 38 + .../cloud/osconfig/v1/osconfig_service.proto | 158 + .../osconfig/v1/osconfig_zonal_service.proto | 202 + .../cloud/osconfig/v1/patch_deployments.proto | 339 ++ .../google/cloud/osconfig/v1/patch_jobs.proto | 742 +++ .../cloud/osconfig/v1/vulnerability.proto | 365 ++ .../v1/asset_service.analyze_iam_policy.js | 89 + ..._service.analyze_iam_policy_longrunning.js | 84 + .../v1/asset_service.analyze_move.js | 78 + .../asset_service.batch_get_assets_history.js | 104 + ...ervice.batch_get_effective_iam_policies.js | 77 + .../generated/v1/asset_service.create_feed.js | 79 + .../v1/asset_service.create_saved_query.js | 82 + .../generated/v1/asset_service.delete_feed.js | 64 + .../v1/asset_service.delete_saved_query.js | 65 + .../v1/asset_service.export_assets.js | 119 + .../generated/v1/asset_service.get_feed.js | 64 + .../v1/asset_service.get_saved_query.js | 64 + .../generated/v1/asset_service.list_assets.js | 126 + .../generated/v1/asset_service.list_feeds.js | 63 + .../v1/asset_service.list_saved_queries.js | 88 + .../v1/asset_service.query_assets.js | 123 + .../asset_service.search_all_iam_policies.js | 160 + .../v1/asset_service.search_all_resources.js | 204 + .../generated/v1/asset_service.update_feed.js | 72 + .../v1/asset_service.update_saved_query.js | 71 + ...nippet_metadata.google.cloud.asset.v1.json | 1015 +++++ owl-bot-staging/v1/src/index.ts | 25 + .../v1/src/v1/asset_service_client.ts | 4043 +++++++++++++++++ .../src/v1/asset_service_client_config.json | 128 + .../v1/src/v1/asset_service_proto_list.json | 10 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 239 + owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_asset_service_v1.ts | 3697 +++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1p1beta1/.eslintignore | 7 + owl-bot-staging/v1p1beta1/.eslintrc.json | 3 + owl-bot-staging/v1p1beta1/.gitignore | 14 + owl-bot-staging/v1p1beta1/.jsdoc.js | 55 + owl-bot-staging/v1p1beta1/.mocharc.js | 33 + owl-bot-staging/v1p1beta1/.prettierrc.js | 22 + owl-bot-staging/v1p1beta1/README.md | 1 + .../v1p1beta1/linkinator.config.json | 16 + owl-bot-staging/v1p1beta1/package.json | 64 + .../cloud/asset/v1p1beta1/asset_service.proto | 149 + .../google/cloud/asset/v1p1beta1/assets.proto | 113 + .../asset_service.search_all_iam_policies.js | 89 + .../asset_service.search_all_resources.js | 98 + ...metadata.google.cloud.asset.v1p1beta1.json | 127 + owl-bot-staging/v1p1beta1/src/index.ts | 25 + .../src/v1p1beta1/asset_service_client.ts | 782 ++++ .../asset_service_client_config.json | 36 + .../v1p1beta1/asset_service_proto_list.json | 4 + .../src/v1p1beta1/gapic_metadata.json | 51 + .../v1p1beta1/src/v1p1beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1p1beta1/system-test/install.ts | 49 + .../test/gapic_asset_service_v1p1beta1.ts | 687 +++ owl-bot-staging/v1p1beta1/tsconfig.json | 19 + owl-bot-staging/v1p1beta1/webpack.config.js | 64 + owl-bot-staging/v1p2beta1/.eslintignore | 7 + owl-bot-staging/v1p2beta1/.eslintrc.json | 3 + owl-bot-staging/v1p2beta1/.gitignore | 14 + owl-bot-staging/v1p2beta1/.jsdoc.js | 55 + owl-bot-staging/v1p2beta1/.mocharc.js | 33 + owl-bot-staging/v1p2beta1/.prettierrc.js | 22 + owl-bot-staging/v1p2beta1/README.md | 1 + .../v1p2beta1/linkinator.config.json | 16 + owl-bot-staging/v1p2beta1/package.json | 64 + .../cloud/asset/v1p2beta1/asset_service.proto | 259 ++ .../google/cloud/asset/v1p2beta1/assets.proto | 124 + .../v1p2beta1/asset_service.create_feed.js | 80 + .../v1p2beta1/asset_service.delete_feed.js | 64 + .../v1p2beta1/asset_service.get_feed.js | 64 + .../v1p2beta1/asset_service.list_feeds.js | 63 + .../v1p2beta1/asset_service.update_feed.js | 72 + ...metadata.google.cloud.asset.v1p2beta1.json | 227 + owl-bot-staging/v1p2beta1/src/index.ts | 25 + .../src/v1p2beta1/asset_service_client.ts | 816 ++++ .../asset_service_client_config.json | 51 + .../v1p2beta1/asset_service_proto_list.json | 4 + .../src/v1p2beta1/gapic_metadata.json | 73 + .../v1p2beta1/src/v1p2beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1p2beta1/system-test/install.ts | 49 + .../test/gapic_asset_service_v1p2beta1.ts | 811 ++++ owl-bot-staging/v1p2beta1/tsconfig.json | 19 + owl-bot-staging/v1p2beta1/webpack.config.js | 64 + owl-bot-staging/v1p5beta1/.eslintignore | 7 + owl-bot-staging/v1p5beta1/.eslintrc.json | 3 + owl-bot-staging/v1p5beta1/.gitignore | 14 + owl-bot-staging/v1p5beta1/.jsdoc.js | 55 + owl-bot-staging/v1p5beta1/.mocharc.js | 33 + owl-bot-staging/v1p5beta1/.prettierrc.js | 22 + owl-bot-staging/v1p5beta1/README.md | 1 + .../v1p5beta1/linkinator.config.json | 16 + owl-bot-staging/v1p5beta1/package.json | 64 + .../cloud/asset/v1p5beta1/asset_service.proto | 112 + .../google/cloud/asset/v1p5beta1/assets.proto | 124 + .../v1p5beta1/asset_service.list_assets.js | 98 + ...metadata.google.cloud.asset.v1p5beta1.json | 75 + owl-bot-staging/v1p5beta1/src/index.ts | 25 + .../src/v1p5beta1/asset_service_client.ts | 664 +++ .../asset_service_client_config.json | 30 + .../v1p5beta1/asset_service_proto_list.json | 9 + .../src/v1p5beta1/gapic_metadata.json | 37 + .../v1p5beta1/src/v1p5beta1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1p5beta1/system-test/install.ts | 49 + .../test/gapic_asset_service_v1p5beta1.ts | 551 +++ owl-bot-staging/v1p5beta1/tsconfig.json | 19 + owl-bot-staging/v1p5beta1/webpack.config.js | 64 + 134 files changed, 25801 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/asset_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/asset_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/asset_service_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_asset_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1p1beta1/.eslintignore create mode 100644 owl-bot-staging/v1p1beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1p1beta1/.gitignore create mode 100644 owl-bot-staging/v1p1beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1p1beta1/.mocharc.js create mode 100644 owl-bot-staging/v1p1beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1p1beta1/README.md create mode 100644 owl-bot-staging/v1p1beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1p1beta1/package.json create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto create mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js create mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json create mode 100644 owl-bot-staging/v1p1beta1/src/index.ts create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts create mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1p1beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts create mode 100644 owl-bot-staging/v1p1beta1/tsconfig.json create mode 100644 owl-bot-staging/v1p1beta1/webpack.config.js create mode 100644 owl-bot-staging/v1p2beta1/.eslintignore create mode 100644 owl-bot-staging/v1p2beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1p2beta1/.gitignore create mode 100644 owl-bot-staging/v1p2beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1p2beta1/.mocharc.js create mode 100644 owl-bot-staging/v1p2beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1p2beta1/README.md create mode 100644 owl-bot-staging/v1p2beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1p2beta1/package.json create mode 100644 owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto create mode 100644 owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto create mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js create mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js create mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js create mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js create mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js create mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json create mode 100644 owl-bot-staging/v1p2beta1/src/index.ts create mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts create mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json create mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json create mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts create mode 100644 owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1p2beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts create mode 100644 owl-bot-staging/v1p2beta1/tsconfig.json create mode 100644 owl-bot-staging/v1p2beta1/webpack.config.js create mode 100644 owl-bot-staging/v1p5beta1/.eslintignore create mode 100644 owl-bot-staging/v1p5beta1/.eslintrc.json create mode 100644 owl-bot-staging/v1p5beta1/.gitignore create mode 100644 owl-bot-staging/v1p5beta1/.jsdoc.js create mode 100644 owl-bot-staging/v1p5beta1/.mocharc.js create mode 100644 owl-bot-staging/v1p5beta1/.prettierrc.js create mode 100644 owl-bot-staging/v1p5beta1/README.md create mode 100644 owl-bot-staging/v1p5beta1/linkinator.config.json create mode 100644 owl-bot-staging/v1p5beta1/package.json create mode 100644 owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto create mode 100644 owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto create mode 100644 owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js create mode 100644 owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json create mode 100644 owl-bot-staging/v1p5beta1/src/index.ts create mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts create mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json create mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json create mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json create mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts create mode 100644 owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1p5beta1/system-test/install.ts create mode 100644 owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts create mode 100644 owl-bot-staging/v1p5beta1/tsconfig.json create mode 100644 owl-bot-staging/v1p5beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 00000000..a40ee8ff --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/asset', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 00000000..481c522b --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 00000000..b35f3a5e --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Asset: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 00000000..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 00000000..4d04e08d --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/asset", + "version": "0.1.0", + "description": "Asset client for Node.js", + "repository": "googleapis/nodejs-asset", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google asset", + "asset", + "asset service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto b/owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto new file mode 100644 index 00000000..1c343272 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto @@ -0,0 +1,2072 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.asset.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/asset/v1/assets.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/expr.proto"; + +option csharp_namespace = "Google.Cloud.Asset.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetServiceProto"; +option java_package = "com.google.cloud.asset.v1"; +option php_namespace = "Google\\Cloud\\Asset\\V1"; + +// Asset service definition. +service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // 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. + rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=*/*}:exportAssets" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.asset.v1.ExportAssetsResponse" + metadata_type: "google.cloud.asset.v1.ExportAssetsRequest" + }; + } + + // Lists assets with time and resource types and returns paged results in + // response. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=*/*}/assets" + }; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) + returns (BatchGetAssetsHistoryResponse) { + option (google.api.http) = { + get: "/v1/{parent=*/*}:batchGetAssetsHistory" + }; + } + + // Creates a feed in a parent project/folder/organization to listen to its + // asset updates. + rpc CreateFeed(CreateFeedRequest) returns (Feed) { + option (google.api.http) = { + post: "/v1/{parent=*/*}/feeds" + body: "*" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about an asset feed. + rpc GetFeed(GetFeedRequest) returns (Feed) { + option (google.api.http) = { + get: "/v1/{name=*/*/feeds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all asset feeds in a parent project/folder/organization. + rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { + option (google.api.http) = { + get: "/v1/{parent=*/*}/feeds" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates an asset feed configuration. + rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { + option (google.api.http) = { + patch: "/v1/{feed.name=*/*/feeds/*}" + body: "*" + }; + option (google.api.method_signature) = "feed"; + } + + // Deletes an asset feed. + rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=*/*/feeds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // 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. + rpc SearchAllResources(SearchAllResourcesRequest) + returns (SearchAllResourcesResponse) { + option (google.api.http) = { + get: "/v1/{scope=*/*}:searchAllResources" + }; + option (google.api.method_signature) = "scope,query,asset_types"; + } + + // 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. + rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) + returns (SearchAllIamPoliciesResponse) { + option (google.api.http) = { + get: "/v1/{scope=*/*}:searchAllIamPolicies" + }; + option (google.api.method_signature) = "scope,query"; + } + + // Analyzes IAM policies to answer which identities have what accesses on + // which resources. + rpc AnalyzeIamPolicy(AnalyzeIamPolicyRequest) + returns (AnalyzeIamPolicyResponse) { + option (google.api.http) = { + get: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicy" + }; + } + + // 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. + rpc AnalyzeIamPolicyLongrunning(AnalyzeIamPolicyLongrunningRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicyLongrunning" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse" + metadata_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata" + }; + } + + // 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. + rpc AnalyzeMove(AnalyzeMoveRequest) returns (AnalyzeMoveResponse) { + option (google.api.http) = { + get: "/v1/{resource=*/*}:analyzeMove" + }; + } + + // Issue a job that queries assets using a SQL statement compatible with + // [BigQuery Standard + // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + // + // If the query execution finishes within timeout and there's no pagination, + // the full query results will be returned in the `QueryAssetsResponse`. + // + // Otherwise, full query results can be obtained by issuing extra requests + // with the `job_reference` from the a previous `QueryAssets` call. + // + // Note, the query result has approximately 10 GB limitation enforced by + // BigQuery + // https://cloud.google.com/bigquery/docs/best-practices-performance-output, + // queries return larger results will result in errors. + rpc QueryAssets(QueryAssetsRequest) returns (QueryAssetsResponse) { + option (google.api.http) = { + post: "/v1/{parent=*/*}:queryAssets" + body: "*" + }; + } + + // Creates a saved query in a parent project/folder/organization. + rpc CreateSavedQuery(CreateSavedQueryRequest) returns (SavedQuery) { + option (google.api.http) = { + post: "/v1/{parent=*/*}/savedQueries" + body: "saved_query" + }; + option (google.api.method_signature) = "parent,saved_query,saved_query_id"; + } + + // Gets details about a saved query. + rpc GetSavedQuery(GetSavedQueryRequest) returns (SavedQuery) { + option (google.api.http) = { + get: "/v1/{name=*/*/savedQueries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all saved queries in a parent project/folder/organization. + rpc ListSavedQueries(ListSavedQueriesRequest) + returns (ListSavedQueriesResponse) { + option (google.api.http) = { + get: "/v1/{parent=*/*}/savedQueries" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a saved query. + rpc UpdateSavedQuery(UpdateSavedQueryRequest) returns (SavedQuery) { + option (google.api.http) = { + patch: "/v1/{saved_query.name=*/*/savedQueries/*}" + body: "saved_query" + }; + option (google.api.method_signature) = "saved_query,update_mask"; + } + + // Deletes a saved query. + rpc DeleteSavedQuery(DeleteSavedQueryRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=*/*/savedQueries/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets effective IAM policies for a batch of resources. + rpc BatchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest) + returns (BatchGetEffectiveIamPoliciesResponse) { + option (google.api.http) = { + get: "/v1/{scope=*/*}/effectiveIamPolicies:batchGet" + }; + } +} + +// Represents the metadata of the longrunning operation for the +// AnalyzeIamPolicyLongrunning rpc. +message AnalyzeIamPolicyLongrunningMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Export asset request. +message ExportAssetsRequest { + // Required. The relative name of the root asset. This can only be an + // organization number (such as "organizations/123"), a project ID (such as + // "projects/my-project-id"), or a project number (such as "projects/12345"), + // or a folder number (such as "folders/123"). + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; + + // Timestamp to take an asset snapshot. This can only be set to a timestamp + // between the current time and the current time minus 35 days (inclusive). + // If not specified, the current time will be used. Due to delays in resource + // data collection and indexing, there is a volatile window during which + // running the same query may get different results. + google.protobuf.Timestamp read_time = 2; + + // A list of asset types to take a snapshot for. For example: + // "compute.googleapis.com/Disk". + // + // Regular expressions are also supported. For example: + // + // * "compute.googleapis.com.*" snapshots resources whose asset type starts + // with "compute.googleapis.com". + // * ".*Instance" snapshots resources whose asset type ends with "Instance". + // * ".*Instance.*" snapshots resources whose asset type contains "Instance". + // + // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + // regular expression syntax. If the regular expression does not match any + // supported asset type, an INVALID_ARGUMENT error will be returned. + // + // If specified, only matching assets will be returned, otherwise, it will + // snapshot all asset types. See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) + // for all supported asset types. + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name will be + // returned. + ContentType content_type = 4; + + // Required. Output configuration indicating where the results will be output + // to. + OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED]; + + // A list of relationship types to export, for example: + // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + // content_type=RELATIONSHIP. + // * If specified: + // it snapshots specified relationships. It returns an error if + // any of the [relationship_types] doesn't belong to the supported + // relationship types of the [asset_types] or if any of the [asset_types] + // doesn't belong to the source types of the [relationship_types]. + // * Otherwise: + // it snapshots the supported relationships for all [asset_types] or returns + // an error if any of the [asset_types] has no relationship support. + // An unspecified asset types field means all supported asset_types. + // See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all + // supported asset types and relationship types. + repeated string relationship_types = 6; +} + +// The export asset response. This message is returned by the +// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] +// method in the returned +// [google.longrunning.Operation.response][google.longrunning.Operation.response] +// field. +message ExportAssetsResponse { + // Time the snapshot was taken. + google.protobuf.Timestamp read_time = 1; + + // Output configuration indicating where the results were output to. + OutputConfig output_config = 2; + + // Output result indicating where the assets were exported to. For example, a + // set of actual Google Cloud Storage object uris where the assets are + // exported to. The uris can be different from what [output_config] has + // specified, as the service will split the output object into multiple ones + // once it exceeds a single Google Cloud Storage object limit. + OutputResult output_result = 3; +} + +// ListAssets request. +message ListAssetsRequest { + // 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"). + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; + + // Timestamp to take an asset snapshot. This can only be set to a timestamp + // between the current time and the current time minus 35 days (inclusive). + // If not specified, the current time will be used. Due to delays in resource + // data collection and indexing, there is a volatile window during which + // running the same query may get different results. + google.protobuf.Timestamp read_time = 2; + + // A list of asset types to take a snapshot for. For example: + // "compute.googleapis.com/Disk". + // + // Regular expression is also supported. For example: + // + // * "compute.googleapis.com.*" snapshots resources whose asset type starts + // with "compute.googleapis.com". + // * ".*Instance" snapshots resources whose asset type ends with "Instance". + // * ".*Instance.*" snapshots resources whose asset type contains "Instance". + // + // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + // regular expression syntax. If the regular expression does not match any + // supported asset type, an INVALID_ARGUMENT error will be returned. + // + // If specified, only matching assets will be returned, otherwise, it will + // snapshot all asset types. See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) + // for all supported asset types. + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name will + // be returned. + ContentType content_type = 4; + + // The maximum number of assets to be returned in a single response. Default + // is 100, minimum is 1, and maximum is 1000. + int32 page_size = 5; + + // The `next_page_token` returned from the previous `ListAssetsResponse`, or + // unspecified for the first `ListAssetsRequest`. It is a continuation of a + // prior `ListAssets` call, and the API should return the next page of assets. + string page_token = 6; + + // A list of relationship types to output, for example: + // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + // content_type=RELATIONSHIP. + // * If specified: + // it snapshots specified relationships. It returns an error if + // any of the [relationship_types] doesn't belong to the supported + // relationship types of the [asset_types] or if any of the [asset_types] + // doesn't belong to the source types of the [relationship_types]. + // * Otherwise: + // it snapshots the supported relationships for all [asset_types] or returns + // an error if any of the [asset_types] has no relationship support. + // An unspecified asset types field means all supported asset_types. + // See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) + // for all supported asset types and relationship types. + repeated string relationship_types = 7; +} + +// ListAssets response. +message ListAssetsResponse { + // Time the snapshot was taken. + google.protobuf.Timestamp read_time = 1; + + // Assets. + repeated Asset assets = 2; + + // Token to retrieve the next page of results. It expires 72 hours after the + // page token for the first page is generated. Set to empty if there are no + // remaining results. + string next_page_token = 3; +} + +// Batch get assets history request. +message BatchGetAssetsHistoryRequest { + // Required. The relative name of the root asset. It can only be an + // organization number (such as "organizations/123"), a project ID (such as + // "projects/my-project-id")", or a project number (such as "projects/12345"). + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; + + // A list of the full names of the assets. + // See: https://cloud.google.com/asset-inventory/docs/resource-name-format + // Example: + // + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // + // The request becomes a no-op if the asset name list is empty, and the max + // size of the asset name list is 100 in one request. + repeated string asset_names = 2; + + // Optional. The content type. + ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The time window for the asset history. Both start_time and + // end_time are optional and if set, it must be after the current time minus + // 35 days. If end_time is not set, it is default to current timestamp. + // If start_time is not set, the snapshot of the assets at end_time will be + // returned. The returned results contain all temporal assets whose time + // window overlap with read_time_window. + TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of relationship types to output, for example: + // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + // content_type=RELATIONSHIP. + // * If specified: + // it outputs specified relationships' history on the [asset_names]. It + // returns an error if any of the [relationship_types] doesn't belong to the + // supported relationship types of the [asset_names] or if any of the + // [asset_names]'s types doesn't belong to the source types of the + // [relationship_types]. + // * Otherwise: + // it outputs the supported relationships' history on the [asset_names] or + // returns an error if any of the [asset_names]'s types has no relationship + // support. + // See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all + // supported asset types and relationship types. + repeated string relationship_types = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Batch get assets history response. +message BatchGetAssetsHistoryResponse { + // A list of assets with valid time windows. + repeated TemporalAsset assets = 1; +} + +// Create asset feed request. +message CreateFeedRequest { + // Required. The name of the project/folder/organization where this feed + // 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"). + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. This is the client-assigned asset feed identifier and it needs to + // be unique under a specific parent project/folder/organization. + string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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 + Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Get asset feed request. +message GetFeedRequest { + // Required. The name of the Feed and it must be in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } + ]; +} + +// List asset feeds request. +message ListFeedsRequest { + // Required. The parent project/folder/organization whose feeds 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"). + string parent = 1 [(google.api.field_behavior) = REQUIRED]; +} + +message ListFeedsResponse { + // A list of feeds. + repeated Feed feeds = 1; +} + +// Update asset feed request. +message UpdateFeedRequest { + // 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. + Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only updates the `feed` fields indicated by this mask. + // The field mask must not be empty, and it must not contain fields that + // are immutable or only set by the server. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +message DeleteFeedRequest { + // Required. The name of the feed and it must be in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } + ]; +} + +// Output configuration for export assets destination. +message OutputConfig { + // Asset export destination. + oneof destination { + // Destination on Cloud Storage. + GcsDestination gcs_destination = 1; + + // Destination on BigQuery. The output table stores the fields in asset + // Protobuf as columns in BigQuery. + BigQueryDestination bigquery_destination = 2; + } +} + +// Output result of export assets. +message OutputResult { + // Asset export result. + oneof result { + // Export result on Cloud Storage. + GcsOutputResult gcs_result = 1; + } +} + +// A Cloud Storage output result. +message GcsOutputResult { + // List of uris of the Cloud Storage objects. Example: + // "gs://bucket_name/object_name". + repeated string uris = 1; +} + +// A Cloud Storage location. +message GcsDestination { + // Required. + oneof object_uri { + // The uri of the Cloud Storage object. It's the same uri that is used by + // gsutil. Example: "gs://bucket_name/object_name". See [Viewing and + // Editing Object + // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) + // for more information. + // + // If the specified Cloud Storage object already exists and there is no + // [hold](https://cloud.google.com/storage/docs/object-holds), it will be + // overwritten with the exported result. + string uri = 1; + + // The uri prefix of all generated Cloud Storage objects. Example: + // "gs://bucket_name/object_name_prefix". Each object uri is in format: + // "gs://bucket_name/object_name_prefix// and only + // contains assets for that type. starts from 0. Example: + // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is + // the first shard of output objects containing all + // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be + // returned if file with the same name "gs://bucket_name/object_name_prefix" + // already exists. + string uri_prefix = 2; + } +} + +// A BigQuery destination for exporting assets to. +message BigQueryDestination { + // Required. The BigQuery dataset in format + // "projects/projectId/datasets/datasetId", to which the snapshot result + // should be exported. If this dataset does not exist, the export call returns + // an INVALID_ARGUMENT error. Setting the `contentType` for `exportAssets` + // determines the + // [schema](/asset-inventory/docs/exporting-to-bigquery#bigquery-schema) + // of the BigQuery table. Setting `separateTablesPerAssetType` to `TRUE` also + // influences the schema. + string dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BigQuery table to which the snapshot result should be + // written. If this table does not exist, a new table with the given name + // will be created. + string table = 2 [(google.api.field_behavior) = REQUIRED]; + + // If the destination table already exists and this flag is `TRUE`, the + // table will be overwritten by the contents of assets snapshot. If the flag + // is `FALSE` or unset and the destination table already exists, the export + // call returns an INVALID_ARGUMEMT error. + bool force = 3; + + // [partition_spec] determines whether to export to partitioned table(s) and + // how to partition the data. + // + // If [partition_spec] is unset or [partition_spec.partition_key] is unset or + // `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to + // non-partitioned table(s). [force] will decide whether to overwrite existing + // table(s). + // + // If [partition_spec] is specified. First, the snapshot results will be + // written to partitioned table(s) with two additional timestamp columns, + // readTime and requestTime, one of which will be the partition key. Secondly, + // in the case when any destination table already exists, it will first try to + // update existing table's schema as necessary by appending additional + // columns. Then, if [force] is `TRUE`, the corresponding partition will be + // overwritten by the snapshot results (data in different partitions will + // remain intact); if [force] is unset or `FALSE`, it will append the data. An + // error will be returned if the schema update or data appension fails. + PartitionSpec partition_spec = 4; + + // If this flag is `TRUE`, the snapshot results will be written to one or + // multiple tables, each of which contains results of one asset type. The + // [force] and [partition_spec] fields will apply to each of them. + // + // Field [table] will be concatenated with "_" and the asset type names (see + // https://cloud.google.com/asset-inventory/docs/supported-asset-types for + // supported asset types) to construct per-asset-type table names, in which + // all non-alphanumeric characters like "." and "/" will be substituted by + // "_". Example: if field [table] is "mytable" and snapshot results + // contain "storage.googleapis.com/Bucket" assets, the corresponding table + // name will be "mytable_storage_googleapis_com_Bucket". If any of these + // tables does not exist, a new table with the concatenated name will be + // created. + // + // When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of + // each table will include RECORD-type columns mapped to the nested fields in + // the Asset.resource.data field of that asset type (up to the 15 nested level + // BigQuery supports + // (https://cloud.google.com/bigquery/docs/nested-repeated#limitations)). The + // fields in >15 nested levels will be stored in JSON format string as a child + // column of its parent RECORD column. + // + // If error occurs when exporting to any table, the whole export call will + // return an error but the export results that already succeed will persist. + // Example: if exporting to table_type_A succeeds when exporting to + // table_type_B fails during one export call, the results in table_type_A will + // persist and there will not be partial results persisting in a table. + bool separate_tables_per_asset_type = 5; +} + +// Specifications of BigQuery partitioned table as export destination. +message PartitionSpec { + // This enum is used to determine the partition key column when exporting + // assets to BigQuery partitioned table(s). Note that, if the partition key is + // a timestamp column, the actual partition is based on its date value + // (expressed in UTC. see details in + // https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables). + enum PartitionKey { + // Unspecified partition key. If used, it means using non-partitioned table. + PARTITION_KEY_UNSPECIFIED = 0; + + // The time when the snapshot is taken. If specified as partition key, the + // result table(s) is partitoned by the additional timestamp column, + // readTime. If [read_time] in ExportAssetsRequest is specified, the + // readTime column's value will be the same as it. Otherwise, its value will + // be the current time that is used to take the snapshot. + READ_TIME = 1; + + // The time when the request is received and started to be processed. If + // specified as partition key, the result table(s) is partitoned by the + // requestTime column, an additional timestamp column representing when the + // request was received. + REQUEST_TIME = 2; + } + + // The partition key for BigQuery partitioned table. + PartitionKey partition_key = 1; +} + +// A Pub/Sub destination. +message PubsubDestination { + // The name of the Pub/Sub topic to publish to. + // Example: `projects/PROJECT_ID/topics/TOPIC_ID`. + string topic = 1; +} + +// Output configuration for asset feed destination. +message FeedOutputConfig { + // Asset feed destination. + oneof destination { + // Destination on Pub/Sub. + PubsubDestination pubsub_destination = 1; + } +} + +// An asset feed used to export asset updates to a destinations. +// An asset feed filter controls what updates are exported. +// The asset feed must be created within a project, organization, or +// folder. Supported destinations are: +// Pub/Sub topics. +message Feed { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Feed" + pattern: "projects/{project}/feeds/{feed}" + pattern: "folders/{folder}/feeds/{feed}" + pattern: "organizations/{organization}/feeds/{feed}" + history: ORIGINALLY_SINGLE_PATTERN + }; + + // Required. The format will be + // projects/{project_number}/feeds/{client-assigned_feed_identifier} or + // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + // + // The client-assigned feed identifier must be unique within the parent + // project/folder/organization. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // A list of the full names of the assets to receive updates. You must specify + // either or both of asset_names and asset_types. Only asset updates matching + // specified asset_names or asset_types are exported to the feed. + // Example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // For a list of the full names for supported asset types, see [Resource + // name format](/asset-inventory/docs/resource-name-format). + repeated string asset_names = 2; + + // A list of types of the assets to receive updates. You must specify either + // or both of asset_names and asset_types. Only asset updates matching + // specified asset_names or asset_types are exported to the feed. + // Example: `"compute.googleapis.com/Disk"` + // + // For a list of all supported asset types, see + // [Supported asset types](/asset-inventory/docs/supported-asset-types). + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name and + // type will be returned. + ContentType content_type = 4; + + // Required. Feed output configuration defining where the asset updates are + // published to. + FeedOutputConfig feed_output_config = 5 + [(google.api.field_behavior) = REQUIRED]; + + // A condition which determines whether an asset update should be published. + // If specified, an asset will be returned only when the expression evaluates + // to true. + // When set, `expression` field in the `Expr` must be a valid [CEL expression] + // (https://github.com/google/cel-spec) on a TemporalAsset with name + // `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted + // == true") will only publish Asset deletions. Other fields of `Expr` are + // optional. + // + // See our [user + // guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition) + // for detailed instructions. + google.type.Expr condition = 6; + + // A list of relationship types to output, for example: + // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + // content_type=RELATIONSHIP. + // * If specified: + // it outputs specified relationship updates on the [asset_names] or the + // [asset_types]. It returns an error if any of the [relationship_types] + // doesn't belong to the supported relationship types of the [asset_names] or + // [asset_types], or any of the [asset_names] or the [asset_types] doesn't + // belong to the source types of the [relationship_types]. + // * Otherwise: + // it outputs the supported relationships of the types of [asset_names] and + // [asset_types] or returns an error if any of the [asset_names] or the + // [asset_types] has no replationship support. + // See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/asset-inventory/docs/overview) + // for all supported asset types and relationship types. + repeated string relationship_types = 7; +} + +// Search all resources request. +message SearchAllResourcesRequest { + // 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: + // + // * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. See [how to construct a + // query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + // for more information. If not specified or empty, it will search all the + // resources within the specified `scope`. + // + // Examples: + // + // * `name:Important` to find Cloud resources whose name contains + // "Important" as a word. + // * `name=Important` to find the Cloud resource whose name is exactly + // "Important". + // * `displayName:Impor*` to find Cloud resources whose display name + // contains "Impor" as a prefix of any word in the field. + // * `location:us-west*` to find Cloud resources whose location contains both + // "us" and "west" as prefixes. + // * `labels:prod` to find Cloud resources whose labels contain "prod" as + // a key or value. + // * `labels.env:prod` to find Cloud resources that have a label "env" + // and its value is "prod". + // * `labels.env:*` to find Cloud resources that have a label "env". + // * `kmsKey:key` to find Cloud resources encrypted with a customer-managed + // encryption key whose name contains the word "key". + // * `relationships:instance-group-1` to find Cloud resources that have + // relationships with "instance-group-1" in the related resource name. + // * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + // have relationships of type "INSTANCE_TO_INSTANCEGROUP". + // * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + // compute instances that have relationships with "instance-group-1" in the + // compute instance group resource name, for relationship type + // "INSTANCE_TO_INSTANCEGROUP". + // * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a + // word. + // * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain + // "ACTIVE" as a word. + // * `createTime<1609459200` to find Cloud resources that were created before + // "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + // "2021-01-01 00:00:00 UTC" in seconds. + // * `updateTime>1609459200` to find Cloud resources that were updated after + // "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + // "2021-01-01 00:00:00 UTC" in seconds. + // * `Important` to find Cloud resources that contain "Important" as a word + // in any of the searchable fields. + // * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any + // word in any of the searchable fields. + // * `Important location:(us-west1 OR global)` to find Cloud + // resources that contain "Important" as a word in any of the searchable + // fields and are also located in the "us-west1" region or the "global" + // location. + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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 + // with "compute.googleapis.com". + // * ".*Instance" snapshots resources whose asset type ends with "Instance". + // * ".*Instance.*" snapshots resources whose asset type contains "Instance". + // + // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + // regular expression syntax. If the regular expression does not match any + // supported asset type, an INVALID_ARGUMENT error will be returned. + repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; + + // 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 + // * assetType + // * project + // * displayName + // * description + // * location + // * kmsKey + // * createTime + // * updateTime + // * state + // * parentFullResourceName + // * parentAssetType + // + // All the other fields such as repeated fields (e.g., `networkTags`), map + // fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) + // are not supported. + string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; + + // 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 + // * assetType + // * project + // * displayName + // * description + // * location + // * tagKeys + // * tagValues + // * tagValueIds + // * labels + // * networkTags + // * kmsKey + // * createTime + // * updateTime + // * state + // * additionalAttributes + // * versionedResources + // + // If read_mask is not specified, all fields except versionedResources will + // be returned. + // If only '*' is specified, all fields including versionedResources will be + // returned. + // Any invalid field path will trigger INVALID_ARGUMENT error. + google.protobuf.FieldMask read_mask = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all resources response. +message SearchAllResourcesResponse { + // A list of Resources that match the search query. It contains the resource + // standard metadata information. + repeated ResourceSearchResult results = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token`. + string next_page_token = 2; +} + +// Search all IAM policies request. +message SearchAllIamPoliciesRequest { + // 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: + // + // * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. See [how to construct a + // 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 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 the [IAM policy + // documentation](https://cloud.google.com/iam/help/allow-policies/structure). + // + // Examples: + // + // * `policy:amy@gmail.com` to find IAM policy bindings that specify user + // "amy@gmail.com". + // * `policy:roles/compute.admin` to find IAM policy bindings that specify + // the Compute Admin role. + // * `policy:comp*` to find IAM policy bindings that contain "comp" as a + // prefix of any word in the binding. + // * `policy.role.permissions:storage.buckets.update` to find IAM policy + // bindings that specify a role containing "storage.buckets.update" + // permission. Note that if callers don't have `iam.roles.get` access to a + // role's included permissions, policy bindings that specify this role will + // be dropped from the search results. + // * `policy.role.permissions:upd*` to find IAM policy bindings that specify a + // role containing "upd" as a prefix of any word in the role permission. + // Note that if callers don't have `iam.roles.get` access to a role's + // included permissions, policy bindings that specify this role will be + // dropped from the search results. + // * `resource:organizations/123456` to find IAM policy bindings + // that are set on "organizations/123456". + // * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to + // find IAM policy bindings that are set on the project named "myproject". + // * `Important` to find IAM policy bindings that contain "Important" as a + // word in any of the searchable fields (except for the included + // permissions). + // * `resource:(instance1 OR instance2) policy:amy` to find + // IAM policy bindings that are set on resources "instance1" or + // "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 + // principal type "user". + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; + + // 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 + // starts with "compute.googleapis.com". + // * ".*Instance" snapshots IAM policies attached to asset type ends with + // "Instance". + // * ".*Instance.*" snapshots IAM policies attached to asset type contains + // "Instance". + // + // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + // regular expression syntax. If the regular expression does not match any + // supported asset type, an INVALID_ARGUMENT error will be returned. + repeated string asset_types = 5 [(google.api.field_behavior) = OPTIONAL]; + + // 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 + // * assetType + // * project + // All the other fields such as repeated fields (e.g., `folders`) and + // non-primitive fields (e.g., `policy`) are not supported. + string order_by = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all IAM policies response. +message SearchAllIamPoliciesResponse { + // A list of IamPolicy that match the search query. Related information such + // as the associated resource is returned along with the policy. + repeated IamPolicySearchResult results = 1; + + // Set if there are more results than those appearing in this response; to get + // the next set of results, call this method again, using this value as the + // `page_token`. + string next_page_token = 2; +} + +// IAM policy analysis query message. +message IamPolicyAnalysisQuery { + // Specifies the resource to analyze for access policies, which may be set + // directly on the resource, or on ancestors such as organizations, folders or + // projects. + message ResourceSelector { + // Required. The [full resource name] + // (https://cloud.google.com/asset-inventory/docs/resource-name-format) + // of a resource of [supported resource + // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types). + string full_resource_name = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Specifies an identity for which to determine resource access, based on + // roles assigned either directly to them or to the groups they belong to, + // directly or indirectly. + message IdentitySelector { + // Required. The identity appear in the form of principals in + // [IAM policy + // binding](https://cloud.google.com/iam/reference/rest/v1/Binding). + // + // The examples of supported forms are: + // "user:mike@example.com", + // "group:admins@example.com", + // "domain:google.com", + // "serviceAccount:my-project-id@appspot.gserviceaccount.com". + // + // Notice that wildcard characters (such as * and ?) are not supported. + // You must give a specific identity. + string identity = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Specifies roles and/or permissions to analyze, to determine both the + // identities possessing them and the resources they control. If multiple + // values are specified, results will include roles or permissions matching + // any of them. The total number of roles and permissions should be equal or + // less than 10. + message AccessSelector { + // Optional. The roles to appear in result. + repeated string roles = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The permissions to appear in result. + repeated string permissions = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Contains query options. + message Options { + // Optional. If true, the identities section of the result will expand any + // Google groups appearing in an IAM policy binding. + // + // If + // [IamPolicyAnalysisQuery.identity_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector] + // is specified, the identity in the result will be determined by the + // selector, and this flag is not allowed to set. + // + // If true, the default max expansion per group is 1000 for + // AssetService.AnalyzeIamPolicy][]. + // + // Default is false. + bool expand_groups = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the access section of result will expand any roles + // appearing in IAM policy bindings to include their permissions. + // + // If + // [IamPolicyAnalysisQuery.access_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector] + // is specified, the access section of the result will be determined by the + // selector, and this flag is not allowed to set. + // + // Default is false. + bool expand_roles = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true and + // [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] + // is not specified, the resource section of the result will expand any + // resource attached to an IAM policy to include resources lower in the + // resource hierarchy. + // + // For example, if the request analyzes for which resources user A has + // permission P, and the results include an IAM policy with P on a GCP + // folder, the results will also include resources in that folder with + // permission P. + // + // If true and + // [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] + // is specified, the resource section of the result will expand the + // specified resource to include resources lower in the resource hierarchy. + // Only project or lower resources are supported. Folder and organization + // resource cannot be used together with this option. + // + // For example, if the request analyzes for which users have permission P on + // a GCP project with this option enabled, the results will include all + // users who have permission P on that project or any lower resource. + // + // If true, the default max expansion per resource is 1000 for + // AssetService.AnalyzeIamPolicy][] and 100000 for + // AssetService.AnalyzeIamPolicyLongrunning][]. + // + // Default is false. + bool expand_resources = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the result will output the relevant parent/child + // relationships between resources. Default is false. + bool output_resource_edges = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the result will output the relevant membership + // relationships between groups and other groups, and between groups and + // principals. Default is false. + bool output_group_edges = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If true, the response will include access analysis from + // identities to resources via service account impersonation. This is a very + // expensive operation, because many derived queries will be executed. We + // highly recommend you use + // [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] + // rpc instead. + // + // For example, if the request analyzes for which resources user A has + // permission P, and there's an IAM policy states user A has + // iam.serviceAccounts.getAccessToken permission to a service account SA, + // and there's another IAM policy states service account SA has permission P + // to a GCP folder F, then user A potentially has access to the GCP folder + // F. And those advanced analysis results will be included in + // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]. + // + // Another example, if the request analyzes for who has + // permission P to a GCP folder F, and there's an IAM policy states user A + // has iam.serviceAccounts.actAs permission to a service account SA, and + // there's another IAM policy states service account SA has permission P to + // the GCP folder F, then user A potentially has access to the GCP folder + // F. And those advanced analysis results will be included in + // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]. + // + // Only the following permissions are considered in this analysis: + // + // * `iam.serviceAccounts.actAs` + // * `iam.serviceAccounts.signBlob` + // * `iam.serviceAccounts.signJwt` + // * `iam.serviceAccounts.getAccessToken` + // * `iam.serviceAccounts.getOpenIdToken` + // * `iam.serviceAccounts.implicitDelegation` + // + // Default is false. + bool analyze_service_account_impersonation = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // The IAM conditions context. + message ConditionContext { + // The IAM conditions time context. + oneof TimeContext { + // The hypothetical access timestamp to evaluate IAM conditions. Note that + // this value must not be earlier than the current time; otherwise, an + // INVALID_ARGUMENT error will be returned. + google.protobuf.Timestamp access_time = 1; + } + } + + // Required. The relative name of the root asset. Only resources and IAM + // policies within the scope will be analyzed. + // + // 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). + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Specifies a resource for analysis. + ResourceSelector resource_selector = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies an identity for analysis. + IdentitySelector identity_selector = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies roles or permissions for analysis. This is optional. + AccessSelector access_selector = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The query options. + Options options = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The hypothetical context for IAM conditions evaluation. + ConditionContext condition_context = 6 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A request message for +// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. +message AnalyzeIamPolicyRequest { + // Required. The request query. + IamPolicyAnalysisQuery analysis_query = 1 + [(google.api.field_behavior) = REQUIRED]; + + // 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. + string saved_analysis_query = 3 [(google.api.field_behavior) = OPTIONAL]; + + // 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 + // execution timeout, you will get a response with partial result. + // Otherwise, your query's execution will continue until the RPC deadline. + // If it's not finished until then, you will get a DEADLINE_EXCEEDED error. + // + // Default is empty. + google.protobuf.Duration execution_timeout = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A response message for +// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. +message AnalyzeIamPolicyResponse { + // An analysis message to group the query and results. + message IamPolicyAnalysis { + // The analysis query. + IamPolicyAnalysisQuery analysis_query = 1; + + // A list of + // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult] + // that matches the analysis query, or empty if no result is found. + repeated IamPolicyAnalysisResult analysis_results = 2; + + // Represents whether all entries in the + // [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results] + // have been fully explored to answer the query. + bool fully_explored = 3; + + // A list of non-critical errors happened during the query handling. + repeated IamPolicyAnalysisState non_critical_errors = 5; + } + + // The main analysis that matches the original request. + IamPolicyAnalysis main_analysis = 1; + + // The service account impersonation analysis if + // [AnalyzeIamPolicyRequest.analyze_service_account_impersonation][] is + // enabled. + repeated IamPolicyAnalysis service_account_impersonation_analysis = 2; + + // Represents whether all entries in the + // [main_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis] + // and + // [service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis] + // have been fully explored to answer the query in the request. + bool fully_explored = 3; +} + +// Output configuration for export IAM policy analysis destination. +message IamPolicyAnalysisOutputConfig { + // A Cloud Storage location. + message GcsDestination { + // Required. The uri of the Cloud Storage object. It's the same uri that is + // used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and + // Editing Object + // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) + // for more information. + // + // If the specified Cloud Storage object already exists and there is no + // [hold](https://cloud.google.com/storage/docs/object-holds), it will be + // overwritten with the analysis result. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // A BigQuery destination. + message BigQueryDestination { + // This enum determines the partition key column for the bigquery tables. + // Partitioning can improve query performance and reduce query cost by + // filtering partitions. Refer to + // https://cloud.google.com/bigquery/docs/partitioned-tables for details. + enum PartitionKey { + // Unspecified partition key. Tables won't be partitioned using this + // option. + PARTITION_KEY_UNSPECIFIED = 0; + + // The time when the request is received. If specified as partition key, + // the result table(s) is partitoned by the RequestTime column, an + // additional timestamp column representing when the request was received. + REQUEST_TIME = 1; + } + + // Required. The BigQuery dataset in format + // "projects/projectId/datasets/datasetId", to which the analysis results + // should be exported. If this dataset does not exist, the export call will + // return an INVALID_ARGUMENT error. + string dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The prefix of the BigQuery tables to which the analysis results + // will be written. Tables will be created based on this table_prefix if not + // exist: + // * _analysis table will contain export operation's metadata. + // * _analysis_result will contain all the + // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult]. + // When [partition_key] is specified, both tables will be partitioned based + // on the [partition_key]. + string table_prefix = 2 [(google.api.field_behavior) = REQUIRED]; + + // The partition key for BigQuery partitioned table. + PartitionKey partition_key = 3; + + // Optional. Specifies the action that occurs if the destination table or + // partition already exists. The following values are supported: + // + // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery + // overwrites the entire table or all the partitions data. + // * WRITE_APPEND: If the table or partition already exists, BigQuery + // appends the data to the table or the latest partition. + // * WRITE_EMPTY: If the table already exists and contains data, an error is + // returned. + // + // The default value is WRITE_APPEND. Each action is atomic and only occurs + // if BigQuery is able to complete the job successfully. Details are at + // https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file. + string write_disposition = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // IAM policy analysis export destination. + oneof destination { + // Destination on Cloud Storage. + GcsDestination gcs_destination = 1; + + // Destination on BigQuery. + BigQueryDestination bigquery_destination = 2; + } +} + +// A request message for +// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. +message AnalyzeIamPolicyLongrunningRequest { + // Required. The request query. + IamPolicyAnalysisQuery analysis_query = 1 + [(google.api.field_behavior) = REQUIRED]; + + // 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. + string saved_analysis_query = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Output configuration indicating where the results will be output + // to. + IamPolicyAnalysisOutputConfig output_config = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// A response message for +// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. +message AnalyzeIamPolicyLongrunningResponse {} + +// A saved query which can be shared with others or used later. +message SavedQuery { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/SavedQuery" + pattern: "projects/{project}/savedQueries/{saved_query}" + pattern: "folders/{folder}/savedQueries/{saved_query}" + pattern: "organizations/{organization}/savedQueries/{saved_query}" + }; + + // The query content. + message QueryContent { + oneof query_content { + // An IAM Policy Analysis query, which could be used in + // the + // [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy] + // rpc or the + // [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] + // rpc. + IamPolicyAnalysisQuery iam_policy_analysis_query = 1; + } + } + + // The resource name of the saved query. The format must be: + // + // * projects/project_number/savedQueries/saved_query_id + // * folders/folder_number/savedQueries/saved_query_id + // * organizations/organization_number/savedQueries/saved_query_id + string name = 1; + + // The description of this saved query. This value should be fewer than 255 + // characters. + string description = 2; + + // Output only. The create time of this saved query. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The account's email address who has created this saved query. + string creator = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of this saved query. + google.protobuf.Timestamp last_update_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The account's email address who has updated this saved query + // most recently. + string last_updater = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels applied on the resource. + // This value should not contain more than 10 entries. The key and value of + // each entry must be non-empty and fewer than 64 characters. + map labels = 7; + + // The query content. + QueryContent content = 8; +} + +// Request to create a saved query. +message CreateSavedQueryRequest { + // 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"). + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/SavedQuery" + } + ]; + + // Required. The saved_query details. The `name` field must be empty as it + // will be generated based on the parent and saved_query_id. + SavedQuery saved_query = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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. + string saved_query_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to get a saved query. +message GetSavedQueryRequest { + // 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 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudasset.googleapis.com/SavedQuery" + } + ]; +} + +// Request to list saved queries. +message ListSavedQueriesRequest { + // 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"). + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/SavedQuery" + } + ]; + + // 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. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response of listing saved queries. +message ListSavedQueriesResponse { + // A list of savedQueries. + repeated SavedQuery saved_queries = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request to update a saved query. +message UpdateSavedQueryRequest { + // 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 + SavedQuery saved_query = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The list of fields to update. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request to delete a saved query. +message DeleteSavedQueryRequest { + // 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 + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudasset.googleapis.com/SavedQuery" + } + ]; +} + +// The request message for performing resource move analysis. +message AnalyzeMoveRequest { + // View enum for supporting partial analysis responses. + enum AnalysisView { + // The default/unset value. + // The API will default to the FULL view. + ANALYSIS_VIEW_UNSPECIFIED = 0; + + // Full analysis including all level of impacts of the specified resource + // move. + FULL = 1; + + // Basic analysis only including blockers which will prevent the specified + // resource move at runtime. + BASIC = 2; + } + + // Required. Name of the resource to perform the analysis against. + // Only GCP Project are supported as of today. Hence, this can only be Project + // ID (such as "projects/my-project-id") or a Project Number (such as + // "projects/12345"). + string resource = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Name of the GCP Folder or Organization to reparent the target + // resource. The analysis will be performed against hypothetically moving the + // resource to this specified desitination parent. This can only be a Folder + // number (such as "folders/123") or an Organization number (such as + // "organizations/123"). + string destination_parent = 2 [(google.api.field_behavior) = REQUIRED]; + + // Analysis view indicating what information should be included in the + // analysis response. If unspecified, the default view is FULL. + AnalysisView view = 3; +} + +// The response message for resource move analysis. +message AnalyzeMoveResponse { + // The list of analyses returned from performing the intended resource move + // analysis. The analysis is grouped by different Cloud services. + repeated MoveAnalysis move_analysis = 1; +} + +// A message to group the analysis information. +message MoveAnalysis { + // The user friendly display name of the analysis. E.g. IAM, Organization + // Policy etc. + string display_name = 1; + + oneof result { + // Analysis result of moving the target resource. + MoveAnalysisResult analysis = 2; + + // Description of error encountered when performing the analysis. + google.rpc.Status error = 3; + } +} + +// An analysis result including blockers and warnings. +message MoveAnalysisResult { + // Blocking information that would prevent the target resource from moving + // to the specified destination at runtime. + repeated MoveImpact blockers = 1; + + // Warning information indicating that moving the target resource to the + // specified destination might be unsafe. This can include important policy + // information and configuration changes, but will not block moves at runtime. + repeated MoveImpact warnings = 2; +} + +// A message to group impacts of moving the target resource. +message MoveImpact { + // User friendly impact detail in a free form message. + string detail = 1; +} + +// Output configuration query assets. +message QueryAssetsOutputConfig { + // BigQuery destination. + message BigQueryDestination { + // Required. The BigQuery dataset where the query results will be saved. It + // has the format of "projects/{projectId}/datasets/{datasetId}". + string dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The BigQuery table where the query results will be saved. If + // this table does not exist, a new table with the given name will be + // created. + string table = 2 [(google.api.field_behavior) = REQUIRED]; + + // Specifies the action that occurs if the destination table or partition + // already exists. The following values are supported: + // + // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery + // overwrites the entire table or all the partitions data. + // * WRITE_APPEND: If the table or partition already exists, BigQuery + // appends the data to the table or the latest partition. + // * WRITE_EMPTY: If the table already exists and contains data, an error is + // returned. + string write_disposition = 3; + } + + // BigQuery destination where the query results will be saved. + BigQueryDestination bigquery_destination = 1; +} + +// QueryAssets request. +message QueryAssetsRequest { + // Required. The relative name of the root asset. This can only be an + // organization number (such as "organizations/123"), a project ID (such as + // "projects/my-project-id"), or a project number (such as "projects/12345"), + // or a folder number (such as "folders/123"). + // + // Only assets belonging to the `parent` will be returned. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudasset.googleapis.com/Asset" + } + ]; + + oneof query { + // Optional. A SQL statement that's compatible with [BigQuery Standard + // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + string statement = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Reference to the query job, which is from the + // `QueryAssetsResponse` of previous `QueryAssets` call. + string job_reference = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The maximum number of rows to return in the results. Responses + // are limited to 10 MB and 1000 rows. + // + // By default, the maximum row count is 1000. When the byte or row count limit + // is reached, the rest of the query results will be paginated. + // + // The field will be ignored when [output_config] is specified. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A page token received from previous `QueryAssets`. + // + // The field will be ignored when [output_config] is specified. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the maximum amount of time that the client is willing + // to wait for the query to complete. By default, this limit is 5 min for the + // first query, and 1 minute for the following queries. If the query is + // complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + // false. + // + // Like BigQuery [jobs.query + // API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + // The call is not guaranteed to wait for the specified timeout; it typically + // returns after around 200 seconds (200,000 milliseconds), even if the query + // is not complete. + // + // The field will be ignored when [output_config] is specified. + google.protobuf.Duration timeout = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Specifies what time period or point in time to query asset metadata at. + // * unset - query asset metadata as it is right now + // * [read_time_window] - query asset metadata as it was at any point in time + // between [start_time] and [end_time]. + // * [read_time] - query asset metadata as it was at that point in time. + // If data for the timestamp/date range selected does not exist, + // it will simply return a valid response with no rows. + oneof time { + // Optional. [start_time] is required. [start_time] must be less than + // [end_time] Defaults [end_time] to now if [start_time] is set and + // [end_time] isn't. Maximum permitted time range is 7 days. + TimeWindow read_time_window = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Queries cloud assets as they appeared at the specified point in + // time. + google.protobuf.Timestamp read_time = 8 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Destination where the query results will be saved. + // + // When this field is specified, the query results won't be saved in the + // [QueryAssetsResponse.query_result]. Instead + // [QueryAssetsResponse.output_config] will be set. + // + // Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used + // to check the status of the query job when passed to a following + // [QueryAssets] API call. + QueryAssetsOutputConfig output_config = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +// QueryAssets response. +message QueryAssetsResponse { + // Reference to a query job. + string job_reference = 1; + + // The query response, which can be either an `error` or a valid `response`. + // + // If `done` == `false` and the query result is being saved in a output, the + // output_config field will be set. + // If `done` == `true`, exactly one of + // `error`, `query_result` or `output_config` will be set. + bool done = 2; + + oneof response { + // Error status. + google.rpc.Status error = 3; + + // Result of the query. + QueryResult query_result = 4; + + // Output configuration which indicates instead of being returned in API + // response on the fly, the query result will be saved in a specific output. + QueryAssetsOutputConfig output_config = 5; + } +} + +// Execution results of the query. +// +// The result is formatted as rows represented by BigQuery compatible [schema]. +// When pagination is necessary, it will contains the page token to retrieve +// the results of following pages. +message QueryResult { + // Each row hold a query result in the format of `Struct`. + repeated google.protobuf.Struct rows = 1; + + // Describes the format of the [rows]. + TableSchema schema = 2; + + // Token to retrieve the next page of the results. + string next_page_token = 3; + + // Total rows of the whole query results. + int64 total_rows = 4; +} + +// BigQuery Compatible table schema. +message TableSchema { + // Describes the fields in a table. + repeated TableFieldSchema fields = 1; +} + +// A field in TableSchema. +message TableFieldSchema { + // The field name. The name must contain only letters (a-z, A-Z), + // numbers (0-9), or underscores (_), and must start with a letter or + // underscore. The maximum length is 128 characters. + string field = 1; + + // The field data type. Possible values include + // * STRING + // * BYTES + // * INTEGER + // * FLOAT + // * BOOLEAN + // * TIMESTAMP + // * DATE + // * TIME + // * DATETIME + // * GEOGRAPHY, + // * NUMERIC, + // * BIGNUMERIC, + // * RECORD + // (where RECORD indicates that the field contains a nested schema). + string type = 2; + + // The field mode. Possible values include NULLABLE, REQUIRED and + // REPEATED. The default value is NULLABLE. + string mode = 3; + + // Describes the nested schema fields if the type property is set + // to RECORD. + repeated TableFieldSchema fields = 4; +} + +// A request message for +// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]. +message BatchGetEffectiveIamPoliciesRequest { + // 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). + string scope = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { child_type: "*" } + ]; + + // 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. + repeated string names = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "*" } + ]; +} + +// A response message for +// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]. +message BatchGetEffectiveIamPoliciesResponse { + // The effective IAM policies on one resource. + message EffectiveIamPolicy { + // The IAM policy and its attached resource. + message PolicyInfo { + // The full resource name the + // [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy] + // is directly attached to. + string attached_resource = 1; + + // The IAM policy that's directly attached to the + // [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]. + google.iam.v1.Policy policy = 2; + } + + // The [full_resource_name] + // (https://cloud.google.com/asset-inventory/docs/resource-name-format) + // for which the + // [policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies] + // are computed. This is one of the + // [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names] + // the caller provides in the request. + string full_resource_name = 1; + + // The effective policies for the + // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]. + // + // These policies include the policy set on the + // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name] + // and those set on its parents and ancestors up to the + // [BatchGetEffectiveIamPoliciesRequest.scope][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope]. + // Note that these policies are not filtered according to the resource type + // of the + // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]. + // + // These policies are hierarchically ordered by + // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource] + // starting from + // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name] + // itself to its parents and ancestors, such that policies[i]'s + // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource] + // is the child of policies[i+1]'s + // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource], + // if policies[i+1] exists. + repeated PolicyInfo policies = 2; + } + + // The effective policies for a batch of resources. Note that the results + // order is the same as the order of + // [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]. + // When a resource does not have any effective IAM policies, its corresponding + // policy_result will contain empty + // [EffectiveIamPolicy.policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]. + repeated EffectiveIamPolicy policy_results = 2; +} + +// Asset content type. +enum ContentType { + // Unspecified content type. + CONTENT_TYPE_UNSPECIFIED = 0; + + // Resource metadata. + RESOURCE = 1; + + // The actual IAM policy set on a resource. + IAM_POLICY = 2; + + // The Cloud Organization Policy set on an asset. + ORG_POLICY = 4; + + // The Cloud Access context manager Policy set on an asset. + ACCESS_POLICY = 5; + + // The runtime OS Inventory information. + OS_INVENTORY = 6; + + // The related resources. + RELATIONSHIP = 7; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto b/owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto new file mode 100644 index 00000000..83a23693 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto @@ -0,0 +1,919 @@ +// 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.asset.v1; + +import "google/api/resource.proto"; +import "google/cloud/orgpolicy/v1/orgpolicy.proto"; +import "google/cloud/osconfig/v1/inventory.proto"; +import "google/iam/v1/policy.proto"; +import "google/identity/accesscontextmanager/v1/access_level.proto"; +import "google/identity/accesscontextmanager/v1/access_policy.proto"; +import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/code.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Asset.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetProto"; +option java_package = "com.google.cloud.asset.v1"; +option php_namespace = "Google\\Cloud\\Asset\\V1"; + +// An asset in Google Cloud and its temporal metadata, including the time window +// when it was observed and its status during that window. +message TemporalAsset { + // State of prior asset. + enum PriorAssetState { + // prior_asset is not applicable for the current asset. + PRIOR_ASSET_STATE_UNSPECIFIED = 0; + + // prior_asset is populated correctly. + PRESENT = 1; + + // Failed to set prior_asset. + INVALID = 2; + + // Current asset is the first known state. + DOES_NOT_EXIST = 3; + + // prior_asset is a deletion. + DELETED = 4; + } + + // The time window when the asset data and state was observed. + TimeWindow window = 1; + + // Whether the asset has been deleted or not. + bool deleted = 2; + + // An asset in Google Cloud. + Asset asset = 3; + + // State of prior_asset. + PriorAssetState prior_asset_state = 4; + + // Prior copy of the asset. Populated if prior_asset_state is PRESENT. + // Currently this is only set for responses in Real-Time Feed. + Asset prior_asset = 5; +} + +// A time window specified by its `start_time` and `end_time`. +message TimeWindow { + // Start time of the time window (exclusive). + google.protobuf.Timestamp start_time = 1; + + // End time of the time window (inclusive). If not specified, the current + // timestamp is used instead. + google.protobuf.Timestamp end_time = 2; +} + +// An asset in Google Cloud. An asset can be any resource in the Google Cloud +// [resource +// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), +// a resource outside the Google Cloud resource hierarchy (such as Google +// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy), +// or a relationship (e.g. an INSTANCE_TO_INSTANCEGROUP relationship). +// See [Supported asset +// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) +// for more information. +message Asset { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Asset" + pattern: "*" + }; + + // The last update timestamp of an asset. update_time is updated when + // create/update/delete operation is performed. + google.protobuf.Timestamp update_time = 11; + + // The full name of the asset. Example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` + // + // See [Resource + // names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + string name = 1; + + // The type of the asset. Example: `compute.googleapis.com/Disk` + // + // See [Supported asset + // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) + // for more information. + string asset_type = 2; + + // A representation of the resource. + Resource resource = 3; + + // A representation of the Cloud IAM policy set on a Google Cloud resource. + // There can be a maximum of one Cloud IAM policy set on any given resource. + // In addition, Cloud IAM policies inherit their granted access scope from any + // policies set on parent resources in the resource hierarchy. Therefore, the + // effectively policy is the union of both the policy set on this resource + // and each policy set on all of the resource's ancestry resource levels in + // the hierarchy. See + // [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance) + // for more information. + google.iam.v1.Policy iam_policy = 4; + + // A representation of an [organization + // policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). + // There can be more than one organization policy with different constraints + // set on a given resource. + repeated google.cloud.orgpolicy.v1.Policy org_policy = 6; + + // A representation of an [access + // policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies). + oneof access_context_policy { + // Please also refer to the [access policy user + // guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies). + google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7; + + // Please also refer to the [access level user + // guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels). + google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; + + // Please also refer to the [service perimeter user + // guide](https://cloud.google.com/vpc-service-controls/docs/overview). + google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = + 9; + } + + // A representation of runtime OS Inventory information. See [this + // topic](https://cloud.google.com/compute/docs/instances/os-inventory-management) + // for more information. + google.cloud.osconfig.v1.Inventory os_inventory = 12; + + // DEPRECATED. This field only presents for the purpose of + // backward-compatibility. The server will never generate responses with this + // field. + // The related assets of the asset of one relationship type. One asset + // only represents one type of relationship. + RelatedAssets related_assets = 13 [deprecated = true]; + + // One related asset of the current asset. + RelatedAsset related_asset = 15; + + // The ancestry path of an asset in Google Cloud [resource + // hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), + // represented as a list of relative resource names. An ancestry path starts + // with the closest ancestor in the hierarchy and ends at root. If the asset + // is a project, folder, or organization, the ancestry path starts from the + // asset itself. + // + // Example: `["projects/123456789", "folders/5432", "organizations/1234"]` + repeated string ancestors = 10; +} + +// A representation of a Google Cloud resource. +message Resource { + // The API version. Example: `v1` + string version = 1; + + // The URL of the discovery document containing the resource's JSON schema. + // Example: + // `https://www.googleapis.com/discovery/v1/apis/compute/v1/rest` + // + // This value is unspecified for resources that do not have an API based on a + // discovery document, such as Cloud Bigtable. + string discovery_document_uri = 2; + + // The JSON schema name listed in the discovery document. Example: + // `Project` + // + // This value is unspecified for resources that do not have an API based on a + // discovery document, such as Cloud Bigtable. + string discovery_name = 3; + + // The REST URL for accessing the resource. An HTTP `GET` request using this + // URL returns the resource itself. Example: + // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123` + // + // This value is unspecified for resources without a REST API. + string resource_url = 4; + + // The full name of the immediate parent of this resource. See + // [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + // + // For Google Cloud assets, this value is the parent resource defined in the + // [Cloud IAM policy + // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). + // Example: + // `//cloudresourcemanager.googleapis.com/projects/my_project_123` + // + // For third-party assets, this field may be set differently. + string parent = 5; + + // The content of the resource, in which some sensitive fields are removed + // and may not be present. + google.protobuf.Struct data = 6; + + // The location of the resource in Google Cloud, such as its zone and region. + // For more information, see https://cloud.google.com/about/locations/. + string location = 8; +} + +// DEPRECATED. This message only presents for the purpose of +// backward-compatibility. The server will never populate this message in +// responses. +// The detailed related assets with the `relationship_type`. +message RelatedAssets { + option deprecated = true; + + // The detailed relationship attributes. + RelationshipAttributes relationship_attributes = 1; + + // The peer resources of the relationship. + repeated RelatedAsset assets = 2; +} + +// DEPRECATED. This message only presents for the purpose of +// backward-compatibility. The server will never populate this message in +// responses. +// The relationship attributes which include `type`, `source_resource_type`, +// `target_resource_type` and `action`. +message RelationshipAttributes { + option deprecated = true; + + // The unique identifier of the relationship type. Example: + // `INSTANCE_TO_INSTANCEGROUP` + string type = 4; + + // The source asset type. Example: `compute.googleapis.com/Instance` + string source_resource_type = 1; + + // The target asset type. Example: `compute.googleapis.com/Disk` + string target_resource_type = 2; + + // The detail of the relationship, e.g. `contains`, `attaches` + string action = 3; +} + +// An asset identifier in Google Cloud which contains its name, type and +// ancestors. An asset can be any resource in the Google Cloud [resource +// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), +// a resource outside the Google Cloud resource hierarchy (such as Google +// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy). +// See [Supported asset +// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) +// for more information. +message RelatedAsset { + // The full name of the asset. Example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` + // + // See [Resource + // names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + string asset = 1 [(google.api.resource_reference) = { + type: "cloudasset.googleapis.com/Asset" + }]; + + // The type of the asset. Example: `compute.googleapis.com/Disk` + // + // See [Supported asset + // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) + // for more information. + string asset_type = 2; + + // The ancestors of an asset in Google Cloud [resource + // hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), + // represented as a list of relative resource names. An ancestry path starts + // with the closest ancestor in the hierarchy and ends at root. + // + // Example: `["projects/123456789", "folders/5432", "organizations/1234"]` + repeated string ancestors = 3; + + // The unique identifier of the relationship type. Example: + // `INSTANCE_TO_INSTANCEGROUP` + string relationship_type = 4; +} + +// A result of Resource Search, containing information of a cloud resource. +// Next ID: 29 +message ResourceSearchResult { + // The full resource name of this resource. Example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Cloud Asset Inventory Resource Name + // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // for more information. + // + // To search against the `name`: + // + // * use a field query. Example: `name:instance1` + // * use a free text query. Example: `instance1` + string name = 1; + + // The type of this resource. Example: `compute.googleapis.com/Disk`. + // + // To search against the `asset_type`: + // + // * specify the `asset_type` field in your search request. + string asset_type = 2; + + // The project that this resource belongs to, in the form of + // projects/{PROJECT_NUMBER}. This field is available when the resource + // belongs to a project. + // + // To search against `project`: + // + // * use a field query. Example: `project:12345` + // * use a free text query. Example: `12345` + // * specify the `scope` field as this project in your search request. + string project = 3; + + // The folder(s) that this resource belongs to, in the form of + // folders/{FOLDER_NUMBER}. This field is available when the resource + // belongs to one or more folders. + // + // To search against `folders`: + // + // * use a field query. Example: `folders:(123 OR 456)` + // * use a free text query. Example: `123` + // * specify the `scope` field as this folder in your search request. + repeated string folders = 17; + + // The organization that this resource belongs to, in the form of + // organizations/{ORGANIZATION_NUMBER}. This field is available when the + // resource belongs to an organization. + // + // To search against `organization`: + // + // * use a field query. Example: `organization:123` + // * use a free text query. Example: `123` + // * specify the `scope` field as this organization in your search request. + string organization = 18; + + // The display name of this resource. This field is available only when the + // resource's Protobuf contains it. + // + // To search against the `display_name`: + // + // * use a field query. Example: `displayName:"My Instance"` + // * use a free text query. Example: `"My Instance"` + string display_name = 4; + + // One or more paragraphs of text description of this resource. Maximum length + // could be up to 1M bytes. This field is available only when the resource's + // Protobuf contains it. + // + // To search against the `description`: + // + // * use a field query. Example: `description:"important instance"` + // * use a free text query. Example: `"important instance"` + string description = 5; + + // Location can be `global`, regional like `us-east1`, or zonal like + // `us-west1-b`. This field is available only when the resource's Protobuf + // contains it. + // + // To search against the `location`: + // + // * use a field query. Example: `location:us-west*` + // * use a free text query. Example: `us-west*` + string location = 6; + + // Labels associated with this resource. See [Labelling and grouping GCP + // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) + // for more information. This field is available only when the resource's + // Protobuf contains it. + // + // To search against the `labels`: + // + // * use a field query: + // - query on any label's key or value. Example: `labels:prod` + // - query by a given label. Example: `labels.env:prod` + // - query by a given label's existence. Example: `labels.env:*` + // * use a free text query. Example: `prod` + map labels = 7; + + // Network tags associated with this resource. Like labels, network tags are a + // type of annotations used to group GCP resources. See [Labelling GCP + // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) + // for more information. This field is available only when the resource's + // Protobuf contains it. + // + // To search against the `network_tags`: + // + // * use a field query. Example: `networkTags:internal` + // * use a free text query. Example: `internal` + repeated string network_tags = 8; + + // The Cloud KMS + // [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys) + // name or + // [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions) + // name. This field is available only when the resource's Protobuf contains + // it. + // + // To search against the `kms_key`: + // + // * use a field query. Example: `kmsKey:key` + // * use a free text query. Example: `key` + string kms_key = 10; + + // The create timestamp of this resource, at which the resource was created. + // The granularity is in seconds. Timestamp.nanos will always be 0. This field + // is available only when the resource's Protobuf contains it. + // + // To search against `create_time`: + // + // * use a field query. + // - value in seconds since unix epoch. Example: `createTime > 1609459200` + // - value in date string. Example: `createTime > 2021-01-01` + // - value in date-time string (must be quoted). Example: `createTime > + // "2021-01-01T00:00:00"` + google.protobuf.Timestamp create_time = 11; + + // The last update timestamp of this resource, at which the resource was last + // modified or deleted. The granularity is in seconds. Timestamp.nanos will + // always be 0. This field is available only when the resource's Protobuf + // contains it. + // + // To search against `update_time`: + // + // * use a field query. + // - value in seconds since unix epoch. Example: `updateTime < 1609459200` + // - value in date string. Example: `updateTime < 2021-01-01` + // - value in date-time string (must be quoted). Example: `updateTime < + // "2021-01-01T00:00:00"` + google.protobuf.Timestamp update_time = 12; + + // The state of this resource. Different resources types have different state + // definitions that are mapped from various fields of different resource + // types. This field is available only when the resource's Protobuf contains + // it. + // + // Example: + // If the resource is an instance provided by Compute Engine, + // its state will include PROVISIONING, STAGING, RUNNING, STOPPING, + // SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. See `status` definition + // in [API + // Reference](https://cloud.google.com/compute/docs/reference/rest/v1/instances). + // If the resource is a project provided by Cloud Resource Manager, its state + // will include LIFECYCLE_STATE_UNSPECIFIED, ACTIVE, DELETE_REQUESTED and + // DELETE_IN_PROGRESS. See `lifecycleState` definition in [API + // Reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects). + // + // To search against the `state`: + // + // * use a field query. Example: `state:RUNNING` + // * use a free text query. Example: `RUNNING` + string state = 13; + + // The additional searchable attributes of this resource. The attributes may + // vary from one resource type to another. Examples: `projectId` for Project, + // `dnsName` for DNS ManagedZone. This field contains a subset of the resource + // metadata fields that are returned by the List or Get APIs provided by the + // corresponding GCP service (e.g., Compute Engine). see [API references and + // supported searchable + // attributes](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types) + // to see which fields are included. + // + // You can search values of these fields through free text search. However, + // you should not consume the field programically as the field names and + // values may change as the GCP service updates to a new incompatible API + // version. + // + // To search against the `additional_attributes`: + // + // * use a free text query to match the attributes values. Example: to search + // `additional_attributes = { dnsName: "foobar" }`, you can issue a query + // `foobar`. + google.protobuf.Struct additional_attributes = 9; + + // The full resource name of this resource's parent, if it has one. + // To search against the `parent_full_resource_name`: + // + // * use a field query. Example: + // `parentFullResourceName:"project-name"` + // * use a free text query. Example: + // `project-name` + string parent_full_resource_name = 19; + + // Versioned resource representations of this resource. This is repeated + // because there could be multiple versions of resource representations during + // version migration. + // + // This `versioned_resources` field is not searchable. Some attributes of the + // resource representations are exposed in `additional_attributes` field, so + // as to allow users to search on them. + repeated VersionedResource versioned_resources = 16; + + // Attached resources of this resource. For example, an OSConfig + // Inventory is an attached resource of a Compute Instance. This field is + // repeated because a resource could have multiple attached resources. + // + // This `attached_resources` field is not searchable. Some attributes + // of the attached resources are exposed in `additional_attributes` field, so + // as to allow users to search on them. + repeated AttachedResource attached_resources = 20; + + // A map of related resources of this resource, keyed by the + // relationship type. A relationship type is in the format of + // {SourceType}_{ACTION}_{DestType}. Example: `DISK_TO_INSTANCE`, + // `DISK_TO_NETWORK`, `INSTANCE_TO_INSTANCEGROUP`. + // See [supported relationship + // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#supported_relationship_types). + map relationships = 21; + + // TagKey namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}. + // To search against the `tagKeys`: + // + // * use a field query. Example: + // - `tagKeys:"123456789/env*"` + // - `tagKeys="123456789/env"` + // - `tagKeys:"env"` + // + // * use a free text query. Example: + // - `env` + repeated string tag_keys = 23; + + // TagValue namespaced names, in the format of + // {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}. + // To search against the `tagValues`: + // + // * use a field query. Example: + // - `tagValues:"env"` + // - `tagValues:"env/prod"` + // - `tagValues:"123456789/env/prod*"` + // - `tagValues="123456789/env/prod"` + // + // * use a free text query. Example: + // - `prod` + repeated string tag_values = 25; + + // TagValue IDs, in the format of tagValues/{TAG_VALUE_ID}. + // To search against the `tagValueIds`: + // + // * use a field query. Example: + // - `tagValueIds:"456"` + // - `tagValueIds="tagValues/456"` + // + // * use a free text query. Example: + // - `456` + repeated string tag_value_ids = 26; + + // The type of this resource's immediate parent, if there is one. + // + // To search against the `parent_asset_type`: + // + // * use a field query. Example: + // `parentAssetType:"cloudresourcemanager.googleapis.com/Project"` + // * use a free text query. Example: + // `cloudresourcemanager.googleapis.com/Project` + string parent_asset_type = 103; +} + +// Resource representation as defined by the corresponding service providing the +// resource for a given API version. +message VersionedResource { + // API version of the resource. + // + // Example: + // If the resource is an instance provided by Compute Engine v1 API as defined + // in `https://cloud.google.com/compute/docs/reference/rest/v1/instances`, + // version will be "v1". + string version = 1; + + // JSON representation of the resource as defined by the corresponding + // service providing this resource. + // + // Example: + // If the resource is an instance provided by Compute Engine, this field will + // contain the JSON representation of the instance as defined by Compute + // Engine: + // `https://cloud.google.com/compute/docs/reference/rest/v1/instances`. + // + // You can find the resource definition for each supported resource type in + // this table: + // `https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types` + google.protobuf.Struct resource = 2; +} + +// Attached resource representation, which is defined by the corresponding +// service provider. It represents an attached resource's payload. +message AttachedResource { + // The type of this attached resource. + // + // Example: `osconfig.googleapis.com/Inventory` + // + // You can find the supported attached asset types of each resource in this + // table: + // `https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types` + string asset_type = 1; + + // Versioned resource representations of this attached resource. This is + // repeated because there could be multiple versions of the attached resource + // representations during version migration. + repeated VersionedResource versioned_resources = 3; +} + +// The related resources of the primary resource. +message RelatedResources { + // The detailed related resources of the primary resource. + repeated RelatedResource related_resources = 1; +} + +// The detailed related resource. +message RelatedResource { + // The type of the asset. Example: `compute.googleapis.com/Instance` + string asset_type = 1; + + // The full resource name of the related resource. Example: + // `//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123` + string full_resource_name = 2; +} + +// A result of IAM Policy search, containing information of an IAM policy. +message IamPolicySearchResult { + // Explanation about the IAM policy search result. + message Explanation { + // IAM permissions + message Permissions { + // A list of permissions. A sample permission string: `compute.disk.get`. + repeated string permissions = 1; + } + + // The map from roles to their included permissions that match the + // permission query (i.e., a query containing `policy.role.permissions:`). + // Example: if query `policy.role.permissions:compute.disk.get` + // matches a policy binding that contains owner role, the + // matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The + // roles can also be found in the returned `policy` bindings. Note that the + // map is populated only for requests with permission queries. + map matched_permissions = 1; + } + + // The full resource name of the resource associated with this IAM policy. + // Example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Cloud Asset Inventory Resource Name + // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // for more information. + // + // To search against the `resource`: + // + // * use a field query. Example: `resource:organizations/123` + string resource = 1; + + // The type of the resource associated with this IAM policy. Example: + // `compute.googleapis.com/Disk`. + // + // To search against the `asset_type`: + // + // * specify the `asset_types` field in your search request. + string asset_type = 5; + + // The project that the associated GCP resource belongs to, in the form of + // projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource (like VM + // instance, Cloud Storage bucket), the project field will indicate the + // project that contains the resource. If an IAM policy is set on a folder or + // orgnization, this field will be empty. + // + // To search against the `project`: + // + // * specify the `scope` field as this project in your search request. + string project = 2; + + // The folder(s) that the IAM policy belongs to, in the form of + // folders/{FOLDER_NUMBER}. This field is available when the IAM policy + // belongs to one or more folders. + // + // To search against `folders`: + // + // * use a field query. Example: `folders:(123 OR 456)` + // * use a free text query. Example: `123` + // * specify the `scope` field as this folder in your search request. + repeated string folders = 6; + + // The organization that the IAM policy belongs to, in the form + // of organizations/{ORGANIZATION_NUMBER}. This field is available when the + // IAM policy belongs to an organization. + // + // To search against `organization`: + // + // * use a field query. Example: `organization:123` + // * use a free text query. Example: `123` + // * specify the `scope` field as this organization in your search request. + string organization = 7; + + // The IAM policy directly set on the given resource. Note that the original + // IAM policy can contain multiple bindings. This only contains the bindings + // that match the given query. For queries that don't contain a constrain on + // policies (e.g., an empty query), this contains all the bindings. + // + // To search against the `policy` bindings: + // + // * use a field query: + // - query by the policy contained members. Example: + // `policy:amy@gmail.com` + // - query by the policy contained roles. Example: + // `policy:roles/compute.admin` + // - query by the policy contained roles' included permissions. Example: + // `policy.role.permissions:compute.instances.create` + google.iam.v1.Policy policy = 3; + + // Explanation about the IAM policy search result. It contains additional + // information to explain why the search result matches the query. + Explanation explanation = 4; +} + +// Represents the detailed state of an entity under analysis, such as a +// resource, an identity or an access. +message IamPolicyAnalysisState { + // The Google standard error code that best describes the state. + // For example: + // - OK means the analysis on this entity has been successfully finished; + // - PERMISSION_DENIED means an access denied error is encountered; + // - DEADLINE_EXCEEDED means the analysis on this entity hasn't been started + // in time; + google.rpc.Code code = 1; + + // The human-readable description of the cause of failure. + string cause = 2; +} + +// The Condition evaluation. +message ConditionEvaluation { + // Value of this expression. + enum EvaluationValue { + // Reserved for future use. + EVALUATION_VALUE_UNSPECIFIED = 0; + + // The evaluation result is `true`. + TRUE = 1; + + // The evaluation result is `false`. + FALSE = 2; + + // The evaluation result is `conditional` when the condition expression + // contains variables that are either missing input values or have not been + // supported by Analyzer yet. + CONDITIONAL = 3; + } + + // The evaluation result. + EvaluationValue evaluation_value = 1; +} + +// IAM Policy analysis result, consisting of one IAM policy binding and derived +// access control lists. +message IamPolicyAnalysisResult { + // A Google Cloud resource under analysis. + message Resource { + // The [full resource + // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) + string full_resource_name = 1; + + // The analysis state of this resource. + IamPolicyAnalysisState analysis_state = 2; + } + + // An IAM role or permission under analysis. + message Access { + oneof oneof_access { + // The role. + string role = 1; + + // The permission. + string permission = 2; + } + + // The analysis state of this access. + IamPolicyAnalysisState analysis_state = 3; + } + + // An identity under analysis. + message Identity { + // The identity name in any form of members appear in + // [IAM policy + // binding](https://cloud.google.com/iam/reference/rest/v1/Binding), such + // as: + // - user:foo@google.com + // - group:group1@google.com + // - serviceAccount:s1@prj1.iam.gserviceaccount.com + // - projectOwner:some_project_id + // - domain:google.com + // - allUsers + // - etc. + string name = 1; + + // The analysis state of this identity. + IamPolicyAnalysisState analysis_state = 2; + } + + // A directional edge. + message Edge { + // The source node of the edge. For example, it could be a full resource + // name for a resource node or an email of an identity. + string source_node = 1; + + // The target node of the edge. For example, it could be a full resource + // name for a resource node or an email of an identity. + string target_node = 2; + } + + // An access control list, derived from the above IAM policy binding, which + // contains a set of resources and accesses. May include one + // item from each set to compose an access control entry. + // + // NOTICE that there could be multiple access control lists for one IAM policy + // binding. The access control lists are created based on resource and access + // combinations. + // + // For example, assume we have the following cases in one IAM policy binding: + // - Permission P1 and P2 apply to resource R1 and R2; + // - Permission P3 applies to resource R2 and R3; + // + // This will result in the following access control lists: + // - AccessControlList 1: [R1, R2], [P1, P2] + // - AccessControlList 2: [R2, R3], [P3] + message AccessControlList { + // The resources that match one of the following conditions: + // - The resource_selector, if it is specified in request; + // - Otherwise, resources reachable from the policy attached resource. + repeated Resource resources = 1; + + // The accesses that match one of the following conditions: + // - The access_selector, if it is specified in request; + // - Otherwise, access specifiers reachable from the policy binding's role. + repeated Access accesses = 2; + + // Resource edges of the graph starting from the policy attached + // resource to any descendant resources. The + // [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] + // contains the full resource name of a parent resource and + // [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node] + // contains the full resource name of a child resource. This field is + // present only if the output_resource_edges option is enabled in request. + repeated Edge resource_edges = 3; + + // Condition evaluation for this AccessControlList, if there is a condition + // defined in the above IAM policy binding. + ConditionEvaluation condition_evaluation = 4; + } + + // The identities and group edges. + message IdentityList { + // Only the identities that match one of the following conditions will be + // presented: + // - The identity_selector, if it is specified in request; + // - Otherwise, identities reachable from the policy binding's members. + repeated Identity identities = 1; + + // Group identity edges of the graph starting from the binding's + // group members to any node of the + // [identities][google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities]. + // The + // [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] + // contains a group, such as `group:parent@google.com`. The + // [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node] + // contains a member of the group, such as `group:child@google.com` or + // `user:foo@google.com`. This field is present only if the + // output_group_edges option is enabled in request. + repeated Edge group_edges = 2; + } + + // The [full resource + // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) + // of the resource to which the + // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] + // policy attaches. + string attached_resource_full_name = 1; + + // The Cloud IAM policy binding under analysis. + google.iam.v1.Binding iam_binding = 2; + + // The access control lists derived from the + // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] + // that match or potentially match resource and access selectors specified in + // the request. + repeated AccessControlList access_control_lists = 3; + + // The identity list derived from members of the + // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] + // that match or potentially match identity selector specified in the request. + IdentityList identity_list = 4; + + // Represents whether all analyses on the + // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] + // have successfully finished. + bool fully_explored = 5; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto new file mode 100644 index 00000000..92c2b81c --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto @@ -0,0 +1,384 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/date.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_multiple_files = true; +option java_outer_classname = "Inventories"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// OS Config Inventory is a service for collecting and reporting operating +// system and package information on VM instances. + +// This API resource represents the available inventory data for a +// Compute Engine virtual machine (VM) instance at a given point in time. +// +// You can use this API resource to determine the inventory data of your VM. +// +// For more information, see [Information provided by OS inventory +// management](https://cloud.google.com/compute/docs/instances/os-inventory-management#data-collected). +message Inventory { + option (google.api.resource) = { + type: "osconfig.googleapis.com/Inventory" + pattern: "projects/{project}/locations/{location}/instances/{instance}/inventory" + }; + + // Operating system information for the VM. + message OsInfo { + // The VM hostname. + string hostname = 9; + + // The operating system long name. + // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019 + // Datacenter'. + string long_name = 2; + + // The operating system short name. + // For example, 'windows' or 'debian'. + string short_name = 3; + + // The version of the operating system. + string version = 4; + + // The system architecture of the operating system. + string architecture = 5; + + // The kernel version of the operating system. + string kernel_version = 6; + + // The kernel release of the operating system. + string kernel_release = 7; + + // The current version of the OS Config agent running on the VM. + string osconfig_agent_version = 8; + } + + // A single piece of inventory on a VM. + message Item { + // The origin of a specific inventory item. + enum OriginType { + // Invalid. An origin type must be specified. + ORIGIN_TYPE_UNSPECIFIED = 0; + + // This inventory item was discovered as the result of the agent + // reporting inventory via the reporting API. + INVENTORY_REPORT = 1; + } + + // The different types of inventory that are tracked on a VM. + enum Type { + // Invalid. An type must be specified. + TYPE_UNSPECIFIED = 0; + + // This represents a package that is installed on the VM. + INSTALLED_PACKAGE = 1; + + // This represents an update that is available for a package. + AVAILABLE_PACKAGE = 2; + } + + // Identifier for this item, unique across items for this VM. + string id = 1; + + // The origin of this inventory item. + OriginType origin_type = 2; + + // When this inventory item was first detected. + google.protobuf.Timestamp create_time = 8; + + // When this inventory item was last modified. + google.protobuf.Timestamp update_time = 9; + + // The specific type of inventory, correlating to its specific details. + Type type = 5; + + // Specific details of this inventory item based on its type. + oneof details { + // Software package present on the VM instance. + SoftwarePackage installed_package = 6; + + // Software package available to be installed on the VM instance. + SoftwarePackage available_package = 7; + } + } + + // Software package information of the operating system. + message SoftwarePackage { + // Information about the different types of software packages. + oneof details { + // Yum package info. + // For details about the yum package manager, see + // https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum. + VersionedPackage yum_package = 1; + + // Details of an APT package. + // For details about the apt package manager, see + // https://wiki.debian.org/Apt. + VersionedPackage apt_package = 2; + + // Details of a Zypper package. + // For details about the Zypper package manager, see + // https://en.opensuse.org/SDB:Zypper_manual. + VersionedPackage zypper_package = 3; + + // Details of a Googet package. + // For details about the googet package manager, see + // https://github.com/google/googet. + VersionedPackage googet_package = 4; + + // Details of a Zypper patch. + // For details about the Zypper package manager, see + // https://en.opensuse.org/SDB:Zypper_manual. + ZypperPatch zypper_patch = 5; + + // Details of a Windows Update package. + // See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for + // information about Windows Update. + WindowsUpdatePackage wua_package = 6; + + // Details of a Windows Quick Fix engineering package. + // See + // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering + // for info in Windows Quick Fix Engineering. + WindowsQuickFixEngineeringPackage qfe_package = 7; + + // Details of a COS package. + VersionedPackage cos_package = 8; + + // Details of Windows Application. + WindowsApplication windows_application = 9; + } + } + + // Information related to the a standard versioned package. This includes + // package info for APT, Yum, Zypper, and Googet package managers. + message VersionedPackage { + // The name of the package. + string package_name = 4; + + // The system architecture this package is intended for. + string architecture = 2; + + // The version of the package. + string version = 3; + } + + // Details related to a Zypper Patch. + message ZypperPatch { + // The name of the patch. + string patch_name = 5; + + // The category of the patch. + string category = 2; + + // The severity specified for this patch + string severity = 3; + + // Any summary information provided about this patch. + string summary = 4; + } + + // Details related to a Windows Update package. + // Field data and names are taken from Windows Update API IUpdate Interface: + // https://docs.microsoft.com/en-us/windows/win32/api/_wua/ + // Descriptive fields like title, and description are localized based on + // the locale of the VM being updated. + message WindowsUpdatePackage { + // Categories specified by the Windows Update. + message WindowsUpdateCategory { + // The identifier of the windows update category. + string id = 1; + + // The name of the windows update category. + string name = 2; + } + + // The localized title of the update package. + string title = 1; + + // The localized description of the update package. + string description = 2; + + // The categories that are associated with this update package. + repeated WindowsUpdateCategory categories = 3; + + // A collection of Microsoft Knowledge Base article IDs that are associated + // with the update package. + repeated string kb_article_ids = 4; + + // A hyperlink to the language-specific support information for the update. + string support_url = 11; + + // A collection of URLs that provide more information about the update + // package. + repeated string more_info_urls = 5; + + // Gets the identifier of an update package. Stays the same across + // revisions. + string update_id = 6; + + // The revision number of this update package. + int32 revision_number = 7; + + // The last published date of the update, in (UTC) date and time. + google.protobuf.Timestamp last_deployment_change_time = 10; + } + + // Information related to a Quick Fix Engineering package. + // Fields are taken from Windows QuickFixEngineering Interface and match + // the source names: + // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering + message WindowsQuickFixEngineeringPackage { + // A short textual description of the QFE update. + string caption = 1; + + // A textual description of the QFE update. + string description = 2; + + // Unique identifier associated with a particular QFE update. + string hot_fix_id = 3; + + // Date that the QFE update was installed. Mapped from installed_on field. + google.protobuf.Timestamp install_time = 5; + } + + // Contains information about a Windows application that is retrieved from the + // Windows Registry. For more information about these fields, see: + // https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key + message WindowsApplication { + // The name of the application or product. + string display_name = 1; + + // The version of the product or application in string format. + string display_version = 2; + + // The name of the manufacturer for the product or application. + string publisher = 3; + + // The last time this product received service. The value of this property + // is replaced each time a patch is applied or removed from the product or + // the command-line option is used to repair the product. + google.type.Date install_date = 4; + + // The internet address for technical support. + string help_link = 5; + } + + // Output only. The `Inventory` API resource name. + // + // Format: + // `projects/{project_number}/locations/{location}/instances/{instance_id}/inventory` + string name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Base level operating system information for the VM. + OsInfo os_info = 1; + + // Inventory items related to the VM keyed by an opaque unique identifier for + // each inventory item. The identifier is unique to each distinct and + // addressable inventory item and will change, when there is a new package + // version. + map items = 2; + + // Output only. Timestamp of the last reported inventory for the VM. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request message for getting inventory data for the specified VM. +message GetInventoryRequest { + // Required. API resource name for inventory resource. + // + // Format: + // `projects/{project}/locations/{location}/instances/{instance}/inventory` + // + // For `{project}`, either `project-number` or `project-id` can be provided. + // For `{instance}`, either Compute Engine `instance-id` or `instance-name` + // can be provided. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/Inventory" + } + ]; + + // Inventory view indicating what information should be included in the + // inventory resource. If unspecified, the default view is BASIC. + InventoryView view = 2; +} + +// A request message for listing inventory data for all VMs in the specified +// location. +message ListInventoriesRequest { + // Required. The parent resource name. + // + // Format: `projects/{project}/locations/{location}/instances/-` + // + // For `{project}`, either `project-number` or `project-id` can be provided. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + } + ]; + + // Inventory view indicating what information should be included in the + // inventory resource. If unspecified, the default view is BASIC. + InventoryView view = 2; + + // The maximum number of results to return. + int32 page_size = 3; + + // A pagination token returned from a previous call to + // `ListInventories` that indicates where this listing + // should continue from. + string page_token = 4; + + // If provided, this field specifies the criteria that must be met by a + // `Inventory` API resource to be included in the response. + string filter = 5; +} + +// A response message for listing inventory data for all VMs in a specified +// location. +message ListInventoriesResponse { + // List of inventory objects. + repeated Inventory inventories = 1; + + // The pagination token to retrieve the next page of inventory objects. + string next_page_token = 2; +} + +// The view for inventory objects. +enum InventoryView { + // The default value. + // The API defaults to the BASIC view. + INVENTORY_VIEW_UNSPECIFIED = 0; + + // Returns the basic inventory information that includes `os_info`. + BASIC = 1; + + // Returns all fields. + FULL = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto new file mode 100644 index 00000000..de0db191 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto @@ -0,0 +1,548 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_multiple_files = true; +option java_outer_classname = "OsPolicyProto"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// An OS policy defines the desired state configuration for a VM. +message OSPolicy { + // Policy mode + enum Mode { + // Invalid mode + MODE_UNSPECIFIED = 0; + + // This mode checks if the configuration resources in the policy are in + // their desired state. No actions are performed if they are not in the + // desired state. This mode is used for reporting purposes. + VALIDATION = 1; + + // This mode checks if the configuration resources in the policy are in + // their desired state, and if not, enforces the desired state. + ENFORCEMENT = 2; + } + + // Filtering criteria to select VMs based on inventory details. + message InventoryFilter { + // Required. The OS short name + string os_short_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The OS version + // + // Prefix matches are supported if asterisk(*) is provided as the + // last character. For example, to match all versions with a major + // version of `7`, specify the following value for this field `7.*` + // + // An empty string matches all OS versions. + string os_version = 2; + } + + // An OS policy resource is used to define the desired state configuration + // and provides a specific functionality like installing/removing packages, + // executing a script etc. + // + // The system ensures that resources are always in their desired state by + // taking necessary actions if they have drifted from their desired state. + message Resource { + // A remote or local file. + message File { + // Specifies a file available via some URI. + message Remote { + // Required. URI from which to fetch the object. It should contain both + // the protocol and path following the format `{protocol}://{location}`. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // SHA256 checksum of the remote file. + string sha256_checksum = 2; + } + + // Specifies a file available as a Cloud Storage Object. + message Gcs { + // Required. Bucket of the Cloud Storage object. + string bucket = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Name of the Cloud Storage object. + string object = 2 [(google.api.field_behavior) = REQUIRED]; + + // Generation number of the Cloud Storage object. + int64 generation = 3; + } + + // A specific type of file. + oneof type { + // A generic remote file. + Remote remote = 1; + + // A Cloud Storage object. + Gcs gcs = 2; + + // A local path within the VM to use. + string local_path = 3; + } + + // Defaults to false. When false, files are subject to validations + // based on the file type: + // + // Remote: A checksum must be specified. + // Cloud Storage: An object generation number must be specified. + bool allow_insecure = 4; + } + + // A resource that manages a system package. + message PackageResource { + // The desired state that the OS Config agent maintains on the VM. + enum DesiredState { + // Unspecified is invalid. + DESIRED_STATE_UNSPECIFIED = 0; + + // Ensure that the package is installed. + INSTALLED = 1; + + // The agent ensures that the package is not installed and + // uninstalls it if detected. + REMOVED = 2; + } + + // A deb package file. dpkg packages only support INSTALLED state. + message Deb { + // Required. A deb package. + File source = 1 [(google.api.field_behavior) = REQUIRED]; + + // Whether dependencies should also be installed. + // - install when false: `dpkg -i package` + // - install when true: `apt-get update && apt-get -y install + // package.deb` + bool pull_deps = 2; + } + + // A package managed by APT. + // - install: `apt-get update && apt-get -y install [name]` + // - remove: `apt-get -y remove [name]` + message APT { + // Required. Package name. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // An RPM package file. RPM packages only support INSTALLED state. + message RPM { + // Required. An rpm package. + File source = 1 [(google.api.field_behavior) = REQUIRED]; + + // Whether dependencies should also be installed. + // - install when false: `rpm --upgrade --replacepkgs package.rpm` + // - install when true: `yum -y install package.rpm` or + // `zypper -y install package.rpm` + bool pull_deps = 2; + } + + // A package managed by YUM. + // - install: `yum -y install package` + // - remove: `yum -y remove package` + message YUM { + // Required. Package name. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // A package managed by Zypper. + // - install: `zypper -y install package` + // - remove: `zypper -y rm package` + message Zypper { + // Required. Package name. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // A package managed by GooGet. + // - install: `googet -noconfirm install package` + // - remove: `googet -noconfirm remove package` + message GooGet { + // Required. Package name. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // An MSI package. MSI packages only support INSTALLED state. + message MSI { + // Required. The MSI package. + File source = 1 [(google.api.field_behavior) = REQUIRED]; + + // Additional properties to use during installation. + // This should be in the format of Property=Setting. + // Appended to the defaults of `ACTION=INSTALL + // REBOOT=ReallySuppress`. + repeated string properties = 2; + } + + // Required. The desired state the agent should maintain for this package. + DesiredState desired_state = 1 [(google.api.field_behavior) = REQUIRED]; + + // A system package. + oneof system_package { + // A package managed by Apt. + APT apt = 2; + + // A deb package file. + Deb deb = 3; + + // A package managed by YUM. + YUM yum = 4; + + // A package managed by Zypper. + Zypper zypper = 5; + + // An rpm package file. + RPM rpm = 6; + + // A package managed by GooGet. + GooGet googet = 7; + + // An MSI package. + MSI msi = 8; + } + } + + // A resource that manages a package repository. + message RepositoryResource { + // Represents a single apt package repository. These will be added to + // a repo file that will be managed at + // `/etc/apt/sources.list.d/google_osconfig.list`. + message AptRepository { + // Type of archive. + enum ArchiveType { + // Unspecified is invalid. + ARCHIVE_TYPE_UNSPECIFIED = 0; + + // Deb indicates that the archive contains binary files. + DEB = 1; + + // Deb-src indicates that the archive contains source files. + DEB_SRC = 2; + } + + // Required. Type of archive files in this repository. + ArchiveType archive_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. URI for this repository. + string uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Distribution of this repository. + string distribution = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of components for this repository. Must contain at + // least one item. + repeated string components = 4 [(google.api.field_behavior) = REQUIRED]; + + // URI of the key file for this repository. The agent maintains a + // keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`. + string gpg_key = 5; + } + + // Represents a single yum package repository. These are added to a + // repo file that is managed at + // `/etc/yum.repos.d/google_osconfig.repo`. + message YumRepository { + // Required. A one word, unique name for this repository. This is the + // `repo id` in the yum config file and also the `display_name` if + // `display_name` is omitted. This id is also used as the unique + // identifier when checking for resource conflicts. + string id = 1 [(google.api.field_behavior) = REQUIRED]; + + // The display name of the repository. + string display_name = 2; + + // Required. The location of the repository directory. + string base_url = 3 [(google.api.field_behavior) = REQUIRED]; + + // URIs of GPG keys. + repeated string gpg_keys = 4; + } + + // Represents a single zypper package repository. These are added to a + // repo file that is managed at + // `/etc/zypp/repos.d/google_osconfig.repo`. + message ZypperRepository { + // Required. A one word, unique name for this repository. This is the + // `repo id` in the zypper config file and also the `display_name` if + // `display_name` is omitted. This id is also used as the unique + // identifier when checking for GuestPolicy conflicts. + string id = 1 [(google.api.field_behavior) = REQUIRED]; + + // The display name of the repository. + string display_name = 2; + + // Required. The location of the repository directory. + string base_url = 3 [(google.api.field_behavior) = REQUIRED]; + + // URIs of GPG keys. + repeated string gpg_keys = 4; + } + + // Represents a Goo package repository. These are added to a repo file + // that is managed at + // `C:/ProgramData/GooGet/repos/google_osconfig.repo`. + message GooRepository { + // Required. The name of the repository. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The url of the repository. + string url = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // A specific type of repository. + oneof repository { + // An Apt Repository. + AptRepository apt = 1; + + // A Yum Repository. + YumRepository yum = 2; + + // A Zypper Repository. + ZypperRepository zypper = 3; + + // A Goo Repository. + GooRepository goo = 4; + } + } + + // A resource that allows executing scripts on the VM. + // + // The `ExecResource` has 2 stages: `validate` and `enforce` and both stages + // accept a script as an argument to execute. + // + // When the `ExecResource` is applied by the agent, it first executes the + // script in the `validate` stage. The `validate` stage can signal that the + // `ExecResource` is already in the desired state by returning an exit code + // of `100`. If the `ExecResource` is not in the desired state, it should + // return an exit code of `101`. Any other exit code returned by this stage + // is considered an error. + // + // If the `ExecResource` is not in the desired state based on the exit code + // from the `validate` stage, the agent proceeds to execute the script from + // the `enforce` stage. If the `ExecResource` is already in the desired + // state, the `enforce` stage will not be run. + // Similar to `validate` stage, the `enforce` stage should return an exit + // code of `100` to indicate that the resource in now in its desired state. + // Any other exit code is considered an error. + // + // NOTE: An exit code of `100` was chosen over `0` (and `101` vs `1`) to + // have an explicit indicator of `in desired state`, `not in desired state` + // and errors. Because, for example, Powershell will always return an exit + // code of `0` unless an `exit` statement is provided in the script. So, for + // reasons of consistency and being explicit, exit codes `100` and `101` + // were chosen. + message ExecResource { + // A file or script to execute. + message Exec { + // The interpreter to use. + enum Interpreter { + // Invalid value, the request will return validation error. + INTERPRETER_UNSPECIFIED = 0; + + // If an interpreter is not specified, the + // source is executed directly. This execution, without an + // interpreter, only succeeds for executables and scripts that have shebang lines. + NONE = 1; + + // Indicates that the script runs with `/bin/sh` on Linux and + // `cmd.exe` on Windows. + SHELL = 2; + + // Indicates that the script runs with PowerShell. + POWERSHELL = 3; + } + + // What to execute. + oneof source { + // A remote or local file. + File file = 1; + + // An inline script. + // The size of the script is limited to 1024 characters. + string script = 2; + } + + // Optional arguments to pass to the source during execution. + repeated string args = 3; + + // Required. The script interpreter to use. + Interpreter interpreter = 4 [(google.api.field_behavior) = REQUIRED]; + + // Only recorded for enforce Exec. + // Path to an output file (that is created by this Exec) whose + // content will be recorded in OSPolicyResourceCompliance after a + // successful run. Absence or failure to read this file will result in + // this ExecResource being non-compliant. Output file size is limited to + // 100K bytes. + string output_file_path = 5; + } + + // Required. What to run to validate this resource is in the desired + // state. An exit code of 100 indicates "in desired state", and exit code + // of 101 indicates "not in desired state". Any other exit code indicates + // a failure running validate. + Exec validate = 1 [(google.api.field_behavior) = REQUIRED]; + + // What to run to bring this resource into the desired state. + // An exit code of 100 indicates "success", any other exit code indicates + // a failure running enforce. + Exec enforce = 2; + } + + // A resource that manages the state of a file. + message FileResource { + // Desired state of the file. + enum DesiredState { + // Unspecified is invalid. + DESIRED_STATE_UNSPECIFIED = 0; + + // Ensure file at path is present. + PRESENT = 1; + + // Ensure file at path is absent. + ABSENT = 2; + + // Ensure the contents of the file at path matches. If the file does + // not exist it will be created. + CONTENTS_MATCH = 3; + } + + // The source for the contents of the file. + oneof source { + // A remote or local source. + File file = 1; + + // A a file with this content. + // The size of the content is limited to 1024 characters. + string content = 2; + } + + // Required. The absolute path of the file within the VM. + string path = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Desired state of the file. + DesiredState state = 4 [(google.api.field_behavior) = REQUIRED]; + + // Consists of three octal digits which represent, in + // order, the permissions of the owner, group, and other users for the + // file (similarly to the numeric mode used in the linux chmod + // utility). Each digit represents a three bit number with the 4 bit + // corresponding to the read permissions, the 2 bit corresponds to the + // write bit, and the one bit corresponds to the execute permission. + // Default behavior is 755. + // + // Below are some examples of permissions and their associated values: + // read, write, and execute: 7 + // read and execute: 5 + // read and write: 6 + // read only: 4 + string permissions = 5; + } + + // Required. The id of the resource with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-63 characters. + // * Must end with a number or a letter. + // * Must be unique within the OS policy. + string id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Resource type. + oneof resource_type { + // Package resource + PackageResource pkg = 2; + + // Package repository resource + RepositoryResource repository = 3; + + // Exec resource + ExecResource exec = 4; + + // File resource + FileResource file = 5; + } + } + + // Resource groups provide a mechanism to group OS policy resources. + // + // Resource groups enable OS policy authors to create a single OS policy + // to be applied to VMs running different operating Systems. + // + // When the OS policy is applied to a target VM, the appropriate resource + // group within the OS policy is selected based on the `OSFilter` specified + // within the resource group. + message ResourceGroup { + // List of inventory filters for the resource group. + // + // The resources in this resource group are applied to the target VM if it + // satisfies at least one of the following inventory filters. + // + // For example, to apply this resource group to VMs running either `RHEL` or + // `CentOS` operating systems, specify 2 items for the list with following + // values: + // inventory_filters[0].os_short_name='rhel' and + // inventory_filters[1].os_short_name='centos' + // + // If the list is empty, this resource group will be applied to the target + // VM unconditionally. + repeated InventoryFilter inventory_filters = 1; + + // Required. List of resources configured for this resource group. + // The resources are executed in the exact order specified here. + repeated Resource resources = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. The id of the OS policy with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-63 characters. + // * Must end with a number or a letter. + // * Must be unique within the assignment. + string id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Policy description. + // Length of the description is limited to 1024 characters. + string description = 2; + + // Required. Policy mode + Mode mode = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of resource groups for the policy. + // For a particular VM, resource groups are evaluated in the order specified + // and the first resource group that is applicable is selected and the rest + // are ignored. + // + // If none of the resource groups are applicable for a VM, the VM is + // considered to be non-compliant w.r.t this policy. This behavior can be + // toggled by the flag `allow_no_resource_group_match` + repeated ResourceGroup resource_groups = 4 + [(google.api.field_behavior) = REQUIRED]; + + // This flag determines the OS policy compliance status when none of the + // resource groups within the policy are applicable for a VM. Set this value + // to `true` if the policy needs to be reported as compliant even if the + // policy has nothing to validate or enforce. + bool allow_no_resource_group_match = 5; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto new file mode 100644 index 00000000..aa4b2b11 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto @@ -0,0 +1,296 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_multiple_files = true; +option java_outer_classname = "OSPolicyAssignmentReportsProto"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; +option (google.api.resource_definition) = { + type: "osconfig.googleapis.com/InstanceOSPolicyAssignment" + pattern: "projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}" +}; + +// Get a report of the OS policy assignment for a VM instance. +message GetOSPolicyAssignmentReportRequest { + // Required. API resource name for OS policy assignment report. + // + // Format: + // `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report` + // + // For `{project}`, either `project-number` or `project-id` can be provided. + // For `{instance_id}`, either Compute Engine `instance-id` or `instance-name` + // can be provided. + // For `{assignment_id}`, the OSPolicyAssignment id must be provided. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/OSPolicyAssignmentReport" + } + ]; +} + +// List the OS policy assignment reports for VM instances. +message ListOSPolicyAssignmentReportsRequest { + // Required. The parent resource name. + // + // Format: + // `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports` + // + // For `{project}`, either `project-number` or `project-id` can be provided. + // For `{instance}`, either `instance-name`, `instance-id`, or `-` can be + // provided. If '-' is provided, the response will include + // OSPolicyAssignmentReports for all instances in the project/location. + // For `{assignment}`, either `assignment-id` or `-` can be provided. If '-' + // is provided, the response will include OSPolicyAssignmentReports for all + // OSPolicyAssignments in the project/location. + // Either {instance} or {assignment} must be `-`. + // + // For example: + // `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports` + // returns all reports for the instance + // `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports` + // returns all the reports for the given assignment across all instances. + // `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports` + // returns all the reports for all assignments across all instances. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/InstanceOSPolicyAssignment" + } + ]; + + // The maximum number of results to return. + int32 page_size = 2; + + // If provided, this field specifies the criteria that must be met by the + // `OSPolicyAssignmentReport` API resource that is included in the response. + string filter = 3; + + // A pagination token returned from a previous call to the + // `ListOSPolicyAssignmentReports` method that indicates where this listing + // should continue from. + string page_token = 4; +} + +// A response message for listing OS Policy assignment reports including the +// page of results and page token. +message ListOSPolicyAssignmentReportsResponse { + // List of OS policy assignment reports. + repeated OSPolicyAssignmentReport os_policy_assignment_reports = 1; + + // The pagination token to retrieve the next page of OS policy assignment + // report objects. + string next_page_token = 2; +} + +// A report of the OS policy assignment status for a given instance. +message OSPolicyAssignmentReport { + option (google.api.resource) = { + type: "osconfig.googleapis.com/OSPolicyAssignmentReport" + pattern: "projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report" + }; + + // Compliance data for an OS policy + message OSPolicyCompliance { + // Possible compliance states for an os policy. + enum ComplianceState { + // The policy is in an unknown compliance state. + // + // Refer to the field `compliance_state_reason` to learn the exact reason + // for the policy to be in this compliance state. + UNKNOWN = 0; + + // Policy is compliant. + // + // The policy is compliant if all the underlying resources are also + // compliant. + COMPLIANT = 1; + + // Policy is non-compliant. + // + // The policy is non-compliant if one or more underlying resources are + // non-compliant. + NON_COMPLIANT = 2; + } + + // Compliance data for an OS policy resource. + message OSPolicyResourceCompliance { + // Step performed by the OS Config agent for configuring an + // `OSPolicy` resource to its desired state. + message OSPolicyResourceConfigStep { + // Supported configuration step types + enum Type { + // Default value. This value is unused. + TYPE_UNSPECIFIED = 0; + + // Checks for resource conflicts such as schema errors. + VALIDATION = 1; + + // Checks the current status of the desired state for a resource. + DESIRED_STATE_CHECK = 2; + + // Enforces the desired state for a resource that is not in desired + // state. + DESIRED_STATE_ENFORCEMENT = 3; + + // Re-checks the status of the desired state. This check is done + // for a resource after the enforcement of all OS policies. + // + // This step is used to determine the final desired state status for + // the resource. It accounts for any resources that might have drifted + // from their desired state due to side effects from executing other + // resources. + DESIRED_STATE_CHECK_POST_ENFORCEMENT = 4; + } + + // Configuration step type. + Type type = 1; + + // An error message recorded during the execution of this step. + // Only populated if errors were encountered during this step execution. + string error_message = 2; + } + + // Possible compliance states for a resource. + enum ComplianceState { + // The resource is in an unknown compliance state. + // + // To get more details about why the policy is in this state, review + // the output of the `compliance_state_reason` field. + UNKNOWN = 0; + + // Resource is compliant. + COMPLIANT = 1; + + // Resource is non-compliant. + NON_COMPLIANT = 2; + } + + // ExecResource specific output. + message ExecResourceOutput { + // Output from enforcement phase output file (if run). + // Output size is limited to 100K bytes. + bytes enforcement_output = 2; + } + + // The ID of the OS policy resource. + string os_policy_resource_id = 1; + + // Ordered list of configuration completed by the agent for the OS policy + // resource. + repeated OSPolicyResourceConfigStep config_steps = 2; + + // The compliance state of the resource. + ComplianceState compliance_state = 3; + + // A reason for the resource to be in the given compliance state. + // This field is always populated when `compliance_state` is `UNKNOWN`. + // + // The following values are supported when `compliance_state == UNKNOWN` + // + // * `execution-errors`: Errors were encountered by the agent while + // executing the resource and the compliance state couldn't be + // determined. + // * `execution-skipped-by-agent`: Resource execution was skipped by the + // agent because errors were encountered while executing prior resources + // in the OS policy. + // * `os-policy-execution-attempt-failed`: The execution of the OS policy + // containing this resource failed and the compliance state couldn't be + // determined. + string compliance_state_reason = 4; + + // Resource specific output. + oneof output { + // ExecResource specific output. + ExecResourceOutput exec_resource_output = 5; + } + } + + // The OS policy id + string os_policy_id = 1; + + // The compliance state of the OS policy. + ComplianceState compliance_state = 2; + + // The reason for the OS policy to be in an unknown compliance state. + // This field is always populated when `compliance_state` is `UNKNOWN`. + // + // If populated, the field can contain one of the following values: + // + // * `vm-not-running`: The VM was not running. + // * `os-policies-not-supported-by-agent`: The version of the OS Config + // agent running on the VM does not support running OS policies. + // * `no-agent-detected`: The OS Config agent is not detected for the VM. + // * `resource-execution-errors`: The OS Config agent encountered errors + // while executing one or more resources in the policy. See + // `os_policy_resource_compliances` for details. + // * `task-timeout`: The task sent to the agent to apply the policy timed + // out. + // * `unexpected-agent-state`: The OS Config agent did not report the final + // status of the task that attempted to apply the policy. Instead, the agent + // unexpectedly started working on a different task. This mostly happens + // when the agent or VM unexpectedly restarts while applying OS policies. + // * `internal-service-errors`: Internal service errors were encountered + // while attempting to apply the policy. + string compliance_state_reason = 3; + + // Compliance data for each resource within the policy that is applied to + // the VM. + repeated OSPolicyResourceCompliance os_policy_resource_compliances = 4; + } + + // The `OSPolicyAssignmentReport` API resource name. + // + // Format: + // `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report` + string name = 1; + + // The Compute Engine VM instance name. + string instance = 2; + + // Reference to the `OSPolicyAssignment` API resource that the `OSPolicy` + // belongs to. + // + // Format: + // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}` + string os_policy_assignment = 3 [(google.api.resource_reference) = { + type: "osconfig.googleapis.com/OSPolicyAssignment" + }]; + + // Compliance data for each `OSPolicy` that is applied to the VM. + repeated OSPolicyCompliance os_policy_compliances = 4; + + // Timestamp for when the report was last generated. + google.protobuf.Timestamp update_time = 5; + + // Unique identifier of the last attempted run to apply the OS policies + // associated with this assignment on the VM. + // + // This ID is logged by the OS Config agent while applying the OS + // policies associated with this assignment on the VM. + // NOTE: If the service is unable to successfully connect to the agent for + // this run, then this id will not be available in the agent logs. + string last_run_id = 6; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto new file mode 100644 index 00000000..157b8fd3 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto @@ -0,0 +1,386 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/osconfig/v1/os_policy.proto"; +import "google/cloud/osconfig/v1/osconfig_common.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_multiple_files = true; +option java_outer_classname = "OsPolicyAssignmentsProto"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// OS policy assignment is an API resource that is used to +// apply a set of OS policies to a dynamically targeted group of Compute Engine +// VM instances. +// +// An OS policy is used to define the desired state configuration for a +// Compute Engine VM instance through a set of configuration resources that +// provide capabilities such as installing or removing software packages, or +// executing a script. +// +// For more information, see [OS policy and OS policy +// assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies). +message OSPolicyAssignment { + option (google.api.resource) = { + type: "osconfig.googleapis.com/OSPolicyAssignment" + pattern: "projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}" + }; + + // Message representing label set. + // * A label is a key value pair set for a VM. + // * A LabelSet is a set of labels. + // * Labels within a LabelSet are ANDed. In other words, a LabelSet is + // applicable for a VM only if it matches all the labels in the + // LabelSet. + // * Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will + // only be applicable for those VMs with both labels + // present. + message LabelSet { + // Labels are identified by key/value pairs in this map. + // A VM should contain all the key/value pairs specified in this + // map to be selected. + map labels = 1; + } + + // Filters to select target VMs for an assignment. + // + // If more than one filter criteria is specified below, a VM will be selected + // if and only if it satisfies all of them. + message InstanceFilter { + // VM inventory details. + message Inventory { + // Required. The OS short name + string os_short_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The OS version + // + // Prefix matches are supported if asterisk(*) is provided as the + // last character. For example, to match all versions with a major + // version of `7`, specify the following value for this field `7.*` + // + // An empty string matches all OS versions. + string os_version = 2; + } + + // Target all VMs in the project. If true, no other criteria is + // permitted. + bool all = 1; + + // List of label sets used for VM inclusion. + // + // If the list has more than one `LabelSet`, the VM is included if any + // of the label sets are applicable for the VM. + repeated LabelSet inclusion_labels = 2; + + // List of label sets used for VM exclusion. + // + // If the list has more than one label set, the VM is excluded if any + // of the label sets are applicable for the VM. + repeated LabelSet exclusion_labels = 3; + + // List of inventories to select VMs. + // + // A VM is selected if its inventory data matches at least one of the + // following inventories. + repeated Inventory inventories = 4; + } + + // Message to configure the rollout at the zonal level for the OS policy + // assignment. + message Rollout { + // Required. The maximum number (or percentage) of VMs per zone to disrupt + // at any given moment. + FixedOrPercent disruption_budget = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. This determines the minimum duration of time to wait after the + // configuration changes are applied through the current rollout. A + // VM continues to count towards the `disruption_budget` at least + // until this duration of time has passed after configuration changes are + // applied. + google.protobuf.Duration min_wait_duration = 2 + [(google.api.field_behavior) = REQUIRED]; + } + + // OS policy assignment rollout state + enum RolloutState { + // Invalid value + ROLLOUT_STATE_UNSPECIFIED = 0; + + // The rollout is in progress. + IN_PROGRESS = 1; + + // The rollout is being cancelled. + CANCELLING = 2; + + // The rollout is cancelled. + CANCELLED = 3; + + // The rollout has completed successfully. + SUCCEEDED = 4; + } + + // Resource name. + // + // Format: + // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}` + // + // This field is ignored when you create an OS policy assignment. + string name = 1; + + // OS policy assignment description. + // Length of the description is limited to 1024 characters. + string description = 2; + + // Required. List of OS policies to be applied to the VMs. + repeated OSPolicy os_policies = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Filter to select VMs. + InstanceFilter instance_filter = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Rollout to deploy the OS policy assignment. + // A rollout is triggered in the following situations: + // 1) OSPolicyAssignment is created. + // 2) OSPolicyAssignment is updated and the update contains changes to one of + // the following fields: + // - instance_filter + // - os_policies + // 3) OSPolicyAssignment is deleted. + Rollout rollout = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The assignment revision ID + // A new revision is committed whenever a rollout is triggered for a OS policy + // assignment + string revision_id = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp that the revision was created. + google.protobuf.Timestamp revision_create_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The etag for this OS policy assignment. + // If this is provided on update, it must match the server's etag. + string etag = 8; + + // Output only. OS policy assignment rollout state + RolloutState rollout_state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates that this revision has been successfully rolled out + // in this zone and new VMs will be assigned OS policies from this revision. + // + // For a given OS policy assignment, there is only one revision with a value + // of `true` for this field. + bool baseline = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates that this revision deletes the OS policy assignment. + bool deleted = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates that reconciliation is in progress for the revision. + // This value is `true` when the `rollout_state` is one of: + // * IN_PROGRESS + // * CANCELLING + bool reconciling = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server generated unique id for the OS policy assignment + // resource. + string uid = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// OS policy assignment operation metadata provided by OS policy assignment API +// methods that return long running operations. +message OSPolicyAssignmentOperationMetadata { + // The OS policy assignment API method. + enum APIMethod { + // Invalid value + API_METHOD_UNSPECIFIED = 0; + + // Create OS policy assignment API method + CREATE = 1; + + // Update OS policy assignment API method + UPDATE = 2; + + // Delete OS policy assignment API method + DELETE = 3; + } + + // State of the rollout + enum RolloutState { + // Invalid value + ROLLOUT_STATE_UNSPECIFIED = 0; + + // The rollout is in progress. + IN_PROGRESS = 1; + + // The rollout is being cancelled. + CANCELLING = 2; + + // The rollout is cancelled. + CANCELLED = 3; + + // The rollout has completed successfully. + SUCCEEDED = 4; + } + + // Reference to the `OSPolicyAssignment` API resource. + // + // Format: + // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}` + string os_policy_assignment = 1 [(google.api.resource_reference) = { + type: "osconfig.googleapis.com/OSPolicyAssignment" + }]; + + // The OS policy assignment API method. + APIMethod api_method = 2; + + // State of the rollout + RolloutState rollout_state = 3; + + // Rollout start time + google.protobuf.Timestamp rollout_start_time = 4; + + // Rollout update time + google.protobuf.Timestamp rollout_update_time = 5; +} + +// A request message to create an OS policy assignment +message CreateOSPolicyAssignmentRequest { + // Required. The parent resource name in the form: + // projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The OS policy assignment to be created. + OSPolicyAssignment os_policy_assignment = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The logical name of the OS policy assignment in the project + // with the following restrictions: + // + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-63 characters. + // * Must end with a number or a letter. + // * Must be unique within the project. + string os_policy_assignment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A request message to update an OS policy assignment +message UpdateOSPolicyAssignmentRequest { + // Required. The updated OS policy assignment. + OSPolicyAssignment os_policy_assignment = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Field mask that controls which fields of the assignment should be + // updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A request message to get an OS policy assignment +message GetOSPolicyAssignmentRequest { + // Required. The resource name of OS policy assignment. + // + // Format: + // `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/OSPolicyAssignment" + } + ]; +} + +// A request message to list OS policy assignments for a parent resource +message ListOSPolicyAssignmentsRequest { + // Required. The parent resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of assignments to return. + int32 page_size = 2; + + // A pagination token returned from a previous call to + // `ListOSPolicyAssignments` that indicates where this listing should continue + // from. + string page_token = 3; +} + +// A response message for listing all assignments under given parent. +message ListOSPolicyAssignmentsResponse { + // The list of assignments + repeated OSPolicyAssignment os_policy_assignments = 1; + + // The pagination token to retrieve the next page of OS policy assignments. + string next_page_token = 2; +} + +// A request message to list revisions for a OS policy assignment +message ListOSPolicyAssignmentRevisionsRequest { + // Required. The name of the OS policy assignment to list revisions for. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/OSPolicyAssignment" + } + ]; + + // The maximum number of revisions to return. + int32 page_size = 2; + + // A pagination token returned from a previous call to + // `ListOSPolicyAssignmentRevisions` that indicates where this listing should + // continue from. + string page_token = 3; +} + +// A response message for listing all revisions for a OS policy assignment. +message ListOSPolicyAssignmentRevisionsResponse { + // The OS policy assignment revisions + repeated OSPolicyAssignment os_policy_assignments = 1; + + // The pagination token to retrieve the next page of OS policy assignment + // revisions. + string next_page_token = 2; +} + +// A request message for deleting a OS policy assignment. +message DeleteOSPolicyAssignmentRequest { + // Required. The name of the OS policy assignment to be deleted + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/OSPolicyAssignment" + } + ]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto new file mode 100644 index 00000000..2b72d6ae --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto @@ -0,0 +1,38 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_outer_classname = "Common"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// Message encapsulating a value that can be either absolute ("fixed") or +// relative ("percent") to a value. +message FixedOrPercent { + // Type of the value. + oneof mode { + // Specifies a fixed value. + int32 fixed = 1; + + // Specifies the relative value defined as a percentage, which will be + // multiplied by a reference value. + int32 percent = 2; + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto new file mode 100644 index 00000000..515905c8 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto @@ -0,0 +1,158 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/client.proto"; +import "google/api/resource.proto"; +import "google/cloud/osconfig/v1/patch_deployments.proto"; +import "google/cloud/osconfig/v1/patch_jobs.proto"; +import "google/protobuf/empty.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_outer_classname = "OsConfigProto"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Instance" + pattern: "projects/{project}/zones/{zone}/instances/{instance}" + pattern: "projects/{project}/locations/{location}/instances/{instance}" +}; + +// OS Config API +// +// The OS Config service is a server-side component that you can use to +// manage package installations and patch jobs for virtual machine instances. +service OsConfigService { + option (google.api.default_host) = "osconfig.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Patch VM instances by creating and running a patch job. + rpc ExecutePatchJob(ExecutePatchJobRequest) returns (PatchJob) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/patchJobs:execute" + body: "*" + }; + } + + // Get the patch job. This can be used to track the progress of an + // ongoing patch job or review the details of completed jobs. + rpc GetPatchJob(GetPatchJobRequest) returns (PatchJob) { + option (google.api.http) = { + get: "/v1/{name=projects/*/patchJobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Cancel a patch job. The patch job must be active. Canceled patch jobs + // cannot be restarted. + rpc CancelPatchJob(CancelPatchJobRequest) returns (PatchJob) { + option (google.api.http) = { + post: "/v1/{name=projects/*/patchJobs/*}:cancel" + body: "*" + }; + } + + // Get a list of patch jobs. + rpc ListPatchJobs(ListPatchJobsRequest) returns (ListPatchJobsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/patchJobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Get a list of instance details for a given patch job. + rpc ListPatchJobInstanceDetails(ListPatchJobInstanceDetailsRequest) + returns (ListPatchJobInstanceDetailsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/patchJobs/*}/instanceDetails" + }; + option (google.api.method_signature) = "parent"; + } + + // Create an OS Config patch deployment. + rpc CreatePatchDeployment(CreatePatchDeploymentRequest) + returns (PatchDeployment) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/patchDeployments" + body: "patch_deployment" + }; + option (google.api.method_signature) = + "parent,patch_deployment,patch_deployment_id"; + } + + // Get an OS Config patch deployment. + rpc GetPatchDeployment(GetPatchDeploymentRequest) returns (PatchDeployment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/patchDeployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Get a page of OS Config patch deployments. + rpc ListPatchDeployments(ListPatchDeploymentsRequest) + returns (ListPatchDeploymentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/patchDeployments" + }; + option (google.api.method_signature) = "parent"; + } + + // Delete an OS Config patch deployment. + rpc DeletePatchDeployment(DeletePatchDeploymentRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/patchDeployments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Update an OS Config patch deployment. + rpc UpdatePatchDeployment(UpdatePatchDeploymentRequest) + returns (PatchDeployment) { + option (google.api.http) = { + patch: "/v1/{patch_deployment.name=projects/*/patchDeployments/*}" + body: "patch_deployment" + }; + option (google.api.method_signature) = "patch_deployment,update_mask"; + } + + // Change state of patch deployment to "PAUSED". + // Patch deployment in paused state doesn't generate patch jobs. + rpc PausePatchDeployment(PausePatchDeploymentRequest) + returns (PatchDeployment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/patchDeployments/*}:pause" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Change state of patch deployment back to "ACTIVE". + // Patch deployment in active state continues to generate patch jobs. + rpc ResumePatchDeployment(ResumePatchDeploymentRequest) + returns (PatchDeployment) { + option (google.api.http) = { + post: "/v1/{name=projects/*/patchDeployments/*}:resume" + body: "*" + }; + option (google.api.method_signature) = "name"; + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto new file mode 100644 index 00000000..196737c1 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto @@ -0,0 +1,202 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/cloud/osconfig/v1/inventory.proto"; +import "google/cloud/osconfig/v1/os_policy_assignment_reports.proto"; +import "google/cloud/osconfig/v1/os_policy_assignments.proto"; +import "google/cloud/osconfig/v1/vulnerability.proto"; +import "google/longrunning/operations.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_multiple_files = true; +option java_outer_classname = "OsConfigZonalServiceProto"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// Zonal OS Config API +// +// The OS Config service is the server-side component that allows users to +// manage package installations and patch jobs for Compute Engine VM instances. +service OsConfigZonalService { + option (google.api.default_host) = "osconfig.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Create an OS policy assignment. + // + // This method also creates the first revision of the OS policy assignment. + // + // This method returns a long running operation (LRO) that contains the + // rollout details. The rollout can be cancelled by cancelling the LRO. + // + // For more information, see [Method: + // projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). + rpc CreateOSPolicyAssignment(CreateOSPolicyAssignmentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/osPolicyAssignments" + body: "os_policy_assignment" + }; + option (google.api.method_signature) = + "parent,os_policy_assignment,os_policy_assignment_id"; + option (google.longrunning.operation_info) = { + response_type: "OSPolicyAssignment" + metadata_type: "OSPolicyAssignmentOperationMetadata" + }; + } + + // Update an existing OS policy assignment. + // + // This method creates a new revision of the OS policy assignment. + // + // This method returns a long running operation (LRO) that contains the + // rollout details. The rollout can be cancelled by cancelling the LRO. + // + // For more information, see [Method: + // projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). + rpc UpdateOSPolicyAssignment(UpdateOSPolicyAssignmentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{os_policy_assignment.name=projects/*/locations/*/osPolicyAssignments/*}" + body: "os_policy_assignment" + }; + option (google.api.method_signature) = "os_policy_assignment,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "OSPolicyAssignment" + metadata_type: "OSPolicyAssignmentOperationMetadata" + }; + } + + // Retrieve an existing OS policy assignment. + // + // This method always returns the latest revision. In order to retrieve a + // previous revision of the assignment, also provide the revision ID in the + // `name` parameter. + rpc GetOSPolicyAssignment(GetOSPolicyAssignmentRequest) + returns (OSPolicyAssignment) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List the OS policy assignments under the parent resource. + // + // For each OS policy assignment, the latest revision is returned. + rpc ListOSPolicyAssignments(ListOSPolicyAssignmentsRequest) + returns (ListOSPolicyAssignmentsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/osPolicyAssignments" + }; + option (google.api.method_signature) = "parent"; + } + + // List the OS policy assignment revisions for a given OS policy assignment. + rpc ListOSPolicyAssignmentRevisions(ListOSPolicyAssignmentRevisionsRequest) + returns (ListOSPolicyAssignmentRevisionsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}:listRevisions" + }; + option (google.api.method_signature) = "name"; + } + + // Delete the OS policy assignment. + // + // This method creates a new revision of the OS policy assignment. + // + // This method returns a long running operation (LRO) that contains the + // rollout details. The rollout can be cancelled by cancelling the LRO. + // + // If the LRO completes and is not cancelled, all revisions associated with + // the OS policy assignment are deleted. + // + // For more information, see [Method: + // projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). + rpc DeleteOSPolicyAssignment(DeleteOSPolicyAssignmentRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OSPolicyAssignmentOperationMetadata" + }; + } + + // Get the OS policy asssignment report for the specified Compute Engine VM + // instance. + rpc GetOSPolicyAssignmentReport(GetOSPolicyAssignmentReportRequest) + returns (OSPolicyAssignmentReport) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*/osPolicyAssignments/*/report}" + }; + option (google.api.method_signature) = "name"; + } + + // List OS policy asssignment reports for all Compute Engine VM instances in + // the specified zone. + rpc ListOSPolicyAssignmentReports(ListOSPolicyAssignmentReportsRequest) + returns (ListOSPolicyAssignmentReportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/instances/*/osPolicyAssignments/*}/reports" + }; + option (google.api.method_signature) = "parent"; + } + + // Get inventory data for the specified VM instance. If the VM has no + // associated inventory, the message `NOT_FOUND` is returned. + rpc GetInventory(GetInventoryRequest) returns (Inventory) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*/inventory}" + }; + option (google.api.method_signature) = "name"; + } + + // List inventory data for all VM instances in the specified zone. + rpc ListInventories(ListInventoriesRequest) + returns (ListInventoriesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/instances/*}/inventories" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the vulnerability report for the specified VM instance. Only VMs with + // inventory data have vulnerability reports associated with them. + rpc GetVulnerabilityReport(GetVulnerabilityReportRequest) + returns (VulnerabilityReport) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/instances/*/vulnerabilityReport}" + }; + option (google.api.method_signature) = "name"; + } + + // List vulnerability reports for all VM instances in the specified zone. + rpc ListVulnerabilityReports(ListVulnerabilityReportsRequest) + returns (ListVulnerabilityReportsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/instances/*}/vulnerabilityReports" + }; + option (google.api.method_signature) = "parent"; + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto new file mode 100644 index 00000000..d5708544 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto @@ -0,0 +1,339 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/osconfig/v1/patch_jobs.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/datetime.proto"; +import "google/type/dayofweek.proto"; +import "google/type/timeofday.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_outer_classname = "PatchDeployments"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// Patch deployments are configurations that individual patch jobs use to +// complete a patch. These configurations include instance filter, package +// repository settings, and a schedule. For more information about creating and +// managing patch deployments, see [Scheduling patch +// jobs](https://cloud.google.com/compute/docs/os-patch-management/schedule-patch-jobs). +message PatchDeployment { + option (google.api.resource) = { + type: "osconfig.googleapis.com/PatchDeployment" + pattern: "projects/{project}/patchDeployments/{patch_deployment}" + }; + + // Represents state of patch peployment. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // Active value means that patch deployment generates Patch Jobs. + ACTIVE = 1; + + // Paused value means that patch deployment does not generate + // Patch jobs. Requires user action to move in and out from this state. + PAUSED = 2; + } + + // Unique name for the patch deployment resource in a project. The patch + // deployment name is in the form: + // `projects/{project_id}/patchDeployments/{patch_deployment_id}`. + // This field is ignored when you create a new patch deployment. + string name = 1; + + // Optional. Description of the patch deployment. Length of the description is + // limited to 1024 characters. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. VM instances to patch. + PatchInstanceFilter instance_filter = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Patch configuration that is applied. + PatchConfig patch_config = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Duration of the patch. After the duration ends, the patch times + // out. + google.protobuf.Duration duration = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Schedule for the patch. + oneof schedule { + // Required. Schedule a one-time execution. + OneTimeSchedule one_time_schedule = 6 + [(google.api.field_behavior) = REQUIRED]; + + // Required. Schedule recurring executions. + RecurringSchedule recurring_schedule = 7 + [(google.api.field_behavior) = REQUIRED]; + } + + // Output only. Time the patch deployment was created. Timestamp is in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + google.protobuf.Timestamp create_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Time the patch deployment was last updated. Timestamp is in + // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. + google.protobuf.Timestamp update_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last time a patch job was started by this deployment. + // Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text + // format. + google.protobuf.Timestamp last_execute_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Rollout strategy of the patch job. + PatchRollout rollout = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Current state of the patch deployment. + State state = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Sets the time for a one time patch deployment. Timestamp is in +// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. +message OneTimeSchedule { + // Required. The desired patch job execution time. + google.protobuf.Timestamp execute_time = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Sets the time for recurring patch deployments. +message RecurringSchedule { + // Specifies the frequency of the recurring patch deployments. + enum Frequency { + // Invalid. A frequency must be specified. + FREQUENCY_UNSPECIFIED = 0; + + // Indicates that the frequency of recurrence should be expressed in terms + // of weeks. + WEEKLY = 1; + + // Indicates that the frequency of recurrence should be expressed in terms + // of months. + MONTHLY = 2; + + // Indicates that the frequency of recurrence should be expressed in terms + // of days. + DAILY = 3; + } + + // Required. Defines the time zone that `time_of_day` is relative to. + // The rules for daylight saving time are determined by the chosen time zone. + google.type.TimeZone time_zone = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The time that the recurring schedule becomes effective. + // Defaults to `create_time` of the patch deployment. + google.protobuf.Timestamp start_time = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The end time at which a recurring patch deployment schedule is no + // longer active. + google.protobuf.Timestamp end_time = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. Time of the day to run a recurring deployment. + google.type.TimeOfDay time_of_day = 4 + [(google.api.field_behavior) = REQUIRED]; + + // Required. The frequency unit of this recurring schedule. + Frequency frequency = 5 [(google.api.field_behavior) = REQUIRED]; + + // Configurations for this recurring schedule. + // Configurations must match frequency. + oneof schedule_config { + // Required. Schedule with weekly executions. + WeeklySchedule weekly = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. Schedule with monthly executions. + MonthlySchedule monthly = 7 [(google.api.field_behavior) = REQUIRED]; + } + + // Output only. The time the last patch job ran successfully. + google.protobuf.Timestamp last_execute_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the next patch job is scheduled to run. + google.protobuf.Timestamp next_execute_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a weekly schedule. +message WeeklySchedule { + // Required. Day of the week. + google.type.DayOfWeek day_of_week = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Represents a monthly schedule. An example of a valid monthly schedule is +// "on the third Tuesday of the month" or "on the 15th of the month". +message MonthlySchedule { + // One day in a month. + oneof day_of_month { + // Required. Week day in a month. + WeekDayOfMonth week_day_of_month = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Required. One day of the month. 1-31 indicates the 1st to the 31st day. + // -1 indicates the last day of the month. Months without the target day + // will be skipped. For example, a schedule to run "every month on the 31st" + // will not run in February, April, June, etc. + int32 month_day = 2 [(google.api.field_behavior) = REQUIRED]; + } +} + +// Represents one week day in a month. An example is "the 4th Sunday". +message WeekDayOfMonth { + // Required. Week number in a month. 1-4 indicates the 1st to 4th week of the + // month. -1 indicates the last week of the month. + int32 week_ordinal = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A day of the week. + google.type.DayOfWeek day_of_week = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Represents the number of days before or after the given week day + // of month that the patch deployment is scheduled for. For example if + // `week_ordinal` and `day_of_week` values point to the second day of the + // month and this `day_offset` value is set to `3`, the patch deployment takes + // place three days after the second Tuesday of the month. If this value is + // negative, for example -5, the patches are deployed five days before before + // the second Tuesday of the month. Allowed values are in range [-30, 30]. + int32 day_offset = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A request message for creating a patch deployment. +message CreatePatchDeploymentRequest { + // Required. The project to apply this patch deployment to in the form + // `projects/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. A name for the patch deployment in the project. When creating a + // name the following rules apply: + // * Must contain only lowercase letters, numbers, and hyphens. + // * Must start with a letter. + // * Must be between 1-63 characters. + // * Must end with a number or a letter. + // * Must be unique within the project. + string patch_deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The patch deployment to create. + PatchDeployment patch_deployment = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A request message for retrieving a patch deployment. +message GetPatchDeploymentRequest { + // Required. The resource name of the patch deployment in the form + // `projects/*/patchDeployments/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchDeployment" + } + ]; +} + +// A request message for listing patch deployments. +message ListPatchDeploymentsRequest { + // Required. The resource name of the parent in the form `projects/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Optional. The maximum number of patch deployments to return. Default is + // 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A pagination token returned from a previous call to + // ListPatchDeployments that indicates where this listing should continue + // from. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// A response message for listing patch deployments. +message ListPatchDeploymentsResponse { + // The list of patch deployments. + repeated PatchDeployment patch_deployments = 1; + + // A pagination token that can be used to get the next page of patch + // deployments. + string next_page_token = 2; +} + +// A request message for deleting a patch deployment. +message DeletePatchDeploymentRequest { + // Required. The resource name of the patch deployment in the form + // `projects/*/patchDeployments/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchDeployment" + } + ]; +} + +// A request message for updating a patch deployment. +message UpdatePatchDeploymentRequest { + // Required. The patch deployment to Update. + PatchDeployment patch_deployment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Field mask that controls which fields of the patch deployment + // should be updated. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A request message for pausing a patch deployment. +message PausePatchDeploymentRequest { + // Required. The resource name of the patch deployment in the form + // `projects/*/patchDeployments/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchDeployment" + } + ]; +} + +// A request message for resuming a patch deployment. +message ResumePatchDeploymentRequest { + // Required. The resource name of the patch deployment in the form + // `projects/*/patchDeployments/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchDeployment" + } + ]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto new file mode 100644 index 00000000..4edfc8df --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto @@ -0,0 +1,742 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/osconfig/v1/osconfig_common.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_outer_classname = "PatchJobs"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// A request message to initiate patching across Compute Engine +// instances. +message ExecutePatchJobRequest { + // Required. The project in which to run this patch in the form `projects/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Description of the patch job. Length of the description is limited + // to 1024 characters. + string description = 2; + + // Required. Instances to patch, either explicitly or filtered by some + // criteria such as zone or labels. + PatchInstanceFilter instance_filter = 7 + [(google.api.field_behavior) = REQUIRED]; + + // Patch configuration being applied. If omitted, instances are + // patched using the default configurations. + PatchConfig patch_config = 4; + + // Duration of the patch job. After the duration ends, the patch job + // times out. + google.protobuf.Duration duration = 5; + + // If this patch is a dry-run only, instances are contacted but + // will do nothing. + bool dry_run = 6; + + // Display name for this patch job. This does not have to be unique. + string display_name = 8; + + // Rollout strategy of the patch job. + PatchRollout rollout = 9; +} + +// Request to get an active or completed patch job. +message GetPatchJobRequest { + // Required. Name of the patch in the form `projects/*/patchJobs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchJob" + } + ]; +} + +// Request to list details for all instances that are part of a patch job. +message ListPatchJobInstanceDetailsRequest { + // Required. The parent for the instances are in the form of + // `projects/*/patchJobs/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchJob" + } + ]; + + // The maximum number of instance details records to return. Default is 100. + int32 page_size = 2; + + // A pagination token returned from a previous call + // that indicates where this listing should continue from. + string page_token = 3; + + // A filter expression that filters results listed in the response. This + // field supports filtering results by instance zone, name, state, or + // `failure_reason`. + string filter = 4; +} + +// A response message for listing the instances details for a patch job. +message ListPatchJobInstanceDetailsResponse { + // A list of instance status. + repeated PatchJobInstanceDetails patch_job_instance_details = 1; + + // A pagination token that can be used to get the next page of results. + string next_page_token = 2; +} + +// Patch details for a VM instance. For more information about reviewing VM +// instance details, see +// [Listing all VM instance details for a specific patch +// job](https://cloud.google.com/compute/docs/os-patch-management/manage-patch-jobs#list-instance-details). +message PatchJobInstanceDetails { + // The instance name in the form `projects/*/zones/*/instances/*` + string name = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + }]; + + // The unique identifier for the instance. This identifier is + // defined by the server. + string instance_system_id = 2; + + // Current state of instance patch. + Instance.PatchState state = 3; + + // If the patch fails, this field provides the reason. + string failure_reason = 4; + + // The number of times the agent that the agent attempts to apply the patch. + int64 attempt_count = 5; +} + +// A request message for listing patch jobs. +message ListPatchJobsRequest { + // Required. In the form of `projects/*` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // The maximum number of instance status to return. + int32 page_size = 2; + + // A pagination token returned from a previous call + // that indicates where this listing should continue from. + string page_token = 3; + + // If provided, this field specifies the criteria that must be met by patch + // jobs to be included in the response. + // Currently, filtering is only available on the patch_deployment field. + string filter = 4; +} + +// A response message for listing patch jobs. +message ListPatchJobsResponse { + // The list of patch jobs. + repeated PatchJob patch_jobs = 1; + + // A pagination token that can be used to get the next page of results. + string next_page_token = 2; +} + +// A high level representation of a patch job that is either in progress +// or has completed. +// +// Instance details are not included in the job. To paginate through instance +// details, use ListPatchJobInstanceDetails. +// +// For more information about patch jobs, see +// [Creating patch +// jobs](https://cloud.google.com/compute/docs/os-patch-management/create-patch-job). +message PatchJob { + option (google.api.resource) = { + type: "osconfig.googleapis.com/PatchJob" + pattern: "projects/{project}/patchJobs/{patch_job}" + }; + + // Enumeration of the various states a patch job passes through as it + // executes. + enum State { + // State must be specified. + STATE_UNSPECIFIED = 0; + + // The patch job was successfully initiated. + STARTED = 1; + + // The patch job is looking up instances to run the patch on. + INSTANCE_LOOKUP = 2; + + // Instances are being patched. + PATCHING = 3; + + // Patch job completed successfully. + SUCCEEDED = 4; + + // Patch job completed but there were errors. + COMPLETED_WITH_ERRORS = 5; + + // The patch job was canceled. + CANCELED = 6; + + // The patch job timed out. + TIMED_OUT = 7; + } + + // A summary of the current patch state across all instances that this patch + // job affects. Contains counts of instances in different states. These states + // map to `InstancePatchState`. List patch job instance details to see the + // specific states of each instance. + message InstanceDetailsSummary { + // Number of instances pending patch job. + int64 pending_instance_count = 1; + + // Number of instances that are inactive. + int64 inactive_instance_count = 2; + + // Number of instances notified about patch job. + int64 notified_instance_count = 3; + + // Number of instances that have started. + int64 started_instance_count = 4; + + // Number of instances that are downloading patches. + int64 downloading_patches_instance_count = 5; + + // Number of instances that are applying patches. + int64 applying_patches_instance_count = 6; + + // Number of instances rebooting. + int64 rebooting_instance_count = 7; + + // Number of instances that have completed successfully. + int64 succeeded_instance_count = 8; + + // Number of instances that require reboot. + int64 succeeded_reboot_required_instance_count = 9; + + // Number of instances that failed. + int64 failed_instance_count = 10; + + // Number of instances that have acked and will start shortly. + int64 acked_instance_count = 11; + + // Number of instances that exceeded the time out while applying the patch. + int64 timed_out_instance_count = 12; + + // Number of instances that are running the pre-patch step. + int64 pre_patch_step_instance_count = 13; + + // Number of instances that are running the post-patch step. + int64 post_patch_step_instance_count = 14; + + // Number of instances that do not appear to be running the agent. Check to + // ensure that the agent is installed, running, and able to communicate with + // the service. + int64 no_agent_detected_instance_count = 15; + } + + // Unique identifier for this patch job in the form + // `projects/*/patchJobs/*` + string name = 1; + + // Display name for this patch job. This is not a unique identifier. + string display_name = 14; + + // Description of the patch job. Length of the description is limited + // to 1024 characters. + string description = 2; + + // Time this patch job was created. + google.protobuf.Timestamp create_time = 3; + + // Last time this patch job was updated. + google.protobuf.Timestamp update_time = 4; + + // The current state of the PatchJob. + State state = 5; + + // Instances to patch. + PatchInstanceFilter instance_filter = 13; + + // Patch configuration being applied. + PatchConfig patch_config = 7; + + // Duration of the patch job. After the duration ends, the + // patch job times out. + google.protobuf.Duration duration = 8; + + // Summary of instance details. + InstanceDetailsSummary instance_details_summary = 9; + + // If this patch job is a dry run, the agent reports that it has + // finished without running any updates on the VM instance. + bool dry_run = 10; + + // If this patch job failed, this message provides information about the + // failure. + string error_message = 11; + + // Reflects the overall progress of the patch job in the range of + // 0.0 being no progress to 100.0 being complete. + double percent_complete = 12; + + // Output only. Name of the patch deployment that created this patch job. + string patch_deployment = 15 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchDeployment" + } + ]; + + // Rollout strategy being applied. + PatchRollout rollout = 16; +} + +// Patch configuration specifications. Contains details on how to apply the +// patch(es) to a VM instance. +message PatchConfig { + // Post-patch reboot settings. + enum RebootConfig { + // The default behavior is DEFAULT. + REBOOT_CONFIG_UNSPECIFIED = 0; + + // The agent decides if a reboot is necessary by checking signals such as + // registry keys on Windows or `/var/run/reboot-required` on APT based + // systems. On RPM based systems, a set of core system package install times + // are compared with system boot time. + DEFAULT = 1; + + // Always reboot the machine after the update completes. + ALWAYS = 2; + + // Never reboot the machine after the update completes. + NEVER = 3; + } + + // Post-patch reboot settings. + RebootConfig reboot_config = 1; + + // Apt update settings. Use this setting to override the default `apt` patch + // rules. + AptSettings apt = 3; + + // Yum update settings. Use this setting to override the default `yum` patch + // rules. + YumSettings yum = 4; + + // Goo update settings. Use this setting to override the default `goo` patch + // rules. + GooSettings goo = 5; + + // Zypper update settings. Use this setting to override the default `zypper` + // patch rules. + ZypperSettings zypper = 6; + + // Windows update settings. Use this override the default windows patch rules. + WindowsUpdateSettings windows_update = 7; + + // The `ExecStep` to run before the patch update. + ExecStep pre_step = 8; + + // The `ExecStep` to run after the patch update. + ExecStep post_step = 9; + + // Allows the patch job to run on Managed instance groups (MIGs). + bool mig_instances_allowed = 10; +} + +// Namespace for instance state enums. +message Instance { + // Patch state of an instance. + enum PatchState { + // Unspecified. + PATCH_STATE_UNSPECIFIED = 0; + + // The instance is not yet notified. + PENDING = 1; + + // Instance is inactive and cannot be patched. + INACTIVE = 2; + + // The instance is notified that it should be patched. + NOTIFIED = 3; + + // The instance has started the patching process. + STARTED = 4; + + // The instance is downloading patches. + DOWNLOADING_PATCHES = 5; + + // The instance is applying patches. + APPLYING_PATCHES = 6; + + // The instance is rebooting. + REBOOTING = 7; + + // The instance has completed applying patches. + SUCCEEDED = 8; + + // The instance has completed applying patches but a reboot is required. + SUCCEEDED_REBOOT_REQUIRED = 9; + + // The instance has failed to apply the patch. + FAILED = 10; + + // The instance acked the notification and will start shortly. + ACKED = 11; + + // The instance exceeded the time out while applying the patch. + TIMED_OUT = 12; + + // The instance is running the pre-patch step. + RUNNING_PRE_PATCH_STEP = 13; + + // The instance is running the post-patch step. + RUNNING_POST_PATCH_STEP = 14; + + // The service could not detect the presence of the agent. Check to ensure + // that the agent is installed, running, and able to communicate with the + // service. + NO_AGENT_DETECTED = 15; + } +} + +// Message for canceling a patch job. +message CancelPatchJobRequest { + // Required. Name of the patch in the form `projects/*/patchJobs/*` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/PatchJob" + } + ]; +} + +// Apt patching is completed by executing `apt-get update && apt-get +// upgrade`. Additional options can be set to control how this is executed. +message AptSettings { + // Apt patch type. + enum Type { + // By default, upgrade will be performed. + TYPE_UNSPECIFIED = 0; + + // Runs `apt-get dist-upgrade`. + DIST = 1; + + // Runs `apt-get upgrade`. + UPGRADE = 2; + } + + // By changing the type to DIST, the patching is performed + // using `apt-get dist-upgrade` instead. + Type type = 1; + + // List of packages to exclude from update. These packages will be excluded + repeated string excludes = 2; + + // An exclusive list of packages to be updated. These are the only packages + // that will be updated. If these packages are not installed, they will be + // ignored. This field cannot be specified with any other patch configuration + // fields. + repeated string exclusive_packages = 3; +} + +// Yum patching is performed by executing `yum update`. Additional options +// can be set to control how this is executed. +// +// Note that not all settings are supported on all platforms. +message YumSettings { + // Adds the `--security` flag to `yum update`. Not supported on + // all platforms. + bool security = 1; + + // Will cause patch to run `yum update-minimal` instead. + bool minimal = 2; + + // List of packages to exclude from update. These packages are excluded by + // using the yum `--exclude` flag. + repeated string excludes = 3; + + // An exclusive list of packages to be updated. These are the only packages + // that will be updated. If these packages are not installed, they will be + // ignored. This field must not be specified with any other patch + // configuration fields. + repeated string exclusive_packages = 4; +} + +// Googet patching is performed by running `googet update`. +message GooSettings {} + +// Zypper patching is performed by running `zypper patch`. +// See also https://en.opensuse.org/SDB:Zypper_manual. +message ZypperSettings { + // Adds the `--with-optional` flag to `zypper patch`. + bool with_optional = 1; + + // Adds the `--with-update` flag, to `zypper patch`. + bool with_update = 2; + + // Install only patches with these categories. + // Common categories include security, recommended, and feature. + repeated string categories = 3; + + // Install only patches with these severities. + // Common severities include critical, important, moderate, and low. + repeated string severities = 4; + + // List of patches to exclude from update. + repeated string excludes = 5; + + // An exclusive list of patches to be updated. These are the only patches + // that will be installed using 'zypper patch patch:' command. + // This field must not be used with any other patch configuration fields. + repeated string exclusive_patches = 6; +} + +// Windows patching is performed using the Windows Update Agent. +message WindowsUpdateSettings { + // Microsoft Windows update classifications as defined in + // [1] + // https://support.microsoft.com/en-us/help/824684/description-of-the-standard-terminology-that-is-used-to-describe-micro + enum Classification { + // Invalid. If classifications are included, they must be specified. + CLASSIFICATION_UNSPECIFIED = 0; + + // "A widely released fix for a specific problem that addresses a critical, + // non-security-related bug." [1] + CRITICAL = 1; + + // "A widely released fix for a product-specific, security-related + // vulnerability. Security vulnerabilities are rated by their severity. The + // severity rating is indicated in the Microsoft security bulletin as + // critical, important, moderate, or low." [1] + SECURITY = 2; + + // "A widely released and frequent software update that contains additions + // to a product's definition database. Definition databases are often used + // to detect objects that have specific attributes, such as malicious code, + // phishing websites, or junk mail." [1] + DEFINITION = 3; + + // "Software that controls the input and output of a device." [1] + DRIVER = 4; + + // "New product functionality that is first distributed outside the context + // of a product release and that is typically included in the next full + // product release." [1] + FEATURE_PACK = 5; + + // "A tested, cumulative set of all hotfixes, security updates, critical + // updates, and updates. Additionally, service packs may contain additional + // fixes for problems that are found internally since the release of the + // product. Service packs my also contain a limited number of + // customer-requested design changes or features." [1] + SERVICE_PACK = 6; + + // "A utility or feature that helps complete a task or set of tasks." [1] + TOOL = 7; + + // "A tested, cumulative set of hotfixes, security updates, critical + // updates, and updates that are packaged together for easy deployment. A + // rollup generally targets a specific area, such as security, or a + // component of a product, such as Internet Information Services (IIS)." [1] + UPDATE_ROLLUP = 8; + + // "A widely released fix for a specific problem. An update addresses a + // noncritical, non-security-related bug." [1] + UPDATE = 9; + } + + // Only apply updates of these windows update classifications. If empty, all + // updates are applied. + repeated Classification classifications = 1; + + // List of KBs to exclude from update. + repeated string excludes = 2; + + // An exclusive list of kbs to be updated. These are the only patches + // that will be updated. This field must not be used with other + // patch configurations. + repeated string exclusive_patches = 3; +} + +// A step that runs an executable for a PatchJob. +message ExecStep { + // The ExecStepConfig for all Linux VMs targeted by the PatchJob. + ExecStepConfig linux_exec_step_config = 1; + + // The ExecStepConfig for all Windows VMs targeted by the PatchJob. + ExecStepConfig windows_exec_step_config = 2; +} + +// Common configurations for an ExecStep. +message ExecStepConfig { + // The interpreter used to execute the a file. + enum Interpreter { + // Invalid for a Windows ExecStepConfig. For a Linux ExecStepConfig, the + // interpreter will be parsed from the shebang line of the script if + // unspecified. + INTERPRETER_UNSPECIFIED = 0; + + // Indicates that the script is run with `/bin/sh` on Linux and `cmd` + // on Windows. + SHELL = 1; + + // Indicates that the file is run with PowerShell flags + // `-NonInteractive`, `-NoProfile`, and `-ExecutionPolicy Bypass`. + POWERSHELL = 2; + } + + // Location of the executable. + oneof executable { + // An absolute path to the executable on the VM. + string local_path = 1; + + // A Cloud Storage object containing the executable. + GcsObject gcs_object = 2; + } + + // Defaults to [0]. A list of possible return values that the + // execution can return to indicate a success. + repeated int32 allowed_success_codes = 3; + + // The script interpreter to use to run the script. If no interpreter is + // specified the script will be executed directly, which will likely + // only succeed for scripts with [shebang lines] + // (https://en.wikipedia.org/wiki/Shebang_\(Unix\)). + Interpreter interpreter = 4; +} + +// Cloud Storage object representation. +message GcsObject { + // Required. Bucket of the Cloud Storage object. + string bucket = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Name of the Cloud Storage object. + string object = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Generation number of the Cloud Storage object. This is used to + // ensure that the ExecStep specified by this PatchJob does not change. + int64 generation_number = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A filter to target VM instances for patching. The targeted +// VMs must meet all criteria specified. So if both labels and zones are +// specified, the patch job targets only VMs with those labels and in those +// zones. +message PatchInstanceFilter { + // Targets a group of VM instances by using their [assigned + // labels](https://cloud.google.com/compute/docs/labeling-resources). Labels + // are key-value pairs. A `GroupLabel` is a combination of labels + // that is used to target VMs for a patch job. + // + // For example, a patch job can target VMs that have the following + // `GroupLabel`: `{"env":"test", "app":"web"}`. This means that the patch job + // is applied to VMs that have both the labels `env=test` and `app=web`. + message GroupLabel { + // Compute Engine instance labels that must be present for a VM + // instance to be targeted by this filter. + map labels = 1; + } + + // Target all VM instances in the project. If true, no other criteria is + // permitted. + bool all = 1; + + // Targets VM instances matching ANY of these GroupLabels. This allows + // targeting of disparate groups of VM instances. + repeated GroupLabel group_labels = 2; + + // Targets VM instances in ANY of these zones. Leave empty to target VM + // instances in any zone. + repeated string zones = 3; + + // Targets any of the VM instances specified. Instances are specified by their + // URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`, + // `projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or + // `https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]` + repeated string instances = 4; + + // Targets VMs whose name starts with one of these prefixes. Similar to + // labels, this is another way to group VMs when targeting configs, for + // example prefix="prod-". + repeated string instance_name_prefixes = 5; +} + +// Patch rollout configuration specifications. Contains details on the +// concurrency control when applying patch(es) to all targeted VMs. +message PatchRollout { + // Type of the rollout. + enum Mode { + // Mode must be specified. + MODE_UNSPECIFIED = 0; + + // Patches are applied one zone at a time. The patch job begins in the + // region with the lowest number of targeted VMs. Within the region, + // patching begins in the zone with the lowest number of targeted VMs. If + // multiple regions (or zones within a region) have the same number of + // targeted VMs, a tie-breaker is achieved by sorting the regions or zones + // in alphabetical order. + ZONE_BY_ZONE = 1; + + // Patches are applied to VMs in all zones at the same time. + CONCURRENT_ZONES = 2; + } + + // Mode of the patch rollout. + Mode mode = 1; + + // The maximum number (or percentage) of VMs per zone to disrupt at any given + // moment. The number of VMs calculated from multiplying the percentage by the + // total number of VMs in a zone is rounded up. + // + // During patching, a VM is considered disrupted from the time the agent is + // notified to begin until patching has completed. This disruption time + // includes the time to complete reboot and any post-patch steps. + // + // A VM contributes to the disruption budget if its patching operation fails + // either when applying the patches, running pre or post patch steps, or if it + // fails to respond with a success notification before timing out. VMs that + // are not running or do not have an active agent do not count toward this + // disruption budget. + // + // For zone-by-zone rollouts, if the disruption budget in a zone is exceeded, + // the patch job stops, because continuing to the next zone requires + // completion of the patch process in the previous zone. + // + // For example, if the disruption budget has a fixed value of `10`, and 8 VMs + // fail to patch in the current zone, the patch job continues to patch 2 VMs + // at a time until the zone is completed. When that zone is completed + // successfully, patching begins with 10 VMs at a time in the next zone. If 10 + // VMs in the next zone fail to patch, the patch job stops. + FixedOrPercent disruption_budget = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto new file mode 100644 index 00000000..b8ca5175 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto @@ -0,0 +1,365 @@ +// Copyright 2021 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.osconfig.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.OsConfig.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; +option java_multiple_files = true; +option java_outer_classname = "VulnerabilityProto"; +option java_package = "com.google.cloud.osconfig.v1"; +option php_namespace = "Google\\Cloud\\OsConfig\\V1"; +option ruby_package = "Google::Cloud::OsConfig::V1"; + +// This API resource represents the vulnerability report for a specified +// Compute Engine virtual machine (VM) instance at a given point in time. +// +// For more information, see [Vulnerability +// reports](https://cloud.google.com/compute/docs/instances/os-inventory-management#vulnerability-reports). +message VulnerabilityReport { + option (google.api.resource) = { + type: "osconfig.googleapis.com/VulnerabilityReport" + pattern: "projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport" + }; + + // A vulnerability affecting the VM instance. + message Vulnerability { + // Contains metadata information for the vulnerability. This information is + // collected from the upstream feed of the operating system. + message Details { + // A reference for this vulnerability. + message Reference { + // The url of the reference. + string url = 1; + + // The source of the reference e.g. NVD. + string source = 2; + } + + // The CVE of the vulnerability. CVE cannot be + // empty and the combination of should be unique + // across vulnerabilities for a VM. + string cve = 1; + + // The CVSS V2 score of this vulnerability. CVSS V2 score is on a scale of + // 0 - 10 where 0 indicates low severity and 10 indicates high severity. + float cvss_v2_score = 2; + + // The full description of the CVSSv3 for this vulnerability from NVD. + CVSSv3 cvss_v3 = 3; + + // Assigned severity/impact ranking from the distro. + string severity = 4; + + // The note or description describing the vulnerability from the distro. + string description = 5; + + // Corresponds to the references attached to the `VulnerabilityDetails`. + repeated Reference references = 6; + } + + // OS inventory item that is affected by a vulnerability or fixed as a + // result of a vulnerability. + message Item { + // Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM. + // This field displays the inventory items affected by this vulnerability. + // If the vulnerability report was not updated after the VM inventory + // update, these values might not display in VM inventory. For some + // operating systems, this field might be empty. + string installed_inventory_item_id = 1; + + // Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM. + // If the vulnerability report was not updated after the VM inventory + // update, these values might not display in VM inventory. If there is no + // available fix, the field is empty. The `inventory_item` value specifies + // the latest `SoftwarePackage` available to the VM that fixes the + // vulnerability. + string available_inventory_item_id = 2; + + // The recommended [CPE URI](https://cpe.mitre.org/specification/) update + // that contains a fix for this vulnerability. + string fixed_cpe_uri = 3; + + // The upstream OS patch, packages or KB that fixes the vulnerability. + string upstream_fix = 4; + } + + // Contains metadata as per the upstream feed of the operating system and + // NVD. + Details details = 1; + + // Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM. + // This field displays the inventory items affected by this vulnerability. + // If the vulnerability report was not updated after the VM inventory + // update, these values might not display in VM inventory. For some distros, + // this field may be empty. + repeated string installed_inventory_item_ids = 2 [deprecated = true]; + + // Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM. + // If the vulnerability report was not updated after the VM inventory + // update, these values might not display in VM inventory. If there is no + // available fix, the field is empty. The `inventory_item` value specifies + // the latest `SoftwarePackage` available to the VM that fixes the + // vulnerability. + repeated string available_inventory_item_ids = 3 [deprecated = true]; + + // The timestamp for when the vulnerability was first detected. + google.protobuf.Timestamp create_time = 4; + + // The timestamp for when the vulnerability was last modified. + google.protobuf.Timestamp update_time = 5; + + // List of items affected by the vulnerability. + repeated Item items = 6; + } + + // Output only. The `vulnerabilityReport` API resource name. + // + // Format: + // `projects/{project_number}/locations/{location}/instances/{instance_id}/vulnerabilityReport` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List of vulnerabilities affecting the VM. + repeated Vulnerability vulnerabilities = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The timestamp for when the last vulnerability report was generated for the + // VM. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A request message for getting the vulnerability report for the specified VM. +message GetVulnerabilityReportRequest { + // Required. API resource name for vulnerability resource. + // + // Format: + // `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport` + // + // For `{project}`, either `project-number` or `project-id` can be provided. + // For `{instance}`, either Compute Engine `instance-id` or `instance-name` + // can be provided. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "osconfig.googleapis.com/VulnerabilityReport" + } + ]; +} + +// A request message for listing vulnerability reports for all VM instances in +// the specified location. +message ListVulnerabilityReportsRequest { + // Required. The parent resource name. + // + // Format: `projects/{project}/locations/{location}/instances/-` + // + // For `{project}`, either `project-number` or `project-id` can be provided. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + } + ]; + + // The maximum number of results to return. + int32 page_size = 2; + + // A pagination token returned from a previous call to + // `ListVulnerabilityReports` that indicates where this listing + // should continue from. + string page_token = 3; + + // If provided, this field specifies the criteria that must be met by a + // `vulnerabilityReport` API resource to be included in the response. + string filter = 4; +} + +// A response message for listing vulnerability reports for all VM instances in +// the specified location. +message ListVulnerabilityReportsResponse { + // List of vulnerabilityReport objects. + repeated VulnerabilityReport vulnerability_reports = 1; + + // The pagination token to retrieve the next page of vulnerabilityReports + // object. + string next_page_token = 2; +} + +// Common Vulnerability Scoring System version 3. +// For details, see https://www.first.org/cvss/specification-document +message CVSSv3 { + // This metric reflects the context by which vulnerability exploitation is + // possible. + enum AttackVector { + // Invalid value. + ATTACK_VECTOR_UNSPECIFIED = 0; + + // The vulnerable component is bound to the network stack and the set of + // possible attackers extends beyond the other options listed below, up to + // and including the entire Internet. + ATTACK_VECTOR_NETWORK = 1; + + // The vulnerable component is bound to the network stack, but the attack is + // limited at the protocol level to a logically adjacent topology. + ATTACK_VECTOR_ADJACENT = 2; + + // The vulnerable component is not bound to the network stack and the + // attacker's path is via read/write/execute capabilities. + ATTACK_VECTOR_LOCAL = 3; + + // The attack requires the attacker to physically touch or manipulate the + // vulnerable component. + ATTACK_VECTOR_PHYSICAL = 4; + } + + // This metric describes the conditions beyond the attacker's control that + // must exist in order to exploit the vulnerability. + enum AttackComplexity { + // Invalid value. + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + + // Specialized access conditions or extenuating circumstances do not exist. + // An attacker can expect repeatable success when attacking the vulnerable + // component. + ATTACK_COMPLEXITY_LOW = 1; + + // A successful attack depends on conditions beyond the attacker's control. + // That is, a successful attack cannot be accomplished at will, but requires + // the attacker to invest in some measurable amount of effort in preparation + // or execution against the vulnerable component before a successful attack + // can be expected. + ATTACK_COMPLEXITY_HIGH = 2; + } + + // This metric describes the level of privileges an attacker must possess + // before successfully exploiting the vulnerability. + enum PrivilegesRequired { + // Invalid value. + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + + // The attacker is unauthorized prior to attack, and therefore does not + // require any access to settings or files of the vulnerable system to + // carry out an attack. + PRIVILEGES_REQUIRED_NONE = 1; + + // The attacker requires privileges that provide basic user capabilities + // that could normally affect only settings and files owned by a user. + // Alternatively, an attacker with Low privileges has the ability to access + // only non-sensitive resources. + PRIVILEGES_REQUIRED_LOW = 2; + + // The attacker requires privileges that provide significant (e.g., + // administrative) control over the vulnerable component allowing access to + // component-wide settings and files. + PRIVILEGES_REQUIRED_HIGH = 3; + } + + // This metric captures the requirement for a human user, other than the + // attacker, to participate in the successful compromise of the vulnerable + // component. + enum UserInteraction { + // Invalid value. + USER_INTERACTION_UNSPECIFIED = 0; + + // The vulnerable system can be exploited without interaction from any user. + USER_INTERACTION_NONE = 1; + + // Successful exploitation of this vulnerability requires a user to take + // some action before the vulnerability can be exploited. + USER_INTERACTION_REQUIRED = 2; + } + + // The Scope metric captures whether a vulnerability in one vulnerable + // component impacts resources in components beyond its security scope. + enum Scope { + // Invalid value. + SCOPE_UNSPECIFIED = 0; + + // An exploited vulnerability can only affect resources managed by the same + // security authority. + SCOPE_UNCHANGED = 1; + + // An exploited vulnerability can affect resources beyond the security scope + // managed by the security authority of the vulnerable component. + SCOPE_CHANGED = 2; + } + + // The Impact metrics capture the effects of a successfully exploited + // vulnerability on the component that suffers the worst outcome that is most + // directly and predictably associated with the attack. + enum Impact { + // Invalid value. + IMPACT_UNSPECIFIED = 0; + + // High impact. + IMPACT_HIGH = 1; + + // Low impact. + IMPACT_LOW = 2; + + // No impact. + IMPACT_NONE = 3; + } + + // The base score is a function of the base metric scores. + // https://www.first.org/cvss/specification-document#Base-Metrics + float base_score = 1; + + // The Exploitability sub-score equation is derived from the Base + // Exploitability metrics. + // https://www.first.org/cvss/specification-document#2-1-Exploitability-Metrics + float exploitability_score = 2; + + // The Impact sub-score equation is derived from the Base Impact metrics. + float impact_score = 3; + + // This metric reflects the context by which vulnerability exploitation is + // possible. + AttackVector attack_vector = 5; + + // This metric describes the conditions beyond the attacker's control that + // must exist in order to exploit the vulnerability. + AttackComplexity attack_complexity = 6; + + // This metric describes the level of privileges an attacker must possess + // before successfully exploiting the vulnerability. + PrivilegesRequired privileges_required = 7; + + // This metric captures the requirement for a human user, other than the + // attacker, to participate in the successful compromise of the vulnerable + // component. + UserInteraction user_interaction = 8; + + // The Scope metric captures whether a vulnerability in one vulnerable + // component impacts resources in components beyond its security scope. + Scope scope = 9; + + // This metric measures the impact to the confidentiality of the information + // resources managed by a software component due to a successfully exploited + // vulnerability. + Impact confidentiality_impact = 10; + + // This metric measures the impact to integrity of a successfully exploited + // vulnerability. + Impact integrity_impact = 11; + + // This metric measures the impact to the availability of the impacted + // component resulting from a successfully exploited vulnerability. + Impact availability_impact = 12; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js new file mode 100644 index 00000000..fb13179b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js @@ -0,0 +1,89 @@ +// 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(analysisQuery) { + // [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The request query. + */ + // const analysisQuery = {} + /** + * 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 + * execution timeout, you will get a response with partial result. + * Otherwise, your query's execution will continue until the RPC deadline. + * If it's not finished until then, you will get a DEADLINE_EXCEEDED error. + * Default is empty. + */ + // const executionTimeout = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callAnalyzeIamPolicy() { + // Construct request + const request = { + analysisQuery, + }; + + // Run request + const response = await assetClient.analyzeIamPolicy(request); + console.log(response); + } + + callAnalyzeIamPolicy(); + // [END cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js new file mode 100644 index 00000000..703f46b4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js @@ -0,0 +1,84 @@ +// 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(analysisQuery, outputConfig) { + // [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The request query. + */ + // const analysisQuery = {} + /** + * 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 = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callAnalyzeIamPolicyLongrunning() { + // Construct request + const request = { + analysisQuery, + outputConfig, + }; + + // Run request + const [operation] = await assetClient.analyzeIamPolicyLongrunning(request); + const [response] = await operation.promise(); + console.log(response); + } + + callAnalyzeIamPolicyLongrunning(); + // [END cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js new file mode 100644 index 00000000..0d6bdd5b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js @@ -0,0 +1,78 @@ +// 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(resource, destinationParent) { + // [START cloudasset_v1_generated_AssetService_AnalyzeMove_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the resource to perform the analysis against. + * Only GCP Project are supported as of today. Hence, this can only be Project + * ID (such as "projects/my-project-id") or a Project Number (such as + * "projects/12345"). + */ + // const resource = 'abc123' + /** + * Required. Name of the GCP Folder or Organization to reparent the target + * resource. The analysis will be performed against hypothetically moving the + * resource to this specified desitination parent. This can only be a Folder + * number (such as "folders/123") or an Organization number (such as + * "organizations/123"). + */ + // const destinationParent = 'abc123' + /** + * Analysis view indicating what information should be included in the + * analysis response. If unspecified, the default view is FULL. + */ + // const view = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callAnalyzeMove() { + // Construct request + const request = { + resource, + destinationParent, + }; + + // Run request + const response = await assetClient.analyzeMove(request); + console.log(response); + } + + callAnalyzeMove(); + // [END cloudasset_v1_generated_AssetService_AnalyzeMove_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js new file mode 100644 index 00000000..da9d3d72 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js @@ -0,0 +1,104 @@ +// 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_BatchGetAssetsHistory_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of the root asset. It can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id")", or a project number (such as "projects/12345"). + */ + // const parent = 'abc123' + /** + * A list of the full names of the assets. + * See: https://cloud.google.com/asset-inventory/docs/resource-name-format + * Example: + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * The request becomes a no-op if the asset name list is empty, and the max + * size of the asset name list is 100 in one request. + */ + // const assetNames = 'abc123' + /** + * Optional. The content type. + */ + // const contentType = {} + /** + * Optional. The time window for the asset history. Both start_time and + * end_time are optional and if set, it must be after the current time minus + * 35 days. If end_time is not set, it is default to current timestamp. + * If start_time is not set, the snapshot of the assets at end_time will be + * returned. The returned results contain all temporal assets whose time + * window overlap with read_time_window. + */ + // const readTimeWindow = {} + /** + * Optional. A list of relationship types to output, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it outputs specified relationships' history on the asset_names. It + * returns an error if any of the relationship_types doesn't belong to the + * supported relationship types of the asset_names or if any of the + * asset_names's types doesn't belong to the source types of the + * relationship_types. + * * Otherwise: + * it outputs the supported relationships' history on the asset_names or + * returns an error if any of the asset_names's types has no relationship + * support. + * See Introduction to Cloud Asset + * Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all + * supported asset types and relationship types. + */ + // const relationshipTypes = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callBatchGetAssetsHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await assetClient.batchGetAssetsHistory(request); + console.log(response); + } + + callBatchGetAssetsHistory(); + // [END cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js new file mode 100644 index 00000000..eab2d1e8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js @@ -0,0 +1,77 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js new file mode 100644 index 00000000..deeabb51 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.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, feedId, feed) { + // [START cloudasset_v1_generated_AssetService_CreateFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project/folder/organization where this feed + * 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. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + */ + // 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 + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + */ + // const feed = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callCreateFeed() { + // Construct request + const request = { + parent, + feedId, + feed, + }; + + // Run request + const response = await assetClient.createFeed(request); + console.log(response); + } + + callCreateFeed(); + // [END cloudasset_v1_generated_AssetService_CreateFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js new file mode 100644 index 00000000..8870f960 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js @@ -0,0 +1,82 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js new file mode 100644 index 00000000..876503f1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js @@ -0,0 +1,64 @@ +// 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_DeleteFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + */ + // const name = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callDeleteFeed() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await assetClient.deleteFeed(request); + console.log(response); + } + + callDeleteFeed(); + // [END cloudasset_v1_generated_AssetService_DeleteFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js new file mode 100644 index 00000000..7ec550b0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js @@ -0,0 +1,65 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js new file mode 100644 index 00000000..59b7182a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js @@ -0,0 +1,119 @@ +// 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, outputConfig) { + // [START cloudasset_v1_generated_AssetService_ExportAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + */ + // const parent = 'abc123' + /** + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between the current time and the current time minus 35 days (inclusive). + * If not specified, the current time will be used. Due to delays in resource + * data collection and indexing, there is a volatile window during which + * running the same query may get different results. + */ + // const readTime = {} + /** + * A list of asset types to take a snapshot for. For example: + * "compute.googleapis.com/Disk". + * Regular expressions are also supported. For example: + * * "compute.googleapis.com.*" snapshots resources whose asset type starts + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * If specified, only matching assets will be returned, otherwise, it will + * snapshot all asset types. See Introduction to Cloud Asset + * Inventory (https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types. + */ + // const assetTypes = 'abc123' + /** + * Asset content type. If not specified, no content but the asset name will be + * returned. + */ + // const contentType = {} + /** + * Required. Output configuration indicating where the results will be output + * to. + */ + // const outputConfig = {} + /** + * A list of relationship types to export, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it snapshots specified relationships. It returns an error if + * any of the relationship_types doesn't belong to the supported + * relationship types of the asset_types or if any of the asset_types + * doesn't belong to the source types of the relationship_types. + * * Otherwise: + * it snapshots the supported relationships for all asset_types or returns + * an error if any of the asset_types has no relationship support. + * An unspecified asset types field means all supported asset_types. + * See Introduction to Cloud Asset + * Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all + * supported asset types and relationship types. + */ + // const relationshipTypes = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callExportAssets() { + // Construct request + const request = { + parent, + outputConfig, + }; + + // Run request + const [operation] = await assetClient.exportAssets(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportAssets(); + // [END cloudasset_v1_generated_AssetService_ExportAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js new file mode 100644 index 00000000..5662d4ab --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js @@ -0,0 +1,64 @@ +// 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_GetFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + */ + // const name = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callGetFeed() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await assetClient.getFeed(request); + console.log(response); + } + + callGetFeed(); + // [END cloudasset_v1_generated_AssetService_GetFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js new file mode 100644 index 00000000..9d54d692 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js @@ -0,0 +1,64 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js new file mode 100644 index 00000000..29b82e4a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js @@ -0,0 +1,126 @@ +// 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_ListAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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' + /** + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between the current time and the current time minus 35 days (inclusive). + * If not specified, the current time will be used. Due to delays in resource + * data collection and indexing, there is a volatile window during which + * running the same query may get different results. + */ + // const readTime = {} + /** + * A list of asset types to take a snapshot for. For example: + * "compute.googleapis.com/Disk". + * Regular expression is also supported. For example: + * * "compute.googleapis.com.*" snapshots resources whose asset type starts + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * If specified, only matching assets will be returned, otherwise, it will + * snapshot all asset types. See Introduction to Cloud Asset + * Inventory (https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types. + */ + // const assetTypes = 'abc123' + /** + * Asset content type. If not specified, no content but the asset name will + * be returned. + */ + // const contentType = {} + /** + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + */ + // const pageSize = 1234 + /** + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + */ + // const pageToken = 'abc123' + /** + * A list of relationship types to output, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it snapshots specified relationships. It returns an error if + * any of the relationship_types doesn't belong to the supported + * relationship types of the asset_types or if any of the asset_types + * doesn't belong to the source types of the relationship_types. + * * Otherwise: + * it snapshots the supported relationships for all asset_types or returns + * an error if any of the asset_types has no relationship support. + * An unspecified asset types field means all supported asset_types. + * See Introduction to Cloud Asset + * Inventory (https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types and relationship types. + */ + // const relationshipTypes = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await assetClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END cloudasset_v1_generated_AssetService_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js new file mode 100644 index 00000000..46c49c07 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js @@ -0,0 +1,63 @@ +// 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_ListFeeds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent project/folder/organization whose feeds 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' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callListFeeds() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await assetClient.listFeeds(request); + console.log(response); + } + + callListFeeds(); + // [END cloudasset_v1_generated_AssetService_ListFeeds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js new file mode 100644 index 00000000..e1f9a66d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js @@ -0,0 +1,88 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js new file mode 100644 index 00000000..09128ea3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js @@ -0,0 +1,123 @@ +// 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_QueryAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + * Only assets belonging to the `parent` will be returned. + */ + // const parent = 'abc123' + /** + * Optional. A SQL statement that's compatible with BigQuery Standard + * SQL (http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + */ + // const statement = 'abc123' + /** + * Optional. Reference to the query job, which is from the + * `QueryAssetsResponse` of previous `QueryAssets` call. + */ + // const jobReference = 'abc123' + /** + * Optional. The maximum number of rows to return in the results. Responses + * are limited to 10 MB and 1000 rows. + * By default, the maximum row count is 1000. When the byte or row count limit + * is reached, the rest of the query results will be paginated. + * The field will be ignored when output_config is specified. + */ + // const pageSize = 1234 + /** + * Optional. A page token received from previous `QueryAssets`. + * The field will be ignored when output_config is specified. + */ + // const pageToken = 'abc123' + /** + * Optional. Specifies the maximum amount of time that the client is willing + * to wait for the query to complete. By default, this limit is 5 min for the + * first query, and 1 minute for the following queries. If the query is + * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + * false. + * Like BigQuery jobs.query + * API (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + * The call is not guaranteed to wait for the specified timeout; it typically + * returns after around 200 seconds (200,000 milliseconds), even if the query + * is not complete. + * The field will be ignored when output_config is specified. + */ + // const timeout = {} + /** + * Optional. start_time is required. start_time must be less than + * end_time Defaults end_time to now if start_time is set and + * end_time isn't. Maximum permitted time range is 7 days. + */ + // const readTimeWindow = {} + /** + * Optional. Queries cloud assets as they appeared at the specified point in + * time. + */ + // const readTime = {} + /** + * Optional. Destination where the query results will be saved. + * When this field is specified, the query results won't be saved in the + * QueryAssetsResponse.query_result. Instead + * QueryAssetsResponse.output_config will be set. + * Meanwhile, QueryAssetsResponse.job_reference will be set and can be used + * to check the status of the query job when passed to a following + * QueryAssets API call. + */ + // const outputConfig = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callQueryAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await assetClient.queryAssets(request); + console.log(response); + } + + callQueryAssets(); + // [END cloudasset_v1_generated_AssetService_QueryAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js new file mode 100644 index 00000000..5c3b05e6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js @@ -0,0 +1,160 @@ +// 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) { + // [START cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 + * `cloudasset.assets.searchAllIamPolicies` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) + * permission on the desired scope. + * The allowed values are: + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + */ + // const scope = 'abc123' + /** + * Optional. The query statement. See how to construct a + * 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 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 the IAM policy + * documentation (https://cloud.google.com/iam/help/allow-policies/structure). + * Examples: + * * `policy:amy@gmail.com` to find IAM policy bindings that specify user + * "amy@gmail.com". + * * `policy:roles/compute.admin` to find IAM policy bindings that specify + * the Compute Admin role. + * * `policy:comp*` to find IAM policy bindings that contain "comp" as a + * prefix of any word in the binding. + * * `policy.role.permissions:storage.buckets.update` to find IAM policy + * bindings that specify a role containing "storage.buckets.update" + * permission. Note that if callers don't have `iam.roles.get` access to a + * role's included permissions, policy bindings that specify this role will + * be dropped from the search results. + * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a + * role containing "upd" as a prefix of any word in the role permission. + * Note that if callers don't have `iam.roles.get` access to a role's + * included permissions, policy bindings that specify this role will be + * dropped from the search results. + * * `resource:organizations/123456` to find IAM policy bindings + * that are set on "organizations/123456". + * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to + * find IAM policy bindings that are set on the project named "myproject". + * * `Important` to find IAM policy bindings that contain "Important" as a + * word in any of the searchable fields (except for the included + * permissions). + * * `resource:(instance1 OR instance2) policy:amy` to find + * IAM policy bindings that are set on resources "instance1" or + * "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 + * 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. + */ + // 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. + */ + // 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 + * 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 + * starts with "compute.googleapis.com". + * * ".*Instance" snapshots IAM policies attached to asset type ends with + * "Instance". + * * ".*Instance.*" snapshots IAM policies attached to asset type contains + * "Instance". + * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + */ + // 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. + * Example: "assetType DESC, resource". + * Only singular primitive fields in the response are sortable: + * * resource + * * assetType + * * project + * All the other fields such as repeated fields (e.g., `folders`) and + * non-primitive fields (e.g., `policy`) are not supported. + */ + // const orderBy = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callSearchAllIamPolicies() { + // Construct request + const request = { + scope, + }; + + // Run request + const iterable = await assetClient.searchAllIamPoliciesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAllIamPolicies(); + // [END cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js new file mode 100644 index 00000000..401168ae --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js @@ -0,0 +1,204 @@ +// 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) { + // [START cloudasset_v1_generated_AssetService_SearchAllResources_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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 + * `cloudasset.assets.searchAllResources` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) + * permission on the desired scope. + * The allowed values are: + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + */ + // const scope = 'abc123' + /** + * Optional. The query statement. See how to construct a + * query (https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more information. If not specified or empty, it will search all the + * resources within the specified `scope`. + * Examples: + * * `name:Important` to find Cloud resources whose name contains + * "Important" as a word. + * * `name=Important` to find the Cloud resource whose name is exactly + * "Important". + * * `displayName:Impor*` to find Cloud resources whose display name + * contains "Impor" as a prefix of any word in the field. + * * `location:us-west*` to find Cloud resources whose location contains both + * "us" and "west" as prefixes. + * * `labels:prod` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env:prod` to find Cloud resources that have a label "env" + * and its value is "prod". + * * `labels.env:*` to find Cloud resources that have a label "env". + * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed + * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". + * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a + * word. + * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain + * "ACTIVE" as a word. + * * `createTime<1609459200` to find Cloud resources that were created before + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `updateTime>1609459200` to find Cloud resources that were updated after + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `Important` to find Cloud resources that contain "Important" as a word + * in any of the searchable fields. + * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any + * word in any of the searchable fields. + * * `Important location:(us-west1 OR global)` to find Cloud + * resources that contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + */ + // const query = 'abc123' + /** + * 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 + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + */ + // 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. + */ + // 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. + */ + // 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. + * Example: "location DESC, name". + * Only singular primitive fields in the response are sortable: + * * name + * * assetType + * * project + * * displayName + * * description + * * location + * * kmsKey + * * createTime + * * updateTime + * * state + * * parentFullResourceName + * * parentAssetType + * All the other fields such as repeated fields (e.g., `networkTags`), map + * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) + * are not supported. + */ + // 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"`. + * The read_mask paths must be valid field paths listed but not limited to + * (both snake_case and camelCase are supported): + * * name + * * assetType + * * project + * * displayName + * * description + * * location + * * tagKeys + * * tagValues + * * tagValueIds + * * labels + * * networkTags + * * kmsKey + * * createTime + * * updateTime + * * state + * * additionalAttributes + * * versionedResources + * If read_mask is not specified, all fields except versionedResources will + * be returned. + * If only '*' is specified, all fields including versionedResources will be + * returned. + * Any invalid field path will trigger INVALID_ARGUMENT error. + */ + // const readMask = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callSearchAllResources() { + // Construct request + const request = { + scope, + }; + + // Run request + const iterable = await assetClient.searchAllResourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAllResources(); + // [END cloudasset_v1_generated_AssetService_SearchAllResources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js new file mode 100644 index 00000000..6e28a96b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js @@ -0,0 +1,72 @@ +// 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(feed, updateMask) { + // [START cloudasset_v1_generated_AssetService_UpdateFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + */ + // const feed = {} + /** + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + */ + // const updateMask = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callUpdateFeed() { + // Construct request + const request = { + feed, + updateMask, + }; + + // Run request + const response = await assetClient.updateFeed(request); + console.log(response); + } + + callUpdateFeed(); + // [END cloudasset_v1_generated_AssetService_UpdateFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js new file mode 100644 index 00000000..5c30529d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js @@ -0,0 +1,71 @@ +// 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] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json new file mode 100644 index 00000000..7ac11ad6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json @@ -0,0 +1,1015 @@ +{ + "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 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": 111, + "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": 118, + "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": 96, + "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": 71, + "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": 56, + "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": 55, + "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": 64, + "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": 56, + "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": 196, + "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": 152, + "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": 81, + "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": "saved_analysis_query", + "type": "TYPE_STRING" + }, + { + "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": 76, + "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": "saved_analysis_query", + "type": "TYPE_STRING" + }, + { + "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": 70, + "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" + } + } + } + }, + { + "regionTag": "cloudasset_v1_generated_AssetService_QueryAssets_async", + "title": "AssetService queryAssets Sample", + "origin": "API_DEFINITION", + "description": " Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`. Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call. Note, the query result has approximately 10 GB limitation enforced by BigQuery https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger results will result in errors.", + "canonical": true, + "file": "asset_service.query_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "QueryAssets", + "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "statement", + "type": "TYPE_STRING" + }, + { + "name": "job_reference", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "timeout", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time_window", + "type": ".google.cloud.asset.v1.TimeWindow" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "output_config", + "type": ".google.cloud.asset.v1.QueryAssetsOutputConfig" + } + ], + "resultType": ".google.cloud.asset.v1.QueryAssetsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "QueryAssets", + "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, + { + "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": 74, + "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": 56, + "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": 80, + "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": 63, + "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": 57, + "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": 69, + "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" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 00000000..eeab755b --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// 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. ** + +import * as v1 from './v1'; +const AssetServiceClient = v1.AssetServiceClient; +type AssetServiceClient = v1.AssetServiceClient; +export {v1, AssetServiceClient}; +export default {v1, AssetServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/asset_service_client.ts b/owl-bot-staging/v1/src/v1/asset_service_client.ts new file mode 100644 index 00000000..5df8a433 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/asset_service_client.ts @@ -0,0 +1,4043 @@ +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/asset_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './asset_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Asset service definition. + * @class + * @memberof v1 + */ +export class AssetServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + assetServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AssetServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AssetServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AssetServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + accessLevelPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}/accessLevels/{access_level}' + ), + accessPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}' + ), + folderFeedPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/feeds/{feed}' + ), + folderSavedQueryPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/savedQueries/{saved_query}' + ), + inventoryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/instances/{instance}/inventory' + ), + organizationFeedPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/feeds/{feed}' + ), + organizationSavedQueryPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/savedQueries/{saved_query}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectFeedPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/feeds/{feed}' + ), + projectSavedQueryPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/savedQueries/{saved_query}' + ), + servicePerimeterPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets'), + searchAllResources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'), + searchAllIamPolicies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'), + listSavedQueries: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'savedQueries') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=*/*/operations/*/**}',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const exportAssetsResponse = protoFilesRoot.lookup( + '.google.cloud.asset.v1.ExportAssetsResponse') as gax.protobuf.Type; + const exportAssetsMetadata = protoFilesRoot.lookup( + '.google.cloud.asset.v1.ExportAssetsRequest') as gax.protobuf.Type; + const analyzeIamPolicyLongrunningResponse = protoFilesRoot.lookup( + '.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse') as gax.protobuf.Type; + const analyzeIamPolicyLongrunningMetadata = protoFilesRoot.lookup( + '.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + exportAssets: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAssetsResponse.decode.bind(exportAssetsResponse), + exportAssetsMetadata.decode.bind(exportAssetsMetadata)), + analyzeIamPolicyLongrunning: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + analyzeIamPolicyLongrunningResponse.decode.bind(analyzeIamPolicyLongrunningResponse), + analyzeIamPolicyLongrunningMetadata.decode.bind(analyzeIamPolicyLongrunningMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.asset.v1.AssetService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.assetServiceStub) { + return this.assetServiceStub; + } + + // Put together the "service stub" for + // google.cloud.asset.v1.AssetService. + this.assetServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1.AssetService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.asset.v1.AssetService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const assetServiceStubMethods = + ['exportAssets', 'listAssets', 'batchGetAssetsHistory', 'createFeed', 'getFeed', 'listFeeds', 'updateFeed', 'deleteFeed', 'searchAllResources', 'searchAllIamPolicies', 'analyzeIamPolicy', 'analyzeIamPolicyLongrunning', 'analyzeMove', 'queryAssets', 'createSavedQuery', 'getSavedQuery', 'listSavedQueries', 'updateSavedQuery', 'deleteSavedQuery', 'batchGetEffectiveIamPolicies']; + for (const methodName of assetServiceStubMethods) { + const callPromise = this.assetServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.assetServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudasset.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudasset.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative name of the root asset. It can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id")", or a project number (such as "projects/12345"). + * @param {string[]} request.assetNames + * A list of the full names of the assets. + * See: https://cloud.google.com/asset-inventory/docs/resource-name-format + * Example: + * + * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + * + * The request becomes a no-op if the asset name list is empty, and the max + * size of the asset name list is 100 in one request. + * @param {google.cloud.asset.v1.ContentType} [request.contentType] + * Optional. The content type. + * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] + * Optional. The time window for the asset history. Both start_time and + * end_time are optional and if set, it must be after the current time minus + * 35 days. If end_time is not set, it is default to current timestamp. + * If start_time is not set, the snapshot of the assets at end_time will be + * returned. The returned results contain all temporal assets whose time + * window overlap with read_time_window. + * @param {string[]} [request.relationshipTypes] + * Optional. A list of relationship types to output, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it outputs specified relationships' history on the [asset_names]. It + * returns an error if any of the [relationship_types] doesn't belong to the + * supported relationship types of the [asset_names] or if any of the + * [asset_names]'s types doesn't belong to the source types of the + * [relationship_types]. + * * Otherwise: + * it outputs the supported relationships' history on the [asset_names] or + * returns an error if any of the [asset_names]'s types has no relationship + * support. + * See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all + * supported asset types and relationship types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchGetAssetsHistoryResponse]{@link google.cloud.asset.v1.BatchGetAssetsHistoryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.batch_get_assets_history.js + * region_tag:cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async + */ + batchGetAssetsHistory( + request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined + ]>; + batchGetAssetsHistory( + request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, + {}|null|undefined>): void; + batchGetAssetsHistory( + request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, + callback: Callback< + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, + {}|null|undefined>): void; + batchGetAssetsHistory( + request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, + protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchGetAssetsHistory(request, options, callback); + } +/** + * Creates a feed in a parent project/folder/organization to listen to its + * asset updates. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project/folder/organization where this feed + * 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"). + * @param {string} request.feedId + * Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * @param {google.cloud.asset.v1.Feed} request.feed + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1.Feed}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.create_feed.js + * region_tag:cloudasset_v1_generated_AssetService_CreateFeed_async + */ + createFeed( + request?: protos.google.cloud.asset.v1.ICreateFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined + ]>; + createFeed( + request: protos.google.cloud.asset.v1.ICreateFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, + {}|null|undefined>): void; + createFeed( + request: protos.google.cloud.asset.v1.ICreateFeedRequest, + callback: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, + {}|null|undefined>): void; + createFeed( + request?: protos.google.cloud.asset.v1.ICreateFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFeed(request, options, callback); + } +/** + * Gets details about an asset feed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1.Feed}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.get_feed.js + * region_tag:cloudasset_v1_generated_AssetService_GetFeed_async + */ + getFeed( + request?: protos.google.cloud.asset.v1.IGetFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined + ]>; + getFeed( + request: protos.google.cloud.asset.v1.IGetFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, + {}|null|undefined>): void; + getFeed( + request: protos.google.cloud.asset.v1.IGetFeedRequest, + callback: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, + {}|null|undefined>): void; + getFeed( + request?: protos.google.cloud.asset.v1.IGetFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFeed(request, options, callback); + } +/** + * Lists all asset feeds in a parent project/folder/organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent project/folder/organization whose feeds 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"). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListFeedsResponse]{@link google.cloud.asset.v1.ListFeedsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.list_feeds.js + * region_tag:cloudasset_v1_generated_AssetService_ListFeeds_async + */ + listFeeds( + request?: protos.google.cloud.asset.v1.IListFeedsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IListFeedsResponse, + protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined + ]>; + listFeeds( + request: protos.google.cloud.asset.v1.IListFeedsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IListFeedsResponse, + protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, + {}|null|undefined>): void; + listFeeds( + request: protos.google.cloud.asset.v1.IListFeedsRequest, + callback: Callback< + protos.google.cloud.asset.v1.IListFeedsResponse, + protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, + {}|null|undefined>): void; + listFeeds( + request?: protos.google.cloud.asset.v1.IListFeedsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IListFeedsResponse, + protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IListFeedsResponse, + protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IListFeedsResponse, + protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFeeds(request, options, callback); + } +/** + * Updates an asset feed configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.asset.v1.Feed} request.feed + * 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. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1.Feed}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.update_feed.js + * region_tag:cloudasset_v1_generated_AssetService_UpdateFeed_async + */ + updateFeed( + request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined + ]>; + updateFeed( + request: protos.google.cloud.asset.v1.IUpdateFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>): void; + updateFeed( + request: protos.google.cloud.asset.v1.IUpdateFeedRequest, + callback: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>): void; + updateFeed( + request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IFeed, + protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'feed.name': request.feed!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFeed(request, options, callback); + } +/** + * Deletes an asset feed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.delete_feed.js + * region_tag:cloudasset_v1_generated_AssetService_DeleteFeed_async + */ + deleteFeed( + request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined + ]>; + deleteFeed( + request: protos.google.cloud.asset.v1.IDeleteFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>): void; + deleteFeed( + request: protos.google.cloud.asset.v1.IDeleteFeedRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>): void; + deleteFeed( + request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFeed(request, options, callback); + } +/** + * Analyzes IAM policies to answer which identities have what accesses on + * which resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.asset.v1.IamPolicyAnalysisQuery} request.analysisQuery + * Required. The request query. + * @param {string} [request.savedAnalysisQuery] + * 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. + * @param {google.protobuf.Duration} [request.executionTimeout] + * 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 + * execution timeout, you will get a response with partial result. + * Otherwise, your query's execution will continue until the RPC deadline. + * If it's not finished until then, you will get a DEADLINE_EXCEEDED error. + * + * Default is empty. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AnalyzeIamPolicyResponse]{@link google.cloud.asset.v1.AnalyzeIamPolicyResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.analyze_iam_policy.js + * region_tag:cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async + */ + analyzeIamPolicy( + request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, + protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|undefined, {}|undefined + ]>; + analyzeIamPolicy( + request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, + protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + analyzeIamPolicy( + request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, + callback: Callback< + protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, + protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + analyzeIamPolicy( + request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, + protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, + protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, + protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'analysis_query.scope': request.analysisQuery!.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeIamPolicy(request, options, callback); + } +/** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * Required. Name of the resource to perform the analysis against. + * Only GCP Project are supported as of today. Hence, this can only be Project + * ID (such as "projects/my-project-id") or a Project Number (such as + * "projects/12345"). + * @param {string} request.destinationParent + * Required. Name of the GCP Folder or Organization to reparent the target + * resource. The analysis will be performed against hypothetically moving the + * resource to this specified desitination parent. This can only be a Folder + * number (such as "folders/123") or an Organization number (such as + * "organizations/123"). + * @param {google.cloud.asset.v1.AnalyzeMoveRequest.AnalysisView} request.view + * Analysis view indicating what information should be included in the + * analysis response. If unspecified, the default view is FULL. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AnalyzeMoveResponse]{@link google.cloud.asset.v1.AnalyzeMoveResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.analyze_move.js + * region_tag:cloudasset_v1_generated_AssetService_AnalyzeMove_async + */ + analyzeMove( + request?: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IAnalyzeMoveResponse, + protos.google.cloud.asset.v1.IAnalyzeMoveRequest|undefined, {}|undefined + ]>; + analyzeMove( + request: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IAnalyzeMoveResponse, + protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, + {}|null|undefined>): void; + analyzeMove( + request: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, + callback: Callback< + protos.google.cloud.asset.v1.IAnalyzeMoveResponse, + protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, + {}|null|undefined>): void; + analyzeMove( + request?: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IAnalyzeMoveResponse, + protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IAnalyzeMoveResponse, + protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IAnalyzeMoveResponse, + protos.google.cloud.asset.v1.IAnalyzeMoveRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'resource': request.resource ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeMove(request, options, callback); + } +/** + * Issue a job that queries assets using a SQL statement compatible with + * [BigQuery Standard + * SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + * + * If the query execution finishes within timeout and there's no pagination, + * the full query results will be returned in the `QueryAssetsResponse`. + * + * Otherwise, full query results can be obtained by issuing extra requests + * with the `job_reference` from the a previous `QueryAssets` call. + * + * Note, the query result has approximately 10 GB limitation enforced by + * BigQuery + * https://cloud.google.com/bigquery/docs/best-practices-performance-output, + * queries return larger results will result in errors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + * + * Only assets belonging to the `parent` will be returned. + * @param {string} [request.statement] + * Optional. A SQL statement that's compatible with [BigQuery Standard + * SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + * @param {string} [request.jobReference] + * Optional. Reference to the query job, which is from the + * `QueryAssetsResponse` of previous `QueryAssets` call. + * @param {number} [request.pageSize] + * Optional. The maximum number of rows to return in the results. Responses + * are limited to 10 MB and 1000 rows. + * + * By default, the maximum row count is 1000. When the byte or row count limit + * is reached, the rest of the query results will be paginated. + * + * The field will be ignored when [output_config] is specified. + * @param {string} [request.pageToken] + * Optional. A page token received from previous `QueryAssets`. + * + * The field will be ignored when [output_config] is specified. + * @param {google.protobuf.Duration} [request.timeout] + * Optional. Specifies the maximum amount of time that the client is willing + * to wait for the query to complete. By default, this limit is 5 min for the + * first query, and 1 minute for the following queries. If the query is + * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + * false. + * + * Like BigQuery [jobs.query + * API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + * The call is not guaranteed to wait for the specified timeout; it typically + * returns after around 200 seconds (200,000 milliseconds), even if the query + * is not complete. + * + * The field will be ignored when [output_config] is specified. + * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] + * Optional. [start_time] is required. [start_time] must be less than + * [end_time] Defaults [end_time] to now if [start_time] is set and + * [end_time] isn't. Maximum permitted time range is 7 days. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Queries cloud assets as they appeared at the specified point in + * time. + * @param {google.cloud.asset.v1.QueryAssetsOutputConfig} [request.outputConfig] + * Optional. Destination where the query results will be saved. + * + * When this field is specified, the query results won't be saved in the + * [QueryAssetsResponse.query_result]. Instead + * [QueryAssetsResponse.output_config] will be set. + * + * Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used + * to check the status of the query job when passed to a following + * [QueryAssets] API call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [QueryAssetsResponse]{@link google.cloud.asset.v1.QueryAssetsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.query_assets.js + * region_tag:cloudasset_v1_generated_AssetService_QueryAssets_async + */ + queryAssets( + request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest|undefined, {}|undefined + ]>; + queryAssets( + request: protos.google.cloud.asset.v1.IQueryAssetsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, + {}|null|undefined>): void; + queryAssets( + request: protos.google.cloud.asset.v1.IQueryAssetsRequest, + callback: Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, + {}|null|undefined>): void; + queryAssets( + request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IQueryAssetsResponse, + protos.google.cloud.asset.v1.IQueryAssetsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.queryAssets(request, options, callback); + } +/** + * Creates a saved query in a parent project/folder/organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {google.cloud.asset.v1.SavedQuery} request.savedQuery + * Required. The saved_query details. The `name` field must be empty as it + * will be generated based on the parent and saved_query_id. + * @param {string} request.savedQueryId + * 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 /{@link 0-9|a-z}-/. + * + * Notice that this field is required in the saved query creation, and the + * `name` field of the `saved_query` will be ignored. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.create_saved_query.js + * region_tag:cloudasset_v1_generated_AssetService_CreateSavedQuery_async + */ + createSavedQuery( + request?: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.ICreateSavedQueryRequest|undefined, {}|undefined + ]>; + createSavedQuery( + request: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + createSavedQuery( + request: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, + callback: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + createSavedQuery( + request?: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.ICreateSavedQueryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createSavedQuery(request, options, callback); + } +/** + * Gets details about a saved query. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.get_saved_query.js + * region_tag:cloudasset_v1_generated_AssetService_GetSavedQuery_async + */ + getSavedQuery( + request?: protos.google.cloud.asset.v1.IGetSavedQueryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IGetSavedQueryRequest|undefined, {}|undefined + ]>; + getSavedQuery( + request: protos.google.cloud.asset.v1.IGetSavedQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + getSavedQuery( + request: protos.google.cloud.asset.v1.IGetSavedQueryRequest, + callback: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + getSavedQuery( + request?: protos.google.cloud.asset.v1.IGetSavedQueryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IGetSavedQueryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getSavedQuery(request, options, callback); + } +/** + * Updates a saved query. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.asset.v1.SavedQuery} request.savedQuery + * 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 + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The list of fields to update. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.update_saved_query.js + * region_tag:cloudasset_v1_generated_AssetService_UpdateSavedQuery_async + */ + updateSavedQuery( + request?: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|undefined, {}|undefined + ]>; + updateSavedQuery( + request: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + updateSavedQuery( + request: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, + callback: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + updateSavedQuery( + request?: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery, + protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'saved_query.name': request.savedQuery!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSavedQuery(request, options, callback); + } +/** + * Deletes a saved query. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.delete_saved_query.js + * region_tag:cloudasset_v1_generated_AssetService_DeleteSavedQuery_async + */ + deleteSavedQuery( + request?: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|undefined, {}|undefined + ]>; + deleteSavedQuery( + request: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + deleteSavedQuery( + request: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, + {}|null|undefined>): void; + deleteSavedQuery( + request?: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteSavedQuery(request, options, callback); + } +/** + * Gets effective IAM policies for a batch of resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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). + * @param {string[]} request.names + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchGetEffectiveIamPoliciesResponse]{@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.batch_get_effective_iam_policies.js + * region_tag:cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async + */ + batchGetEffectiveIamPolicies( + request?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|undefined, {}|undefined + ]>; + batchGetEffectiveIamPolicies( + request: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, + {}|null|undefined>): void; + batchGetEffectiveIamPolicies( + request: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, + callback: Callback< + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, + {}|null|undefined>): void; + batchGetEffectiveIamPolicies( + request?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, + protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.batchGetEffectiveIamPolicies(request, options, callback); + } + +/** + * 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 + * {@link 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 + * {@link 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between the current time and the current time minus 35 days (inclusive). + * If not specified, the current time will be used. Due to delays in resource + * data collection and indexing, there is a volatile window during which + * running the same query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types to take a snapshot for. For example: + * "compute.googleapis.com/Disk". + * + * Regular expressions are also supported. For example: + * + * * "compute.googleapis.com.*" snapshots resources whose asset type starts + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * + * If specified, only matching assets will be returned, otherwise, it will + * snapshot all asset types. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will be + * returned. + * @param {google.cloud.asset.v1.OutputConfig} request.outputConfig + * Required. Output configuration indicating where the results will be output + * to. + * @param {string[]} request.relationshipTypes + * A list of relationship types to export, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it snapshots specified relationships. It returns an error if + * any of the [relationship_types] doesn't belong to the supported + * relationship types of the [asset_types] or if any of the [asset_types] + * doesn't belong to the source types of the [relationship_types]. + * * Otherwise: + * it snapshots the supported relationships for all [asset_types] or returns + * an error if any of the [asset_types] has no relationship support. + * An unspecified asset types field means all supported asset_types. + * See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all + * supported asset types and relationship types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.export_assets.js + * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async + */ + exportAssets( + request?: protos.google.cloud.asset.v1.IExportAssetsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportAssets( + request: protos.google.cloud.asset.v1.IExportAssetsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportAssets( + request: protos.google.cloud.asset.v1.IExportAssetsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportAssets( + request?: protos.google.cloud.asset.v1.IExportAssetsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportAssets(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportAssets()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.export_assets.js + * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async + */ + async checkExportAssetsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAssets, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * 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 + * {@link google.cloud.asset.v1.AnalyzeIamPolicyResponse|AnalyzeIamPolicyResponse}. + * This method implements the + * {@link 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.asset.v1.IamPolicyAnalysisQuery} request.analysisQuery + * Required. The request query. + * @param {string} [request.savedAnalysisQuery] + * 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. + * @param {google.cloud.asset.v1.IamPolicyAnalysisOutputConfig} request.outputConfig + * Required. Output configuration indicating where the results will be output + * to. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js + * region_tag:cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async + */ + analyzeIamPolicyLongrunning( + request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + analyzeIamPolicyLongrunning( + request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + analyzeIamPolicyLongrunning( + request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + analyzeIamPolicyLongrunning( + request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'analysis_query.scope': request.analysisQuery!.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeIamPolicyLongrunning(request, options, callback); + } +/** + * Check the status of the long running operation returned by `analyzeIamPolicyLongrunning()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js + * region_tag:cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async + */ + async checkAnalyzeIamPolicyLongrunningProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.analyzeIamPolicyLongrunning, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists assets with time and resource types and returns paged results in + * response. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between the current time and the current time minus 35 days (inclusive). + * If not specified, the current time will be used. Due to delays in resource + * data collection and indexing, there is a volatile window during which + * running the same query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types to take a snapshot for. For example: + * "compute.googleapis.com/Disk". + * + * Regular expression is also supported. For example: + * + * * "compute.googleapis.com.*" snapshots resources whose asset type starts + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * + * If specified, only matching assets will be returned, otherwise, it will + * snapshot all asset types. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will + * be returned. + * @param {number} request.pageSize + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + * @param {string} request.pageToken + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + * @param {string[]} request.relationshipTypes + * A list of relationship types to output, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it snapshots specified relationships. It returns an error if + * any of the [relationship_types] doesn't belong to the supported + * relationship types of the [asset_types] or if any of the [asset_types] + * doesn't belong to the source types of the [relationship_types]. + * * Otherwise: + * it snapshots the supported relationships for all [asset_types] or returns + * an error if any of the [asset_types] has no relationship support. + * An unspecified asset types field means all supported asset_types. + * See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types and relationship types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Asset]{@link google.cloud.asset.v1.Asset}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.asset.v1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IAsset[], + protos.google.cloud.asset.v1.IListAssetsRequest|null, + protos.google.cloud.asset.v1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.asset.v1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1.IListAssetsRequest, + protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1.IAsset>): void; + listAssets( + request: protos.google.cloud.asset.v1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1.IListAssetsRequest, + protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1.IAsset>): void; + listAssets( + request?: protos.google.cloud.asset.v1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1.IListAssetsRequest, + protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1.IAsset>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1.IListAssetsRequest, + protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1.IAsset>): + Promise<[ + protos.google.cloud.asset.v1.IAsset[], + protos.google.cloud.asset.v1.IListAssetsRequest|null, + protos.google.cloud.asset.v1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between the current time and the current time minus 35 days (inclusive). + * If not specified, the current time will be used. Due to delays in resource + * data collection and indexing, there is a volatile window during which + * running the same query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types to take a snapshot for. For example: + * "compute.googleapis.com/Disk". + * + * Regular expression is also supported. For example: + * + * * "compute.googleapis.com.*" snapshots resources whose asset type starts + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * + * If specified, only matching assets will be returned, otherwise, it will + * snapshot all asset types. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will + * be returned. + * @param {number} request.pageSize + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + * @param {string} request.pageToken + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + * @param {string[]} request.relationshipTypes + * A list of relationship types to output, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it snapshots specified relationships. It returns an error if + * any of the [relationship_types] doesn't belong to the supported + * relationship types of the [asset_types] or if any of the [asset_types] + * doesn't belong to the source types of the [relationship_types]. + * * Otherwise: + * it snapshots the supported relationships for all [asset_types] or returns + * an error if any of the [asset_types] has no relationship support. + * An unspecified asset types field means all supported asset_types. + * See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types and relationship types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Asset]{@link google.cloud.asset.v1.Asset} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.asset.v1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between the current time and the current time minus 35 days (inclusive). + * If not specified, the current time will be used. Due to delays in resource + * data collection and indexing, there is a volatile window during which + * running the same query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types to take a snapshot for. For example: + * "compute.googleapis.com/Disk". + * + * Regular expression is also supported. For example: + * + * * "compute.googleapis.com.*" snapshots resources whose asset type starts + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * + * If specified, only matching assets will be returned, otherwise, it will + * snapshot all asset types. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will + * be returned. + * @param {number} request.pageSize + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + * @param {string} request.pageToken + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + * @param {string[]} request.relationshipTypes + * A list of relationship types to output, for example: + * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if + * content_type=RELATIONSHIP. + * * If specified: + * it snapshots specified relationships. It returns an error if + * any of the [relationship_types] doesn't belong to the supported + * relationship types of the [asset_types] or if any of the [asset_types] + * doesn't belong to the source types of the [relationship_types]. + * * Otherwise: + * it snapshots the supported relationships for all [asset_types] or returns + * an error if any of the [asset_types] has no relationship support. + * An unspecified asset types field means all supported asset_types. + * See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/asset-inventory/docs/overview) + * for all supported asset types and relationship types. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Asset]{@link google.cloud.asset.v1.Asset}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.list_assets.js + * region_tag:cloudasset_v1_generated_AssetService_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.asset.v1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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: + * + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + * @param {string} [request.query] + * Optional. The query statement. See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more information. If not specified or empty, it will search all the + * resources within the specified `scope`. + * + * Examples: + * + * * `name:Important` to find Cloud resources whose name contains + * "Important" as a word. + * * `name=Important` to find the Cloud resource whose name is exactly + * "Important". + * * `displayName:Impor*` to find Cloud resources whose display name + * contains "Impor" as a prefix of any word in the field. + * * `location:us-west*` to find Cloud resources whose location contains both + * "us" and "west" as prefixes. + * * `labels:prod` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env:prod` to find Cloud resources that have a label "env" + * and its value is "prod". + * * `labels.env:*` to find Cloud resources that have a label "env". + * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed + * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". + * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a + * word. + * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain + * "ACTIVE" as a word. + * * `createTime<1609459200` to find Cloud resources that were created before + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `updateTime>1609459200` to find Cloud resources that were updated after + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `Important` to find Cloud resources that contain "Important" as a word + * in any of the searchable fields. + * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any + * word in any of the searchable fields. + * * `Important location:(us-west1 OR global)` to find Cloud + * resources that contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + * @param {string[]} [request.assetTypes] + * 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 + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.orderBy] + * 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 + * * assetType + * * project + * * displayName + * * description + * * location + * * kmsKey + * * createTime + * * updateTime + * * state + * * parentFullResourceName + * * parentAssetType + * + * All the other fields such as repeated fields (e.g., `networkTags`), map + * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) + * are not supported. + * @param {google.protobuf.FieldMask} [request.readMask] + * 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 + * * assetType + * * project + * * displayName + * * description + * * location + * * tagKeys + * * tagValues + * * tagValueIds + * * labels + * * networkTags + * * kmsKey + * * createTime + * * updateTime + * * state + * * additionalAttributes + * * versionedResources + * + * If read_mask is not specified, all fields except versionedResources will + * be returned. + * If only '*' is specified, all fields including versionedResources will be + * returned. + * Any invalid field path will trigger INVALID_ARGUMENT error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAllResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllResources( + request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IResourceSearchResult[], + protos.google.cloud.asset.v1.ISearchAllResourcesRequest|null, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse + ]>; + searchAllResources( + request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1.IResourceSearchResult>): void; + searchAllResources( + request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1.IResourceSearchResult>): void; + searchAllResources( + request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1.IResourceSearchResult>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1.IResourceSearchResult>): + Promise<[ + protos.google.cloud.asset.v1.IResourceSearchResult[], + protos.google.cloud.asset.v1.ISearchAllResourcesRequest|null, + protos.google.cloud.asset.v1.ISearchAllResourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchAllResources(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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: + * + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + * @param {string} [request.query] + * Optional. The query statement. See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more information. If not specified or empty, it will search all the + * resources within the specified `scope`. + * + * Examples: + * + * * `name:Important` to find Cloud resources whose name contains + * "Important" as a word. + * * `name=Important` to find the Cloud resource whose name is exactly + * "Important". + * * `displayName:Impor*` to find Cloud resources whose display name + * contains "Impor" as a prefix of any word in the field. + * * `location:us-west*` to find Cloud resources whose location contains both + * "us" and "west" as prefixes. + * * `labels:prod` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env:prod` to find Cloud resources that have a label "env" + * and its value is "prod". + * * `labels.env:*` to find Cloud resources that have a label "env". + * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed + * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". + * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a + * word. + * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain + * "ACTIVE" as a word. + * * `createTime<1609459200` to find Cloud resources that were created before + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `updateTime>1609459200` to find Cloud resources that were updated after + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `Important` to find Cloud resources that contain "Important" as a word + * in any of the searchable fields. + * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any + * word in any of the searchable fields. + * * `Important location:(us-west1 OR global)` to find Cloud + * resources that contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + * @param {string[]} [request.assetTypes] + * 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 + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.orderBy] + * 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 + * * assetType + * * project + * * displayName + * * description + * * location + * * kmsKey + * * createTime + * * updateTime + * * state + * * parentFullResourceName + * * parentAssetType + * + * All the other fields such as repeated fields (e.g., `networkTags`), map + * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) + * are not supported. + * @param {google.protobuf.FieldMask} [request.readMask] + * 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 + * * assetType + * * project + * * displayName + * * description + * * location + * * tagKeys + * * tagValues + * * tagValueIds + * * labels + * * networkTags + * * kmsKey + * * createTime + * * updateTime + * * state + * * additionalAttributes + * * versionedResources + * + * If read_mask is not specified, all fields except versionedResources will + * be returned. + * If only '*' is specified, all fields including versionedResources will be + * returned. + * Any invalid field path will trigger INVALID_ARGUMENT error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAllResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllResourcesStream( + request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllResources.createStream( + this.innerApiCalls.searchAllResources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAllResources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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: + * + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + * @param {string} [request.query] + * Optional. The query statement. See [how to construct a + * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) + * for more information. If not specified or empty, it will search all the + * resources within the specified `scope`. + * + * Examples: + * + * * `name:Important` to find Cloud resources whose name contains + * "Important" as a word. + * * `name=Important` to find the Cloud resource whose name is exactly + * "Important". + * * `displayName:Impor*` to find Cloud resources whose display name + * contains "Impor" as a prefix of any word in the field. + * * `location:us-west*` to find Cloud resources whose location contains both + * "us" and "west" as prefixes. + * * `labels:prod` to find Cloud resources whose labels contain "prod" as + * a key or value. + * * `labels.env:prod` to find Cloud resources that have a label "env" + * and its value is "prod". + * * `labels.env:*` to find Cloud resources that have a label "env". + * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed + * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". + * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a + * word. + * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain + * "ACTIVE" as a word. + * * `createTime<1609459200` to find Cloud resources that were created before + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `updateTime>1609459200` to find Cloud resources that were updated after + * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of + * "2021-01-01 00:00:00 UTC" in seconds. + * * `Important` to find Cloud resources that contain "Important" as a word + * in any of the searchable fields. + * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any + * word in any of the searchable fields. + * * `Important location:(us-west1 OR global)` to find Cloud + * resources that contain "Important" as a word in any of the searchable + * fields and are also located in the "us-west1" region or the "global" + * location. + * @param {string[]} [request.assetTypes] + * 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 + * with "compute.googleapis.com". + * * ".*Instance" snapshots resources whose asset type ends with "Instance". + * * ".*Instance.*" snapshots resources whose asset type contains "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.orderBy] + * 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 + * * assetType + * * project + * * displayName + * * description + * * location + * * kmsKey + * * createTime + * * updateTime + * * state + * * parentFullResourceName + * * parentAssetType + * + * All the other fields such as repeated fields (e.g., `networkTags`), map + * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) + * are not supported. + * @param {google.protobuf.FieldMask} [request.readMask] + * 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 + * * assetType + * * project + * * displayName + * * description + * * location + * * tagKeys + * * tagValues + * * tagValueIds + * * labels + * * networkTags + * * kmsKey + * * createTime + * * updateTime + * * state + * * additionalAttributes + * * versionedResources + * + * If read_mask is not specified, all fields except versionedResources will + * be returned. + * If only '*' is specified, all fields including versionedResources will be + * returned. + * Any invalid field path will trigger INVALID_ARGUMENT error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.search_all_resources.js + * region_tag:cloudasset_v1_generated_AssetService_SearchAllResources_async + */ + searchAllResourcesAsync( + request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllResources.asyncIterate( + this.innerApiCalls['searchAllResources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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: + * + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + * @param {string} [request.query] + * Optional. The query statement. See [how to construct a + * 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 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 the [IAM policy + * documentation](https://cloud.google.com/iam/help/allow-policies/structure). + * + * Examples: + * + * * `policy:amy@gmail.com` to find IAM policy bindings that specify user + * "amy@gmail.com". + * * `policy:roles/compute.admin` to find IAM policy bindings that specify + * the Compute Admin role. + * * `policy:comp*` to find IAM policy bindings that contain "comp" as a + * prefix of any word in the binding. + * * `policy.role.permissions:storage.buckets.update` to find IAM policy + * bindings that specify a role containing "storage.buckets.update" + * permission. Note that if callers don't have `iam.roles.get` access to a + * role's included permissions, policy bindings that specify this role will + * be dropped from the search results. + * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a + * role containing "upd" as a prefix of any word in the role permission. + * Note that if callers don't have `iam.roles.get` access to a role's + * included permissions, policy bindings that specify this role will be + * dropped from the search results. + * * `resource:organizations/123456` to find IAM policy bindings + * that are set on "organizations/123456". + * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to + * find IAM policy bindings that are set on the project named "myproject". + * * `Important` to find IAM policy bindings that contain "Important" as a + * word in any of the searchable fields (except for the included + * permissions). + * * `resource:(instance1 OR instance2) policy:amy` to find + * IAM policy bindings that are set on resources "instance1" or + * "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 + * principal type "user". + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string[]} [request.assetTypes] + * 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 + * starts with "compute.googleapis.com". + * * ".*Instance" snapshots IAM policies attached to asset type ends with + * "Instance". + * * ".*Instance.*" snapshots IAM policies attached to asset type contains + * "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * @param {string} [request.orderBy] + * 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 + * * assetType + * * project + * All the other fields such as repeated fields (e.g., `folders`) and + * non-primitive fields (e.g., `policy`) are not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAllIamPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllIamPolicies( + request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.IIamPolicySearchResult[], + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest|null, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + ]>; + searchAllIamPolicies( + request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult>): void; + searchAllIamPolicies( + request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult>): void; + searchAllIamPolicies( + request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1.IIamPolicySearchResult>): + Promise<[ + protos.google.cloud.asset.v1.IIamPolicySearchResult[], + protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest|null, + protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchAllIamPolicies(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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: + * + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + * @param {string} [request.query] + * Optional. The query statement. See [how to construct a + * 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 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 the [IAM policy + * documentation](https://cloud.google.com/iam/help/allow-policies/structure). + * + * Examples: + * + * * `policy:amy@gmail.com` to find IAM policy bindings that specify user + * "amy@gmail.com". + * * `policy:roles/compute.admin` to find IAM policy bindings that specify + * the Compute Admin role. + * * `policy:comp*` to find IAM policy bindings that contain "comp" as a + * prefix of any word in the binding. + * * `policy.role.permissions:storage.buckets.update` to find IAM policy + * bindings that specify a role containing "storage.buckets.update" + * permission. Note that if callers don't have `iam.roles.get` access to a + * role's included permissions, policy bindings that specify this role will + * be dropped from the search results. + * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a + * role containing "upd" as a prefix of any word in the role permission. + * Note that if callers don't have `iam.roles.get` access to a role's + * included permissions, policy bindings that specify this role will be + * dropped from the search results. + * * `resource:organizations/123456` to find IAM policy bindings + * that are set on "organizations/123456". + * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to + * find IAM policy bindings that are set on the project named "myproject". + * * `Important` to find IAM policy bindings that contain "Important" as a + * word in any of the searchable fields (except for the included + * permissions). + * * `resource:(instance1 OR instance2) policy:amy` to find + * IAM policy bindings that are set on resources "instance1" or + * "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 + * principal type "user". + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string[]} [request.assetTypes] + * 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 + * starts with "compute.googleapis.com". + * * ".*Instance" snapshots IAM policies attached to asset type ends with + * "Instance". + * * ".*Instance.*" snapshots IAM policies attached to asset type contains + * "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * @param {string} [request.orderBy] + * 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 + * * assetType + * * project + * All the other fields such as repeated fields (e.g., `folders`) and + * non-primitive fields (e.g., `policy`) are not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAllIamPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllIamPoliciesStream( + request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllIamPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllIamPolicies.createStream( + this.innerApiCalls.searchAllIamPolicies as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAllIamPolicies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * 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: + * + * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") + * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") + * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") + * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") + * @param {string} [request.query] + * Optional. The query statement. See [how to construct a + * 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 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 the [IAM policy + * documentation](https://cloud.google.com/iam/help/allow-policies/structure). + * + * Examples: + * + * * `policy:amy@gmail.com` to find IAM policy bindings that specify user + * "amy@gmail.com". + * * `policy:roles/compute.admin` to find IAM policy bindings that specify + * the Compute Admin role. + * * `policy:comp*` to find IAM policy bindings that contain "comp" as a + * prefix of any word in the binding. + * * `policy.role.permissions:storage.buckets.update` to find IAM policy + * bindings that specify a role containing "storage.buckets.update" + * permission. Note that if callers don't have `iam.roles.get` access to a + * role's included permissions, policy bindings that specify this role will + * be dropped from the search results. + * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a + * role containing "upd" as a prefix of any word in the role permission. + * Note that if callers don't have `iam.roles.get` access to a role's + * included permissions, policy bindings that specify this role will be + * dropped from the search results. + * * `resource:organizations/123456` to find IAM policy bindings + * that are set on "organizations/123456". + * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to + * find IAM policy bindings that are set on the project named "myproject". + * * `Important` to find IAM policy bindings that contain "Important" as a + * word in any of the searchable fields (except for the included + * permissions). + * * `resource:(instance1 OR instance2) policy:amy` to find + * IAM policy bindings that are set on resources "instance1" or + * "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 + * principal type "user". + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string[]} [request.assetTypes] + * 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 + * starts with "compute.googleapis.com". + * * ".*Instance" snapshots IAM policies attached to asset type ends with + * "Instance". + * * ".*Instance.*" snapshots IAM policies attached to asset type contains + * "Instance". + * + * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported + * regular expression syntax. If the regular expression does not match any + * supported asset type, an INVALID_ARGUMENT error will be returned. + * @param {string} [request.orderBy] + * 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 + * * assetType + * * project + * All the other fields such as repeated fields (e.g., `folders`) and + * non-primitive fields (e.g., `policy`) are not supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.search_all_iam_policies.js + * region_tag:cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async + */ + searchAllIamPoliciesAsync( + request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllIamPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllIamPolicies.asyncIterate( + this.innerApiCalls['searchAllIamPolicies'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists all saved queries in a parent project/folder/organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {string} [request.filter] + * 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. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSavedQueriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSavedQueries( + request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery[], + protos.google.cloud.asset.v1.IListSavedQueriesRequest|null, + protos.google.cloud.asset.v1.IListSavedQueriesResponse + ]>; + listSavedQueries( + request: protos.google.cloud.asset.v1.IListSavedQueriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1.IListSavedQueriesRequest, + protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, + protos.google.cloud.asset.v1.ISavedQuery>): void; + listSavedQueries( + request: protos.google.cloud.asset.v1.IListSavedQueriesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1.IListSavedQueriesRequest, + protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, + protos.google.cloud.asset.v1.ISavedQuery>): void; + listSavedQueries( + request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1.IListSavedQueriesRequest, + protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, + protos.google.cloud.asset.v1.ISavedQuery>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1.IListSavedQueriesRequest, + protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, + protos.google.cloud.asset.v1.ISavedQuery>): + Promise<[ + protos.google.cloud.asset.v1.ISavedQuery[], + protos.google.cloud.asset.v1.IListSavedQueriesRequest|null, + protos.google.cloud.asset.v1.IListSavedQueriesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listSavedQueries(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {string} [request.filter] + * 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. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSavedQueriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listSavedQueriesStream( + request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSavedQueries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSavedQueries.createStream( + this.innerApiCalls.listSavedQueries as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSavedQueries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * 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"). + * @param {string} [request.filter] + * 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. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/asset_service.list_saved_queries.js + * region_tag:cloudasset_v1_generated_AssetService_ListSavedQueries_async + */ + listSavedQueriesAsync( + request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSavedQueries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSavedQueries.asyncIterate( + this.innerApiCalls['listSavedQueries'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified accessLevel resource name string. + * + * @param {string} access_policy + * @param {string} access_level + * @returns {string} Resource name string. + */ + accessLevelPath(accessPolicy:string,accessLevel:string) { + return this.pathTemplates.accessLevelPathTemplate.render({ + access_policy: accessPolicy, + access_level: accessLevel, + }); + } + + /** + * Parse the access_policy from AccessLevel resource. + * + * @param {string} accessLevelName + * A fully-qualified path representing AccessLevel resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromAccessLevelName(accessLevelName: string) { + return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_policy; + } + + /** + * Parse the access_level from AccessLevel resource. + * + * @param {string} accessLevelName + * A fully-qualified path representing AccessLevel resource. + * @returns {string} A string representing the access_level. + */ + matchAccessLevelFromAccessLevelName(accessLevelName: string) { + return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_level; + } + + /** + * Return a fully-qualified accessPolicy resource name string. + * + * @param {string} access_policy + * @returns {string} Resource name string. + */ + accessPolicyPath(accessPolicy:string) { + return this.pathTemplates.accessPolicyPathTemplate.render({ + access_policy: accessPolicy, + }); + } + + /** + * Parse the access_policy from AccessPolicy resource. + * + * @param {string} accessPolicyName + * A fully-qualified path representing AccessPolicy resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromAccessPolicyName(accessPolicyName: string) { + return this.pathTemplates.accessPolicyPathTemplate.match(accessPolicyName).access_policy; + } + + /** + * Return a fully-qualified folderFeed resource name string. + * + * @param {string} folder + * @param {string} feed + * @returns {string} Resource name string. + */ + folderFeedPath(folder:string,feed:string) { + return this.pathTemplates.folderFeedPathTemplate.render({ + folder: folder, + feed: feed, + }); + } + + /** + * Parse the folder from FolderFeed resource. + * + * @param {string} folderFeedName + * A fully-qualified path representing folder_feed resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderFeedName(folderFeedName: string) { + return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).folder; + } + + /** + * Parse the feed from FolderFeed resource. + * + * @param {string} folderFeedName + * A fully-qualified path representing folder_feed resource. + * @returns {string} A string representing the feed. + */ + matchFeedFromFolderFeedName(folderFeedName: string) { + return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).feed; + } + + /** + * Return a fully-qualified folderSavedQuery resource name string. + * + * @param {string} folder + * @param {string} saved_query + * @returns {string} Resource name string. + */ + folderSavedQueryPath(folder:string,savedQuery:string) { + return this.pathTemplates.folderSavedQueryPathTemplate.render({ + folder: folder, + saved_query: savedQuery, + }); + } + + /** + * Parse the folder from FolderSavedQuery resource. + * + * @param {string} folderSavedQueryName + * A fully-qualified path representing folder_saved_query resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSavedQueryName(folderSavedQueryName: string) { + return this.pathTemplates.folderSavedQueryPathTemplate.match(folderSavedQueryName).folder; + } + + /** + * Parse the saved_query from FolderSavedQuery resource. + * + * @param {string} folderSavedQueryName + * A fully-qualified path representing folder_saved_query resource. + * @returns {string} A string representing the saved_query. + */ + matchSavedQueryFromFolderSavedQueryName(folderSavedQueryName: string) { + return this.pathTemplates.folderSavedQueryPathTemplate.match(folderSavedQueryName).saved_query; + } + + /** + * Return a fully-qualified inventory resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} instance + * @returns {string} Resource name string. + */ + inventoryPath(project:string,location:string,instance:string) { + return this.pathTemplates.inventoryPathTemplate.render({ + project: project, + location: location, + instance: instance, + }); + } + + /** + * Parse the project from Inventory resource. + * + * @param {string} inventoryName + * A fully-qualified path representing Inventory resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInventoryName(inventoryName: string) { + return this.pathTemplates.inventoryPathTemplate.match(inventoryName).project; + } + + /** + * Parse the location from Inventory resource. + * + * @param {string} inventoryName + * A fully-qualified path representing Inventory resource. + * @returns {string} A string representing the location. + */ + matchLocationFromInventoryName(inventoryName: string) { + return this.pathTemplates.inventoryPathTemplate.match(inventoryName).location; + } + + /** + * Parse the instance from Inventory resource. + * + * @param {string} inventoryName + * A fully-qualified path representing Inventory resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInventoryName(inventoryName: string) { + return this.pathTemplates.inventoryPathTemplate.match(inventoryName).instance; + } + + /** + * Return a fully-qualified organizationFeed resource name string. + * + * @param {string} organization + * @param {string} feed + * @returns {string} Resource name string. + */ + organizationFeedPath(organization:string,feed:string) { + return this.pathTemplates.organizationFeedPathTemplate.render({ + organization: organization, + feed: feed, + }); + } + + /** + * Parse the organization from OrganizationFeed resource. + * + * @param {string} organizationFeedName + * A fully-qualified path representing organization_feed resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationFeedName(organizationFeedName: string) { + return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).organization; + } + + /** + * Parse the feed from OrganizationFeed resource. + * + * @param {string} organizationFeedName + * A fully-qualified path representing organization_feed resource. + * @returns {string} A string representing the feed. + */ + matchFeedFromOrganizationFeedName(organizationFeedName: string) { + return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).feed; + } + + /** + * Return a fully-qualified organizationSavedQuery resource name string. + * + * @param {string} organization + * @param {string} saved_query + * @returns {string} Resource name string. + */ + organizationSavedQueryPath(organization:string,savedQuery:string) { + return this.pathTemplates.organizationSavedQueryPathTemplate.render({ + organization: organization, + saved_query: savedQuery, + }); + } + + /** + * Parse the organization from OrganizationSavedQuery resource. + * + * @param {string} organizationSavedQueryName + * A fully-qualified path representing organization_saved_query resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSavedQueryName(organizationSavedQueryName: string) { + return this.pathTemplates.organizationSavedQueryPathTemplate.match(organizationSavedQueryName).organization; + } + + /** + * Parse the saved_query from OrganizationSavedQuery resource. + * + * @param {string} organizationSavedQueryName + * A fully-qualified path representing organization_saved_query resource. + * @returns {string} A string representing the saved_query. + */ + matchSavedQueryFromOrganizationSavedQueryName(organizationSavedQueryName: string) { + return this.pathTemplates.organizationSavedQueryPathTemplate.match(organizationSavedQueryName).saved_query; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectFeed resource name string. + * + * @param {string} project + * @param {string} feed + * @returns {string} Resource name string. + */ + projectFeedPath(project:string,feed:string) { + return this.pathTemplates.projectFeedPathTemplate.render({ + project: project, + feed: feed, + }); + } + + /** + * Parse the project from ProjectFeed resource. + * + * @param {string} projectFeedName + * A fully-qualified path representing project_feed resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectFeedName(projectFeedName: string) { + return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).project; + } + + /** + * Parse the feed from ProjectFeed resource. + * + * @param {string} projectFeedName + * A fully-qualified path representing project_feed resource. + * @returns {string} A string representing the feed. + */ + matchFeedFromProjectFeedName(projectFeedName: string) { + return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).feed; + } + + /** + * Return a fully-qualified projectSavedQuery resource name string. + * + * @param {string} project + * @param {string} saved_query + * @returns {string} Resource name string. + */ + projectSavedQueryPath(project:string,savedQuery:string) { + return this.pathTemplates.projectSavedQueryPathTemplate.render({ + project: project, + saved_query: savedQuery, + }); + } + + /** + * Parse the project from ProjectSavedQuery resource. + * + * @param {string} projectSavedQueryName + * A fully-qualified path representing project_saved_query resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSavedQueryName(projectSavedQueryName: string) { + return this.pathTemplates.projectSavedQueryPathTemplate.match(projectSavedQueryName).project; + } + + /** + * Parse the saved_query from ProjectSavedQuery resource. + * + * @param {string} projectSavedQueryName + * A fully-qualified path representing project_saved_query resource. + * @returns {string} A string representing the saved_query. + */ + matchSavedQueryFromProjectSavedQueryName(projectSavedQueryName: string) { + return this.pathTemplates.projectSavedQueryPathTemplate.match(projectSavedQueryName).saved_query; + } + + /** + * Return a fully-qualified servicePerimeter resource name string. + * + * @param {string} access_policy + * @param {string} service_perimeter + * @returns {string} Resource name string. + */ + servicePerimeterPath(accessPolicy:string,servicePerimeter:string) { + return this.pathTemplates.servicePerimeterPathTemplate.render({ + access_policy: accessPolicy, + service_perimeter: servicePerimeter, + }); + } + + /** + * Parse the access_policy from ServicePerimeter resource. + * + * @param {string} servicePerimeterName + * A fully-qualified path representing ServicePerimeter resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string) { + return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).access_policy; + } + + /** + * Parse the service_perimeter from ServicePerimeter resource. + * + * @param {string} servicePerimeterName + * A fully-qualified path representing ServicePerimeter resource. + * @returns {string} A string representing the service_perimeter. + */ + matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string) { + return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).service_perimeter; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/asset_service_client_config.json b/owl-bot-staging/v1/src/v1/asset_service_client_config.json new file mode 100644 index 00000000..f98d630a --- /dev/null +++ b/owl-bot-staging/v1/src/v1/asset_service_client_config.json @@ -0,0 +1,128 @@ +{ + "interfaces": { + "google.cloud.asset.v1.AssetService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ExportAssets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListAssets": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchGetAssetsHistory": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateFeed": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFeed": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFeeds": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFeed": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFeed": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchAllResources": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SearchAllIamPolicies": { + "timeout_millis": 30000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "AnalyzeIamPolicy": { + "timeout_millis": 300000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "AnalyzeIamPolicyLongrunning": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AnalyzeMove": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "QueryAssets": { + "timeout_millis": 200000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateSavedQuery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSavedQuery": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListSavedQueries": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateSavedQuery": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSavedQuery": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "BatchGetEffectiveIamPolicies": { + "timeout_millis": 300000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/asset_service_proto_list.json b/owl-bot-staging/v1/src/v1/asset_service_proto_list.json new file mode 100644 index 00000000..d519d6bf --- /dev/null +++ b/owl-bot-staging/v1/src/v1/asset_service_proto_list.json @@ -0,0 +1,10 @@ +[ + "../../protos/google/cloud/asset/v1/asset_service.proto", + "../../protos/google/cloud/asset/v1/assets.proto", + "../../protos/google/cloud/orgpolicy/v1/orgpolicy.proto", + "../../protos/google/cloud/osconfig/v1/inventory.proto", + "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", + "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" +] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000..452c8a6e --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,239 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.asset.v1", + "libraryPackage": "@google-cloud/asset", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "BatchGetAssetsHistory": { + "methods": [ + "batchGetAssetsHistory" + ] + }, + "CreateFeed": { + "methods": [ + "createFeed" + ] + }, + "GetFeed": { + "methods": [ + "getFeed" + ] + }, + "ListFeeds": { + "methods": [ + "listFeeds" + ] + }, + "UpdateFeed": { + "methods": [ + "updateFeed" + ] + }, + "DeleteFeed": { + "methods": [ + "deleteFeed" + ] + }, + "AnalyzeIamPolicy": { + "methods": [ + "analyzeIamPolicy" + ] + }, + "AnalyzeMove": { + "methods": [ + "analyzeMove" + ] + }, + "QueryAssets": { + "methods": [ + "queryAssets" + ] + }, + "CreateSavedQuery": { + "methods": [ + "createSavedQuery" + ] + }, + "GetSavedQuery": { + "methods": [ + "getSavedQuery" + ] + }, + "UpdateSavedQuery": { + "methods": [ + "updateSavedQuery" + ] + }, + "DeleteSavedQuery": { + "methods": [ + "deleteSavedQuery" + ] + }, + "BatchGetEffectiveIamPolicies": { + "methods": [ + "batchGetEffectiveIamPolicies" + ] + }, + "ExportAssets": { + "methods": [ + "exportAssets" + ] + }, + "AnalyzeIamPolicyLongrunning": { + "methods": [ + "analyzeIamPolicyLongrunning" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "SearchAllResources": { + "methods": [ + "searchAllResources", + "searchAllResourcesStream", + "searchAllResourcesAsync" + ] + }, + "SearchAllIamPolicies": { + "methods": [ + "searchAllIamPolicies", + "searchAllIamPoliciesStream", + "searchAllIamPoliciesAsync" + ] + }, + "ListSavedQueries": { + "methods": [ + "listSavedQueries", + "listSavedQueriesStream", + "listSavedQueriesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "BatchGetAssetsHistory": { + "methods": [ + "batchGetAssetsHistory" + ] + }, + "CreateFeed": { + "methods": [ + "createFeed" + ] + }, + "GetFeed": { + "methods": [ + "getFeed" + ] + }, + "ListFeeds": { + "methods": [ + "listFeeds" + ] + }, + "UpdateFeed": { + "methods": [ + "updateFeed" + ] + }, + "DeleteFeed": { + "methods": [ + "deleteFeed" + ] + }, + "AnalyzeIamPolicy": { + "methods": [ + "analyzeIamPolicy" + ] + }, + "AnalyzeMove": { + "methods": [ + "analyzeMove" + ] + }, + "QueryAssets": { + "methods": [ + "queryAssets" + ] + }, + "CreateSavedQuery": { + "methods": [ + "createSavedQuery" + ] + }, + "GetSavedQuery": { + "methods": [ + "getSavedQuery" + ] + }, + "UpdateSavedQuery": { + "methods": [ + "updateSavedQuery" + ] + }, + "DeleteSavedQuery": { + "methods": [ + "deleteSavedQuery" + ] + }, + "BatchGetEffectiveIamPolicies": { + "methods": [ + "batchGetEffectiveIamPolicies" + ] + }, + "ExportAssets": { + "methods": [ + "exportAssets" + ] + }, + "AnalyzeIamPolicyLongrunning": { + "methods": [ + "analyzeIamPolicyLongrunning" + ] + }, + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + }, + "SearchAllResources": { + "methods": [ + "searchAllResources", + "searchAllResourcesStream", + "searchAllResourcesAsync" + ] + }, + "SearchAllIamPolicies": { + "methods": [ + "searchAllIamPolicies", + "searchAllIamPoliciesStream", + "searchAllIamPoliciesAsync" + ] + }, + "ListSavedQueries": { + "methods": [ + "listSavedQueries", + "listSavedQueriesStream", + "listSavedQueriesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 00000000..9008232c --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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. ** + +export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..5fa01880 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const asset = require('@google-cloud/asset'); + +function main() { + const assetServiceClient = new asset.AssetServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..8fb3fb03 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. ** + +import {AssetServiceClient} from '@google-cloud/asset'; + +// check that the client class type name can be used +function doStuffWithAssetServiceClient(client: AssetServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const assetServiceClient = new AssetServiceClient(); + doStuffWithAssetServiceClient(assetServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 00000000..557a5755 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_asset_service_v1.ts b/owl-bot-staging/v1/test/gapic_asset_service_v1.ts new file mode 100644 index 00000000..780f6168 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_asset_service_v1.ts @@ -0,0 +1,3697 @@ +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as assetserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.AssetServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = assetserviceModule.v1.AssetServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = assetserviceModule.v1.AssetServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new assetserviceModule.v1.AssetServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + await client.initialize(); + assert(client.assetServiceStub); + }); + + 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.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 () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('batchGetAssetsHistory', () => { + it('invokes batchGetAssetsHistory without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() + ); + client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(expectedResponse); + const [response] = await client.batchGetAssetsHistory(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetAssetsHistory without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() + ); + client.innerApiCalls.batchGetAssetsHistory = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchGetAssetsHistory( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetAssetsHistory with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchGetAssetsHistory(request), expectedError); + const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchGetAssetsHistory(request), expectedError); + }); + }); + + describe('createFeed', () => { + it('invokes createFeed without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.Feed() + ); + client.innerApiCalls.createFeed = stubSimpleCall(expectedResponse); + const [response] = await client.createFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeed without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.Feed() + ); + client.innerApiCalls.createFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFeed( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeed with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFeed(request), expectedError); + }); + }); + + describe('getFeed', () => { + it('invokes getFeed without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.Feed() + ); + client.innerApiCalls.getFeed = stubSimpleCall(expectedResponse); + const [response] = await client.getFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeed without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.Feed() + ); + client.innerApiCalls.getFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFeed( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeed with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeed(request), expectedError); + }); + }); + + describe('listFeeds', () => { + it('invokes listFeeds without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.ListFeedsResponse() + ); + client.innerApiCalls.listFeeds = stubSimpleCall(expectedResponse); + const [response] = await client.listFeeds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeeds without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.ListFeedsResponse() + ); + client.innerApiCalls.listFeeds = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFeeds( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IListFeedsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeeds with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFeeds = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFeeds(request), expectedError); + const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFeeds(request), expectedError); + }); + }); + + describe('updateFeed', () => { + it('invokes updateFeed without error', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.Feed() + ); + client.innerApiCalls.updateFeed = stubSimpleCall(expectedResponse); + const [response] = await client.updateFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeed without error using callback', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.Feed() + ); + client.innerApiCalls.updateFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFeed( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeed with error', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFeed(request), expectedError); + }); + }); + + describe('deleteFeed', () => { + it('invokes deleteFeed without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteFeed = stubSimpleCall(expectedResponse); + const [response] = await client.deleteFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeed without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFeed( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeed with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteFeed(request), expectedError); + }); + }); + + describe('analyzeIamPolicy', () => { + it('invokes analyzeIamPolicy without error', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.AnalyzeIamPolicyResponse() + ); + client.innerApiCalls.analyzeIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.analyzeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeIamPolicy without error using callback', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.AnalyzeIamPolicyResponse() + ); + client.innerApiCalls.analyzeIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeIamPolicy( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.analyzeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeIamPolicy with error', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeIamPolicy(request), expectedError); + const actualRequest = (client.innerApiCalls.analyzeIamPolicy as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicy as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeIamPolicy(request), expectedError); + }); + }); + + describe('analyzeMove', () => { + it('invokes analyzeMove without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.AnalyzeMoveResponse() + ); + client.innerApiCalls.analyzeMove = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeMove(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.analyzeMove as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeMove as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeMove without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.AnalyzeMoveResponse() + ); + client.innerApiCalls.analyzeMove = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeMove( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IAnalyzeMoveResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.analyzeMove as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeMove as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeMove with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); + request.resource = defaultValue1; + const expectedHeaderRequestParams = `resource=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeMove = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.analyzeMove(request), expectedError); + const actualRequest = (client.innerApiCalls.analyzeMove as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeMove as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); + request.resource = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeMove(request), expectedError); + }); + }); + + describe('queryAssets', () => { + it('invokes queryAssets without error', 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.QueryAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('QueryAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.QueryAssetsResponse() + ); + client.innerApiCalls.queryAssets = stubSimpleCall(expectedResponse); + const [response] = await client.queryAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryAssets without error using callback', 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.QueryAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('QueryAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.QueryAssetsResponse() + ); + client.innerApiCalls.queryAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.queryAssets( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IQueryAssetsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryAssets with error', 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.QueryAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('QueryAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.queryAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.queryAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.queryAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes queryAssets 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.QueryAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('QueryAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.queryAssets(request), expectedError); + }); + }); + + describe('createSavedQuery', () => { + it('invokes createSavedQuery without error', 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.CreateSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.SavedQuery() + ); + client.innerApiCalls.createSavedQuery = stubSimpleCall(expectedResponse); + const [response] = await client.createSavedQuery(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSavedQuery without error using callback', 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.CreateSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.SavedQuery() + ); + client.innerApiCalls.createSavedQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSavedQuery( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSavedQuery with error', 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.CreateSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSavedQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSavedQuery(request), expectedError); + const actualRequest = (client.innerApiCalls.createSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSavedQuery 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.CreateSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSavedQuery(request), expectedError); + }); + }); + + describe('getSavedQuery', () => { + it('invokes getSavedQuery without error', 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.GetSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.SavedQuery() + ); + client.innerApiCalls.getSavedQuery = stubSimpleCall(expectedResponse); + const [response] = await client.getSavedQuery(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSavedQuery without error using callback', 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.GetSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.SavedQuery() + ); + client.innerApiCalls.getSavedQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSavedQuery( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSavedQuery with error', 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.GetSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSavedQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSavedQuery(request), expectedError); + const actualRequest = (client.innerApiCalls.getSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSavedQuery 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.GetSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('GetSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSavedQuery(request), expectedError); + }); + }); + + describe('updateSavedQuery', () => { + it('invokes updateSavedQuery without error', 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.UpdateSavedQueryRequest() + ); + request.savedQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); + request.savedQuery.name = defaultValue1; + const expectedHeaderRequestParams = `saved_query.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.SavedQuery() + ); + client.innerApiCalls.updateSavedQuery = stubSimpleCall(expectedResponse); + const [response] = await client.updateSavedQuery(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSavedQuery without error using callback', 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.UpdateSavedQueryRequest() + ); + request.savedQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); + request.savedQuery.name = defaultValue1; + const expectedHeaderRequestParams = `saved_query.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.SavedQuery() + ); + client.innerApiCalls.updateSavedQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSavedQuery( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSavedQuery with error', 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.UpdateSavedQueryRequest() + ); + request.savedQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); + request.savedQuery.name = defaultValue1; + const expectedHeaderRequestParams = `saved_query.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSavedQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSavedQuery(request), expectedError); + const actualRequest = (client.innerApiCalls.updateSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSavedQuery 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.UpdateSavedQueryRequest() + ); + request.savedQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); + request.savedQuery.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSavedQuery(request), expectedError); + }); + }); + + describe('deleteSavedQuery', () => { + it('invokes deleteSavedQuery without error', 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.DeleteSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSavedQuery = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSavedQuery(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSavedQuery without error using callback', 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.DeleteSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSavedQuery = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSavedQuery( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSavedQuery with error', 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.DeleteSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSavedQuery = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSavedQuery(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteSavedQuery as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteSavedQuery as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSavedQuery 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.DeleteSavedQueryRequest() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSavedQuery(request), expectedError); + }); + }); + + describe('batchGetEffectiveIamPolicies', () => { + it('invokes batchGetEffectiveIamPolicies without error', 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.BatchGetEffectiveIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse() + ); + client.innerApiCalls.batchGetEffectiveIamPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.batchGetEffectiveIamPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetEffectiveIamPolicies without error using callback', 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.BatchGetEffectiveIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse() + ); + client.innerApiCalls.batchGetEffectiveIamPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchGetEffectiveIamPolicies( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetEffectiveIamPolicies with error', 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.BatchGetEffectiveIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchGetEffectiveIamPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.batchGetEffectiveIamPolicies(request), expectedError); + const actualRequest = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchGetEffectiveIamPolicies 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.BatchGetEffectiveIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchGetEffectiveIamPolicies(request), expectedError); + }); + }); + + describe('exportAssets', () => { + it('invokes exportAssets without error', 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.ExportAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ExportAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAssets = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAssets(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAssets without error using callback', 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.ExportAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ExportAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAssets = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportAssets( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAssets with call error', 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.ExportAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ExportAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAssets with LRO error', 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.ExportAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ExportAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportAssets(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportAssetsProgress without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExportAssetsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAssetsProgress with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkExportAssetsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('analyzeIamPolicyLongrunning', () => { + it('invokes analyzeIamPolicyLongrunning without error', 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.AnalyzeIamPolicyLongrunningRequest() + ); + request.analysisQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall(expectedResponse); + const [operation] = await client.analyzeIamPolicyLongrunning(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeIamPolicyLongrunning without error using callback', 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.AnalyzeIamPolicyLongrunningRequest() + ); + request.analysisQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeIamPolicyLongrunning( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeIamPolicyLongrunning with call error', 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.AnalyzeIamPolicyLongrunningRequest() + ); + request.analysisQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.analyzeIamPolicyLongrunning(request), expectedError); + const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeIamPolicyLongrunning with LRO error', 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.AnalyzeIamPolicyLongrunningRequest() + ); + request.analysisQuery ??= {}; + const defaultValue1 = + getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); + request.analysisQuery.scope = defaultValue1; + const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.analyzeIamPolicyLongrunning(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkAnalyzeIamPolicyLongrunningProgress without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAnalyzeIamPolicyLongrunningProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkAnalyzeIamPolicyLongrunningProgress with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.checkAnalyzeIamPolicyLongrunningProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets without error using callback', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IAsset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets with error', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssetsStream without error', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssetsStream with error', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets without error', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1.IAsset[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets with error', 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.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1.IAsset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('searchAllResources', () => { + it('invokes searchAllResources without error', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + ]; + client.innerApiCalls.searchAllResources = stubSimpleCall(expectedResponse); + const [response] = await client.searchAllResources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllResources without error using callback', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + ]; + client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAllResources( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IResourceSearchResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllResources with error', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllResources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAllResources(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllResourcesStream without error', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + ]; + client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAllResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); + assert( + (client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAllResourcesStream with error', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAllResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); + assert( + (client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllResources without error', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), + ]; + client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; + const iterable = client.searchAllResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllResources with error', 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.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAllResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('searchAllIamPolicies', () => { + it('invokes searchAllIamPolicies without error', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + ]; + client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.searchAllIamPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllIamPolicies without error using callback', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + ]; + client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAllIamPolicies( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.IIamPolicySearchResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllIamPolicies with error', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAllIamPolicies(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllIamPoliciesStream without error', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + ]; + client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAllIamPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); + assert( + (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAllIamPoliciesStream with error', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAllIamPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); + assert( + (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllIamPolicies without error', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), + ]; + client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; + const iterable = client.searchAllIamPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllIamPolicies with error', 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.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAllIamPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSavedQueries', () => { + it('invokes listSavedQueries without error', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + ]; + client.innerApiCalls.listSavedQueries = stubSimpleCall(expectedResponse); + const [response] = await client.listSavedQueries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSavedQueries as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSavedQueries as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSavedQueries without error using callback', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + ]; + client.innerApiCalls.listSavedQueries = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSavedQueries( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listSavedQueries as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSavedQueries as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSavedQueries with error', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSavedQueries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSavedQueries(request), expectedError); + const actualRequest = (client.innerApiCalls.listSavedQueries as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listSavedQueries as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSavedQueriesStream without error', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + ]; + client.descriptors.page.listSavedQueries.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSavedQueriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.SavedQuery[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.SavedQuery) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listSavedQueries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSavedQueries, request)); + assert( + (client.descriptors.page.listSavedQueries.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSavedQueriesStream with error', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSavedQueries.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSavedQueriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1.SavedQuery[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1.SavedQuery) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSavedQueries.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSavedQueries, request)); + assert( + (client.descriptors.page.listSavedQueries.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSavedQueries without error', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), + ]; + client.descriptors.page.listSavedQueries.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1.ISavedQuery[] = []; + const iterable = client.listSavedQueriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSavedQueries with error', 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.ListSavedQueriesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSavedQueries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSavedQueriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1.ISavedQuery[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('accessLevel', () => { + const fakePath = "/rendered/path/accessLevel"; + const expectedParameters = { + access_policy: "accessPolicyValue", + access_level: "accessLevelValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accessLevelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accessLevelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accessLevelPath', () => { + const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromAccessLevelName', () => { + const result = client.matchAccessPolicyFromAccessLevelName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAccessLevelFromAccessLevelName', () => { + const result = client.matchAccessLevelFromAccessLevelName(fakePath); + assert.strictEqual(result, "accessLevelValue"); + assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('accessPolicy', () => { + const fakePath = "/rendered/path/accessPolicy"; + const expectedParameters = { + access_policy: "accessPolicyValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accessPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accessPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accessPolicyPath', () => { + const result = client.accessPolicyPath("accessPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromAccessPolicyName', () => { + const result = client.matchAccessPolicyFromAccessPolicyName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderFeed', () => { + const fakePath = "/rendered/path/folderFeed"; + const expectedParameters = { + folder: "folderValue", + feed: "feedValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderFeedPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderFeedPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderFeedPath', () => { + const result = client.folderFeedPath("folderValue", "feedValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderFeedPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderFeedName', () => { + const result = client.matchFolderFromFolderFeedName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeedFromFolderFeedName', () => { + const result = client.matchFeedFromFolderFeedName(fakePath); + assert.strictEqual(result, "feedValue"); + assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('folderSavedQuery', () => { + const fakePath = "/rendered/path/folderSavedQuery"; + const expectedParameters = { + folder: "folderValue", + saved_query: "savedQueryValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderSavedQueryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderSavedQueryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderSavedQueryPath', () => { + const result = client.folderSavedQueryPath("folderValue", "savedQueryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderSavedQueryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderSavedQueryName', () => { + const result = client.matchFolderFromFolderSavedQueryName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderSavedQueryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSavedQueryFromFolderSavedQueryName', () => { + const result = client.matchSavedQueryFromFolderSavedQueryName(fakePath); + assert.strictEqual(result, "savedQueryValue"); + assert((client.pathTemplates.folderSavedQueryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('inventory', () => { + const fakePath = "/rendered/path/inventory"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + instance: "instanceValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.inventoryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.inventoryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('inventoryPath', () => { + const result = client.inventoryPath("projectValue", "locationValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.inventoryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInventoryName', () => { + const result = client.matchProjectFromInventoryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.inventoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromInventoryName', () => { + const result = client.matchLocationFromInventoryName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.inventoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInventoryName', () => { + const result = client.matchInstanceFromInventoryName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.inventoryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationFeed', () => { + const fakePath = "/rendered/path/organizationFeed"; + const expectedParameters = { + organization: "organizationValue", + feed: "feedValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationFeedPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationFeedPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationFeedPath', () => { + const result = client.organizationFeedPath("organizationValue", "feedValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationFeedPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationFeedName', () => { + const result = client.matchOrganizationFromOrganizationFeedName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeedFromOrganizationFeedName', () => { + const result = client.matchFeedFromOrganizationFeedName(fakePath); + assert.strictEqual(result, "feedValue"); + assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationSavedQuery', () => { + const fakePath = "/rendered/path/organizationSavedQuery"; + const expectedParameters = { + organization: "organizationValue", + saved_query: "savedQueryValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationSavedQueryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationSavedQueryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationSavedQueryPath', () => { + const result = client.organizationSavedQueryPath("organizationValue", "savedQueryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationSavedQueryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationSavedQueryName', () => { + const result = client.matchOrganizationFromOrganizationSavedQueryName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationSavedQueryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSavedQueryFromOrganizationSavedQueryName', () => { + const result = client.matchSavedQueryFromOrganizationSavedQueryName(fakePath); + assert.strictEqual(result, "savedQueryValue"); + assert((client.pathTemplates.organizationSavedQueryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectFeed', () => { + const fakePath = "/rendered/path/projectFeed"; + const expectedParameters = { + project: "projectValue", + feed: "feedValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectFeedPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectFeedPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectFeedPath', () => { + const result = client.projectFeedPath("projectValue", "feedValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectFeedPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectFeedName', () => { + const result = client.matchProjectFromProjectFeedName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeedFromProjectFeedName', () => { + const result = client.matchFeedFromProjectFeedName(fakePath); + assert.strictEqual(result, "feedValue"); + assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectSavedQuery', () => { + const fakePath = "/rendered/path/projectSavedQuery"; + const expectedParameters = { + project: "projectValue", + saved_query: "savedQueryValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectSavedQueryPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectSavedQueryPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectSavedQueryPath', () => { + const result = client.projectSavedQueryPath("projectValue", "savedQueryValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectSavedQueryPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectSavedQueryName', () => { + const result = client.matchProjectFromProjectSavedQueryName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectSavedQueryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSavedQueryFromProjectSavedQueryName', () => { + const result = client.matchSavedQueryFromProjectSavedQueryName(fakePath); + assert.strictEqual(result, "savedQueryValue"); + assert((client.pathTemplates.projectSavedQueryPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('servicePerimeter', () => { + const fakePath = "/rendered/path/servicePerimeter"; + const expectedParameters = { + access_policy: "accessPolicyValue", + service_perimeter: "servicePerimeterValue", + }; + const client = new assetserviceModule.v1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePerimeterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePerimeterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePerimeterPath', () => { + const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromServicePerimeterName', () => { + const result = client.matchAccessPolicyFromServicePerimeterName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServicePerimeterFromServicePerimeterName', () => { + const result = client.matchServicePerimeterFromServicePerimeterName(fakePath); + assert.strictEqual(result, "servicePerimeterValue"); + assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 00000000..9d42a74b --- /dev/null +++ b/owl-bot-staging/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'AssetService', + filename: './asset-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v1p1beta1/.eslintignore b/owl-bot-staging/v1p1beta1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1p1beta1/.eslintrc.json b/owl-bot-staging/v1p1beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1p1beta1/.gitignore b/owl-bot-staging/v1p1beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1p1beta1/.jsdoc.js b/owl-bot-staging/v1p1beta1/.jsdoc.js new file mode 100644 index 00000000..a40ee8ff --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/asset', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1p1beta1/.mocharc.js b/owl-bot-staging/v1p1beta1/.mocharc.js new file mode 100644 index 00000000..481c522b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1p1beta1/.prettierrc.js b/owl-bot-staging/v1p1beta1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1p1beta1/README.md b/owl-bot-staging/v1p1beta1/README.md new file mode 100644 index 00000000..b35f3a5e --- /dev/null +++ b/owl-bot-staging/v1p1beta1/README.md @@ -0,0 +1 @@ +Asset: Nodejs Client diff --git a/owl-bot-staging/v1p1beta1/linkinator.config.json b/owl-bot-staging/v1p1beta1/linkinator.config.json new file mode 100644 index 00000000..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1p1beta1/package.json b/owl-bot-staging/v1p1beta1/package.json new file mode 100644 index 00000000..4d04e08d --- /dev/null +++ b/owl-bot-staging/v1p1beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/asset", + "version": "0.1.0", + "description": "Asset client for Node.js", + "repository": "googleapis/nodejs-asset", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google asset", + "asset", + "asset service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto new file mode 100644 index 00000000..d5a0d8c4 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto @@ -0,0 +1,149 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.asset.v1p1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/asset/v1p1beta1/assets.proto"; + +option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetServiceProto"; +option java_package = "com.google.cloud.asset.v1p1beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p1beta1"; + +// Asset service definition. +service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // 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. + rpc SearchAllResources(SearchAllResourcesRequest) returns (SearchAllResourcesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{scope=*/*}/resources:searchAll" + }; + option (google.api.method_signature) = "scope,query,asset_types"; + } + + // 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. + rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) returns (SearchAllIamPoliciesResponse) { + option (google.api.http) = { + get: "/v1p1beta1/{scope=*/*}/iamPolicies:searchAll" + }; + option (google.api.method_signature) = "scope,query"; + } +} + +// Search all resources request. +message SearchAllResourcesRequest { + // Required. The relative name of an asset. The search is limited to the resources + // within the `scope`. The allowed value must be: + // * Organization number (such as "organizations/123") + // * Folder number(such as "folders/1234") + // * Project number (such as "projects/12345") + // * Project id (such as "projects/abc") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of asset types that this request searches for. If empty, it will + // search all the supported asset types. + repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; + + // 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. For + // example, " foo , bar desc ". + string order_by = 10 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all resources response. +message SearchAllResourcesResponse { + // A list of resource that match the search query. + repeated StandardResourceMetadata results = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token`. + string next_page_token = 2; +} + +// Search all IAM policies request. +message SearchAllIamPoliciesRequest { + // Required. The relative name of an asset. The search is limited to the resources + // within the `scope`. The allowed value must be: + // * Organization number (such as "organizations/123") + // * Folder number(such as "folders/1234") + // * Project number (such as "projects/12345") + // * Project id (such as "projects/abc") + string scope = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The query statement. + // Examples: + // * "policy:myuser@mydomain.com" + // * "policy:(myuser@mydomain.com viewer)" + string query = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Search all IAM policies response. +message SearchAllIamPoliciesResponse { + // A list of IamPolicy that match the search query. Related information such + // as the associated resource is returned along with the policy. + repeated IamPolicySearchResult results = 1; + + // Set if there are more results than those appearing in this response; to get + // the next set of results, call this method again, using this value as the + // `page_token`. + string next_page_token = 2; +} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto new file mode 100644 index 00000000..c0ac1403 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto @@ -0,0 +1,113 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.asset.v1p1beta1; + +import "google/iam/v1/policy.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetProto"; +option java_package = "com.google.cloud.asset.v1p1beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p1beta1"; + +// The standard metadata of a cloud resource. +message StandardResourceMetadata { + // The full resource name. For example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + string name = 1; + + // The type of this resource. + // For example: "compute.googleapis.com/Disk". + string asset_type = 2; + + // The project that this resource belongs to, in the form of + // `projects/{project_number}`. + string project = 3; + + // The display name of this resource. + string display_name = 4; + + // One or more paragraphs of text description of this resource. Maximum length + // could be up to 1M bytes. + string description = 5; + + // Additional searchable attributes of this resource. + // Informational only. The exact set of attributes is subject to change. + // For example: project id, DNS name etc. + repeated string additional_attributes = 10; + + // Location can be "global", regional like "us-east1", or zonal like + // "us-west1-b". + string location = 11; + + // Labels associated with this resource. See [Labelling and grouping GCP + // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) + // for more information. + map labels = 12; + + // Network tags associated with this resource. Like labels, network tags are a + // type of annotations used to group GCP resources. See [Labelling GCP + // resources](lhttps://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) + // for more information. + repeated string network_tags = 13; +} + +// The result for a IAM Policy search. +message IamPolicySearchResult { + // Explanation about the IAM policy search result. + message Explanation { + // The map from roles to their included permission matching the permission + // query (e.g. containing `policy.role.permissions:`). A sample role string: + // "roles/compute.instanceAdmin". The roles can also be found in the + // returned `policy` bindings. Note that the map is populated only if + // requesting with a permission query. + map matched_permissions = 1; + } + + // The [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // of the resource associated with this IAM policy. + string resource = 1; + + // The project that the associated GCP resource belongs to, in the form of + // `projects/{project_number}`. If an IAM policy is set on a resource (like VM + // instance, Cloud Storage bucket), the project field will indicate the + // project that contains the resource. If an IAM policy is set on a folder or + // orgnization, the project field will be empty. + string project = 3; + + // The IAM policy directly set on the given resource. Note that the original + // IAM policy can contain multiple bindings. This only contains the bindings + // that match the given query. For queries that don't contain a constrain on + // policies (e.g. an empty query), this contains all the bindings. + google.iam.v1.Policy policy = 4; + + // Explanation about the IAM policy search result. It contains additional + // information to explain why the search result matches the query. + Explanation explanation = 5; +} + +// IAM permissions +message Permissions { + // A list of permissions. A sample permission string: "compute.disk.get". + repeated string permissions = 1; +} diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js new file mode 100644 index 00000000..8c4de0d4 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js @@ -0,0 +1,89 @@ +// 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) { + // [START cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + */ + // const scope = 'abc123' + /** + * Optional. The query statement. + * Examples: + * * "policy:myuser@mydomain.com" + * * "policy:(myuser@mydomain.com viewer)" + */ + // 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. + */ + // 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. + */ + // const pageToken = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p1beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callSearchAllIamPolicies() { + // Construct request + const request = { + scope, + }; + + // Run request + const iterable = await assetClient.searchAllIamPoliciesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAllIamPolicies(); + // [END cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js new file mode 100644 index 00000000..201744f6 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js @@ -0,0 +1,98 @@ +// 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) { + // [START cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + */ + // const scope = 'abc123' + /** + * Optional. The query statement. + */ + // const query = 'abc123' + /** + * Optional. A list of asset types that this request searches for. If empty, it will + * search all the supported asset types. + */ + // 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. + */ + // 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. + */ + // 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. For + * example, " foo , bar desc ". + */ + // const orderBy = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p1beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callSearchAllResources() { + // Construct request + const request = { + scope, + }; + + // Run request + const iterable = await assetClient.searchAllResourcesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAllResources(); + // [END cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json new file mode 100644 index 00000000..ba390b3e --- /dev/null +++ b/owl-bot-staging/v1p1beta1/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": 90, + "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": 81, + "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/owl-bot-staging/v1p1beta1/src/index.ts b/owl-bot-staging/v1p1beta1/src/index.ts new file mode 100644 index 00000000..2f9d6008 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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. ** + +import * as v1p1beta1 from './v1p1beta1'; +const AssetServiceClient = v1p1beta1.AssetServiceClient; +type AssetServiceClient = v1p1beta1.AssetServiceClient; +export {v1p1beta1, AssetServiceClient}; +export default {v1p1beta1, AssetServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts new file mode 100644 index 00000000..3cffcbbe --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts @@ -0,0 +1,782 @@ +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1p1beta1/asset_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './asset_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Asset service definition. + * @class + * @memberof v1p1beta1 + */ +export class AssetServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + assetServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AssetServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AssetServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AssetServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + searchAllResources: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'), + searchAllIamPolicies: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.asset.v1p1beta1.AssetService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.assetServiceStub) { + return this.assetServiceStub; + } + + // Put together the "service stub" for + // google.cloud.asset.v1p1beta1.AssetService. + this.assetServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1p1beta1.AssetService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.asset.v1p1beta1.AssetService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const assetServiceStubMethods = + ['searchAllResources', 'searchAllIamPolicies']; + for (const methodName of assetServiceStubMethods) { + const callPromise = this.assetServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.assetServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudasset.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudasset.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + * @param {string} [request.query] + * Optional. The query statement. + * @param {string[]} [request.assetTypes] + * Optional. A list of asset types that this request searches for. If empty, it will + * search all the supported asset types. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.orderBy] + * 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. For + * example, " foo , bar desc ". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [StandardResourceMetadata]{@link google.cloud.asset.v1p1beta1.StandardResourceMetadata}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAllResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllResources( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[], + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest|null, + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse + ]>; + searchAllResources( + request: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>): void; + searchAllResources( + request: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>): void; + searchAllResources( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>): + Promise<[ + protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[], + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest|null, + protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchAllResources(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + * @param {string} [request.query] + * Optional. The query statement. + * @param {string[]} [request.assetTypes] + * Optional. A list of asset types that this request searches for. If empty, it will + * search all the supported asset types. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.orderBy] + * 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. For + * example, " foo , bar desc ". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [StandardResourceMetadata]{@link google.cloud.asset.v1p1beta1.StandardResourceMetadata} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAllResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllResourcesStream( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllResources.createStream( + this.innerApiCalls.searchAllResources as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAllResources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + * @param {string} [request.query] + * Optional. The query statement. + * @param {string[]} [request.assetTypes] + * Optional. A list of asset types that this request searches for. If empty, it will + * search all the supported asset types. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.orderBy] + * 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. For + * example, " foo , bar desc ". + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [StandardResourceMetadata]{@link google.cloud.asset.v1p1beta1.StandardResourceMetadata}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/asset_service.search_all_resources.js + * region_tag:cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async + */ + searchAllResourcesAsync( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllResources']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllResources.asyncIterate( + this.innerApiCalls['searchAllResources'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * 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. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + * @param {string} [request.query] + * Optional. The query statement. + * Examples: + * * "policy:myuser@mydomain.com" + * * "policy:(myuser@mydomain.com viewer)" + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [IamPolicySearchResult]{@link google.cloud.asset.v1p1beta1.IamPolicySearchResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAllIamPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllIamPolicies( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[], + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest|null, + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse + ]>; + searchAllIamPolicies( + request: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>): void; + searchAllIamPolicies( + request: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>): void; + searchAllIamPolicies( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, + protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>): + Promise<[ + protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[], + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest|null, + protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + this.initialize(); + return this.innerApiCalls.searchAllIamPolicies(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + * @param {string} [request.query] + * Optional. The query statement. + * Examples: + * * "policy:myuser@mydomain.com" + * * "policy:(myuser@mydomain.com viewer)" + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [IamPolicySearchResult]{@link google.cloud.asset.v1p1beta1.IamPolicySearchResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAllIamPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + searchAllIamPoliciesStream( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllIamPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllIamPolicies.createStream( + this.innerApiCalls.searchAllIamPolicies as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `searchAllIamPolicies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.scope + * Required. The relative name of an asset. The search is limited to the resources + * within the `scope`. The allowed value must be: + * * Organization number (such as "organizations/123") + * * Folder number(such as "folders/1234") + * * Project number (such as "projects/12345") + * * Project id (such as "projects/abc") + * @param {string} [request.query] + * Optional. The query statement. + * Examples: + * * "policy:myuser@mydomain.com" + * * "policy:(myuser@mydomain.com viewer)" + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [IamPolicySearchResult]{@link google.cloud.asset.v1p1beta1.IamPolicySearchResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js + * region_tag:cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async + */ + searchAllIamPoliciesAsync( + request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'scope': request.scope ?? '', + }); + const defaultCallSettings = this._defaults['searchAllIamPolicies']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAllIamPolicies.asyncIterate( + this.innerApiCalls['searchAllIamPolicies'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json new file mode 100644 index 00000000..fe7cd34b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json @@ -0,0 +1,36 @@ +{ + "interfaces": { + "google.cloud.asset.v1p1beta1.AssetService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "SearchAllResources": { + "timeout_millis": 15000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "SearchAllIamPolicies": { + "timeout_millis": 15000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json new file mode 100644 index 00000000..4eba2431 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/asset/v1p1beta1/asset_service.proto", + "../../protos/google/cloud/asset/v1p1beta1/assets.proto" +] diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json new file mode 100644 index 00000000..4376c498 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json @@ -0,0 +1,51 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.asset.v1p1beta1", + "libraryPackage": "@google-cloud/asset", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "SearchAllResources": { + "methods": [ + "searchAllResources", + "searchAllResourcesStream", + "searchAllResourcesAsync" + ] + }, + "SearchAllIamPolicies": { + "methods": [ + "searchAllIamPolicies", + "searchAllIamPoliciesStream", + "searchAllIamPoliciesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "SearchAllResources": { + "methods": [ + "searchAllResources", + "searchAllResourcesStream", + "searchAllResourcesAsync" + ] + }, + "SearchAllIamPolicies": { + "methods": [ + "searchAllIamPolicies", + "searchAllIamPoliciesStream", + "searchAllIamPoliciesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts new file mode 100644 index 00000000..9008232c --- /dev/null +++ b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts @@ -0,0 +1,19 @@ +// 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. ** + +export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..5fa01880 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const asset = require('@google-cloud/asset'); + +function main() { + const assetServiceClient = new asset.AssetServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..8fb3fb03 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. ** + +import {AssetServiceClient} from '@google-cloud/asset'; + +// check that the client class type name can be used +function doStuffWithAssetServiceClient(client: AssetServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const assetServiceClient = new AssetServiceClient(); + doStuffWithAssetServiceClient(assetServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/install.ts b/owl-bot-staging/v1p1beta1/system-test/install.ts new file mode 100644 index 00000000..557a5755 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts b/owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts new file mode 100644 index 00000000..e7fd3ca8 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts @@ -0,0 +1,687 @@ +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as assetserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1p1beta1.AssetServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = assetserviceModule.v1p1beta1.AssetServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = assetserviceModule.v1p1beta1.AssetServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = assetserviceModule.v1p1beta1.AssetServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + await client.initialize(); + assert(client.assetServiceStub); + }); + + 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.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 () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('searchAllResources', () => { + it('invokes searchAllResources without error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + ]; + client.innerApiCalls.searchAllResources = stubSimpleCall(expectedResponse); + const [response] = await client.searchAllResources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllResources without error using callback', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + ]; + client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAllResources( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllResources with error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllResources = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAllResources(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllResourcesStream without error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + ]; + client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAllResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); + assert( + (client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAllResourcesStream with error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAllResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); + assert( + (client.descriptors.page.searchAllResources.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllResources without error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), + ]; + client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = []; + const iterable = client.searchAllResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllResources with error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAllResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('searchAllIamPolicies', () => { + it('invokes searchAllIamPolicies without error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + ]; + client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(expectedResponse); + const [response] = await client.searchAllIamPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllIamPolicies without error using callback', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + ]; + client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAllIamPolicies( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllIamPolicies with error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.searchAllIamPolicies(request), expectedError); + const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAllIamPoliciesStream without error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + ]; + client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.searchAllIamPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); + assert( + (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAllIamPoliciesStream with error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.searchAllIamPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); + assert( + (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllIamPolicies without error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), + ]; + client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = []; + const iterable = client.searchAllIamPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAllIamPolicies with error', async () => { + const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); + request.scope = defaultValue1; + const expectedHeaderRequestParams = `scope=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAllIamPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); +}); diff --git a/owl-bot-staging/v1p1beta1/tsconfig.json b/owl-bot-staging/v1p1beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1p1beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1p1beta1/webpack.config.js b/owl-bot-staging/v1p1beta1/webpack.config.js new file mode 100644 index 00000000..9d42a74b --- /dev/null +++ b/owl-bot-staging/v1p1beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'AssetService', + filename: './asset-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v1p2beta1/.eslintignore b/owl-bot-staging/v1p2beta1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1p2beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1p2beta1/.eslintrc.json b/owl-bot-staging/v1p2beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1p2beta1/.gitignore b/owl-bot-staging/v1p2beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1p2beta1/.jsdoc.js b/owl-bot-staging/v1p2beta1/.jsdoc.js new file mode 100644 index 00000000..a40ee8ff --- /dev/null +++ b/owl-bot-staging/v1p2beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/asset', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1p2beta1/.mocharc.js b/owl-bot-staging/v1p2beta1/.mocharc.js new file mode 100644 index 00000000..481c522b --- /dev/null +++ b/owl-bot-staging/v1p2beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1p2beta1/.prettierrc.js b/owl-bot-staging/v1p2beta1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1p2beta1/README.md b/owl-bot-staging/v1p2beta1/README.md new file mode 100644 index 00000000..b35f3a5e --- /dev/null +++ b/owl-bot-staging/v1p2beta1/README.md @@ -0,0 +1 @@ +Asset: Nodejs Client diff --git a/owl-bot-staging/v1p2beta1/linkinator.config.json b/owl-bot-staging/v1p2beta1/linkinator.config.json new file mode 100644 index 00000000..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1p2beta1/package.json b/owl-bot-staging/v1p2beta1/package.json new file mode 100644 index 00000000..4d04e08d --- /dev/null +++ b/owl-bot-staging/v1p2beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/asset", + "version": "0.1.0", + "description": "Asset client for Node.js", + "repository": "googleapis/nodejs-asset", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google asset", + "asset", + "asset service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto b/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto new file mode 100644 index 00000000..92f285f8 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto @@ -0,0 +1,259 @@ +// Copyright 2019 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 +// +// 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. +// + +syntax = "proto3"; + +package google.cloud.asset.v1p2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/asset/v1p2beta1/assets.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Asset.V1p2Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetServiceProto"; +option java_package = "com.google.cloud.asset.v1p2beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p2beta1"; + +// Asset service definition. +service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a feed in a parent project/folder/organization to listen to its + // asset updates. + rpc CreateFeed(CreateFeedRequest) returns (Feed) { + option (google.api.http) = { + post: "/v1p2beta1/{parent=*/*}/feeds" + body: "*" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about an asset feed. + rpc GetFeed(GetFeedRequest) returns (Feed) { + option (google.api.http) = { + get: "/v1p2beta1/{name=*/*/feeds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all asset feeds in a parent project/folder/organization. + rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { + option (google.api.http) = { + get: "/v1p2beta1/{parent=*/*}/feeds" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates an asset feed configuration. + rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { + option (google.api.http) = { + patch: "/v1p2beta1/{feed.name=*/*/feeds/*}" + body: "*" + }; + option (google.api.method_signature) = "feed"; + } + + // Deletes an asset feed. + rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1p2beta1/{name=*/*/feeds/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Create asset feed request. +message CreateFeedRequest { + // Required. The name of the project/folder/organization where this feed + // 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"). + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. This is the client-assigned asset feed identifier and it needs to + // be unique under a specific parent project/folder/organization. + string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // 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 + Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Get asset feed request. +message GetFeedRequest { + // Required. The name of the Feed and it must be in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudasset.googleapis.com/Feed" + } + ]; +} + +// List asset feeds request. +message ListFeedsRequest { + // Required. The parent project/folder/organization whose feeds 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"). + string parent = 1 [(google.api.field_behavior) = REQUIRED]; +} + +message ListFeedsResponse { + // A list of feeds. + repeated Feed feeds = 1; +} + +// Update asset feed request. +message UpdateFeedRequest { + // 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. + Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Only updates the `feed` fields indicated by this mask. + // The field mask must not be empty, and it must not contain fields that + // are immutable or only set by the server. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message DeleteFeedRequest { + // Required. The name of the feed and it must be in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudasset.googleapis.com/Feed" + } + ]; +} + +// Output configuration for export assets destination. +message OutputConfig { + // Asset export destination. + oneof destination { + // Destination on Cloud Storage. + GcsDestination gcs_destination = 1; + } +} + +// A Cloud Storage location. +message GcsDestination { + // Required. + oneof object_uri { + // The uri of the Cloud Storage object. It's the same uri that is used by + // gsutil. For example: "gs://bucket_name/object_name". See [Viewing and + // Editing Object + // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) + // for more information. + string uri = 1; + } +} + +// A Cloud Pubsub destination. +message PubsubDestination { + // The name of the Cloud Pub/Sub topic to publish to. + // For example: `projects/PROJECT_ID/topics/TOPIC_ID`. + string topic = 1; +} + +// Output configuration for asset feed destination. +message FeedOutputConfig { + // Asset feed destination. + oneof destination { + // Destination on Cloud Pubsub. + PubsubDestination pubsub_destination = 1; + } +} + +// An asset feed used to export asset updates to a destinations. +// An asset feed filter controls what updates are exported. +// The asset feed must be created within a project, organization, or +// folder. Supported destinations are: +// Cloud Pub/Sub topics. +message Feed { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Feed" + pattern: "projects/{project}/feeds/{feed}" + pattern: "folders/{folder}/feeds/{feed}" + pattern: "organizations/{organization}/feeds/{feed}" + history: ORIGINALLY_SINGLE_PATTERN + }; + + // Required. The format will be + // projects/{project_number}/feeds/{client-assigned_feed_identifier} or + // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + // + // The client-assigned feed identifier must be unique within the parent + // project/folder/organization. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // A list of the full names of the assets to receive updates. You must specify + // either or both of asset_names and asset_types. Only asset updates matching + // specified asset_names and asset_types are exported to the feed. For + // example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more info. + repeated string asset_names = 2; + + // A list of types of the assets to receive updates. You must specify either + // or both of asset_names and asset_types. Only asset updates matching + // specified asset_names and asset_types are exported to the feed. + // For example: + // "compute.googleapis.com/Disk" See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + // for all supported asset types. + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name and + // type will be returned. + ContentType content_type = 4; + + // Required. Feed output configuration defining where the asset updates are + // published to. + FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED]; +} + +// Asset content type. +enum ContentType { + // Unspecified content type. + CONTENT_TYPE_UNSPECIFIED = 0; + + // Resource metadata. + RESOURCE = 1; + + // The actual IAM policy set on a resource. + IAM_POLICY = 2; +} diff --git a/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto b/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto new file mode 100644 index 00000000..bc2a9c51 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto @@ -0,0 +1,124 @@ +// Copyright 2019 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 +// +// 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. +// + +syntax = "proto3"; + +package google.cloud.asset.v1p2beta1; + +import "google/iam/v1/policy.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Asset.v1p2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetProto"; +option java_package = "com.google.cloud.asset.v1p2beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p2beta1"; + +// Temporal asset. In addition to the asset, the temporal asset includes the +// status of the asset and valid from and to time of it. +message TemporalAsset { + // The time window when the asset data and state was observed. + TimeWindow window = 1; + + // If the asset is deleted or not. + bool deleted = 2; + + // Asset. + Asset asset = 3; +} + +// A time window of (start_time, end_time]. +message TimeWindow { + // Start time of the time window (exclusive). + google.protobuf.Timestamp start_time = 1; + + // End time of the time window (inclusive). + // Current timestamp if not specified. + google.protobuf.Timestamp end_time = 2; +} + +// Cloud asset. This includes all Google Cloud Platform resources, +// Cloud IAM policies, and other non-GCP assets. +message Asset { + // The full name of the asset. For example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + string name = 1; + + // Type of the asset. Example: "compute.googleapis.com/Disk". + string asset_type = 2; + + // Representation of the resource. + Resource resource = 3; + + // Representation of the actual Cloud IAM policy set on a cloud resource. For + // each resource, there must be at most one Cloud IAM policy set on it. + google.iam.v1.Policy iam_policy = 4; + + // Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + // represented as a list of relative resource names. Ancestry path starts with + // the closest CRM ancestor and ends at root. If the asset is a CRM + // project/folder/organization, this starts from the asset itself. + // + // Example: ["projects/123456789", "folders/5432", "organizations/1234"] + repeated string ancestors = 6; +} + +// Representation of a cloud resource. +message Resource { + // The API version. Example: "v1". + string version = 1; + + // The URL of the discovery document containing the resource's JSON schema. + // For example: + // `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`. + // It will be left unspecified for resources without a discovery-based API, + // such as Cloud Bigtable. + string discovery_document_uri = 2; + + // The JSON schema name listed in the discovery document. + // Example: "Project". It will be left unspecified for resources (such as + // Cloud Bigtable) without a discovery-based API. + string discovery_name = 3; + + // The REST URL for accessing the resource. An HTTP GET operation using this + // URL returns the resource itself. + // Example: + // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`. + // It will be left unspecified for resources without a REST API. + string resource_url = 4; + + // The full name of the immediate parent of this resource. See + // [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + // + // For GCP assets, it is the parent resource defined in the [Cloud IAM policy + // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). + // For example: + // `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. + // + // For third-party assets, it is up to the users to define. + string parent = 5; + + // The content of the resource, in which some sensitive fields are scrubbed + // away and may not be present. + google.protobuf.Struct data = 6; +} diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js new file mode 100644 index 00000000..5a9b6fcc --- /dev/null +++ b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js @@ -0,0 +1,80 @@ +// 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, feedId, feed) { + // [START cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the project/folder/organization where this feed + * 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. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + */ + // 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 + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + */ + // const feed = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callCreateFeed() { + // Construct request + const request = { + parent, + feedId, + feed, + }; + + // Run request + const response = await assetClient.createFeed(request); + console.log(response); + } + + callCreateFeed(); + // [END cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js new file mode 100644 index 00000000..7f201ef9 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js @@ -0,0 +1,64 @@ +// 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_v1p2beta1_generated_AssetService_DeleteFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + */ + // const name = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callDeleteFeed() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await assetClient.deleteFeed(request); + console.log(response); + } + + callDeleteFeed(); + // [END cloudasset_v1p2beta1_generated_AssetService_DeleteFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js new file mode 100644 index 00000000..69fab689 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js @@ -0,0 +1,64 @@ +// 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_v1p2beta1_generated_AssetService_GetFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + */ + // const name = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callGetFeed() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await assetClient.getFeed(request); + console.log(response); + } + + callGetFeed(); + // [END cloudasset_v1p2beta1_generated_AssetService_GetFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js new file mode 100644 index 00000000..04eaca34 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js @@ -0,0 +1,63 @@ +// 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_v1p2beta1_generated_AssetService_ListFeeds_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent project/folder/organization whose feeds 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' + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callListFeeds() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await assetClient.listFeeds(request); + console.log(response); + } + + callListFeeds(); + // [END cloudasset_v1p2beta1_generated_AssetService_ListFeeds_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js new file mode 100644 index 00000000..f49d4ab1 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js @@ -0,0 +1,72 @@ +// 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(feed, updateMask) { + // [START cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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: + * projects/project_number/feeds/feed_id or + * folders/folder_number/feeds/feed_id or + * organizations/organization_number/feeds/feed_id. + */ + // const feed = {} + /** + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + */ + // const updateMask = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callUpdateFeed() { + // Construct request + const request = { + feed, + updateMask, + }; + + // Run request + const response = await assetClient.updateFeed(request); + console.log(response); + } + + callUpdateFeed(); + // [END cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json new file mode 100644 index 00000000..90c36e9d --- /dev/null +++ b/owl-bot-staging/v1p2beta1/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": 72, + "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": 56, + "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": 55, + "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": 64, + "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": 56, + "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/owl-bot-staging/v1p2beta1/src/index.ts b/owl-bot-staging/v1p2beta1/src/index.ts new file mode 100644 index 00000000..faba3a31 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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. ** + +import * as v1p2beta1 from './v1p2beta1'; +const AssetServiceClient = v1p2beta1.AssetServiceClient; +type AssetServiceClient = v1p2beta1.AssetServiceClient; +export {v1p2beta1, AssetServiceClient}; +export default {v1p2beta1, AssetServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts new file mode 100644 index 00000000..4799c59a --- /dev/null +++ b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts @@ -0,0 +1,816 @@ +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1p2beta1/asset_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './asset_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Asset service definition. + * @class + * @memberof v1p2beta1 + */ +export class AssetServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + assetServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AssetServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AssetServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AssetServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + folderFeedPathTemplate: new this._gaxModule.PathTemplate( + 'folders/{folder}/feeds/{feed}' + ), + organizationFeedPathTemplate: new this._gaxModule.PathTemplate( + 'organizations/{organization}/feeds/{feed}' + ), + projectFeedPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/feeds/{feed}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.asset.v1p2beta1.AssetService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.assetServiceStub) { + return this.assetServiceStub; + } + + // Put together the "service stub" for + // google.cloud.asset.v1p2beta1.AssetService. + this.assetServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1p2beta1.AssetService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.asset.v1p2beta1.AssetService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const assetServiceStubMethods = + ['createFeed', 'getFeed', 'listFeeds', 'updateFeed', 'deleteFeed']; + for (const methodName of assetServiceStubMethods) { + const callPromise = this.assetServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.assetServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudasset.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudasset.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a feed in a parent project/folder/organization to listen to its + * asset updates. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project/folder/organization where this feed + * 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"). + * @param {string} request.feedId + * Required. This is the client-assigned asset feed identifier and it needs to + * be unique under a specific parent project/folder/organization. + * @param {google.cloud.asset.v1p2beta1.Feed} request.feed + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1p2beta1.Feed}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p2beta1/asset_service.create_feed.js + * region_tag:cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async + */ + createFeed( + request?: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|undefined, {}|undefined + ]>; + createFeed( + request: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, + {}|null|undefined>): void; + createFeed( + request: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, + {}|null|undefined>): void; + createFeed( + request?: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createFeed(request, options, callback); + } +/** + * Gets details about an asset feed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1p2beta1.Feed}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p2beta1/asset_service.get_feed.js + * region_tag:cloudasset_v1p2beta1_generated_AssetService_GetFeed_async + */ + getFeed( + request?: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|undefined, {}|undefined + ]>; + getFeed( + request: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, + {}|null|undefined>): void; + getFeed( + request: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, + {}|null|undefined>): void; + getFeed( + request?: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getFeed(request, options, callback); + } +/** + * Lists all asset feeds in a parent project/folder/organization. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent project/folder/organization whose feeds 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"). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListFeedsResponse]{@link google.cloud.asset.v1p2beta1.ListFeedsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p2beta1/asset_service.list_feeds.js + * region_tag:cloudasset_v1p2beta1_generated_AssetService_ListFeeds_async + */ + listFeeds( + request?: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, + protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|undefined, {}|undefined + ]>; + listFeeds( + request: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, + protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, + {}|null|undefined>): void; + listFeeds( + request: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, + protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, + {}|null|undefined>): void; + listFeeds( + request?: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, + protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, + protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, + protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listFeeds(request, options, callback); + } +/** + * Updates an asset feed configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.asset.v1p2beta1.Feed} request.feed + * 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. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Only updates the `feed` fields indicated by this mask. + * The field mask must not be empty, and it must not contain fields that + * are immutable or only set by the server. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1p2beta1.Feed}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p2beta1/asset_service.update_feed.js + * region_tag:cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async + */ + updateFeed( + request?: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|undefined, {}|undefined + ]>; + updateFeed( + request: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>): void; + updateFeed( + request: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, + callback: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>): void; + updateFeed( + request?: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.asset.v1p2beta1.IFeed, + protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'feed.name': request.feed!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFeed(request, options, callback); + } +/** + * Deletes an asset feed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the feed and it must be in the format of: + * projects/project_number/feeds/feed_id + * folders/folder_number/feeds/feed_id + * organizations/organization_number/feeds/feed_id + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1p2beta1/asset_service.delete_feed.js + * region_tag:cloudasset_v1p2beta1_generated_AssetService_DeleteFeed_async + */ + deleteFeed( + request?: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|undefined, {}|undefined + ]>; + deleteFeed( + request: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>): void; + deleteFeed( + request: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>): void; + deleteFeed( + request?: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteFeed(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified folderFeed resource name string. + * + * @param {string} folder + * @param {string} feed + * @returns {string} Resource name string. + */ + folderFeedPath(folder:string,feed:string) { + return this.pathTemplates.folderFeedPathTemplate.render({ + folder: folder, + feed: feed, + }); + } + + /** + * Parse the folder from FolderFeed resource. + * + * @param {string} folderFeedName + * A fully-qualified path representing folder_feed resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderFeedName(folderFeedName: string) { + return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).folder; + } + + /** + * Parse the feed from FolderFeed resource. + * + * @param {string} folderFeedName + * A fully-qualified path representing folder_feed resource. + * @returns {string} A string representing the feed. + */ + matchFeedFromFolderFeedName(folderFeedName: string) { + return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).feed; + } + + /** + * Return a fully-qualified organizationFeed resource name string. + * + * @param {string} organization + * @param {string} feed + * @returns {string} Resource name string. + */ + organizationFeedPath(organization:string,feed:string) { + return this.pathTemplates.organizationFeedPathTemplate.render({ + organization: organization, + feed: feed, + }); + } + + /** + * Parse the organization from OrganizationFeed resource. + * + * @param {string} organizationFeedName + * A fully-qualified path representing organization_feed resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationFeedName(organizationFeedName: string) { + return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).organization; + } + + /** + * Parse the feed from OrganizationFeed resource. + * + * @param {string} organizationFeedName + * A fully-qualified path representing organization_feed resource. + * @returns {string} A string representing the feed. + */ + matchFeedFromOrganizationFeedName(organizationFeedName: string) { + return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).feed; + } + + /** + * Return a fully-qualified projectFeed resource name string. + * + * @param {string} project + * @param {string} feed + * @returns {string} Resource name string. + */ + projectFeedPath(project:string,feed:string) { + return this.pathTemplates.projectFeedPathTemplate.render({ + project: project, + feed: feed, + }); + } + + /** + * Parse the project from ProjectFeed resource. + * + * @param {string} projectFeedName + * A fully-qualified path representing project_feed resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectFeedName(projectFeedName: string) { + return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).project; + } + + /** + * Parse the feed from ProjectFeed resource. + * + * @param {string} projectFeedName + * A fully-qualified path representing project_feed resource. + * @returns {string} A string representing the feed. + */ + matchFeedFromProjectFeedName(projectFeedName: string) { + return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).feed; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json new file mode 100644 index 00000000..aa7547b8 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.asset.v1p2beta1.AssetService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateFeed": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetFeed": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFeeds": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateFeed": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteFeed": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json new file mode 100644 index 00000000..060b4598 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/asset/v1p2beta1/asset_service.proto", + "../../protos/google/cloud/asset/v1p2beta1/assets.proto" +] diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json b/owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json new file mode 100644 index 00000000..5e7034b0 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json @@ -0,0 +1,73 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.asset.v1p2beta1", + "libraryPackage": "@google-cloud/asset", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "CreateFeed": { + "methods": [ + "createFeed" + ] + }, + "GetFeed": { + "methods": [ + "getFeed" + ] + }, + "ListFeeds": { + "methods": [ + "listFeeds" + ] + }, + "UpdateFeed": { + "methods": [ + "updateFeed" + ] + }, + "DeleteFeed": { + "methods": [ + "deleteFeed" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "CreateFeed": { + "methods": [ + "createFeed" + ] + }, + "GetFeed": { + "methods": [ + "getFeed" + ] + }, + "ListFeeds": { + "methods": [ + "listFeeds" + ] + }, + "UpdateFeed": { + "methods": [ + "updateFeed" + ] + }, + "DeleteFeed": { + "methods": [ + "deleteFeed" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts b/owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts new file mode 100644 index 00000000..9008232c --- /dev/null +++ b/owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts @@ -0,0 +1,19 @@ +// 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. ** + +export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..5fa01880 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const asset = require('@google-cloud/asset'); + +function main() { + const assetServiceClient = new asset.AssetServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..8fb3fb03 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. ** + +import {AssetServiceClient} from '@google-cloud/asset'; + +// check that the client class type name can be used +function doStuffWithAssetServiceClient(client: AssetServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const assetServiceClient = new AssetServiceClient(); + doStuffWithAssetServiceClient(assetServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1p2beta1/system-test/install.ts b/owl-bot-staging/v1p2beta1/system-test/install.ts new file mode 100644 index 00000000..557a5755 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts b/owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts new file mode 100644 index 00000000..00426d83 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts @@ -0,0 +1,811 @@ +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as assetserviceModule from '../src'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +describe('v1p2beta1.AssetServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = assetserviceModule.v1p2beta1.AssetServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = assetserviceModule.v1p2beta1.AssetServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = assetserviceModule.v1p2beta1.AssetServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + await client.initialize(); + assert(client.assetServiceStub); + }); + + 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.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 () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createFeed', () => { + it('invokes createFeed without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.Feed() + ); + client.innerApiCalls.createFeed = stubSimpleCall(expectedResponse); + const [response] = await client.createFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeed without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.Feed() + ); + client.innerApiCalls.createFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createFeed( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IFeed|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createFeed with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('CreateFeedRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createFeed(request), expectedError); + }); + }); + + describe('getFeed', () => { + it('invokes getFeed without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.Feed() + ); + client.innerApiCalls.getFeed = stubSimpleCall(expectedResponse); + const [response] = await client.getFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeed without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.Feed() + ); + client.innerApiCalls.getFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFeed( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IFeed|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFeed with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('GetFeedRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFeed(request), expectedError); + }); + }); + + describe('listFeeds', () => { + it('invokes listFeeds without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.ListFeedsResponse() + ); + client.innerApiCalls.listFeeds = stubSimpleCall(expectedResponse); + const [response] = await client.listFeeds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeeds without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.ListFeedsResponse() + ); + client.innerApiCalls.listFeeds = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFeeds( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IListFeedsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFeeds with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFeeds = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFeeds(request), expectedError); + const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('ListFeedsRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFeeds(request), expectedError); + }); + }); + + describe('updateFeed', () => { + it('invokes updateFeed without error', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.Feed() + ); + client.innerApiCalls.updateFeed = stubSimpleCall(expectedResponse); + const [response] = await client.updateFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeed without error using callback', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.asset.v1p2beta1.Feed() + ); + client.innerApiCalls.updateFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFeed( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IFeed|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFeed with error', 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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 ??= {}; + const defaultValue1 = + getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); + request.feed.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFeed(request), expectedError); + }); + }); + + describe('deleteFeed', () => { + it('invokes deleteFeed without error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteFeed = stubSimpleCall(expectedResponse); + const [response] = await client.deleteFeed(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeed without error using callback', 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteFeed( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteFeed with error', 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteFeed = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteFeed(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + 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() + ); + const defaultValue1 = + getTypeDefaultValue('DeleteFeedRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteFeed(request), expectedError); + }); + }); + + describe('Path templates', () => { + + describe('folderFeed', () => { + const fakePath = "/rendered/path/folderFeed"; + const expectedParameters = { + folder: "folderValue", + feed: "feedValue", + }; + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.folderFeedPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.folderFeedPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('folderFeedPath', () => { + const result = client.folderFeedPath("folderValue", "feedValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.folderFeedPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchFolderFromFolderFeedName', () => { + const result = client.matchFolderFromFolderFeedName(fakePath); + assert.strictEqual(result, "folderValue"); + assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeedFromFolderFeedName', () => { + const result = client.matchFeedFromFolderFeedName(fakePath); + assert.strictEqual(result, "feedValue"); + assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('organizationFeed', () => { + const fakePath = "/rendered/path/organizationFeed"; + const expectedParameters = { + organization: "organizationValue", + feed: "feedValue", + }; + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.organizationFeedPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.organizationFeedPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('organizationFeedPath', () => { + const result = client.organizationFeedPath("organizationValue", "feedValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.organizationFeedPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchOrganizationFromOrganizationFeedName', () => { + const result = client.matchOrganizationFromOrganizationFeedName(fakePath); + assert.strictEqual(result, "organizationValue"); + assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeedFromOrganizationFeedName', () => { + const result = client.matchFeedFromOrganizationFeedName(fakePath); + assert.strictEqual(result, "feedValue"); + assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectFeed', () => { + const fakePath = "/rendered/path/projectFeed"; + const expectedParameters = { + project: "projectValue", + feed: "feedValue", + }; + const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectFeedPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectFeedPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectFeedPath', () => { + const result = client.projectFeedPath("projectValue", "feedValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectFeedPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectFeedName', () => { + const result = client.matchProjectFromProjectFeedName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFeedFromProjectFeedName', () => { + const result = client.matchFeedFromProjectFeedName(fakePath); + assert.strictEqual(result, "feedValue"); + assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1p2beta1/tsconfig.json b/owl-bot-staging/v1p2beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1p2beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1p2beta1/webpack.config.js b/owl-bot-staging/v1p2beta1/webpack.config.js new file mode 100644 index 00000000..9d42a74b --- /dev/null +++ b/owl-bot-staging/v1p2beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'AssetService', + filename: './asset-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/v1p5beta1/.eslintignore b/owl-bot-staging/v1p5beta1/.eslintignore new file mode 100644 index 00000000..cfc348ec --- /dev/null +++ b/owl-bot-staging/v1p5beta1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1p5beta1/.eslintrc.json b/owl-bot-staging/v1p5beta1/.eslintrc.json new file mode 100644 index 00000000..78215349 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1p5beta1/.gitignore b/owl-bot-staging/v1p5beta1/.gitignore new file mode 100644 index 00000000..5d32b237 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/v1p5beta1/.jsdoc.js b/owl-bot-staging/v1p5beta1/.jsdoc.js new file mode 100644 index 00000000..6f00d201 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: 'asset', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1p5beta1/.mocharc.js b/owl-bot-staging/v1p5beta1/.mocharc.js new file mode 100644 index 00000000..481c522b --- /dev/null +++ b/owl-bot-staging/v1p5beta1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1p5beta1/.prettierrc.js b/owl-bot-staging/v1p5beta1/.prettierrc.js new file mode 100644 index 00000000..494e1478 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1p5beta1/README.md b/owl-bot-staging/v1p5beta1/README.md new file mode 100644 index 00000000..b35f3a5e --- /dev/null +++ b/owl-bot-staging/v1p5beta1/README.md @@ -0,0 +1 @@ +Asset: Nodejs Client diff --git a/owl-bot-staging/v1p5beta1/linkinator.config.json b/owl-bot-staging/v1p5beta1/linkinator.config.json new file mode 100644 index 00000000..befd23c8 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/v1p5beta1/package.json b/owl-bot-staging/v1p5beta1/package.json new file mode 100644 index 00000000..a96ec6da --- /dev/null +++ b/owl-bot-staging/v1p5beta1/package.json @@ -0,0 +1,64 @@ +{ + "name": "asset", + "version": "0.1.0", + "description": "Asset client for Node.js", + "repository": "googleapis/nodejs-asset", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google asset", + "asset", + "asset service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.1", + "@types/node": "^16.11.59", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^3.6.11", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.0.3", + "mocha": "^10.0.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^8.4.0", + "typescript": "^4.8.3", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto b/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto new file mode 100644 index 00000000..52233ad0 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto @@ -0,0 +1,112 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.asset.v1p5beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/asset/v1p5beta1/assets.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Asset.V1P5Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetServiceProto"; +option java_package = "com.google.cloud.asset.v1p5beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p5beta1"; + +// Asset service definition. +service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Lists assets with time and resource types and returns paged results in + // response. + rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { + option (google.api.http) = { + get: "/v1p5beta1/{parent=*/*}/assets" + }; + } +} + +// ListAssets request. +message ListAssetsRequest { + // Required. Name of the organization or project the assets belong to. Format: + // "organizations/[organization-number]" (such as "organizations/123"), + // "projects/[project-number]" (such as "projects/my-project-id"), or + // "projects/[project-id]" (such as "projects/12345"). + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp to take an asset snapshot. This can only be set to a timestamp + // between 2018-10-02 UTC (inclusive) and the current time. If not specified, + // the current time will be used. Due to delays in resource data collection + // and indexing, there is a volatile window during which running the same + // query may get different results. + google.protobuf.Timestamp read_time = 2; + + // A list of asset types of which to take a snapshot for. For example: + // "compute.googleapis.com/Disk". If specified, only matching assets will be + // returned. See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + // for all supported asset types. + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name will + // be returned. + ContentType content_type = 4; + + // The maximum number of assets to be returned in a single response. Default + // is 100, minimum is 1, and maximum is 1000. + int32 page_size = 5; + + // The `next_page_token` returned from the previous `ListAssetsResponse`, or + // unspecified for the first `ListAssetsRequest`. It is a continuation of a + // prior `ListAssets` call, and the API should return the next page of assets. + string page_token = 6; +} + +// Asset content type. +enum ContentType { + // Unspecified content type. + CONTENT_TYPE_UNSPECIFIED = 0; + + // Resource metadata. + RESOURCE = 1; + + // The actual IAM policy set on a resource. + IAM_POLICY = 2; + + // The Cloud Organization Policy set on an asset. + ORG_POLICY = 4; + + // The Cloud Access context mananger Policy set on an asset. + ACCESS_POLICY = 5; +} + +// ListAssets response. +message ListAssetsResponse { + // Time the snapshot was taken. + google.protobuf.Timestamp read_time = 1; + + // Assets. + repeated Asset assets = 2; + + // Token to retrieve the next page of results. Set to empty if there are no + // remaining results. + string next_page_token = 3; +} diff --git a/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto b/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto new file mode 100644 index 00000000..7ad133a5 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto @@ -0,0 +1,124 @@ +// Copyright 2020 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 +// +// 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. + +syntax = "proto3"; + +package google.cloud.asset.v1p5beta1; + +import "google/api/resource.proto"; +import "google/cloud/orgpolicy/v1/orgpolicy.proto"; +import "google/iam/v1/policy.proto"; +import "google/identity/accesscontextmanager/v1/access_level.proto"; +import "google/identity/accesscontextmanager/v1/access_policy.proto"; +import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Asset.V1p5Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetProto"; +option java_package = "com.google.cloud.asset.v1p5beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p5beta1"; + +// Cloud asset. This includes all Google Cloud Platform resources, +// Cloud IAM policies, and other non-GCP assets. +message Asset { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Asset" + pattern: "*" + }; + + // The full name of the asset. For example: + // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. + // See [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + string name = 1; + + // Type of the asset. Example: "compute.googleapis.com/Disk". + string asset_type = 2; + + // Representation of the resource. + Resource resource = 3; + + // Representation of the actual Cloud IAM policy set on a cloud resource. For + // each resource, there must be at most one Cloud IAM policy set on it. + google.iam.v1.Policy iam_policy = 4; + + // Representation of the Cloud Organization Policy set on an asset. For each + // asset, there could be multiple Organization policies with different + // constraints. + repeated google.cloud.orgpolicy.v1.Policy org_policy = 6; + + // Representation of the Cloud Organization access policy. + oneof access_context_policy { + google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7; + + google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; + + google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = + 9; + } + + // Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + // represented as a list of relative resource names. Ancestry path starts with + // the closest CRM ancestor and ends at root. If the asset is a CRM + // project/folder/organization, this starts from the asset itself. + // + // Example: ["projects/123456789", "folders/5432", "organizations/1234"] + repeated string ancestors = 10; +} + +// Representation of a cloud resource. +message Resource { + // The API version. Example: "v1". + string version = 1; + + // The URL of the discovery document containing the resource's JSON schema. + // For example: + // `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`. + // It will be left unspecified for resources without a discovery-based API, + // such as Cloud Bigtable. + string discovery_document_uri = 2; + + // The JSON schema name listed in the discovery document. + // Example: "Project". It will be left unspecified for resources (such as + // Cloud Bigtable) without a discovery-based API. + string discovery_name = 3; + + // The REST URL for accessing the resource. An HTTP GET operation using this + // URL returns the resource itself. + // Example: + // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`. + // It will be left unspecified for resources without a REST API. + string resource_url = 4; + + // The full name of the immediate parent of this resource. See + // [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + // + // For GCP assets, it is the parent resource defined in the [Cloud IAM policy + // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). + // For example: + // `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. + // + // For third-party assets, it is up to the users to define. + string parent = 5; + + // The content of the resource, in which some sensitive fields are scrubbed + // away and may not be present. + google.protobuf.Struct data = 6; +} diff --git a/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js b/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js new file mode 100644 index 00000000..0306d7ce --- /dev/null +++ b/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js @@ -0,0 +1,98 @@ +// 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_v1p5beta1_generated_AssetService_ListAssets_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * 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-number]" (such as "projects/my-project-id"), or + * "projects/[project-id]" (such as "projects/12345"). + */ + // const parent = 'abc123' + /** + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between 2018-10-02 UTC (inclusive) and the current time. If not specified, + * the current time will be used. Due to delays in resource data collection + * and indexing, there is a volatile window during which running the same + * query may get different results. + */ + // const readTime = {} + /** + * A list of asset types of which to take a snapshot for. For example: + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See Introduction to Cloud Asset + * Inventory (https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + */ + // const assetTypes = 'abc123' + /** + * Asset content type. If not specified, no content but the asset name will + * be returned. + */ + // const contentType = {} + /** + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + */ + // const pageSize = 1234 + /** + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + */ + // const pageToken = 'abc123' + + // Imports the Asset library + const {AssetServiceClient} = require('asset').v1p5beta1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callListAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await assetClient.listAssetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAssets(); + // [END cloudasset_v1p5beta1_generated_AssetService_ListAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json b/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json new file mode 100644 index 00000000..e5212114 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/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": 90, + "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/owl-bot-staging/v1p5beta1/src/index.ts b/owl-bot-staging/v1p5beta1/src/index.ts new file mode 100644 index 00000000..38a700fb --- /dev/null +++ b/owl-bot-staging/v1p5beta1/src/index.ts @@ -0,0 +1,25 @@ +// 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. ** + +import * as v1p5beta1 from './v1p5beta1'; +const AssetServiceClient = v1p5beta1.AssetServiceClient; +type AssetServiceClient = v1p5beta1.AssetServiceClient; +export {v1p5beta1, AssetServiceClient}; +export default {v1p5beta1, AssetServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts new file mode 100644 index 00000000..7b856703 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts @@ -0,0 +1,664 @@ +// 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1p5beta1/asset_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './asset_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Asset service definition. + * @class + * @memberof v1p5beta1 + */ +export class AssetServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + assetServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AssetServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new AssetServiceClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof AssetServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + accessLevelPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}/accessLevels/{access_level}' + ), + accessPolicyPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}' + ), + servicePerimeterPathTemplate: new this._gaxModule.PathTemplate( + 'accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listAssets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.asset.v1p5beta1.AssetService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.assetServiceStub) { + return this.assetServiceStub; + } + + // Put together the "service stub" for + // google.cloud.asset.v1p5beta1.AssetService. + this.assetServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1p5beta1.AssetService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.asset.v1p5beta1.AssetService, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const assetServiceStubMethods = + ['listAssets']; + for (const methodName of assetServiceStubMethods) { + const callPromise = this.assetServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.assetServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloudasset.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloudasset.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Lists assets with time and resource types and returns paged results in + * response. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization or project the assets belong to. Format: + * "organizations/[organization-number]" (such as "organizations/123"), + * "projects/[project-number]" (such as "projects/my-project-id"), or + * "projects/[project-id]" (such as "projects/12345"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between 2018-10-02 UTC (inclusive) and the current time. If not specified, + * the current time will be used. Due to delays in resource data collection + * and indexing, there is a volatile window during which running the same + * query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types of which to take a snapshot for. For example: + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1p5beta1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will + * be returned. + * @param {number} request.pageSize + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + * @param {string} request.pageToken + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Asset]{@link google.cloud.asset.v1p5beta1.Asset}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssets( + request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.asset.v1p5beta1.IAsset[], + protos.google.cloud.asset.v1p5beta1.IListAssetsRequest|null, + protos.google.cloud.asset.v1p5beta1.IListAssetsResponse + ]>; + listAssets( + request: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1p5beta1.IAsset>): void; + listAssets( + request: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1p5beta1.IAsset>): void; + listAssets( + request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1p5beta1.IAsset>, + callback?: PaginationCallback< + protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, + protos.google.cloud.asset.v1p5beta1.IAsset>): + Promise<[ + protos.google.cloud.asset.v1p5beta1.IAsset[], + protos.google.cloud.asset.v1p5beta1.IListAssetsRequest|null, + protos.google.cloud.asset.v1p5beta1.IListAssetsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listAssets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization or project the assets belong to. Format: + * "organizations/[organization-number]" (such as "organizations/123"), + * "projects/[project-number]" (such as "projects/my-project-id"), or + * "projects/[project-id]" (such as "projects/12345"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between 2018-10-02 UTC (inclusive) and the current time. If not specified, + * the current time will be used. Due to delays in resource data collection + * and indexing, there is a volatile window during which running the same + * query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types of which to take a snapshot for. For example: + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1p5beta1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will + * be returned. + * @param {number} request.pageSize + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + * @param {string} request.pageToken + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Asset]{@link google.cloud.asset.v1p5beta1.Asset} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listAssetsStream( + request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.createStream( + this.innerApiCalls.listAssets as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the organization or project the assets belong to. Format: + * "organizations/[organization-number]" (such as "organizations/123"), + * "projects/[project-number]" (such as "projects/my-project-id"), or + * "projects/[project-id]" (such as "projects/12345"). + * @param {google.protobuf.Timestamp} request.readTime + * Timestamp to take an asset snapshot. This can only be set to a timestamp + * between 2018-10-02 UTC (inclusive) and the current time. If not specified, + * the current time will be used. Due to delays in resource data collection + * and indexing, there is a volatile window during which running the same + * query may get different results. + * @param {string[]} request.assetTypes + * A list of asset types of which to take a snapshot for. For example: + * "compute.googleapis.com/Disk". If specified, only matching assets will be + * returned. See [Introduction to Cloud Asset + * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + * for all supported asset types. + * @param {google.cloud.asset.v1p5beta1.ContentType} request.contentType + * Asset content type. If not specified, no content but the asset name will + * be returned. + * @param {number} request.pageSize + * The maximum number of assets to be returned in a single response. Default + * is 100, minimum is 1, and maximum is 1000. + * @param {string} request.pageToken + * The `next_page_token` returned from the previous `ListAssetsResponse`, or + * unspecified for the first `ListAssetsRequest`. It is a continuation of a + * prior `ListAssets` call, and the API should return the next page of assets. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Asset]{@link google.cloud.asset.v1p5beta1.Asset}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1p5beta1/asset_service.list_assets.js + * region_tag:cloudasset_v1p5beta1_generated_AssetService_ListAssets_async + */ + listAssetsAsync( + request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listAssets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAssets.asyncIterate( + this.innerApiCalls['listAssets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified accessLevel resource name string. + * + * @param {string} access_policy + * @param {string} access_level + * @returns {string} Resource name string. + */ + accessLevelPath(accessPolicy:string,accessLevel:string) { + return this.pathTemplates.accessLevelPathTemplate.render({ + access_policy: accessPolicy, + access_level: accessLevel, + }); + } + + /** + * Parse the access_policy from AccessLevel resource. + * + * @param {string} accessLevelName + * A fully-qualified path representing AccessLevel resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromAccessLevelName(accessLevelName: string) { + return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_policy; + } + + /** + * Parse the access_level from AccessLevel resource. + * + * @param {string} accessLevelName + * A fully-qualified path representing AccessLevel resource. + * @returns {string} A string representing the access_level. + */ + matchAccessLevelFromAccessLevelName(accessLevelName: string) { + return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_level; + } + + /** + * Return a fully-qualified accessPolicy resource name string. + * + * @param {string} access_policy + * @returns {string} Resource name string. + */ + accessPolicyPath(accessPolicy:string) { + return this.pathTemplates.accessPolicyPathTemplate.render({ + access_policy: accessPolicy, + }); + } + + /** + * Parse the access_policy from AccessPolicy resource. + * + * @param {string} accessPolicyName + * A fully-qualified path representing AccessPolicy resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromAccessPolicyName(accessPolicyName: string) { + return this.pathTemplates.accessPolicyPathTemplate.match(accessPolicyName).access_policy; + } + + /** + * Return a fully-qualified servicePerimeter resource name string. + * + * @param {string} access_policy + * @param {string} service_perimeter + * @returns {string} Resource name string. + */ + servicePerimeterPath(accessPolicy:string,servicePerimeter:string) { + return this.pathTemplates.servicePerimeterPathTemplate.render({ + access_policy: accessPolicy, + service_perimeter: servicePerimeter, + }); + } + + /** + * Parse the access_policy from ServicePerimeter resource. + * + * @param {string} servicePerimeterName + * A fully-qualified path representing ServicePerimeter resource. + * @returns {string} A string representing the access_policy. + */ + matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string) { + return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).access_policy; + } + + /** + * Parse the service_perimeter from ServicePerimeter resource. + * + * @param {string} servicePerimeterName + * A fully-qualified path representing ServicePerimeter resource. + * @returns {string} A string representing the service_perimeter. + */ + matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string) { + return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).service_perimeter; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.assetServiceStub && !this._terminated) { + return this.assetServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json new file mode 100644 index 00000000..1ac24652 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json @@ -0,0 +1,30 @@ +{ + "interfaces": { + "google.cloud.asset.v1p5beta1.AssetService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListAssets": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json new file mode 100644 index 00000000..98ff312c --- /dev/null +++ b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/asset/v1p5beta1/asset_service.proto", + "../../protos/google/cloud/asset/v1p5beta1/assets.proto", + "../../protos/google/cloud/orgpolicy/v1/orgpolicy.proto", + "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", + "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", + "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" +] diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json b/owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json new file mode 100644 index 00000000..cd06433c --- /dev/null +++ b/owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json @@ -0,0 +1,37 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.asset.v1p5beta1", + "libraryPackage": "asset", + "services": { + "AssetService": { + "clients": { + "grpc": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AssetServiceClient", + "rpcs": { + "ListAssets": { + "methods": [ + "listAssets", + "listAssetsStream", + "listAssetsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts b/owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts new file mode 100644 index 00000000..9008232c --- /dev/null +++ b/owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts @@ -0,0 +1,19 @@ +// 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. ** + +export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000..d3eaebbd --- /dev/null +++ b/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const asset = require('asset'); + +function main() { + const assetServiceClient = new asset.AssetServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000..131cdf8c --- /dev/null +++ b/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. ** + +import {AssetServiceClient} from 'asset'; + +// check that the client class type name can be used +function doStuffWithAssetServiceClient(client: AssetServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const assetServiceClient = new AssetServiceClient(); + doStuffWithAssetServiceClient(assetServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1p5beta1/system-test/install.ts b/owl-bot-staging/v1p5beta1/system-test/install.ts new file mode 100644 index 00000000..557a5755 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts b/owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts new file mode 100644 index 00000000..32414708 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts @@ -0,0 +1,551 @@ +// 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as assetserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1p5beta1.AssetServiceClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = assetserviceModule.v1p5beta1.AssetServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = assetserviceModule.v1p5beta1.AssetServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = assetserviceModule.v1p5beta1.AssetServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.assetServiceStub, undefined); + await client.initialize(); + assert(client.assetServiceStub); + }); + + 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.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 () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets without error using callback', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + (err?: Error|null, result?: protos.google.cloud.asset.v1p5beta1.IAsset[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssets with error', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAssetsStream without error', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + ]; + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1p5beta1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1p5beta1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAssetsStream with error', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.asset.v1p5beta1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.asset.v1p5beta1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets without error', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), + ]; + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.asset.v1p5beta1.IAsset[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAssets with error', async () => { + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('ListAssetsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.asset.v1p5beta1.IAsset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('accessLevel', () => { + const fakePath = "/rendered/path/accessLevel"; + const expectedParameters = { + access_policy: "accessPolicyValue", + access_level: "accessLevelValue", + }; + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accessLevelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accessLevelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accessLevelPath', () => { + const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromAccessLevelName', () => { + const result = client.matchAccessPolicyFromAccessLevelName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAccessLevelFromAccessLevelName', () => { + const result = client.matchAccessLevelFromAccessLevelName(fakePath); + assert.strictEqual(result, "accessLevelValue"); + assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('accessPolicy', () => { + const fakePath = "/rendered/path/accessPolicy"; + const expectedParameters = { + access_policy: "accessPolicyValue", + }; + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.accessPolicyPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.accessPolicyPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('accessPolicyPath', () => { + const result = client.accessPolicyPath("accessPolicyValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromAccessPolicyName', () => { + const result = client.matchAccessPolicyFromAccessPolicyName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('servicePerimeter', () => { + const fakePath = "/rendered/path/servicePerimeter"; + const expectedParameters = { + access_policy: "accessPolicyValue", + service_perimeter: "servicePerimeterValue", + }; + const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.servicePerimeterPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.servicePerimeterPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('servicePerimeterPath', () => { + const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchAccessPolicyFromServicePerimeterName', () => { + const result = client.matchAccessPolicyFromServicePerimeterName(fakePath); + assert.strictEqual(result, "accessPolicyValue"); + assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchServicePerimeterFromServicePerimeterName', () => { + const result = client.matchServicePerimeterFromServicePerimeterName(fakePath); + assert.strictEqual(result, "servicePerimeterValue"); + assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1p5beta1/tsconfig.json b/owl-bot-staging/v1p5beta1/tsconfig.json new file mode 100644 index 00000000..c78f1c88 --- /dev/null +++ b/owl-bot-staging/v1p5beta1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1p5beta1/webpack.config.js b/owl-bot-staging/v1p5beta1/webpack.config.js new file mode 100644 index 00000000..9d42a74b --- /dev/null +++ b/owl-bot-staging/v1p5beta1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'AssetService', + filename: './asset-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From 10800c5471344c3c5cef100d613c61f13b492f7e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 19 Sep 2022 22:01:45 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../google/cloud/asset/v1/asset_service.proto | 2072 --------- .../protos/google/cloud/asset/v1/assets.proto | 919 ---- .../google/cloud/osconfig/v1/inventory.proto | 384 -- .../google/cloud/osconfig/v1/os_policy.proto | 548 --- .../v1/os_policy_assignment_reports.proto | 296 -- .../osconfig/v1/os_policy_assignments.proto | 386 -- .../cloud/osconfig/v1/osconfig_common.proto | 38 - .../cloud/osconfig/v1/osconfig_service.proto | 158 - .../osconfig/v1/osconfig_zonal_service.proto | 202 - .../cloud/osconfig/v1/patch_deployments.proto | 339 -- .../google/cloud/osconfig/v1/patch_jobs.proto | 742 --- .../cloud/osconfig/v1/vulnerability.proto | 365 -- .../v1/asset_service.analyze_iam_policy.js | 89 - ..._service.analyze_iam_policy_longrunning.js | 84 - .../v1/asset_service.analyze_move.js | 78 - .../asset_service.batch_get_assets_history.js | 104 - ...ervice.batch_get_effective_iam_policies.js | 77 - .../generated/v1/asset_service.create_feed.js | 79 - .../v1/asset_service.create_saved_query.js | 82 - .../generated/v1/asset_service.delete_feed.js | 64 - .../v1/asset_service.delete_saved_query.js | 65 - .../v1/asset_service.export_assets.js | 119 - .../generated/v1/asset_service.get_feed.js | 64 - .../v1/asset_service.get_saved_query.js | 64 - .../generated/v1/asset_service.list_assets.js | 126 - .../generated/v1/asset_service.list_feeds.js | 63 - .../v1/asset_service.list_saved_queries.js | 88 - .../v1/asset_service.query_assets.js | 123 - .../asset_service.search_all_iam_policies.js | 160 - .../v1/asset_service.search_all_resources.js | 204 - .../generated/v1/asset_service.update_feed.js | 72 - .../v1/asset_service.update_saved_query.js | 71 - ...nippet_metadata.google.cloud.asset.v1.json | 1015 ----- owl-bot-staging/v1/src/index.ts | 25 - .../v1/src/v1/asset_service_client.ts | 4043 ----------------- .../src/v1/asset_service_client_config.json | 128 - .../v1/src/v1/asset_service_proto_list.json | 10 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 239 - owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_asset_service_v1.ts | 3697 --------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1p1beta1/.eslintignore | 7 - owl-bot-staging/v1p1beta1/.eslintrc.json | 3 - owl-bot-staging/v1p1beta1/.gitignore | 14 - owl-bot-staging/v1p1beta1/.jsdoc.js | 55 - owl-bot-staging/v1p1beta1/.mocharc.js | 33 - owl-bot-staging/v1p1beta1/.prettierrc.js | 22 - owl-bot-staging/v1p1beta1/README.md | 1 - .../v1p1beta1/linkinator.config.json | 16 - owl-bot-staging/v1p1beta1/package.json | 64 - .../cloud/asset/v1p1beta1/asset_service.proto | 149 - .../google/cloud/asset/v1p1beta1/assets.proto | 113 - .../asset_service.search_all_iam_policies.js | 89 - .../asset_service.search_all_resources.js | 98 - ...metadata.google.cloud.asset.v1p1beta1.json | 127 - owl-bot-staging/v1p1beta1/src/index.ts | 25 - .../src/v1p1beta1/asset_service_client.ts | 782 ---- .../asset_service_client_config.json | 36 - .../v1p1beta1/asset_service_proto_list.json | 4 - .../src/v1p1beta1/gapic_metadata.json | 51 - .../v1p1beta1/src/v1p1beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1p1beta1/system-test/install.ts | 49 - .../test/gapic_asset_service_v1p1beta1.ts | 687 --- owl-bot-staging/v1p1beta1/tsconfig.json | 19 - owl-bot-staging/v1p1beta1/webpack.config.js | 64 - owl-bot-staging/v1p2beta1/.eslintignore | 7 - owl-bot-staging/v1p2beta1/.eslintrc.json | 3 - owl-bot-staging/v1p2beta1/.gitignore | 14 - owl-bot-staging/v1p2beta1/.jsdoc.js | 55 - owl-bot-staging/v1p2beta1/.mocharc.js | 33 - owl-bot-staging/v1p2beta1/.prettierrc.js | 22 - owl-bot-staging/v1p2beta1/README.md | 1 - .../v1p2beta1/linkinator.config.json | 16 - owl-bot-staging/v1p2beta1/package.json | 64 - .../cloud/asset/v1p2beta1/asset_service.proto | 259 -- .../google/cloud/asset/v1p2beta1/assets.proto | 124 - .../v1p2beta1/asset_service.create_feed.js | 80 - .../v1p2beta1/asset_service.delete_feed.js | 64 - .../v1p2beta1/asset_service.get_feed.js | 64 - .../v1p2beta1/asset_service.list_feeds.js | 63 - .../v1p2beta1/asset_service.update_feed.js | 72 - ...metadata.google.cloud.asset.v1p2beta1.json | 227 - owl-bot-staging/v1p2beta1/src/index.ts | 25 - .../src/v1p2beta1/asset_service_client.ts | 816 ---- .../asset_service_client_config.json | 51 - .../v1p2beta1/asset_service_proto_list.json | 4 - .../src/v1p2beta1/gapic_metadata.json | 73 - .../v1p2beta1/src/v1p2beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1p2beta1/system-test/install.ts | 49 - .../test/gapic_asset_service_v1p2beta1.ts | 811 ---- owl-bot-staging/v1p2beta1/tsconfig.json | 19 - owl-bot-staging/v1p2beta1/webpack.config.js | 64 - owl-bot-staging/v1p5beta1/.eslintignore | 7 - owl-bot-staging/v1p5beta1/.eslintrc.json | 3 - owl-bot-staging/v1p5beta1/.gitignore | 14 - owl-bot-staging/v1p5beta1/.jsdoc.js | 55 - owl-bot-staging/v1p5beta1/.mocharc.js | 33 - owl-bot-staging/v1p5beta1/.prettierrc.js | 22 - owl-bot-staging/v1p5beta1/README.md | 1 - .../v1p5beta1/linkinator.config.json | 16 - owl-bot-staging/v1p5beta1/package.json | 64 - .../cloud/asset/v1p5beta1/asset_service.proto | 112 - .../google/cloud/asset/v1p5beta1/assets.proto | 124 - .../v1p5beta1/asset_service.list_assets.js | 98 - ...metadata.google.cloud.asset.v1p5beta1.json | 75 - owl-bot-staging/v1p5beta1/src/index.ts | 25 - .../src/v1p5beta1/asset_service_client.ts | 664 --- .../asset_service_client_config.json | 30 - .../v1p5beta1/asset_service_proto_list.json | 9 - .../src/v1p5beta1/gapic_metadata.json | 37 - .../v1p5beta1/src/v1p5beta1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1p5beta1/system-test/install.ts | 49 - .../test/gapic_asset_service_v1p5beta1.ts | 551 --- owl-bot-staging/v1p5beta1/tsconfig.json | 19 - owl-bot-staging/v1p5beta1/webpack.config.js | 64 - src/index.ts | 12 +- src/v1/asset_service_client_config.json | 11 +- 136 files changed, 10 insertions(+), 25814 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/asset_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/asset_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/asset_service_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_asset_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1p1beta1/.eslintignore delete mode 100644 owl-bot-staging/v1p1beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1p1beta1/.gitignore delete mode 100644 owl-bot-staging/v1p1beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1p1beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1p1beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1p1beta1/README.md delete mode 100644 owl-bot-staging/v1p1beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1p1beta1/package.json delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto delete mode 100644 owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js delete mode 100644 owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json delete mode 100644 owl-bot-staging/v1p1beta1/src/index.ts delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts delete mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1p1beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts delete mode 100644 owl-bot-staging/v1p1beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1p1beta1/webpack.config.js delete mode 100644 owl-bot-staging/v1p2beta1/.eslintignore delete mode 100644 owl-bot-staging/v1p2beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1p2beta1/.gitignore delete mode 100644 owl-bot-staging/v1p2beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1p2beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1p2beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1p2beta1/README.md delete mode 100644 owl-bot-staging/v1p2beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1p2beta1/package.json delete mode 100644 owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto delete mode 100644 owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto delete mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js delete mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js delete mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js delete mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js delete mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js delete mode 100644 owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json delete mode 100644 owl-bot-staging/v1p2beta1/src/index.ts delete mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts delete mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json delete mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json delete mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts delete mode 100644 owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1p2beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts delete mode 100644 owl-bot-staging/v1p2beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1p2beta1/webpack.config.js delete mode 100644 owl-bot-staging/v1p5beta1/.eslintignore delete mode 100644 owl-bot-staging/v1p5beta1/.eslintrc.json delete mode 100644 owl-bot-staging/v1p5beta1/.gitignore delete mode 100644 owl-bot-staging/v1p5beta1/.jsdoc.js delete mode 100644 owl-bot-staging/v1p5beta1/.mocharc.js delete mode 100644 owl-bot-staging/v1p5beta1/.prettierrc.js delete mode 100644 owl-bot-staging/v1p5beta1/README.md delete mode 100644 owl-bot-staging/v1p5beta1/linkinator.config.json delete mode 100644 owl-bot-staging/v1p5beta1/package.json delete mode 100644 owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto delete mode 100644 owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto delete mode 100644 owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js delete mode 100644 owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json delete mode 100644 owl-bot-staging/v1p5beta1/src/index.ts delete mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts delete mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json delete mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json delete mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts delete mode 100644 owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1p5beta1/system-test/install.ts delete mode 100644 owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts delete mode 100644 owl-bot-staging/v1p5beta1/tsconfig.json delete mode 100644 owl-bot-staging/v1p5beta1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index a40ee8ff..00000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/asset', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522b..00000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index b35f3a5e..00000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Asset: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c8..00000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 4d04e08d..00000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/asset", - "version": "0.1.0", - "description": "Asset client for Node.js", - "repository": "googleapis/nodejs-asset", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google asset", - "asset", - "asset service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto b/owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto deleted file mode 100644 index 1c343272..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/asset/v1/asset_service.proto +++ /dev/null @@ -1,2072 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.asset.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/asset/v1/assets.proto"; -import "google/iam/v1/policy.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/expr.proto"; - -option csharp_namespace = "Google.Cloud.Asset.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetServiceProto"; -option java_package = "com.google.cloud.asset.v1"; -option php_namespace = "Google\\Cloud\\Asset\\V1"; - -// Asset service definition. -service AssetService { - option (google.api.default_host) = "cloudasset.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // 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. - rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=*/*}:exportAssets" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.asset.v1.ExportAssetsResponse" - metadata_type: "google.cloud.asset.v1.ExportAssetsRequest" - }; - } - - // Lists assets with time and resource types and returns paged results in - // response. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}/assets" - }; - option (google.api.method_signature) = "parent"; - } - - // 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. - rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) - returns (BatchGetAssetsHistoryResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}:batchGetAssetsHistory" - }; - } - - // Creates a feed in a parent project/folder/organization to listen to its - // asset updates. - rpc CreateFeed(CreateFeedRequest) returns (Feed) { - option (google.api.http) = { - post: "/v1/{parent=*/*}/feeds" - body: "*" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about an asset feed. - rpc GetFeed(GetFeedRequest) returns (Feed) { - option (google.api.http) = { - get: "/v1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all asset feeds in a parent project/folder/organization. - rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}/feeds" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an asset feed configuration. - rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { - option (google.api.http) = { - patch: "/v1/{feed.name=*/*/feeds/*}" - body: "*" - }; - option (google.api.method_signature) = "feed"; - } - - // Deletes an asset feed. - rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } - - // 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. - rpc SearchAllResources(SearchAllResourcesRequest) - returns (SearchAllResourcesResponse) { - option (google.api.http) = { - get: "/v1/{scope=*/*}:searchAllResources" - }; - option (google.api.method_signature) = "scope,query,asset_types"; - } - - // 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. - rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) - returns (SearchAllIamPoliciesResponse) { - option (google.api.http) = { - get: "/v1/{scope=*/*}:searchAllIamPolicies" - }; - option (google.api.method_signature) = "scope,query"; - } - - // Analyzes IAM policies to answer which identities have what accesses on - // which resources. - rpc AnalyzeIamPolicy(AnalyzeIamPolicyRequest) - returns (AnalyzeIamPolicyResponse) { - option (google.api.http) = { - get: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicy" - }; - } - - // 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. - rpc AnalyzeIamPolicyLongrunning(AnalyzeIamPolicyLongrunningRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{analysis_query.scope=*/*}:analyzeIamPolicyLongrunning" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse" - metadata_type: "google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata" - }; - } - - // 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. - rpc AnalyzeMove(AnalyzeMoveRequest) returns (AnalyzeMoveResponse) { - option (google.api.http) = { - get: "/v1/{resource=*/*}:analyzeMove" - }; - } - - // Issue a job that queries assets using a SQL statement compatible with - // [BigQuery Standard - // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). - // - // If the query execution finishes within timeout and there's no pagination, - // the full query results will be returned in the `QueryAssetsResponse`. - // - // Otherwise, full query results can be obtained by issuing extra requests - // with the `job_reference` from the a previous `QueryAssets` call. - // - // Note, the query result has approximately 10 GB limitation enforced by - // BigQuery - // https://cloud.google.com/bigquery/docs/best-practices-performance-output, - // queries return larger results will result in errors. - rpc QueryAssets(QueryAssetsRequest) returns (QueryAssetsResponse) { - option (google.api.http) = { - post: "/v1/{parent=*/*}:queryAssets" - body: "*" - }; - } - - // Creates a saved query in a parent project/folder/organization. - rpc CreateSavedQuery(CreateSavedQueryRequest) returns (SavedQuery) { - option (google.api.http) = { - post: "/v1/{parent=*/*}/savedQueries" - body: "saved_query" - }; - option (google.api.method_signature) = "parent,saved_query,saved_query_id"; - } - - // Gets details about a saved query. - rpc GetSavedQuery(GetSavedQueryRequest) returns (SavedQuery) { - option (google.api.http) = { - get: "/v1/{name=*/*/savedQueries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all saved queries in a parent project/folder/organization. - rpc ListSavedQueries(ListSavedQueriesRequest) - returns (ListSavedQueriesResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}/savedQueries" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a saved query. - rpc UpdateSavedQuery(UpdateSavedQueryRequest) returns (SavedQuery) { - option (google.api.http) = { - patch: "/v1/{saved_query.name=*/*/savedQueries/*}" - body: "saved_query" - }; - option (google.api.method_signature) = "saved_query,update_mask"; - } - - // Deletes a saved query. - rpc DeleteSavedQuery(DeleteSavedQueryRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=*/*/savedQueries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets effective IAM policies for a batch of resources. - rpc BatchGetEffectiveIamPolicies(BatchGetEffectiveIamPoliciesRequest) - returns (BatchGetEffectiveIamPoliciesResponse) { - option (google.api.http) = { - get: "/v1/{scope=*/*}/effectiveIamPolicies:batchGet" - }; - } -} - -// Represents the metadata of the longrunning operation for the -// AnalyzeIamPolicyLongrunning rpc. -message AnalyzeIamPolicyLongrunningMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Export asset request. -message ExportAssetsRequest { - // Required. The relative name of the root asset. This can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id"), or a project number (such as "projects/12345"), - // or a folder number (such as "folders/123"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // Timestamp to take an asset snapshot. This can only be set to a timestamp - // between the current time and the current time minus 35 days (inclusive). - // If not specified, the current time will be used. Due to delays in resource - // data collection and indexing, there is a volatile window during which - // running the same query may get different results. - google.protobuf.Timestamp read_time = 2; - - // A list of asset types to take a snapshot for. For example: - // "compute.googleapis.com/Disk". - // - // Regular expressions are also supported. For example: - // - // * "compute.googleapis.com.*" snapshots resources whose asset type starts - // with "compute.googleapis.com". - // * ".*Instance" snapshots resources whose asset type ends with "Instance". - // * ".*Instance.*" snapshots resources whose asset type contains "Instance". - // - // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - // regular expression syntax. If the regular expression does not match any - // supported asset type, an INVALID_ARGUMENT error will be returned. - // - // If specified, only matching assets will be returned, otherwise, it will - // snapshot all asset types. See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) - // for all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name will be - // returned. - ContentType content_type = 4; - - // Required. Output configuration indicating where the results will be output - // to. - OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED]; - - // A list of relationship types to export, for example: - // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - // content_type=RELATIONSHIP. - // * If specified: - // it snapshots specified relationships. It returns an error if - // any of the [relationship_types] doesn't belong to the supported - // relationship types of the [asset_types] or if any of the [asset_types] - // doesn't belong to the source types of the [relationship_types]. - // * Otherwise: - // it snapshots the supported relationships for all [asset_types] or returns - // an error if any of the [asset_types] has no relationship support. - // An unspecified asset types field means all supported asset_types. - // See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all - // supported asset types and relationship types. - repeated string relationship_types = 6; -} - -// The export asset response. This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] -// method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] -// field. -message ExportAssetsResponse { - // Time the snapshot was taken. - google.protobuf.Timestamp read_time = 1; - - // Output configuration indicating where the results were output to. - OutputConfig output_config = 2; - - // Output result indicating where the assets were exported to. For example, a - // set of actual Google Cloud Storage object uris where the assets are - // exported to. The uris can be different from what [output_config] has - // specified, as the service will split the output object into multiple ones - // once it exceeds a single Google Cloud Storage object limit. - OutputResult output_result = 3; -} - -// ListAssets request. -message ListAssetsRequest { - // 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"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // Timestamp to take an asset snapshot. This can only be set to a timestamp - // between the current time and the current time minus 35 days (inclusive). - // If not specified, the current time will be used. Due to delays in resource - // data collection and indexing, there is a volatile window during which - // running the same query may get different results. - google.protobuf.Timestamp read_time = 2; - - // A list of asset types to take a snapshot for. For example: - // "compute.googleapis.com/Disk". - // - // Regular expression is also supported. For example: - // - // * "compute.googleapis.com.*" snapshots resources whose asset type starts - // with "compute.googleapis.com". - // * ".*Instance" snapshots resources whose asset type ends with "Instance". - // * ".*Instance.*" snapshots resources whose asset type contains "Instance". - // - // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - // regular expression syntax. If the regular expression does not match any - // supported asset type, an INVALID_ARGUMENT error will be returned. - // - // If specified, only matching assets will be returned, otherwise, it will - // snapshot all asset types. See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) - // for all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name will - // be returned. - ContentType content_type = 4; - - // The maximum number of assets to be returned in a single response. Default - // is 100, minimum is 1, and maximum is 1000. - int32 page_size = 5; - - // The `next_page_token` returned from the previous `ListAssetsResponse`, or - // unspecified for the first `ListAssetsRequest`. It is a continuation of a - // prior `ListAssets` call, and the API should return the next page of assets. - string page_token = 6; - - // A list of relationship types to output, for example: - // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - // content_type=RELATIONSHIP. - // * If specified: - // it snapshots specified relationships. It returns an error if - // any of the [relationship_types] doesn't belong to the supported - // relationship types of the [asset_types] or if any of the [asset_types] - // doesn't belong to the source types of the [relationship_types]. - // * Otherwise: - // it snapshots the supported relationships for all [asset_types] or returns - // an error if any of the [asset_types] has no relationship support. - // An unspecified asset types field means all supported asset_types. - // See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) - // for all supported asset types and relationship types. - repeated string relationship_types = 7; -} - -// ListAssets response. -message ListAssetsResponse { - // Time the snapshot was taken. - google.protobuf.Timestamp read_time = 1; - - // Assets. - repeated Asset assets = 2; - - // Token to retrieve the next page of results. It expires 72 hours after the - // page token for the first page is generated. Set to empty if there are no - // remaining results. - string next_page_token = 3; -} - -// Batch get assets history request. -message BatchGetAssetsHistoryRequest { - // Required. The relative name of the root asset. It can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id")", or a project number (such as "projects/12345"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // A list of the full names of the assets. - // See: https://cloud.google.com/asset-inventory/docs/resource-name-format - // Example: - // - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // - // The request becomes a no-op if the asset name list is empty, and the max - // size of the asset name list is 100 in one request. - repeated string asset_names = 2; - - // Optional. The content type. - ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The time window for the asset history. Both start_time and - // end_time are optional and if set, it must be after the current time minus - // 35 days. If end_time is not set, it is default to current timestamp. - // If start_time is not set, the snapshot of the assets at end_time will be - // returned. The returned results contain all temporal assets whose time - // window overlap with read_time_window. - TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A list of relationship types to output, for example: - // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - // content_type=RELATIONSHIP. - // * If specified: - // it outputs specified relationships' history on the [asset_names]. It - // returns an error if any of the [relationship_types] doesn't belong to the - // supported relationship types of the [asset_names] or if any of the - // [asset_names]'s types doesn't belong to the source types of the - // [relationship_types]. - // * Otherwise: - // it outputs the supported relationships' history on the [asset_names] or - // returns an error if any of the [asset_names]'s types has no relationship - // support. - // See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all - // supported asset types and relationship types. - repeated string relationship_types = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Batch get assets history response. -message BatchGetAssetsHistoryResponse { - // A list of assets with valid time windows. - repeated TemporalAsset assets = 1; -} - -// Create asset feed request. -message CreateFeedRequest { - // Required. The name of the project/folder/organization where this feed - // 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"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. This is the client-assigned asset feed identifier and it needs to - // be unique under a specific parent project/folder/organization. - string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 - Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Get asset feed request. -message GetFeedRequest { - // Required. The name of the Feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } - ]; -} - -// List asset feeds request. -message ListFeedsRequest { - // Required. The parent project/folder/organization whose feeds 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"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message ListFeedsResponse { - // A list of feeds. - repeated Feed feeds = 1; -} - -// Update asset feed request. -message UpdateFeedRequest { - // 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. - Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `feed` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteFeedRequest { - // Required. The name of the feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "cloudasset.googleapis.com/Feed" } - ]; -} - -// Output configuration for export assets destination. -message OutputConfig { - // Asset export destination. - oneof destination { - // Destination on Cloud Storage. - GcsDestination gcs_destination = 1; - - // Destination on BigQuery. The output table stores the fields in asset - // Protobuf as columns in BigQuery. - BigQueryDestination bigquery_destination = 2; - } -} - -// Output result of export assets. -message OutputResult { - // Asset export result. - oneof result { - // Export result on Cloud Storage. - GcsOutputResult gcs_result = 1; - } -} - -// A Cloud Storage output result. -message GcsOutputResult { - // List of uris of the Cloud Storage objects. Example: - // "gs://bucket_name/object_name". - repeated string uris = 1; -} - -// A Cloud Storage location. -message GcsDestination { - // Required. - oneof object_uri { - // The uri of the Cloud Storage object. It's the same uri that is used by - // gsutil. Example: "gs://bucket_name/object_name". See [Viewing and - // Editing Object - // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) - // for more information. - // - // If the specified Cloud Storage object already exists and there is no - // [hold](https://cloud.google.com/storage/docs/object-holds), it will be - // overwritten with the exported result. - string uri = 1; - - // The uri prefix of all generated Cloud Storage objects. Example: - // "gs://bucket_name/object_name_prefix". Each object uri is in format: - // "gs://bucket_name/object_name_prefix// and only - // contains assets for that type. starts from 0. Example: - // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is - // the first shard of output objects containing all - // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be - // returned if file with the same name "gs://bucket_name/object_name_prefix" - // already exists. - string uri_prefix = 2; - } -} - -// A BigQuery destination for exporting assets to. -message BigQueryDestination { - // Required. The BigQuery dataset in format - // "projects/projectId/datasets/datasetId", to which the snapshot result - // should be exported. If this dataset does not exist, the export call returns - // an INVALID_ARGUMENT error. Setting the `contentType` for `exportAssets` - // determines the - // [schema](/asset-inventory/docs/exporting-to-bigquery#bigquery-schema) - // of the BigQuery table. Setting `separateTablesPerAssetType` to `TRUE` also - // influences the schema. - string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The BigQuery table to which the snapshot result should be - // written. If this table does not exist, a new table with the given name - // will be created. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - - // If the destination table already exists and this flag is `TRUE`, the - // table will be overwritten by the contents of assets snapshot. If the flag - // is `FALSE` or unset and the destination table already exists, the export - // call returns an INVALID_ARGUMEMT error. - bool force = 3; - - // [partition_spec] determines whether to export to partitioned table(s) and - // how to partition the data. - // - // If [partition_spec] is unset or [partition_spec.partition_key] is unset or - // `PARTITION_KEY_UNSPECIFIED`, the snapshot results will be exported to - // non-partitioned table(s). [force] will decide whether to overwrite existing - // table(s). - // - // If [partition_spec] is specified. First, the snapshot results will be - // written to partitioned table(s) with two additional timestamp columns, - // readTime and requestTime, one of which will be the partition key. Secondly, - // in the case when any destination table already exists, it will first try to - // update existing table's schema as necessary by appending additional - // columns. Then, if [force] is `TRUE`, the corresponding partition will be - // overwritten by the snapshot results (data in different partitions will - // remain intact); if [force] is unset or `FALSE`, it will append the data. An - // error will be returned if the schema update or data appension fails. - PartitionSpec partition_spec = 4; - - // If this flag is `TRUE`, the snapshot results will be written to one or - // multiple tables, each of which contains results of one asset type. The - // [force] and [partition_spec] fields will apply to each of them. - // - // Field [table] will be concatenated with "_" and the asset type names (see - // https://cloud.google.com/asset-inventory/docs/supported-asset-types for - // supported asset types) to construct per-asset-type table names, in which - // all non-alphanumeric characters like "." and "/" will be substituted by - // "_". Example: if field [table] is "mytable" and snapshot results - // contain "storage.googleapis.com/Bucket" assets, the corresponding table - // name will be "mytable_storage_googleapis_com_Bucket". If any of these - // tables does not exist, a new table with the concatenated name will be - // created. - // - // When [content_type] in the ExportAssetsRequest is `RESOURCE`, the schema of - // each table will include RECORD-type columns mapped to the nested fields in - // the Asset.resource.data field of that asset type (up to the 15 nested level - // BigQuery supports - // (https://cloud.google.com/bigquery/docs/nested-repeated#limitations)). The - // fields in >15 nested levels will be stored in JSON format string as a child - // column of its parent RECORD column. - // - // If error occurs when exporting to any table, the whole export call will - // return an error but the export results that already succeed will persist. - // Example: if exporting to table_type_A succeeds when exporting to - // table_type_B fails during one export call, the results in table_type_A will - // persist and there will not be partial results persisting in a table. - bool separate_tables_per_asset_type = 5; -} - -// Specifications of BigQuery partitioned table as export destination. -message PartitionSpec { - // This enum is used to determine the partition key column when exporting - // assets to BigQuery partitioned table(s). Note that, if the partition key is - // a timestamp column, the actual partition is based on its date value - // (expressed in UTC. see details in - // https://cloud.google.com/bigquery/docs/partitioned-tables#date_timestamp_partitioned_tables). - enum PartitionKey { - // Unspecified partition key. If used, it means using non-partitioned table. - PARTITION_KEY_UNSPECIFIED = 0; - - // The time when the snapshot is taken. If specified as partition key, the - // result table(s) is partitoned by the additional timestamp column, - // readTime. If [read_time] in ExportAssetsRequest is specified, the - // readTime column's value will be the same as it. Otherwise, its value will - // be the current time that is used to take the snapshot. - READ_TIME = 1; - - // The time when the request is received and started to be processed. If - // specified as partition key, the result table(s) is partitoned by the - // requestTime column, an additional timestamp column representing when the - // request was received. - REQUEST_TIME = 2; - } - - // The partition key for BigQuery partitioned table. - PartitionKey partition_key = 1; -} - -// A Pub/Sub destination. -message PubsubDestination { - // The name of the Pub/Sub topic to publish to. - // Example: `projects/PROJECT_ID/topics/TOPIC_ID`. - string topic = 1; -} - -// Output configuration for asset feed destination. -message FeedOutputConfig { - // Asset feed destination. - oneof destination { - // Destination on Pub/Sub. - PubsubDestination pubsub_destination = 1; - } -} - -// An asset feed used to export asset updates to a destinations. -// An asset feed filter controls what updates are exported. -// The asset feed must be created within a project, organization, or -// folder. Supported destinations are: -// Pub/Sub topics. -message Feed { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Feed" - pattern: "projects/{project}/feeds/{feed}" - pattern: "folders/{folder}/feeds/{feed}" - pattern: "organizations/{organization}/feeds/{feed}" - history: ORIGINALLY_SINGLE_PATTERN - }; - - // Required. The format will be - // projects/{project_number}/feeds/{client-assigned_feed_identifier} or - // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or - // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} - // - // The client-assigned feed identifier must be unique within the parent - // project/folder/organization. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of the full names of the assets to receive updates. You must specify - // either or both of asset_names and asset_types. Only asset updates matching - // specified asset_names or asset_types are exported to the feed. - // Example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // For a list of the full names for supported asset types, see [Resource - // name format](/asset-inventory/docs/resource-name-format). - repeated string asset_names = 2; - - // A list of types of the assets to receive updates. You must specify either - // or both of asset_names and asset_types. Only asset updates matching - // specified asset_names or asset_types are exported to the feed. - // Example: `"compute.googleapis.com/Disk"` - // - // For a list of all supported asset types, see - // [Supported asset types](/asset-inventory/docs/supported-asset-types). - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name and - // type will be returned. - ContentType content_type = 4; - - // Required. Feed output configuration defining where the asset updates are - // published to. - FeedOutputConfig feed_output_config = 5 - [(google.api.field_behavior) = REQUIRED]; - - // A condition which determines whether an asset update should be published. - // If specified, an asset will be returned only when the expression evaluates - // to true. - // When set, `expression` field in the `Expr` must be a valid [CEL expression] - // (https://github.com/google/cel-spec) on a TemporalAsset with name - // `temporal_asset`. Example: a Feed with expression ("temporal_asset.deleted - // == true") will only publish Asset deletions. Other fields of `Expr` are - // optional. - // - // See our [user - // guide](https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes-with-condition) - // for detailed instructions. - google.type.Expr condition = 6; - - // A list of relationship types to output, for example: - // `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - // content_type=RELATIONSHIP. - // * If specified: - // it outputs specified relationship updates on the [asset_names] or the - // [asset_types]. It returns an error if any of the [relationship_types] - // doesn't belong to the supported relationship types of the [asset_names] or - // [asset_types], or any of the [asset_names] or the [asset_types] doesn't - // belong to the source types of the [relationship_types]. - // * Otherwise: - // it outputs the supported relationships of the types of [asset_names] and - // [asset_types] or returns an error if any of the [asset_names] or the - // [asset_types] has no replationship support. - // See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) - // for all supported asset types and relationship types. - repeated string relationship_types = 7; -} - -// Search all resources request. -message SearchAllResourcesRequest { - // 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: - // - // * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - string scope = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The query statement. See [how to construct a - // query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) - // for more information. If not specified or empty, it will search all the - // resources within the specified `scope`. - // - // Examples: - // - // * `name:Important` to find Cloud resources whose name contains - // "Important" as a word. - // * `name=Important` to find the Cloud resource whose name is exactly - // "Important". - // * `displayName:Impor*` to find Cloud resources whose display name - // contains "Impor" as a prefix of any word in the field. - // * `location:us-west*` to find Cloud resources whose location contains both - // "us" and "west" as prefixes. - // * `labels:prod` to find Cloud resources whose labels contain "prod" as - // a key or value. - // * `labels.env:prod` to find Cloud resources that have a label "env" - // and its value is "prod". - // * `labels.env:*` to find Cloud resources that have a label "env". - // * `kmsKey:key` to find Cloud resources encrypted with a customer-managed - // encryption key whose name contains the word "key". - // * `relationships:instance-group-1` to find Cloud resources that have - // relationships with "instance-group-1" in the related resource name. - // * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that - // have relationships of type "INSTANCE_TO_INSTANCEGROUP". - // * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find - // compute instances that have relationships with "instance-group-1" in the - // compute instance group resource name, for relationship type - // "INSTANCE_TO_INSTANCEGROUP". - // * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a - // word. - // * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain - // "ACTIVE" as a word. - // * `createTime<1609459200` to find Cloud resources that were created before - // "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - // "2021-01-01 00:00:00 UTC" in seconds. - // * `updateTime>1609459200` to find Cloud resources that were updated after - // "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - // "2021-01-01 00:00:00 UTC" in seconds. - // * `Important` to find Cloud resources that contain "Important" as a word - // in any of the searchable fields. - // * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any - // word in any of the searchable fields. - // * `Important location:(us-west1 OR global)` to find Cloud - // resources that contain "Important" as a word in any of the searchable - // fields and are also located in the "us-west1" region or the "global" - // location. - string query = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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 - // with "compute.googleapis.com". - // * ".*Instance" snapshots resources whose asset type ends with "Instance". - // * ".*Instance.*" snapshots resources whose asset type contains "Instance". - // - // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - // regular expression syntax. If the regular expression does not match any - // supported asset type, an INVALID_ARGUMENT error will be returned. - repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; - - // 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 - // * assetType - // * project - // * displayName - // * description - // * location - // * kmsKey - // * createTime - // * updateTime - // * state - // * parentFullResourceName - // * parentAssetType - // - // All the other fields such as repeated fields (e.g., `networkTags`), map - // fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) - // are not supported. - string order_by = 6 [(google.api.field_behavior) = OPTIONAL]; - - // 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 - // * assetType - // * project - // * displayName - // * description - // * location - // * tagKeys - // * tagValues - // * tagValueIds - // * labels - // * networkTags - // * kmsKey - // * createTime - // * updateTime - // * state - // * additionalAttributes - // * versionedResources - // - // If read_mask is not specified, all fields except versionedResources will - // be returned. - // If only '*' is specified, all fields including versionedResources will be - // returned. - // Any invalid field path will trigger INVALID_ARGUMENT error. - google.protobuf.FieldMask read_mask = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Search all resources response. -message SearchAllResourcesResponse { - // A list of Resources that match the search query. It contains the resource - // standard metadata information. - repeated ResourceSearchResult results = 1; - - // If there are more results than those appearing in this response, then - // `next_page_token` is included. To get the next set of results, call this - // method again using the value of `next_page_token` as `page_token`. - string next_page_token = 2; -} - -// Search all IAM policies request. -message SearchAllIamPoliciesRequest { - // 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: - // - // * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - // * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - // * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - // * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - string scope = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The query statement. See [how to construct a - // 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 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 the [IAM policy - // documentation](https://cloud.google.com/iam/help/allow-policies/structure). - // - // Examples: - // - // * `policy:amy@gmail.com` to find IAM policy bindings that specify user - // "amy@gmail.com". - // * `policy:roles/compute.admin` to find IAM policy bindings that specify - // the Compute Admin role. - // * `policy:comp*` to find IAM policy bindings that contain "comp" as a - // prefix of any word in the binding. - // * `policy.role.permissions:storage.buckets.update` to find IAM policy - // bindings that specify a role containing "storage.buckets.update" - // permission. Note that if callers don't have `iam.roles.get` access to a - // role's included permissions, policy bindings that specify this role will - // be dropped from the search results. - // * `policy.role.permissions:upd*` to find IAM policy bindings that specify a - // role containing "upd" as a prefix of any word in the role permission. - // Note that if callers don't have `iam.roles.get` access to a role's - // included permissions, policy bindings that specify this role will be - // dropped from the search results. - // * `resource:organizations/123456` to find IAM policy bindings - // that are set on "organizations/123456". - // * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to - // find IAM policy bindings that are set on the project named "myproject". - // * `Important` to find IAM policy bindings that contain "Important" as a - // word in any of the searchable fields (except for the included - // permissions). - // * `resource:(instance1 OR instance2) policy:amy` to find - // IAM policy bindings that are set on resources "instance1" or - // "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 - // principal type "user". - string query = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; - - // 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 - // starts with "compute.googleapis.com". - // * ".*Instance" snapshots IAM policies attached to asset type ends with - // "Instance". - // * ".*Instance.*" snapshots IAM policies attached to asset type contains - // "Instance". - // - // See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - // regular expression syntax. If the regular expression does not match any - // supported asset type, an INVALID_ARGUMENT error will be returned. - repeated string asset_types = 5 [(google.api.field_behavior) = OPTIONAL]; - - // 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 - // * assetType - // * project - // All the other fields such as repeated fields (e.g., `folders`) and - // non-primitive fields (e.g., `policy`) are not supported. - string order_by = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Search all IAM policies response. -message SearchAllIamPoliciesResponse { - // A list of IamPolicy that match the search query. Related information such - // as the associated resource is returned along with the policy. - repeated IamPolicySearchResult results = 1; - - // Set if there are more results than those appearing in this response; to get - // the next set of results, call this method again, using this value as the - // `page_token`. - string next_page_token = 2; -} - -// IAM policy analysis query message. -message IamPolicyAnalysisQuery { - // Specifies the resource to analyze for access policies, which may be set - // directly on the resource, or on ancestors such as organizations, folders or - // projects. - message ResourceSelector { - // Required. The [full resource name] - // (https://cloud.google.com/asset-inventory/docs/resource-name-format) - // of a resource of [supported resource - // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#analyzable_asset_types). - string full_resource_name = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Specifies an identity for which to determine resource access, based on - // roles assigned either directly to them or to the groups they belong to, - // directly or indirectly. - message IdentitySelector { - // Required. The identity appear in the form of principals in - // [IAM policy - // binding](https://cloud.google.com/iam/reference/rest/v1/Binding). - // - // The examples of supported forms are: - // "user:mike@example.com", - // "group:admins@example.com", - // "domain:google.com", - // "serviceAccount:my-project-id@appspot.gserviceaccount.com". - // - // Notice that wildcard characters (such as * and ?) are not supported. - // You must give a specific identity. - string identity = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Specifies roles and/or permissions to analyze, to determine both the - // identities possessing them and the resources they control. If multiple - // values are specified, results will include roles or permissions matching - // any of them. The total number of roles and permissions should be equal or - // less than 10. - message AccessSelector { - // Optional. The roles to appear in result. - repeated string roles = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The permissions to appear in result. - repeated string permissions = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Contains query options. - message Options { - // Optional. If true, the identities section of the result will expand any - // Google groups appearing in an IAM policy binding. - // - // If - // [IamPolicyAnalysisQuery.identity_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.identity_selector] - // is specified, the identity in the result will be determined by the - // selector, and this flag is not allowed to set. - // - // If true, the default max expansion per group is 1000 for - // AssetService.AnalyzeIamPolicy][]. - // - // Default is false. - bool expand_groups = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the access section of result will expand any roles - // appearing in IAM policy bindings to include their permissions. - // - // If - // [IamPolicyAnalysisQuery.access_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.access_selector] - // is specified, the access section of the result will be determined by the - // selector, and this flag is not allowed to set. - // - // Default is false. - bool expand_roles = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true and - // [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] - // is not specified, the resource section of the result will expand any - // resource attached to an IAM policy to include resources lower in the - // resource hierarchy. - // - // For example, if the request analyzes for which resources user A has - // permission P, and the results include an IAM policy with P on a GCP - // folder, the results will also include resources in that folder with - // permission P. - // - // If true and - // [IamPolicyAnalysisQuery.resource_selector][google.cloud.asset.v1.IamPolicyAnalysisQuery.resource_selector] - // is specified, the resource section of the result will expand the - // specified resource to include resources lower in the resource hierarchy. - // Only project or lower resources are supported. Folder and organization - // resource cannot be used together with this option. - // - // For example, if the request analyzes for which users have permission P on - // a GCP project with this option enabled, the results will include all - // users who have permission P on that project or any lower resource. - // - // If true, the default max expansion per resource is 1000 for - // AssetService.AnalyzeIamPolicy][] and 100000 for - // AssetService.AnalyzeIamPolicyLongrunning][]. - // - // Default is false. - bool expand_resources = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the result will output the relevant parent/child - // relationships between resources. Default is false. - bool output_resource_edges = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the result will output the relevant membership - // relationships between groups and other groups, and between groups and - // principals. Default is false. - bool output_group_edges = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the response will include access analysis from - // identities to resources via service account impersonation. This is a very - // expensive operation, because many derived queries will be executed. We - // highly recommend you use - // [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] - // rpc instead. - // - // For example, if the request analyzes for which resources user A has - // permission P, and there's an IAM policy states user A has - // iam.serviceAccounts.getAccessToken permission to a service account SA, - // and there's another IAM policy states service account SA has permission P - // to a GCP folder F, then user A potentially has access to the GCP folder - // F. And those advanced analysis results will be included in - // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]. - // - // Another example, if the request analyzes for who has - // permission P to a GCP folder F, and there's an IAM policy states user A - // has iam.serviceAccounts.actAs permission to a service account SA, and - // there's another IAM policy states service account SA has permission P to - // the GCP folder F, then user A potentially has access to the GCP folder - // F. And those advanced analysis results will be included in - // [AnalyzeIamPolicyResponse.service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis]. - // - // Only the following permissions are considered in this analysis: - // - // * `iam.serviceAccounts.actAs` - // * `iam.serviceAccounts.signBlob` - // * `iam.serviceAccounts.signJwt` - // * `iam.serviceAccounts.getAccessToken` - // * `iam.serviceAccounts.getOpenIdToken` - // * `iam.serviceAccounts.implicitDelegation` - // - // Default is false. - bool analyze_service_account_impersonation = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // The IAM conditions context. - message ConditionContext { - // The IAM conditions time context. - oneof TimeContext { - // The hypothetical access timestamp to evaluate IAM conditions. Note that - // this value must not be earlier than the current time; otherwise, an - // INVALID_ARGUMENT error will be returned. - google.protobuf.Timestamp access_time = 1; - } - } - - // Required. The relative name of the root asset. Only resources and IAM - // policies within the scope will be analyzed. - // - // 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). - string scope = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifies a resource for analysis. - ResourceSelector resource_selector = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies an identity for analysis. - IdentitySelector identity_selector = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies roles or permissions for analysis. This is optional. - AccessSelector access_selector = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The query options. - Options options = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The hypothetical context for IAM conditions evaluation. - ConditionContext condition_context = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A request message for -// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. -message AnalyzeIamPolicyRequest { - // Required. The request query. - IamPolicyAnalysisQuery analysis_query = 1 - [(google.api.field_behavior) = REQUIRED]; - - // 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. - string saved_analysis_query = 3 [(google.api.field_behavior) = OPTIONAL]; - - // 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 - // execution timeout, you will get a response with partial result. - // Otherwise, your query's execution will continue until the RPC deadline. - // If it's not finished until then, you will get a DEADLINE_EXCEEDED error. - // - // Default is empty. - google.protobuf.Duration execution_timeout = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A response message for -// [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy]. -message AnalyzeIamPolicyResponse { - // An analysis message to group the query and results. - message IamPolicyAnalysis { - // The analysis query. - IamPolicyAnalysisQuery analysis_query = 1; - - // A list of - // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult] - // that matches the analysis query, or empty if no result is found. - repeated IamPolicyAnalysisResult analysis_results = 2; - - // Represents whether all entries in the - // [analysis_results][google.cloud.asset.v1.AnalyzeIamPolicyResponse.IamPolicyAnalysis.analysis_results] - // have been fully explored to answer the query. - bool fully_explored = 3; - - // A list of non-critical errors happened during the query handling. - repeated IamPolicyAnalysisState non_critical_errors = 5; - } - - // The main analysis that matches the original request. - IamPolicyAnalysis main_analysis = 1; - - // The service account impersonation analysis if - // [AnalyzeIamPolicyRequest.analyze_service_account_impersonation][] is - // enabled. - repeated IamPolicyAnalysis service_account_impersonation_analysis = 2; - - // Represents whether all entries in the - // [main_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.main_analysis] - // and - // [service_account_impersonation_analysis][google.cloud.asset.v1.AnalyzeIamPolicyResponse.service_account_impersonation_analysis] - // have been fully explored to answer the query in the request. - bool fully_explored = 3; -} - -// Output configuration for export IAM policy analysis destination. -message IamPolicyAnalysisOutputConfig { - // A Cloud Storage location. - message GcsDestination { - // Required. The uri of the Cloud Storage object. It's the same uri that is - // used by gsutil. Example: "gs://bucket_name/object_name". See [Viewing and - // Editing Object - // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) - // for more information. - // - // If the specified Cloud Storage object already exists and there is no - // [hold](https://cloud.google.com/storage/docs/object-holds), it will be - // overwritten with the analysis result. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // A BigQuery destination. - message BigQueryDestination { - // This enum determines the partition key column for the bigquery tables. - // Partitioning can improve query performance and reduce query cost by - // filtering partitions. Refer to - // https://cloud.google.com/bigquery/docs/partitioned-tables for details. - enum PartitionKey { - // Unspecified partition key. Tables won't be partitioned using this - // option. - PARTITION_KEY_UNSPECIFIED = 0; - - // The time when the request is received. If specified as partition key, - // the result table(s) is partitoned by the RequestTime column, an - // additional timestamp column representing when the request was received. - REQUEST_TIME = 1; - } - - // Required. The BigQuery dataset in format - // "projects/projectId/datasets/datasetId", to which the analysis results - // should be exported. If this dataset does not exist, the export call will - // return an INVALID_ARGUMENT error. - string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The prefix of the BigQuery tables to which the analysis results - // will be written. Tables will be created based on this table_prefix if not - // exist: - // * _analysis table will contain export operation's metadata. - // * _analysis_result will contain all the - // [IamPolicyAnalysisResult][google.cloud.asset.v1.IamPolicyAnalysisResult]. - // When [partition_key] is specified, both tables will be partitioned based - // on the [partition_key]. - string table_prefix = 2 [(google.api.field_behavior) = REQUIRED]; - - // The partition key for BigQuery partitioned table. - PartitionKey partition_key = 3; - - // Optional. Specifies the action that occurs if the destination table or - // partition already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery - // overwrites the entire table or all the partitions data. - // * WRITE_APPEND: If the table or partition already exists, BigQuery - // appends the data to the table or the latest partition. - // * WRITE_EMPTY: If the table already exists and contains data, an error is - // returned. - // - // The default value is WRITE_APPEND. Each action is atomic and only occurs - // if BigQuery is able to complete the job successfully. Details are at - // https://cloud.google.com/bigquery/docs/loading-data-local#appending_to_or_overwriting_a_table_using_a_local_file. - string write_disposition = 4 [(google.api.field_behavior) = OPTIONAL]; - } - - // IAM policy analysis export destination. - oneof destination { - // Destination on Cloud Storage. - GcsDestination gcs_destination = 1; - - // Destination on BigQuery. - BigQueryDestination bigquery_destination = 2; - } -} - -// A request message for -// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. -message AnalyzeIamPolicyLongrunningRequest { - // Required. The request query. - IamPolicyAnalysisQuery analysis_query = 1 - [(google.api.field_behavior) = REQUIRED]; - - // 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. - string saved_analysis_query = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Output configuration indicating where the results will be output - // to. - IamPolicyAnalysisOutputConfig output_config = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// A response message for -// [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning]. -message AnalyzeIamPolicyLongrunningResponse {} - -// A saved query which can be shared with others or used later. -message SavedQuery { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/SavedQuery" - pattern: "projects/{project}/savedQueries/{saved_query}" - pattern: "folders/{folder}/savedQueries/{saved_query}" - pattern: "organizations/{organization}/savedQueries/{saved_query}" - }; - - // The query content. - message QueryContent { - oneof query_content { - // An IAM Policy Analysis query, which could be used in - // the - // [AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy] - // rpc or the - // [AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning] - // rpc. - IamPolicyAnalysisQuery iam_policy_analysis_query = 1; - } - } - - // The resource name of the saved query. The format must be: - // - // * projects/project_number/savedQueries/saved_query_id - // * folders/folder_number/savedQueries/saved_query_id - // * organizations/organization_number/savedQueries/saved_query_id - string name = 1; - - // The description of this saved query. This value should be fewer than 255 - // characters. - string description = 2; - - // Output only. The create time of this saved query. - google.protobuf.Timestamp create_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The account's email address who has created this saved query. - string creator = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time of this saved query. - google.protobuf.Timestamp last_update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The account's email address who has updated this saved query - // most recently. - string last_updater = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels applied on the resource. - // This value should not contain more than 10 entries. The key and value of - // each entry must be non-empty and fewer than 64 characters. - map labels = 7; - - // The query content. - QueryContent content = 8; -} - -// Request to create a saved query. -message CreateSavedQueryRequest { - // 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"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/SavedQuery" - } - ]; - - // Required. The saved_query details. The `name` field must be empty as it - // will be generated based on the parent and saved_query_id. - SavedQuery saved_query = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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. - string saved_query_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to get a saved query. -message GetSavedQueryRequest { - // 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 - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/SavedQuery" - } - ]; -} - -// Request to list saved queries. -message ListSavedQueriesRequest { - // 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"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/SavedQuery" - } - ]; - - // 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. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response of listing saved queries. -message ListSavedQueriesResponse { - // A list of savedQueries. - repeated SavedQuery saved_queries = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request to update a saved query. -message UpdateSavedQueryRequest { - // 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 - SavedQuery saved_query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields to update. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request to delete a saved query. -message DeleteSavedQueryRequest { - // 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 - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/SavedQuery" - } - ]; -} - -// The request message for performing resource move analysis. -message AnalyzeMoveRequest { - // View enum for supporting partial analysis responses. - enum AnalysisView { - // The default/unset value. - // The API will default to the FULL view. - ANALYSIS_VIEW_UNSPECIFIED = 0; - - // Full analysis including all level of impacts of the specified resource - // move. - FULL = 1; - - // Basic analysis only including blockers which will prevent the specified - // resource move at runtime. - BASIC = 2; - } - - // Required. Name of the resource to perform the analysis against. - // Only GCP Project are supported as of today. Hence, this can only be Project - // ID (such as "projects/my-project-id") or a Project Number (such as - // "projects/12345"). - string resource = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Name of the GCP Folder or Organization to reparent the target - // resource. The analysis will be performed against hypothetically moving the - // resource to this specified desitination parent. This can only be a Folder - // number (such as "folders/123") or an Organization number (such as - // "organizations/123"). - string destination_parent = 2 [(google.api.field_behavior) = REQUIRED]; - - // Analysis view indicating what information should be included in the - // analysis response. If unspecified, the default view is FULL. - AnalysisView view = 3; -} - -// The response message for resource move analysis. -message AnalyzeMoveResponse { - // The list of analyses returned from performing the intended resource move - // analysis. The analysis is grouped by different Cloud services. - repeated MoveAnalysis move_analysis = 1; -} - -// A message to group the analysis information. -message MoveAnalysis { - // The user friendly display name of the analysis. E.g. IAM, Organization - // Policy etc. - string display_name = 1; - - oneof result { - // Analysis result of moving the target resource. - MoveAnalysisResult analysis = 2; - - // Description of error encountered when performing the analysis. - google.rpc.Status error = 3; - } -} - -// An analysis result including blockers and warnings. -message MoveAnalysisResult { - // Blocking information that would prevent the target resource from moving - // to the specified destination at runtime. - repeated MoveImpact blockers = 1; - - // Warning information indicating that moving the target resource to the - // specified destination might be unsafe. This can include important policy - // information and configuration changes, but will not block moves at runtime. - repeated MoveImpact warnings = 2; -} - -// A message to group impacts of moving the target resource. -message MoveImpact { - // User friendly impact detail in a free form message. - string detail = 1; -} - -// Output configuration query assets. -message QueryAssetsOutputConfig { - // BigQuery destination. - message BigQueryDestination { - // Required. The BigQuery dataset where the query results will be saved. It - // has the format of "projects/{projectId}/datasets/{datasetId}". - string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The BigQuery table where the query results will be saved. If - // this table does not exist, a new table with the given name will be - // created. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the action that occurs if the destination table or partition - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table or partition already exists, BigQuery - // overwrites the entire table or all the partitions data. - // * WRITE_APPEND: If the table or partition already exists, BigQuery - // appends the data to the table or the latest partition. - // * WRITE_EMPTY: If the table already exists and contains data, an error is - // returned. - string write_disposition = 3; - } - - // BigQuery destination where the query results will be saved. - BigQueryDestination bigquery_destination = 1; -} - -// QueryAssets request. -message QueryAssetsRequest { - // Required. The relative name of the root asset. This can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id"), or a project number (such as "projects/12345"), - // or a folder number (such as "folders/123"). - // - // Only assets belonging to the `parent` will be returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - oneof query { - // Optional. A SQL statement that's compatible with [BigQuery Standard - // SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). - string statement = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Reference to the query job, which is from the - // `QueryAssetsResponse` of previous `QueryAssets` call. - string job_reference = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The maximum number of rows to return in the results. Responses - // are limited to 10 MB and 1000 rows. - // - // By default, the maximum row count is 1000. When the byte or row count limit - // is reached, the rest of the query results will be paginated. - // - // The field will be ignored when [output_config] is specified. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token received from previous `QueryAssets`. - // - // The field will be ignored when [output_config] is specified. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the maximum amount of time that the client is willing - // to wait for the query to complete. By default, this limit is 5 min for the - // first query, and 1 minute for the following queries. If the query is - // complete, the `done` field in the `QueryAssetsResponse` is true, otherwise - // false. - // - // Like BigQuery [jobs.query - // API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) - // The call is not guaranteed to wait for the specified timeout; it typically - // returns after around 200 seconds (200,000 milliseconds), even if the query - // is not complete. - // - // The field will be ignored when [output_config] is specified. - google.protobuf.Duration timeout = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Specifies what time period or point in time to query asset metadata at. - // * unset - query asset metadata as it is right now - // * [read_time_window] - query asset metadata as it was at any point in time - // between [start_time] and [end_time]. - // * [read_time] - query asset metadata as it was at that point in time. - // If data for the timestamp/date range selected does not exist, - // it will simply return a valid response with no rows. - oneof time { - // Optional. [start_time] is required. [start_time] must be less than - // [end_time] Defaults [end_time] to now if [start_time] is set and - // [end_time] isn't. Maximum permitted time range is 7 days. - TimeWindow read_time_window = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Queries cloud assets as they appeared at the specified point in - // time. - google.protobuf.Timestamp read_time = 8 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. Destination where the query results will be saved. - // - // When this field is specified, the query results won't be saved in the - // [QueryAssetsResponse.query_result]. Instead - // [QueryAssetsResponse.output_config] will be set. - // - // Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used - // to check the status of the query job when passed to a following - // [QueryAssets] API call. - QueryAssetsOutputConfig output_config = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -// QueryAssets response. -message QueryAssetsResponse { - // Reference to a query job. - string job_reference = 1; - - // The query response, which can be either an `error` or a valid `response`. - // - // If `done` == `false` and the query result is being saved in a output, the - // output_config field will be set. - // If `done` == `true`, exactly one of - // `error`, `query_result` or `output_config` will be set. - bool done = 2; - - oneof response { - // Error status. - google.rpc.Status error = 3; - - // Result of the query. - QueryResult query_result = 4; - - // Output configuration which indicates instead of being returned in API - // response on the fly, the query result will be saved in a specific output. - QueryAssetsOutputConfig output_config = 5; - } -} - -// Execution results of the query. -// -// The result is formatted as rows represented by BigQuery compatible [schema]. -// When pagination is necessary, it will contains the page token to retrieve -// the results of following pages. -message QueryResult { - // Each row hold a query result in the format of `Struct`. - repeated google.protobuf.Struct rows = 1; - - // Describes the format of the [rows]. - TableSchema schema = 2; - - // Token to retrieve the next page of the results. - string next_page_token = 3; - - // Total rows of the whole query results. - int64 total_rows = 4; -} - -// BigQuery Compatible table schema. -message TableSchema { - // Describes the fields in a table. - repeated TableFieldSchema fields = 1; -} - -// A field in TableSchema. -message TableFieldSchema { - // The field name. The name must contain only letters (a-z, A-Z), - // numbers (0-9), or underscores (_), and must start with a letter or - // underscore. The maximum length is 128 characters. - string field = 1; - - // The field data type. Possible values include - // * STRING - // * BYTES - // * INTEGER - // * FLOAT - // * BOOLEAN - // * TIMESTAMP - // * DATE - // * TIME - // * DATETIME - // * GEOGRAPHY, - // * NUMERIC, - // * BIGNUMERIC, - // * RECORD - // (where RECORD indicates that the field contains a nested schema). - string type = 2; - - // The field mode. Possible values include NULLABLE, REQUIRED and - // REPEATED. The default value is NULLABLE. - string mode = 3; - - // Describes the nested schema fields if the type property is set - // to RECORD. - repeated TableFieldSchema fields = 4; -} - -// A request message for -// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]. -message BatchGetEffectiveIamPoliciesRequest { - // 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). - string scope = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { child_type: "*" } - ]; - - // 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. - repeated string names = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "*" } - ]; -} - -// A response message for -// [AssetService.BatchGetEffectiveIamPolicies][google.cloud.asset.v1.AssetService.BatchGetEffectiveIamPolicies]. -message BatchGetEffectiveIamPoliciesResponse { - // The effective IAM policies on one resource. - message EffectiveIamPolicy { - // The IAM policy and its attached resource. - message PolicyInfo { - // The full resource name the - // [policy][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.policy] - // is directly attached to. - string attached_resource = 1; - - // The IAM policy that's directly attached to the - // [attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource]. - google.iam.v1.Policy policy = 2; - } - - // The [full_resource_name] - // (https://cloud.google.com/asset-inventory/docs/resource-name-format) - // for which the - // [policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies] - // are computed. This is one of the - // [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names] - // the caller provides in the request. - string full_resource_name = 1; - - // The effective policies for the - // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]. - // - // These policies include the policy set on the - // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name] - // and those set on its parents and ancestors up to the - // [BatchGetEffectiveIamPoliciesRequest.scope][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.scope]. - // Note that these policies are not filtered according to the resource type - // of the - // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name]. - // - // These policies are hierarchically ordered by - // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource] - // starting from - // [full_resource_name][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.full_resource_name] - // itself to its parents and ancestors, such that policies[i]'s - // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource] - // is the child of policies[i+1]'s - // [PolicyInfo.attached_resource][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.PolicyInfo.attached_resource], - // if policies[i+1] exists. - repeated PolicyInfo policies = 2; - } - - // The effective policies for a batch of resources. Note that the results - // order is the same as the order of - // [BatchGetEffectiveIamPoliciesRequest.names][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesRequest.names]. - // When a resource does not have any effective IAM policies, its corresponding - // policy_result will contain empty - // [EffectiveIamPolicy.policies][google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse.EffectiveIamPolicy.policies]. - repeated EffectiveIamPolicy policy_results = 2; -} - -// Asset content type. -enum ContentType { - // Unspecified content type. - CONTENT_TYPE_UNSPECIFIED = 0; - - // Resource metadata. - RESOURCE = 1; - - // The actual IAM policy set on a resource. - IAM_POLICY = 2; - - // The Cloud Organization Policy set on an asset. - ORG_POLICY = 4; - - // The Cloud Access context manager Policy set on an asset. - ACCESS_POLICY = 5; - - // The runtime OS Inventory information. - OS_INVENTORY = 6; - - // The related resources. - RELATIONSHIP = 7; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto b/owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto deleted file mode 100644 index 83a23693..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/asset/v1/assets.proto +++ /dev/null @@ -1,919 +0,0 @@ -// 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.asset.v1; - -import "google/api/resource.proto"; -import "google/cloud/orgpolicy/v1/orgpolicy.proto"; -import "google/cloud/osconfig/v1/inventory.proto"; -import "google/iam/v1/policy.proto"; -import "google/identity/accesscontextmanager/v1/access_level.proto"; -import "google/identity/accesscontextmanager/v1/access_policy.proto"; -import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/code.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Asset.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetProto"; -option java_package = "com.google.cloud.asset.v1"; -option php_namespace = "Google\\Cloud\\Asset\\V1"; - -// An asset in Google Cloud and its temporal metadata, including the time window -// when it was observed and its status during that window. -message TemporalAsset { - // State of prior asset. - enum PriorAssetState { - // prior_asset is not applicable for the current asset. - PRIOR_ASSET_STATE_UNSPECIFIED = 0; - - // prior_asset is populated correctly. - PRESENT = 1; - - // Failed to set prior_asset. - INVALID = 2; - - // Current asset is the first known state. - DOES_NOT_EXIST = 3; - - // prior_asset is a deletion. - DELETED = 4; - } - - // The time window when the asset data and state was observed. - TimeWindow window = 1; - - // Whether the asset has been deleted or not. - bool deleted = 2; - - // An asset in Google Cloud. - Asset asset = 3; - - // State of prior_asset. - PriorAssetState prior_asset_state = 4; - - // Prior copy of the asset. Populated if prior_asset_state is PRESENT. - // Currently this is only set for responses in Real-Time Feed. - Asset prior_asset = 5; -} - -// A time window specified by its `start_time` and `end_time`. -message TimeWindow { - // Start time of the time window (exclusive). - google.protobuf.Timestamp start_time = 1; - - // End time of the time window (inclusive). If not specified, the current - // timestamp is used instead. - google.protobuf.Timestamp end_time = 2; -} - -// An asset in Google Cloud. An asset can be any resource in the Google Cloud -// [resource -// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), -// a resource outside the Google Cloud resource hierarchy (such as Google -// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy), -// or a relationship (e.g. an INSTANCE_TO_INSTANCEGROUP relationship). -// See [Supported asset -// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) -// for more information. -message Asset { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Asset" - pattern: "*" - }; - - // The last update timestamp of an asset. update_time is updated when - // create/update/delete operation is performed. - google.protobuf.Timestamp update_time = 11; - - // The full name of the asset. Example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` - // - // See [Resource - // names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string name = 1; - - // The type of the asset. Example: `compute.googleapis.com/Disk` - // - // See [Supported asset - // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) - // for more information. - string asset_type = 2; - - // A representation of the resource. - Resource resource = 3; - - // A representation of the Cloud IAM policy set on a Google Cloud resource. - // There can be a maximum of one Cloud IAM policy set on any given resource. - // In addition, Cloud IAM policies inherit their granted access scope from any - // policies set on parent resources in the resource hierarchy. Therefore, the - // effectively policy is the union of both the policy set on this resource - // and each policy set on all of the resource's ancestry resource levels in - // the hierarchy. See - // [this topic](https://cloud.google.com/iam/help/allow-policies/inheritance) - // for more information. - google.iam.v1.Policy iam_policy = 4; - - // A representation of an [organization - // policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). - // There can be more than one organization policy with different constraints - // set on a given resource. - repeated google.cloud.orgpolicy.v1.Policy org_policy = 6; - - // A representation of an [access - // policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies). - oneof access_context_policy { - // Please also refer to the [access policy user - // guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies). - google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7; - - // Please also refer to the [access level user - // guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels). - google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; - - // Please also refer to the [service perimeter user - // guide](https://cloud.google.com/vpc-service-controls/docs/overview). - google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = - 9; - } - - // A representation of runtime OS Inventory information. See [this - // topic](https://cloud.google.com/compute/docs/instances/os-inventory-management) - // for more information. - google.cloud.osconfig.v1.Inventory os_inventory = 12; - - // DEPRECATED. This field only presents for the purpose of - // backward-compatibility. The server will never generate responses with this - // field. - // The related assets of the asset of one relationship type. One asset - // only represents one type of relationship. - RelatedAssets related_assets = 13 [deprecated = true]; - - // One related asset of the current asset. - RelatedAsset related_asset = 15; - - // The ancestry path of an asset in Google Cloud [resource - // hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), - // represented as a list of relative resource names. An ancestry path starts - // with the closest ancestor in the hierarchy and ends at root. If the asset - // is a project, folder, or organization, the ancestry path starts from the - // asset itself. - // - // Example: `["projects/123456789", "folders/5432", "organizations/1234"]` - repeated string ancestors = 10; -} - -// A representation of a Google Cloud resource. -message Resource { - // The API version. Example: `v1` - string version = 1; - - // The URL of the discovery document containing the resource's JSON schema. - // Example: - // `https://www.googleapis.com/discovery/v1/apis/compute/v1/rest` - // - // This value is unspecified for resources that do not have an API based on a - // discovery document, such as Cloud Bigtable. - string discovery_document_uri = 2; - - // The JSON schema name listed in the discovery document. Example: - // `Project` - // - // This value is unspecified for resources that do not have an API based on a - // discovery document, such as Cloud Bigtable. - string discovery_name = 3; - - // The REST URL for accessing the resource. An HTTP `GET` request using this - // URL returns the resource itself. Example: - // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123` - // - // This value is unspecified for resources without a REST API. - string resource_url = 4; - - // The full name of the immediate parent of this resource. See - // [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - // - // For Google Cloud assets, this value is the parent resource defined in the - // [Cloud IAM policy - // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). - // Example: - // `//cloudresourcemanager.googleapis.com/projects/my_project_123` - // - // For third-party assets, this field may be set differently. - string parent = 5; - - // The content of the resource, in which some sensitive fields are removed - // and may not be present. - google.protobuf.Struct data = 6; - - // The location of the resource in Google Cloud, such as its zone and region. - // For more information, see https://cloud.google.com/about/locations/. - string location = 8; -} - -// DEPRECATED. This message only presents for the purpose of -// backward-compatibility. The server will never populate this message in -// responses. -// The detailed related assets with the `relationship_type`. -message RelatedAssets { - option deprecated = true; - - // The detailed relationship attributes. - RelationshipAttributes relationship_attributes = 1; - - // The peer resources of the relationship. - repeated RelatedAsset assets = 2; -} - -// DEPRECATED. This message only presents for the purpose of -// backward-compatibility. The server will never populate this message in -// responses. -// The relationship attributes which include `type`, `source_resource_type`, -// `target_resource_type` and `action`. -message RelationshipAttributes { - option deprecated = true; - - // The unique identifier of the relationship type. Example: - // `INSTANCE_TO_INSTANCEGROUP` - string type = 4; - - // The source asset type. Example: `compute.googleapis.com/Instance` - string source_resource_type = 1; - - // The target asset type. Example: `compute.googleapis.com/Disk` - string target_resource_type = 2; - - // The detail of the relationship, e.g. `contains`, `attaches` - string action = 3; -} - -// An asset identifier in Google Cloud which contains its name, type and -// ancestors. An asset can be any resource in the Google Cloud [resource -// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), -// a resource outside the Google Cloud resource hierarchy (such as Google -// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy). -// See [Supported asset -// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) -// for more information. -message RelatedAsset { - // The full name of the asset. Example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` - // - // See [Resource - // names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string asset = 1 [(google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Asset" - }]; - - // The type of the asset. Example: `compute.googleapis.com/Disk` - // - // See [Supported asset - // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) - // for more information. - string asset_type = 2; - - // The ancestors of an asset in Google Cloud [resource - // hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), - // represented as a list of relative resource names. An ancestry path starts - // with the closest ancestor in the hierarchy and ends at root. - // - // Example: `["projects/123456789", "folders/5432", "organizations/1234"]` - repeated string ancestors = 3; - - // The unique identifier of the relationship type. Example: - // `INSTANCE_TO_INSTANCEGROUP` - string relationship_type = 4; -} - -// A result of Resource Search, containing information of a cloud resource. -// Next ID: 29 -message ResourceSearchResult { - // The full resource name of this resource. Example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Cloud Asset Inventory Resource Name - // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) - // for more information. - // - // To search against the `name`: - // - // * use a field query. Example: `name:instance1` - // * use a free text query. Example: `instance1` - string name = 1; - - // The type of this resource. Example: `compute.googleapis.com/Disk`. - // - // To search against the `asset_type`: - // - // * specify the `asset_type` field in your search request. - string asset_type = 2; - - // The project that this resource belongs to, in the form of - // projects/{PROJECT_NUMBER}. This field is available when the resource - // belongs to a project. - // - // To search against `project`: - // - // * use a field query. Example: `project:12345` - // * use a free text query. Example: `12345` - // * specify the `scope` field as this project in your search request. - string project = 3; - - // The folder(s) that this resource belongs to, in the form of - // folders/{FOLDER_NUMBER}. This field is available when the resource - // belongs to one or more folders. - // - // To search against `folders`: - // - // * use a field query. Example: `folders:(123 OR 456)` - // * use a free text query. Example: `123` - // * specify the `scope` field as this folder in your search request. - repeated string folders = 17; - - // The organization that this resource belongs to, in the form of - // organizations/{ORGANIZATION_NUMBER}. This field is available when the - // resource belongs to an organization. - // - // To search against `organization`: - // - // * use a field query. Example: `organization:123` - // * use a free text query. Example: `123` - // * specify the `scope` field as this organization in your search request. - string organization = 18; - - // The display name of this resource. This field is available only when the - // resource's Protobuf contains it. - // - // To search against the `display_name`: - // - // * use a field query. Example: `displayName:"My Instance"` - // * use a free text query. Example: `"My Instance"` - string display_name = 4; - - // One or more paragraphs of text description of this resource. Maximum length - // could be up to 1M bytes. This field is available only when the resource's - // Protobuf contains it. - // - // To search against the `description`: - // - // * use a field query. Example: `description:"important instance"` - // * use a free text query. Example: `"important instance"` - string description = 5; - - // Location can be `global`, regional like `us-east1`, or zonal like - // `us-west1-b`. This field is available only when the resource's Protobuf - // contains it. - // - // To search against the `location`: - // - // * use a field query. Example: `location:us-west*` - // * use a free text query. Example: `us-west*` - string location = 6; - - // Labels associated with this resource. See [Labelling and grouping GCP - // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) - // for more information. This field is available only when the resource's - // Protobuf contains it. - // - // To search against the `labels`: - // - // * use a field query: - // - query on any label's key or value. Example: `labels:prod` - // - query by a given label. Example: `labels.env:prod` - // - query by a given label's existence. Example: `labels.env:*` - // * use a free text query. Example: `prod` - map labels = 7; - - // Network tags associated with this resource. Like labels, network tags are a - // type of annotations used to group GCP resources. See [Labelling GCP - // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) - // for more information. This field is available only when the resource's - // Protobuf contains it. - // - // To search against the `network_tags`: - // - // * use a field query. Example: `networkTags:internal` - // * use a free text query. Example: `internal` - repeated string network_tags = 8; - - // The Cloud KMS - // [CryptoKey](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys) - // name or - // [CryptoKeyVersion](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions) - // name. This field is available only when the resource's Protobuf contains - // it. - // - // To search against the `kms_key`: - // - // * use a field query. Example: `kmsKey:key` - // * use a free text query. Example: `key` - string kms_key = 10; - - // The create timestamp of this resource, at which the resource was created. - // The granularity is in seconds. Timestamp.nanos will always be 0. This field - // is available only when the resource's Protobuf contains it. - // - // To search against `create_time`: - // - // * use a field query. - // - value in seconds since unix epoch. Example: `createTime > 1609459200` - // - value in date string. Example: `createTime > 2021-01-01` - // - value in date-time string (must be quoted). Example: `createTime > - // "2021-01-01T00:00:00"` - google.protobuf.Timestamp create_time = 11; - - // The last update timestamp of this resource, at which the resource was last - // modified or deleted. The granularity is in seconds. Timestamp.nanos will - // always be 0. This field is available only when the resource's Protobuf - // contains it. - // - // To search against `update_time`: - // - // * use a field query. - // - value in seconds since unix epoch. Example: `updateTime < 1609459200` - // - value in date string. Example: `updateTime < 2021-01-01` - // - value in date-time string (must be quoted). Example: `updateTime < - // "2021-01-01T00:00:00"` - google.protobuf.Timestamp update_time = 12; - - // The state of this resource. Different resources types have different state - // definitions that are mapped from various fields of different resource - // types. This field is available only when the resource's Protobuf contains - // it. - // - // Example: - // If the resource is an instance provided by Compute Engine, - // its state will include PROVISIONING, STAGING, RUNNING, STOPPING, - // SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. See `status` definition - // in [API - // Reference](https://cloud.google.com/compute/docs/reference/rest/v1/instances). - // If the resource is a project provided by Cloud Resource Manager, its state - // will include LIFECYCLE_STATE_UNSPECIFIED, ACTIVE, DELETE_REQUESTED and - // DELETE_IN_PROGRESS. See `lifecycleState` definition in [API - // Reference](https://cloud.google.com/resource-manager/reference/rest/v1/projects). - // - // To search against the `state`: - // - // * use a field query. Example: `state:RUNNING` - // * use a free text query. Example: `RUNNING` - string state = 13; - - // The additional searchable attributes of this resource. The attributes may - // vary from one resource type to another. Examples: `projectId` for Project, - // `dnsName` for DNS ManagedZone. This field contains a subset of the resource - // metadata fields that are returned by the List or Get APIs provided by the - // corresponding GCP service (e.g., Compute Engine). see [API references and - // supported searchable - // attributes](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types) - // to see which fields are included. - // - // You can search values of these fields through free text search. However, - // you should not consume the field programically as the field names and - // values may change as the GCP service updates to a new incompatible API - // version. - // - // To search against the `additional_attributes`: - // - // * use a free text query to match the attributes values. Example: to search - // `additional_attributes = { dnsName: "foobar" }`, you can issue a query - // `foobar`. - google.protobuf.Struct additional_attributes = 9; - - // The full resource name of this resource's parent, if it has one. - // To search against the `parent_full_resource_name`: - // - // * use a field query. Example: - // `parentFullResourceName:"project-name"` - // * use a free text query. Example: - // `project-name` - string parent_full_resource_name = 19; - - // Versioned resource representations of this resource. This is repeated - // because there could be multiple versions of resource representations during - // version migration. - // - // This `versioned_resources` field is not searchable. Some attributes of the - // resource representations are exposed in `additional_attributes` field, so - // as to allow users to search on them. - repeated VersionedResource versioned_resources = 16; - - // Attached resources of this resource. For example, an OSConfig - // Inventory is an attached resource of a Compute Instance. This field is - // repeated because a resource could have multiple attached resources. - // - // This `attached_resources` field is not searchable. Some attributes - // of the attached resources are exposed in `additional_attributes` field, so - // as to allow users to search on them. - repeated AttachedResource attached_resources = 20; - - // A map of related resources of this resource, keyed by the - // relationship type. A relationship type is in the format of - // {SourceType}_{ACTION}_{DestType}. Example: `DISK_TO_INSTANCE`, - // `DISK_TO_NETWORK`, `INSTANCE_TO_INSTANCEGROUP`. - // See [supported relationship - // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types#supported_relationship_types). - map relationships = 21; - - // TagKey namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}. - // To search against the `tagKeys`: - // - // * use a field query. Example: - // - `tagKeys:"123456789/env*"` - // - `tagKeys="123456789/env"` - // - `tagKeys:"env"` - // - // * use a free text query. Example: - // - `env` - repeated string tag_keys = 23; - - // TagValue namespaced names, in the format of - // {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}. - // To search against the `tagValues`: - // - // * use a field query. Example: - // - `tagValues:"env"` - // - `tagValues:"env/prod"` - // - `tagValues:"123456789/env/prod*"` - // - `tagValues="123456789/env/prod"` - // - // * use a free text query. Example: - // - `prod` - repeated string tag_values = 25; - - // TagValue IDs, in the format of tagValues/{TAG_VALUE_ID}. - // To search against the `tagValueIds`: - // - // * use a field query. Example: - // - `tagValueIds:"456"` - // - `tagValueIds="tagValues/456"` - // - // * use a free text query. Example: - // - `456` - repeated string tag_value_ids = 26; - - // The type of this resource's immediate parent, if there is one. - // - // To search against the `parent_asset_type`: - // - // * use a field query. Example: - // `parentAssetType:"cloudresourcemanager.googleapis.com/Project"` - // * use a free text query. Example: - // `cloudresourcemanager.googleapis.com/Project` - string parent_asset_type = 103; -} - -// Resource representation as defined by the corresponding service providing the -// resource for a given API version. -message VersionedResource { - // API version of the resource. - // - // Example: - // If the resource is an instance provided by Compute Engine v1 API as defined - // in `https://cloud.google.com/compute/docs/reference/rest/v1/instances`, - // version will be "v1". - string version = 1; - - // JSON representation of the resource as defined by the corresponding - // service providing this resource. - // - // Example: - // If the resource is an instance provided by Compute Engine, this field will - // contain the JSON representation of the instance as defined by Compute - // Engine: - // `https://cloud.google.com/compute/docs/reference/rest/v1/instances`. - // - // You can find the resource definition for each supported resource type in - // this table: - // `https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types` - google.protobuf.Struct resource = 2; -} - -// Attached resource representation, which is defined by the corresponding -// service provider. It represents an attached resource's payload. -message AttachedResource { - // The type of this attached resource. - // - // Example: `osconfig.googleapis.com/Inventory` - // - // You can find the supported attached asset types of each resource in this - // table: - // `https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types` - string asset_type = 1; - - // Versioned resource representations of this attached resource. This is - // repeated because there could be multiple versions of the attached resource - // representations during version migration. - repeated VersionedResource versioned_resources = 3; -} - -// The related resources of the primary resource. -message RelatedResources { - // The detailed related resources of the primary resource. - repeated RelatedResource related_resources = 1; -} - -// The detailed related resource. -message RelatedResource { - // The type of the asset. Example: `compute.googleapis.com/Instance` - string asset_type = 1; - - // The full resource name of the related resource. Example: - // `//compute.googleapis.com/projects/my_proj_123/zones/instance/instance123` - string full_resource_name = 2; -} - -// A result of IAM Policy search, containing information of an IAM policy. -message IamPolicySearchResult { - // Explanation about the IAM policy search result. - message Explanation { - // IAM permissions - message Permissions { - // A list of permissions. A sample permission string: `compute.disk.get`. - repeated string permissions = 1; - } - - // The map from roles to their included permissions that match the - // permission query (i.e., a query containing `policy.role.permissions:`). - // Example: if query `policy.role.permissions:compute.disk.get` - // matches a policy binding that contains owner role, the - // matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The - // roles can also be found in the returned `policy` bindings. Note that the - // map is populated only for requests with permission queries. - map matched_permissions = 1; - } - - // The full resource name of the resource associated with this IAM policy. - // Example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Cloud Asset Inventory Resource Name - // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) - // for more information. - // - // To search against the `resource`: - // - // * use a field query. Example: `resource:organizations/123` - string resource = 1; - - // The type of the resource associated with this IAM policy. Example: - // `compute.googleapis.com/Disk`. - // - // To search against the `asset_type`: - // - // * specify the `asset_types` field in your search request. - string asset_type = 5; - - // The project that the associated GCP resource belongs to, in the form of - // projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource (like VM - // instance, Cloud Storage bucket), the project field will indicate the - // project that contains the resource. If an IAM policy is set on a folder or - // orgnization, this field will be empty. - // - // To search against the `project`: - // - // * specify the `scope` field as this project in your search request. - string project = 2; - - // The folder(s) that the IAM policy belongs to, in the form of - // folders/{FOLDER_NUMBER}. This field is available when the IAM policy - // belongs to one or more folders. - // - // To search against `folders`: - // - // * use a field query. Example: `folders:(123 OR 456)` - // * use a free text query. Example: `123` - // * specify the `scope` field as this folder in your search request. - repeated string folders = 6; - - // The organization that the IAM policy belongs to, in the form - // of organizations/{ORGANIZATION_NUMBER}. This field is available when the - // IAM policy belongs to an organization. - // - // To search against `organization`: - // - // * use a field query. Example: `organization:123` - // * use a free text query. Example: `123` - // * specify the `scope` field as this organization in your search request. - string organization = 7; - - // The IAM policy directly set on the given resource. Note that the original - // IAM policy can contain multiple bindings. This only contains the bindings - // that match the given query. For queries that don't contain a constrain on - // policies (e.g., an empty query), this contains all the bindings. - // - // To search against the `policy` bindings: - // - // * use a field query: - // - query by the policy contained members. Example: - // `policy:amy@gmail.com` - // - query by the policy contained roles. Example: - // `policy:roles/compute.admin` - // - query by the policy contained roles' included permissions. Example: - // `policy.role.permissions:compute.instances.create` - google.iam.v1.Policy policy = 3; - - // Explanation about the IAM policy search result. It contains additional - // information to explain why the search result matches the query. - Explanation explanation = 4; -} - -// Represents the detailed state of an entity under analysis, such as a -// resource, an identity or an access. -message IamPolicyAnalysisState { - // The Google standard error code that best describes the state. - // For example: - // - OK means the analysis on this entity has been successfully finished; - // - PERMISSION_DENIED means an access denied error is encountered; - // - DEADLINE_EXCEEDED means the analysis on this entity hasn't been started - // in time; - google.rpc.Code code = 1; - - // The human-readable description of the cause of failure. - string cause = 2; -} - -// The Condition evaluation. -message ConditionEvaluation { - // Value of this expression. - enum EvaluationValue { - // Reserved for future use. - EVALUATION_VALUE_UNSPECIFIED = 0; - - // The evaluation result is `true`. - TRUE = 1; - - // The evaluation result is `false`. - FALSE = 2; - - // The evaluation result is `conditional` when the condition expression - // contains variables that are either missing input values or have not been - // supported by Analyzer yet. - CONDITIONAL = 3; - } - - // The evaluation result. - EvaluationValue evaluation_value = 1; -} - -// IAM Policy analysis result, consisting of one IAM policy binding and derived -// access control lists. -message IamPolicyAnalysisResult { - // A Google Cloud resource under analysis. - message Resource { - // The [full resource - // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) - string full_resource_name = 1; - - // The analysis state of this resource. - IamPolicyAnalysisState analysis_state = 2; - } - - // An IAM role or permission under analysis. - message Access { - oneof oneof_access { - // The role. - string role = 1; - - // The permission. - string permission = 2; - } - - // The analysis state of this access. - IamPolicyAnalysisState analysis_state = 3; - } - - // An identity under analysis. - message Identity { - // The identity name in any form of members appear in - // [IAM policy - // binding](https://cloud.google.com/iam/reference/rest/v1/Binding), such - // as: - // - user:foo@google.com - // - group:group1@google.com - // - serviceAccount:s1@prj1.iam.gserviceaccount.com - // - projectOwner:some_project_id - // - domain:google.com - // - allUsers - // - etc. - string name = 1; - - // The analysis state of this identity. - IamPolicyAnalysisState analysis_state = 2; - } - - // A directional edge. - message Edge { - // The source node of the edge. For example, it could be a full resource - // name for a resource node or an email of an identity. - string source_node = 1; - - // The target node of the edge. For example, it could be a full resource - // name for a resource node or an email of an identity. - string target_node = 2; - } - - // An access control list, derived from the above IAM policy binding, which - // contains a set of resources and accesses. May include one - // item from each set to compose an access control entry. - // - // NOTICE that there could be multiple access control lists for one IAM policy - // binding. The access control lists are created based on resource and access - // combinations. - // - // For example, assume we have the following cases in one IAM policy binding: - // - Permission P1 and P2 apply to resource R1 and R2; - // - Permission P3 applies to resource R2 and R3; - // - // This will result in the following access control lists: - // - AccessControlList 1: [R1, R2], [P1, P2] - // - AccessControlList 2: [R2, R3], [P3] - message AccessControlList { - // The resources that match one of the following conditions: - // - The resource_selector, if it is specified in request; - // - Otherwise, resources reachable from the policy attached resource. - repeated Resource resources = 1; - - // The accesses that match one of the following conditions: - // - The access_selector, if it is specified in request; - // - Otherwise, access specifiers reachable from the policy binding's role. - repeated Access accesses = 2; - - // Resource edges of the graph starting from the policy attached - // resource to any descendant resources. The - // [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] - // contains the full resource name of a parent resource and - // [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node] - // contains the full resource name of a child resource. This field is - // present only if the output_resource_edges option is enabled in request. - repeated Edge resource_edges = 3; - - // Condition evaluation for this AccessControlList, if there is a condition - // defined in the above IAM policy binding. - ConditionEvaluation condition_evaluation = 4; - } - - // The identities and group edges. - message IdentityList { - // Only the identities that match one of the following conditions will be - // presented: - // - The identity_selector, if it is specified in request; - // - Otherwise, identities reachable from the policy binding's members. - repeated Identity identities = 1; - - // Group identity edges of the graph starting from the binding's - // group members to any node of the - // [identities][google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities]. - // The - // [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] - // contains a group, such as `group:parent@google.com`. The - // [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node] - // contains a member of the group, such as `group:child@google.com` or - // `user:foo@google.com`. This field is present only if the - // output_group_edges option is enabled in request. - repeated Edge group_edges = 2; - } - - // The [full resource - // name](https://cloud.google.com/asset-inventory/docs/resource-name-format) - // of the resource to which the - // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] - // policy attaches. - string attached_resource_full_name = 1; - - // The Cloud IAM policy binding under analysis. - google.iam.v1.Binding iam_binding = 2; - - // The access control lists derived from the - // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] - // that match or potentially match resource and access selectors specified in - // the request. - repeated AccessControlList access_control_lists = 3; - - // The identity list derived from members of the - // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] - // that match or potentially match identity selector specified in the request. - IdentityList identity_list = 4; - - // Represents whether all analyses on the - // [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] - // have successfully finished. - bool fully_explored = 5; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto deleted file mode 100644 index 92c2b81c..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/inventory.proto +++ /dev/null @@ -1,384 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/date.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_multiple_files = true; -option java_outer_classname = "Inventories"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// OS Config Inventory is a service for collecting and reporting operating -// system and package information on VM instances. - -// This API resource represents the available inventory data for a -// Compute Engine virtual machine (VM) instance at a given point in time. -// -// You can use this API resource to determine the inventory data of your VM. -// -// For more information, see [Information provided by OS inventory -// management](https://cloud.google.com/compute/docs/instances/os-inventory-management#data-collected). -message Inventory { - option (google.api.resource) = { - type: "osconfig.googleapis.com/Inventory" - pattern: "projects/{project}/locations/{location}/instances/{instance}/inventory" - }; - - // Operating system information for the VM. - message OsInfo { - // The VM hostname. - string hostname = 9; - - // The operating system long name. - // For example 'Debian GNU/Linux 9' or 'Microsoft Window Server 2019 - // Datacenter'. - string long_name = 2; - - // The operating system short name. - // For example, 'windows' or 'debian'. - string short_name = 3; - - // The version of the operating system. - string version = 4; - - // The system architecture of the operating system. - string architecture = 5; - - // The kernel version of the operating system. - string kernel_version = 6; - - // The kernel release of the operating system. - string kernel_release = 7; - - // The current version of the OS Config agent running on the VM. - string osconfig_agent_version = 8; - } - - // A single piece of inventory on a VM. - message Item { - // The origin of a specific inventory item. - enum OriginType { - // Invalid. An origin type must be specified. - ORIGIN_TYPE_UNSPECIFIED = 0; - - // This inventory item was discovered as the result of the agent - // reporting inventory via the reporting API. - INVENTORY_REPORT = 1; - } - - // The different types of inventory that are tracked on a VM. - enum Type { - // Invalid. An type must be specified. - TYPE_UNSPECIFIED = 0; - - // This represents a package that is installed on the VM. - INSTALLED_PACKAGE = 1; - - // This represents an update that is available for a package. - AVAILABLE_PACKAGE = 2; - } - - // Identifier for this item, unique across items for this VM. - string id = 1; - - // The origin of this inventory item. - OriginType origin_type = 2; - - // When this inventory item was first detected. - google.protobuf.Timestamp create_time = 8; - - // When this inventory item was last modified. - google.protobuf.Timestamp update_time = 9; - - // The specific type of inventory, correlating to its specific details. - Type type = 5; - - // Specific details of this inventory item based on its type. - oneof details { - // Software package present on the VM instance. - SoftwarePackage installed_package = 6; - - // Software package available to be installed on the VM instance. - SoftwarePackage available_package = 7; - } - } - - // Software package information of the operating system. - message SoftwarePackage { - // Information about the different types of software packages. - oneof details { - // Yum package info. - // For details about the yum package manager, see - // https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-yum. - VersionedPackage yum_package = 1; - - // Details of an APT package. - // For details about the apt package manager, see - // https://wiki.debian.org/Apt. - VersionedPackage apt_package = 2; - - // Details of a Zypper package. - // For details about the Zypper package manager, see - // https://en.opensuse.org/SDB:Zypper_manual. - VersionedPackage zypper_package = 3; - - // Details of a Googet package. - // For details about the googet package manager, see - // https://github.com/google/googet. - VersionedPackage googet_package = 4; - - // Details of a Zypper patch. - // For details about the Zypper package manager, see - // https://en.opensuse.org/SDB:Zypper_manual. - ZypperPatch zypper_patch = 5; - - // Details of a Windows Update package. - // See https://docs.microsoft.com/en-us/windows/win32/api/_wua/ for - // information about Windows Update. - WindowsUpdatePackage wua_package = 6; - - // Details of a Windows Quick Fix engineering package. - // See - // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering - // for info in Windows Quick Fix Engineering. - WindowsQuickFixEngineeringPackage qfe_package = 7; - - // Details of a COS package. - VersionedPackage cos_package = 8; - - // Details of Windows Application. - WindowsApplication windows_application = 9; - } - } - - // Information related to the a standard versioned package. This includes - // package info for APT, Yum, Zypper, and Googet package managers. - message VersionedPackage { - // The name of the package. - string package_name = 4; - - // The system architecture this package is intended for. - string architecture = 2; - - // The version of the package. - string version = 3; - } - - // Details related to a Zypper Patch. - message ZypperPatch { - // The name of the patch. - string patch_name = 5; - - // The category of the patch. - string category = 2; - - // The severity specified for this patch - string severity = 3; - - // Any summary information provided about this patch. - string summary = 4; - } - - // Details related to a Windows Update package. - // Field data and names are taken from Windows Update API IUpdate Interface: - // https://docs.microsoft.com/en-us/windows/win32/api/_wua/ - // Descriptive fields like title, and description are localized based on - // the locale of the VM being updated. - message WindowsUpdatePackage { - // Categories specified by the Windows Update. - message WindowsUpdateCategory { - // The identifier of the windows update category. - string id = 1; - - // The name of the windows update category. - string name = 2; - } - - // The localized title of the update package. - string title = 1; - - // The localized description of the update package. - string description = 2; - - // The categories that are associated with this update package. - repeated WindowsUpdateCategory categories = 3; - - // A collection of Microsoft Knowledge Base article IDs that are associated - // with the update package. - repeated string kb_article_ids = 4; - - // A hyperlink to the language-specific support information for the update. - string support_url = 11; - - // A collection of URLs that provide more information about the update - // package. - repeated string more_info_urls = 5; - - // Gets the identifier of an update package. Stays the same across - // revisions. - string update_id = 6; - - // The revision number of this update package. - int32 revision_number = 7; - - // The last published date of the update, in (UTC) date and time. - google.protobuf.Timestamp last_deployment_change_time = 10; - } - - // Information related to a Quick Fix Engineering package. - // Fields are taken from Windows QuickFixEngineering Interface and match - // the source names: - // https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering - message WindowsQuickFixEngineeringPackage { - // A short textual description of the QFE update. - string caption = 1; - - // A textual description of the QFE update. - string description = 2; - - // Unique identifier associated with a particular QFE update. - string hot_fix_id = 3; - - // Date that the QFE update was installed. Mapped from installed_on field. - google.protobuf.Timestamp install_time = 5; - } - - // Contains information about a Windows application that is retrieved from the - // Windows Registry. For more information about these fields, see: - // https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key - message WindowsApplication { - // The name of the application or product. - string display_name = 1; - - // The version of the product or application in string format. - string display_version = 2; - - // The name of the manufacturer for the product or application. - string publisher = 3; - - // The last time this product received service. The value of this property - // is replaced each time a patch is applied or removed from the product or - // the command-line option is used to repair the product. - google.type.Date install_date = 4; - - // The internet address for technical support. - string help_link = 5; - } - - // Output only. The `Inventory` API resource name. - // - // Format: - // `projects/{project_number}/locations/{location}/instances/{instance_id}/inventory` - string name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Base level operating system information for the VM. - OsInfo os_info = 1; - - // Inventory items related to the VM keyed by an opaque unique identifier for - // each inventory item. The identifier is unique to each distinct and - // addressable inventory item and will change, when there is a new package - // version. - map items = 2; - - // Output only. Timestamp of the last reported inventory for the VM. - google.protobuf.Timestamp update_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A request message for getting inventory data for the specified VM. -message GetInventoryRequest { - // Required. API resource name for inventory resource. - // - // Format: - // `projects/{project}/locations/{location}/instances/{instance}/inventory` - // - // For `{project}`, either `project-number` or `project-id` can be provided. - // For `{instance}`, either Compute Engine `instance-id` or `instance-name` - // can be provided. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/Inventory" - } - ]; - - // Inventory view indicating what information should be included in the - // inventory resource. If unspecified, the default view is BASIC. - InventoryView view = 2; -} - -// A request message for listing inventory data for all VMs in the specified -// location. -message ListInventoriesRequest { - // Required. The parent resource name. - // - // Format: `projects/{project}/locations/{location}/instances/-` - // - // For `{project}`, either `project-number` or `project-id` can be provided. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - } - ]; - - // Inventory view indicating what information should be included in the - // inventory resource. If unspecified, the default view is BASIC. - InventoryView view = 2; - - // The maximum number of results to return. - int32 page_size = 3; - - // A pagination token returned from a previous call to - // `ListInventories` that indicates where this listing - // should continue from. - string page_token = 4; - - // If provided, this field specifies the criteria that must be met by a - // `Inventory` API resource to be included in the response. - string filter = 5; -} - -// A response message for listing inventory data for all VMs in a specified -// location. -message ListInventoriesResponse { - // List of inventory objects. - repeated Inventory inventories = 1; - - // The pagination token to retrieve the next page of inventory objects. - string next_page_token = 2; -} - -// The view for inventory objects. -enum InventoryView { - // The default value. - // The API defaults to the BASIC view. - INVENTORY_VIEW_UNSPECIFIED = 0; - - // Returns the basic inventory information that includes `os_info`. - BASIC = 1; - - // Returns all fields. - FULL = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto deleted file mode 100644 index de0db191..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy.proto +++ /dev/null @@ -1,548 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_multiple_files = true; -option java_outer_classname = "OsPolicyProto"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// An OS policy defines the desired state configuration for a VM. -message OSPolicy { - // Policy mode - enum Mode { - // Invalid mode - MODE_UNSPECIFIED = 0; - - // This mode checks if the configuration resources in the policy are in - // their desired state. No actions are performed if they are not in the - // desired state. This mode is used for reporting purposes. - VALIDATION = 1; - - // This mode checks if the configuration resources in the policy are in - // their desired state, and if not, enforces the desired state. - ENFORCEMENT = 2; - } - - // Filtering criteria to select VMs based on inventory details. - message InventoryFilter { - // Required. The OS short name - string os_short_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The OS version - // - // Prefix matches are supported if asterisk(*) is provided as the - // last character. For example, to match all versions with a major - // version of `7`, specify the following value for this field `7.*` - // - // An empty string matches all OS versions. - string os_version = 2; - } - - // An OS policy resource is used to define the desired state configuration - // and provides a specific functionality like installing/removing packages, - // executing a script etc. - // - // The system ensures that resources are always in their desired state by - // taking necessary actions if they have drifted from their desired state. - message Resource { - // A remote or local file. - message File { - // Specifies a file available via some URI. - message Remote { - // Required. URI from which to fetch the object. It should contain both - // the protocol and path following the format `{protocol}://{location}`. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // SHA256 checksum of the remote file. - string sha256_checksum = 2; - } - - // Specifies a file available as a Cloud Storage Object. - message Gcs { - // Required. Bucket of the Cloud Storage object. - string bucket = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Name of the Cloud Storage object. - string object = 2 [(google.api.field_behavior) = REQUIRED]; - - // Generation number of the Cloud Storage object. - int64 generation = 3; - } - - // A specific type of file. - oneof type { - // A generic remote file. - Remote remote = 1; - - // A Cloud Storage object. - Gcs gcs = 2; - - // A local path within the VM to use. - string local_path = 3; - } - - // Defaults to false. When false, files are subject to validations - // based on the file type: - // - // Remote: A checksum must be specified. - // Cloud Storage: An object generation number must be specified. - bool allow_insecure = 4; - } - - // A resource that manages a system package. - message PackageResource { - // The desired state that the OS Config agent maintains on the VM. - enum DesiredState { - // Unspecified is invalid. - DESIRED_STATE_UNSPECIFIED = 0; - - // Ensure that the package is installed. - INSTALLED = 1; - - // The agent ensures that the package is not installed and - // uninstalls it if detected. - REMOVED = 2; - } - - // A deb package file. dpkg packages only support INSTALLED state. - message Deb { - // Required. A deb package. - File source = 1 [(google.api.field_behavior) = REQUIRED]; - - // Whether dependencies should also be installed. - // - install when false: `dpkg -i package` - // - install when true: `apt-get update && apt-get -y install - // package.deb` - bool pull_deps = 2; - } - - // A package managed by APT. - // - install: `apt-get update && apt-get -y install [name]` - // - remove: `apt-get -y remove [name]` - message APT { - // Required. Package name. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // An RPM package file. RPM packages only support INSTALLED state. - message RPM { - // Required. An rpm package. - File source = 1 [(google.api.field_behavior) = REQUIRED]; - - // Whether dependencies should also be installed. - // - install when false: `rpm --upgrade --replacepkgs package.rpm` - // - install when true: `yum -y install package.rpm` or - // `zypper -y install package.rpm` - bool pull_deps = 2; - } - - // A package managed by YUM. - // - install: `yum -y install package` - // - remove: `yum -y remove package` - message YUM { - // Required. Package name. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // A package managed by Zypper. - // - install: `zypper -y install package` - // - remove: `zypper -y rm package` - message Zypper { - // Required. Package name. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // A package managed by GooGet. - // - install: `googet -noconfirm install package` - // - remove: `googet -noconfirm remove package` - message GooGet { - // Required. Package name. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // An MSI package. MSI packages only support INSTALLED state. - message MSI { - // Required. The MSI package. - File source = 1 [(google.api.field_behavior) = REQUIRED]; - - // Additional properties to use during installation. - // This should be in the format of Property=Setting. - // Appended to the defaults of `ACTION=INSTALL - // REBOOT=ReallySuppress`. - repeated string properties = 2; - } - - // Required. The desired state the agent should maintain for this package. - DesiredState desired_state = 1 [(google.api.field_behavior) = REQUIRED]; - - // A system package. - oneof system_package { - // A package managed by Apt. - APT apt = 2; - - // A deb package file. - Deb deb = 3; - - // A package managed by YUM. - YUM yum = 4; - - // A package managed by Zypper. - Zypper zypper = 5; - - // An rpm package file. - RPM rpm = 6; - - // A package managed by GooGet. - GooGet googet = 7; - - // An MSI package. - MSI msi = 8; - } - } - - // A resource that manages a package repository. - message RepositoryResource { - // Represents a single apt package repository. These will be added to - // a repo file that will be managed at - // `/etc/apt/sources.list.d/google_osconfig.list`. - message AptRepository { - // Type of archive. - enum ArchiveType { - // Unspecified is invalid. - ARCHIVE_TYPE_UNSPECIFIED = 0; - - // Deb indicates that the archive contains binary files. - DEB = 1; - - // Deb-src indicates that the archive contains source files. - DEB_SRC = 2; - } - - // Required. Type of archive files in this repository. - ArchiveType archive_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. URI for this repository. - string uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Distribution of this repository. - string distribution = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. List of components for this repository. Must contain at - // least one item. - repeated string components = 4 [(google.api.field_behavior) = REQUIRED]; - - // URI of the key file for this repository. The agent maintains a - // keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`. - string gpg_key = 5; - } - - // Represents a single yum package repository. These are added to a - // repo file that is managed at - // `/etc/yum.repos.d/google_osconfig.repo`. - message YumRepository { - // Required. A one word, unique name for this repository. This is the - // `repo id` in the yum config file and also the `display_name` if - // `display_name` is omitted. This id is also used as the unique - // identifier when checking for resource conflicts. - string id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The display name of the repository. - string display_name = 2; - - // Required. The location of the repository directory. - string base_url = 3 [(google.api.field_behavior) = REQUIRED]; - - // URIs of GPG keys. - repeated string gpg_keys = 4; - } - - // Represents a single zypper package repository. These are added to a - // repo file that is managed at - // `/etc/zypp/repos.d/google_osconfig.repo`. - message ZypperRepository { - // Required. A one word, unique name for this repository. This is the - // `repo id` in the zypper config file and also the `display_name` if - // `display_name` is omitted. This id is also used as the unique - // identifier when checking for GuestPolicy conflicts. - string id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The display name of the repository. - string display_name = 2; - - // Required. The location of the repository directory. - string base_url = 3 [(google.api.field_behavior) = REQUIRED]; - - // URIs of GPG keys. - repeated string gpg_keys = 4; - } - - // Represents a Goo package repository. These are added to a repo file - // that is managed at - // `C:/ProgramData/GooGet/repos/google_osconfig.repo`. - message GooRepository { - // Required. The name of the repository. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The url of the repository. - string url = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // A specific type of repository. - oneof repository { - // An Apt Repository. - AptRepository apt = 1; - - // A Yum Repository. - YumRepository yum = 2; - - // A Zypper Repository. - ZypperRepository zypper = 3; - - // A Goo Repository. - GooRepository goo = 4; - } - } - - // A resource that allows executing scripts on the VM. - // - // The `ExecResource` has 2 stages: `validate` and `enforce` and both stages - // accept a script as an argument to execute. - // - // When the `ExecResource` is applied by the agent, it first executes the - // script in the `validate` stage. The `validate` stage can signal that the - // `ExecResource` is already in the desired state by returning an exit code - // of `100`. If the `ExecResource` is not in the desired state, it should - // return an exit code of `101`. Any other exit code returned by this stage - // is considered an error. - // - // If the `ExecResource` is not in the desired state based on the exit code - // from the `validate` stage, the agent proceeds to execute the script from - // the `enforce` stage. If the `ExecResource` is already in the desired - // state, the `enforce` stage will not be run. - // Similar to `validate` stage, the `enforce` stage should return an exit - // code of `100` to indicate that the resource in now in its desired state. - // Any other exit code is considered an error. - // - // NOTE: An exit code of `100` was chosen over `0` (and `101` vs `1`) to - // have an explicit indicator of `in desired state`, `not in desired state` - // and errors. Because, for example, Powershell will always return an exit - // code of `0` unless an `exit` statement is provided in the script. So, for - // reasons of consistency and being explicit, exit codes `100` and `101` - // were chosen. - message ExecResource { - // A file or script to execute. - message Exec { - // The interpreter to use. - enum Interpreter { - // Invalid value, the request will return validation error. - INTERPRETER_UNSPECIFIED = 0; - - // If an interpreter is not specified, the - // source is executed directly. This execution, without an - // interpreter, only succeeds for executables and scripts that have shebang lines. - NONE = 1; - - // Indicates that the script runs with `/bin/sh` on Linux and - // `cmd.exe` on Windows. - SHELL = 2; - - // Indicates that the script runs with PowerShell. - POWERSHELL = 3; - } - - // What to execute. - oneof source { - // A remote or local file. - File file = 1; - - // An inline script. - // The size of the script is limited to 1024 characters. - string script = 2; - } - - // Optional arguments to pass to the source during execution. - repeated string args = 3; - - // Required. The script interpreter to use. - Interpreter interpreter = 4 [(google.api.field_behavior) = REQUIRED]; - - // Only recorded for enforce Exec. - // Path to an output file (that is created by this Exec) whose - // content will be recorded in OSPolicyResourceCompliance after a - // successful run. Absence or failure to read this file will result in - // this ExecResource being non-compliant. Output file size is limited to - // 100K bytes. - string output_file_path = 5; - } - - // Required. What to run to validate this resource is in the desired - // state. An exit code of 100 indicates "in desired state", and exit code - // of 101 indicates "not in desired state". Any other exit code indicates - // a failure running validate. - Exec validate = 1 [(google.api.field_behavior) = REQUIRED]; - - // What to run to bring this resource into the desired state. - // An exit code of 100 indicates "success", any other exit code indicates - // a failure running enforce. - Exec enforce = 2; - } - - // A resource that manages the state of a file. - message FileResource { - // Desired state of the file. - enum DesiredState { - // Unspecified is invalid. - DESIRED_STATE_UNSPECIFIED = 0; - - // Ensure file at path is present. - PRESENT = 1; - - // Ensure file at path is absent. - ABSENT = 2; - - // Ensure the contents of the file at path matches. If the file does - // not exist it will be created. - CONTENTS_MATCH = 3; - } - - // The source for the contents of the file. - oneof source { - // A remote or local source. - File file = 1; - - // A a file with this content. - // The size of the content is limited to 1024 characters. - string content = 2; - } - - // Required. The absolute path of the file within the VM. - string path = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Desired state of the file. - DesiredState state = 4 [(google.api.field_behavior) = REQUIRED]; - - // Consists of three octal digits which represent, in - // order, the permissions of the owner, group, and other users for the - // file (similarly to the numeric mode used in the linux chmod - // utility). Each digit represents a three bit number with the 4 bit - // corresponding to the read permissions, the 2 bit corresponds to the - // write bit, and the one bit corresponds to the execute permission. - // Default behavior is 755. - // - // Below are some examples of permissions and their associated values: - // read, write, and execute: 7 - // read and execute: 5 - // read and write: 6 - // read only: 4 - string permissions = 5; - } - - // Required. The id of the resource with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-63 characters. - // * Must end with a number or a letter. - // * Must be unique within the OS policy. - string id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Resource type. - oneof resource_type { - // Package resource - PackageResource pkg = 2; - - // Package repository resource - RepositoryResource repository = 3; - - // Exec resource - ExecResource exec = 4; - - // File resource - FileResource file = 5; - } - } - - // Resource groups provide a mechanism to group OS policy resources. - // - // Resource groups enable OS policy authors to create a single OS policy - // to be applied to VMs running different operating Systems. - // - // When the OS policy is applied to a target VM, the appropriate resource - // group within the OS policy is selected based on the `OSFilter` specified - // within the resource group. - message ResourceGroup { - // List of inventory filters for the resource group. - // - // The resources in this resource group are applied to the target VM if it - // satisfies at least one of the following inventory filters. - // - // For example, to apply this resource group to VMs running either `RHEL` or - // `CentOS` operating systems, specify 2 items for the list with following - // values: - // inventory_filters[0].os_short_name='rhel' and - // inventory_filters[1].os_short_name='centos' - // - // If the list is empty, this resource group will be applied to the target - // VM unconditionally. - repeated InventoryFilter inventory_filters = 1; - - // Required. List of resources configured for this resource group. - // The resources are executed in the exact order specified here. - repeated Resource resources = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The id of the OS policy with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-63 characters. - // * Must end with a number or a letter. - // * Must be unique within the assignment. - string id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Policy description. - // Length of the description is limited to 1024 characters. - string description = 2; - - // Required. Policy mode - Mode mode = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. List of resource groups for the policy. - // For a particular VM, resource groups are evaluated in the order specified - // and the first resource group that is applicable is selected and the rest - // are ignored. - // - // If none of the resource groups are applicable for a VM, the VM is - // considered to be non-compliant w.r.t this policy. This behavior can be - // toggled by the flag `allow_no_resource_group_match` - repeated ResourceGroup resource_groups = 4 - [(google.api.field_behavior) = REQUIRED]; - - // This flag determines the OS policy compliance status when none of the - // resource groups within the policy are applicable for a VM. Set this value - // to `true` if the policy needs to be reported as compliant even if the - // policy has nothing to validate or enforce. - bool allow_no_resource_group_match = 5; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto deleted file mode 100644 index aa4b2b11..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignment_reports.proto +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_multiple_files = true; -option java_outer_classname = "OSPolicyAssignmentReportsProto"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; -option (google.api.resource_definition) = { - type: "osconfig.googleapis.com/InstanceOSPolicyAssignment" - pattern: "projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}" -}; - -// Get a report of the OS policy assignment for a VM instance. -message GetOSPolicyAssignmentReportRequest { - // Required. API resource name for OS policy assignment report. - // - // Format: - // `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report` - // - // For `{project}`, either `project-number` or `project-id` can be provided. - // For `{instance_id}`, either Compute Engine `instance-id` or `instance-name` - // can be provided. - // For `{assignment_id}`, the OSPolicyAssignment id must be provided. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/OSPolicyAssignmentReport" - } - ]; -} - -// List the OS policy assignment reports for VM instances. -message ListOSPolicyAssignmentReportsRequest { - // Required. The parent resource name. - // - // Format: - // `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports` - // - // For `{project}`, either `project-number` or `project-id` can be provided. - // For `{instance}`, either `instance-name`, `instance-id`, or `-` can be - // provided. If '-' is provided, the response will include - // OSPolicyAssignmentReports for all instances in the project/location. - // For `{assignment}`, either `assignment-id` or `-` can be provided. If '-' - // is provided, the response will include OSPolicyAssignmentReports for all - // OSPolicyAssignments in the project/location. - // Either {instance} or {assignment} must be `-`. - // - // For example: - // `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports` - // returns all reports for the instance - // `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports` - // returns all the reports for the given assignment across all instances. - // `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports` - // returns all the reports for all assignments across all instances. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/InstanceOSPolicyAssignment" - } - ]; - - // The maximum number of results to return. - int32 page_size = 2; - - // If provided, this field specifies the criteria that must be met by the - // `OSPolicyAssignmentReport` API resource that is included in the response. - string filter = 3; - - // A pagination token returned from a previous call to the - // `ListOSPolicyAssignmentReports` method that indicates where this listing - // should continue from. - string page_token = 4; -} - -// A response message for listing OS Policy assignment reports including the -// page of results and page token. -message ListOSPolicyAssignmentReportsResponse { - // List of OS policy assignment reports. - repeated OSPolicyAssignmentReport os_policy_assignment_reports = 1; - - // The pagination token to retrieve the next page of OS policy assignment - // report objects. - string next_page_token = 2; -} - -// A report of the OS policy assignment status for a given instance. -message OSPolicyAssignmentReport { - option (google.api.resource) = { - type: "osconfig.googleapis.com/OSPolicyAssignmentReport" - pattern: "projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report" - }; - - // Compliance data for an OS policy - message OSPolicyCompliance { - // Possible compliance states for an os policy. - enum ComplianceState { - // The policy is in an unknown compliance state. - // - // Refer to the field `compliance_state_reason` to learn the exact reason - // for the policy to be in this compliance state. - UNKNOWN = 0; - - // Policy is compliant. - // - // The policy is compliant if all the underlying resources are also - // compliant. - COMPLIANT = 1; - - // Policy is non-compliant. - // - // The policy is non-compliant if one or more underlying resources are - // non-compliant. - NON_COMPLIANT = 2; - } - - // Compliance data for an OS policy resource. - message OSPolicyResourceCompliance { - // Step performed by the OS Config agent for configuring an - // `OSPolicy` resource to its desired state. - message OSPolicyResourceConfigStep { - // Supported configuration step types - enum Type { - // Default value. This value is unused. - TYPE_UNSPECIFIED = 0; - - // Checks for resource conflicts such as schema errors. - VALIDATION = 1; - - // Checks the current status of the desired state for a resource. - DESIRED_STATE_CHECK = 2; - - // Enforces the desired state for a resource that is not in desired - // state. - DESIRED_STATE_ENFORCEMENT = 3; - - // Re-checks the status of the desired state. This check is done - // for a resource after the enforcement of all OS policies. - // - // This step is used to determine the final desired state status for - // the resource. It accounts for any resources that might have drifted - // from their desired state due to side effects from executing other - // resources. - DESIRED_STATE_CHECK_POST_ENFORCEMENT = 4; - } - - // Configuration step type. - Type type = 1; - - // An error message recorded during the execution of this step. - // Only populated if errors were encountered during this step execution. - string error_message = 2; - } - - // Possible compliance states for a resource. - enum ComplianceState { - // The resource is in an unknown compliance state. - // - // To get more details about why the policy is in this state, review - // the output of the `compliance_state_reason` field. - UNKNOWN = 0; - - // Resource is compliant. - COMPLIANT = 1; - - // Resource is non-compliant. - NON_COMPLIANT = 2; - } - - // ExecResource specific output. - message ExecResourceOutput { - // Output from enforcement phase output file (if run). - // Output size is limited to 100K bytes. - bytes enforcement_output = 2; - } - - // The ID of the OS policy resource. - string os_policy_resource_id = 1; - - // Ordered list of configuration completed by the agent for the OS policy - // resource. - repeated OSPolicyResourceConfigStep config_steps = 2; - - // The compliance state of the resource. - ComplianceState compliance_state = 3; - - // A reason for the resource to be in the given compliance state. - // This field is always populated when `compliance_state` is `UNKNOWN`. - // - // The following values are supported when `compliance_state == UNKNOWN` - // - // * `execution-errors`: Errors were encountered by the agent while - // executing the resource and the compliance state couldn't be - // determined. - // * `execution-skipped-by-agent`: Resource execution was skipped by the - // agent because errors were encountered while executing prior resources - // in the OS policy. - // * `os-policy-execution-attempt-failed`: The execution of the OS policy - // containing this resource failed and the compliance state couldn't be - // determined. - string compliance_state_reason = 4; - - // Resource specific output. - oneof output { - // ExecResource specific output. - ExecResourceOutput exec_resource_output = 5; - } - } - - // The OS policy id - string os_policy_id = 1; - - // The compliance state of the OS policy. - ComplianceState compliance_state = 2; - - // The reason for the OS policy to be in an unknown compliance state. - // This field is always populated when `compliance_state` is `UNKNOWN`. - // - // If populated, the field can contain one of the following values: - // - // * `vm-not-running`: The VM was not running. - // * `os-policies-not-supported-by-agent`: The version of the OS Config - // agent running on the VM does not support running OS policies. - // * `no-agent-detected`: The OS Config agent is not detected for the VM. - // * `resource-execution-errors`: The OS Config agent encountered errors - // while executing one or more resources in the policy. See - // `os_policy_resource_compliances` for details. - // * `task-timeout`: The task sent to the agent to apply the policy timed - // out. - // * `unexpected-agent-state`: The OS Config agent did not report the final - // status of the task that attempted to apply the policy. Instead, the agent - // unexpectedly started working on a different task. This mostly happens - // when the agent or VM unexpectedly restarts while applying OS policies. - // * `internal-service-errors`: Internal service errors were encountered - // while attempting to apply the policy. - string compliance_state_reason = 3; - - // Compliance data for each resource within the policy that is applied to - // the VM. - repeated OSPolicyResourceCompliance os_policy_resource_compliances = 4; - } - - // The `OSPolicyAssignmentReport` API resource name. - // - // Format: - // `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report` - string name = 1; - - // The Compute Engine VM instance name. - string instance = 2; - - // Reference to the `OSPolicyAssignment` API resource that the `OSPolicy` - // belongs to. - // - // Format: - // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}` - string os_policy_assignment = 3 [(google.api.resource_reference) = { - type: "osconfig.googleapis.com/OSPolicyAssignment" - }]; - - // Compliance data for each `OSPolicy` that is applied to the VM. - repeated OSPolicyCompliance os_policy_compliances = 4; - - // Timestamp for when the report was last generated. - google.protobuf.Timestamp update_time = 5; - - // Unique identifier of the last attempted run to apply the OS policies - // associated with this assignment on the VM. - // - // This ID is logged by the OS Config agent while applying the OS - // policies associated with this assignment on the VM. - // NOTE: If the service is unable to successfully connect to the agent for - // this run, then this id will not be available in the agent logs. - string last_run_id = 6; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto deleted file mode 100644 index 157b8fd3..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/os_policy_assignments.proto +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/osconfig/v1/os_policy.proto"; -import "google/cloud/osconfig/v1/osconfig_common.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_multiple_files = true; -option java_outer_classname = "OsPolicyAssignmentsProto"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// OS policy assignment is an API resource that is used to -// apply a set of OS policies to a dynamically targeted group of Compute Engine -// VM instances. -// -// An OS policy is used to define the desired state configuration for a -// Compute Engine VM instance through a set of configuration resources that -// provide capabilities such as installing or removing software packages, or -// executing a script. -// -// For more information, see [OS policy and OS policy -// assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies). -message OSPolicyAssignment { - option (google.api.resource) = { - type: "osconfig.googleapis.com/OSPolicyAssignment" - pattern: "projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}" - }; - - // Message representing label set. - // * A label is a key value pair set for a VM. - // * A LabelSet is a set of labels. - // * Labels within a LabelSet are ANDed. In other words, a LabelSet is - // applicable for a VM only if it matches all the labels in the - // LabelSet. - // * Example: A LabelSet with 2 labels: `env=prod` and `type=webserver` will - // only be applicable for those VMs with both labels - // present. - message LabelSet { - // Labels are identified by key/value pairs in this map. - // A VM should contain all the key/value pairs specified in this - // map to be selected. - map labels = 1; - } - - // Filters to select target VMs for an assignment. - // - // If more than one filter criteria is specified below, a VM will be selected - // if and only if it satisfies all of them. - message InstanceFilter { - // VM inventory details. - message Inventory { - // Required. The OS short name - string os_short_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The OS version - // - // Prefix matches are supported if asterisk(*) is provided as the - // last character. For example, to match all versions with a major - // version of `7`, specify the following value for this field `7.*` - // - // An empty string matches all OS versions. - string os_version = 2; - } - - // Target all VMs in the project. If true, no other criteria is - // permitted. - bool all = 1; - - // List of label sets used for VM inclusion. - // - // If the list has more than one `LabelSet`, the VM is included if any - // of the label sets are applicable for the VM. - repeated LabelSet inclusion_labels = 2; - - // List of label sets used for VM exclusion. - // - // If the list has more than one label set, the VM is excluded if any - // of the label sets are applicable for the VM. - repeated LabelSet exclusion_labels = 3; - - // List of inventories to select VMs. - // - // A VM is selected if its inventory data matches at least one of the - // following inventories. - repeated Inventory inventories = 4; - } - - // Message to configure the rollout at the zonal level for the OS policy - // assignment. - message Rollout { - // Required. The maximum number (or percentage) of VMs per zone to disrupt - // at any given moment. - FixedOrPercent disruption_budget = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. This determines the minimum duration of time to wait after the - // configuration changes are applied through the current rollout. A - // VM continues to count towards the `disruption_budget` at least - // until this duration of time has passed after configuration changes are - // applied. - google.protobuf.Duration min_wait_duration = 2 - [(google.api.field_behavior) = REQUIRED]; - } - - // OS policy assignment rollout state - enum RolloutState { - // Invalid value - ROLLOUT_STATE_UNSPECIFIED = 0; - - // The rollout is in progress. - IN_PROGRESS = 1; - - // The rollout is being cancelled. - CANCELLING = 2; - - // The rollout is cancelled. - CANCELLED = 3; - - // The rollout has completed successfully. - SUCCEEDED = 4; - } - - // Resource name. - // - // Format: - // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}` - // - // This field is ignored when you create an OS policy assignment. - string name = 1; - - // OS policy assignment description. - // Length of the description is limited to 1024 characters. - string description = 2; - - // Required. List of OS policies to be applied to the VMs. - repeated OSPolicy os_policies = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Filter to select VMs. - InstanceFilter instance_filter = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Rollout to deploy the OS policy assignment. - // A rollout is triggered in the following situations: - // 1) OSPolicyAssignment is created. - // 2) OSPolicyAssignment is updated and the update contains changes to one of - // the following fields: - // - instance_filter - // - os_policies - // 3) OSPolicyAssignment is deleted. - Rollout rollout = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The assignment revision ID - // A new revision is committed whenever a rollout is triggered for a OS policy - // assignment - string revision_id = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp that the revision was created. - google.protobuf.Timestamp revision_create_time = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The etag for this OS policy assignment. - // If this is provided on update, it must match the server's etag. - string etag = 8; - - // Output only. OS policy assignment rollout state - RolloutState rollout_state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates that this revision has been successfully rolled out - // in this zone and new VMs will be assigned OS policies from this revision. - // - // For a given OS policy assignment, there is only one revision with a value - // of `true` for this field. - bool baseline = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates that this revision deletes the OS policy assignment. - bool deleted = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates that reconciliation is in progress for the revision. - // This value is `true` when the `rollout_state` is one of: - // * IN_PROGRESS - // * CANCELLING - bool reconciling = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server generated unique id for the OS policy assignment - // resource. - string uid = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// OS policy assignment operation metadata provided by OS policy assignment API -// methods that return long running operations. -message OSPolicyAssignmentOperationMetadata { - // The OS policy assignment API method. - enum APIMethod { - // Invalid value - API_METHOD_UNSPECIFIED = 0; - - // Create OS policy assignment API method - CREATE = 1; - - // Update OS policy assignment API method - UPDATE = 2; - - // Delete OS policy assignment API method - DELETE = 3; - } - - // State of the rollout - enum RolloutState { - // Invalid value - ROLLOUT_STATE_UNSPECIFIED = 0; - - // The rollout is in progress. - IN_PROGRESS = 1; - - // The rollout is being cancelled. - CANCELLING = 2; - - // The rollout is cancelled. - CANCELLED = 3; - - // The rollout has completed successfully. - SUCCEEDED = 4; - } - - // Reference to the `OSPolicyAssignment` API resource. - // - // Format: - // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}` - string os_policy_assignment = 1 [(google.api.resource_reference) = { - type: "osconfig.googleapis.com/OSPolicyAssignment" - }]; - - // The OS policy assignment API method. - APIMethod api_method = 2; - - // State of the rollout - RolloutState rollout_state = 3; - - // Rollout start time - google.protobuf.Timestamp rollout_start_time = 4; - - // Rollout update time - google.protobuf.Timestamp rollout_update_time = 5; -} - -// A request message to create an OS policy assignment -message CreateOSPolicyAssignmentRequest { - // Required. The parent resource name in the form: - // projects/{project}/locations/{location} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The OS policy assignment to be created. - OSPolicyAssignment os_policy_assignment = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The logical name of the OS policy assignment in the project - // with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-63 characters. - // * Must end with a number or a letter. - // * Must be unique within the project. - string os_policy_assignment_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// A request message to update an OS policy assignment -message UpdateOSPolicyAssignmentRequest { - // Required. The updated OS policy assignment. - OSPolicyAssignment os_policy_assignment = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Field mask that controls which fields of the assignment should be - // updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A request message to get an OS policy assignment -message GetOSPolicyAssignmentRequest { - // Required. The resource name of OS policy assignment. - // - // Format: - // `projects/{project}/locations/{location}/osPolicyAssignments/{os_policy_assignment}@{revisionId}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/OSPolicyAssignment" - } - ]; -} - -// A request message to list OS policy assignments for a parent resource -message ListOSPolicyAssignmentsRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of assignments to return. - int32 page_size = 2; - - // A pagination token returned from a previous call to - // `ListOSPolicyAssignments` that indicates where this listing should continue - // from. - string page_token = 3; -} - -// A response message for listing all assignments under given parent. -message ListOSPolicyAssignmentsResponse { - // The list of assignments - repeated OSPolicyAssignment os_policy_assignments = 1; - - // The pagination token to retrieve the next page of OS policy assignments. - string next_page_token = 2; -} - -// A request message to list revisions for a OS policy assignment -message ListOSPolicyAssignmentRevisionsRequest { - // Required. The name of the OS policy assignment to list revisions for. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/OSPolicyAssignment" - } - ]; - - // The maximum number of revisions to return. - int32 page_size = 2; - - // A pagination token returned from a previous call to - // `ListOSPolicyAssignmentRevisions` that indicates where this listing should - // continue from. - string page_token = 3; -} - -// A response message for listing all revisions for a OS policy assignment. -message ListOSPolicyAssignmentRevisionsResponse { - // The OS policy assignment revisions - repeated OSPolicyAssignment os_policy_assignments = 1; - - // The pagination token to retrieve the next page of OS policy assignment - // revisions. - string next_page_token = 2; -} - -// A request message for deleting a OS policy assignment. -message DeleteOSPolicyAssignmentRequest { - // Required. The name of the OS policy assignment to be deleted - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/OSPolicyAssignment" - } - ]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto deleted file mode 100644 index 2b72d6ae..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_common.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_outer_classname = "Common"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// Message encapsulating a value that can be either absolute ("fixed") or -// relative ("percent") to a value. -message FixedOrPercent { - // Type of the value. - oneof mode { - // Specifies a fixed value. - int32 fixed = 1; - - // Specifies the relative value defined as a percentage, which will be - // multiplied by a reference value. - int32 percent = 2; - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto deleted file mode 100644 index 515905c8..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_service.proto +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/client.proto"; -import "google/api/resource.proto"; -import "google/cloud/osconfig/v1/patch_deployments.proto"; -import "google/cloud/osconfig/v1/patch_jobs.proto"; -import "google/protobuf/empty.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_outer_classname = "OsConfigProto"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Instance" - pattern: "projects/{project}/zones/{zone}/instances/{instance}" - pattern: "projects/{project}/locations/{location}/instances/{instance}" -}; - -// OS Config API -// -// The OS Config service is a server-side component that you can use to -// manage package installations and patch jobs for virtual machine instances. -service OsConfigService { - option (google.api.default_host) = "osconfig.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Patch VM instances by creating and running a patch job. - rpc ExecutePatchJob(ExecutePatchJobRequest) returns (PatchJob) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/patchJobs:execute" - body: "*" - }; - } - - // Get the patch job. This can be used to track the progress of an - // ongoing patch job or review the details of completed jobs. - rpc GetPatchJob(GetPatchJobRequest) returns (PatchJob) { - option (google.api.http) = { - get: "/v1/{name=projects/*/patchJobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Cancel a patch job. The patch job must be active. Canceled patch jobs - // cannot be restarted. - rpc CancelPatchJob(CancelPatchJobRequest) returns (PatchJob) { - option (google.api.http) = { - post: "/v1/{name=projects/*/patchJobs/*}:cancel" - body: "*" - }; - } - - // Get a list of patch jobs. - rpc ListPatchJobs(ListPatchJobsRequest) returns (ListPatchJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/patchJobs" - }; - option (google.api.method_signature) = "parent"; - } - - // Get a list of instance details for a given patch job. - rpc ListPatchJobInstanceDetails(ListPatchJobInstanceDetailsRequest) - returns (ListPatchJobInstanceDetailsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/patchJobs/*}/instanceDetails" - }; - option (google.api.method_signature) = "parent"; - } - - // Create an OS Config patch deployment. - rpc CreatePatchDeployment(CreatePatchDeploymentRequest) - returns (PatchDeployment) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/patchDeployments" - body: "patch_deployment" - }; - option (google.api.method_signature) = - "parent,patch_deployment,patch_deployment_id"; - } - - // Get an OS Config patch deployment. - rpc GetPatchDeployment(GetPatchDeploymentRequest) returns (PatchDeployment) { - option (google.api.http) = { - get: "/v1/{name=projects/*/patchDeployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Get a page of OS Config patch deployments. - rpc ListPatchDeployments(ListPatchDeploymentsRequest) - returns (ListPatchDeploymentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/patchDeployments" - }; - option (google.api.method_signature) = "parent"; - } - - // Delete an OS Config patch deployment. - rpc DeletePatchDeployment(DeletePatchDeploymentRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/patchDeployments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Update an OS Config patch deployment. - rpc UpdatePatchDeployment(UpdatePatchDeploymentRequest) - returns (PatchDeployment) { - option (google.api.http) = { - patch: "/v1/{patch_deployment.name=projects/*/patchDeployments/*}" - body: "patch_deployment" - }; - option (google.api.method_signature) = "patch_deployment,update_mask"; - } - - // Change state of patch deployment to "PAUSED". - // Patch deployment in paused state doesn't generate patch jobs. - rpc PausePatchDeployment(PausePatchDeploymentRequest) - returns (PatchDeployment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/patchDeployments/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Change state of patch deployment back to "ACTIVE". - // Patch deployment in active state continues to generate patch jobs. - rpc ResumePatchDeployment(ResumePatchDeploymentRequest) - returns (PatchDeployment) { - option (google.api.http) = { - post: "/v1/{name=projects/*/patchDeployments/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto deleted file mode 100644 index 196737c1..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/osconfig_zonal_service.proto +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/cloud/osconfig/v1/inventory.proto"; -import "google/cloud/osconfig/v1/os_policy_assignment_reports.proto"; -import "google/cloud/osconfig/v1/os_policy_assignments.proto"; -import "google/cloud/osconfig/v1/vulnerability.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_multiple_files = true; -option java_outer_classname = "OsConfigZonalServiceProto"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// Zonal OS Config API -// -// The OS Config service is the server-side component that allows users to -// manage package installations and patch jobs for Compute Engine VM instances. -service OsConfigZonalService { - option (google.api.default_host) = "osconfig.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Create an OS policy assignment. - // - // This method also creates the first revision of the OS policy assignment. - // - // This method returns a long running operation (LRO) that contains the - // rollout details. The rollout can be cancelled by cancelling the LRO. - // - // For more information, see [Method: - // projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). - rpc CreateOSPolicyAssignment(CreateOSPolicyAssignmentRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/osPolicyAssignments" - body: "os_policy_assignment" - }; - option (google.api.method_signature) = - "parent,os_policy_assignment,os_policy_assignment_id"; - option (google.longrunning.operation_info) = { - response_type: "OSPolicyAssignment" - metadata_type: "OSPolicyAssignmentOperationMetadata" - }; - } - - // Update an existing OS policy assignment. - // - // This method creates a new revision of the OS policy assignment. - // - // This method returns a long running operation (LRO) that contains the - // rollout details. The rollout can be cancelled by cancelling the LRO. - // - // For more information, see [Method: - // projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). - rpc UpdateOSPolicyAssignment(UpdateOSPolicyAssignmentRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{os_policy_assignment.name=projects/*/locations/*/osPolicyAssignments/*}" - body: "os_policy_assignment" - }; - option (google.api.method_signature) = "os_policy_assignment,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "OSPolicyAssignment" - metadata_type: "OSPolicyAssignmentOperationMetadata" - }; - } - - // Retrieve an existing OS policy assignment. - // - // This method always returns the latest revision. In order to retrieve a - // previous revision of the assignment, also provide the revision ID in the - // `name` parameter. - rpc GetOSPolicyAssignment(GetOSPolicyAssignmentRequest) - returns (OSPolicyAssignment) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List the OS policy assignments under the parent resource. - // - // For each OS policy assignment, the latest revision is returned. - rpc ListOSPolicyAssignments(ListOSPolicyAssignmentsRequest) - returns (ListOSPolicyAssignmentsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/osPolicyAssignments" - }; - option (google.api.method_signature) = "parent"; - } - - // List the OS policy assignment revisions for a given OS policy assignment. - rpc ListOSPolicyAssignmentRevisions(ListOSPolicyAssignmentRevisionsRequest) - returns (ListOSPolicyAssignmentRevisionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}:listRevisions" - }; - option (google.api.method_signature) = "name"; - } - - // Delete the OS policy assignment. - // - // This method creates a new revision of the OS policy assignment. - // - // This method returns a long running operation (LRO) that contains the - // rollout details. The rollout can be cancelled by cancelling the LRO. - // - // If the LRO completes and is not cancelled, all revisions associated with - // the OS policy assignment are deleted. - // - // For more information, see [Method: - // projects.locations.osPolicyAssignments.operations.cancel](https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel). - rpc DeleteOSPolicyAssignment(DeleteOSPolicyAssignmentRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/osPolicyAssignments/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OSPolicyAssignmentOperationMetadata" - }; - } - - // Get the OS policy asssignment report for the specified Compute Engine VM - // instance. - rpc GetOSPolicyAssignmentReport(GetOSPolicyAssignmentReportRequest) - returns (OSPolicyAssignmentReport) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*/osPolicyAssignments/*/report}" - }; - option (google.api.method_signature) = "name"; - } - - // List OS policy asssignment reports for all Compute Engine VM instances in - // the specified zone. - rpc ListOSPolicyAssignmentReports(ListOSPolicyAssignmentReportsRequest) - returns (ListOSPolicyAssignmentReportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/instances/*/osPolicyAssignments/*}/reports" - }; - option (google.api.method_signature) = "parent"; - } - - // Get inventory data for the specified VM instance. If the VM has no - // associated inventory, the message `NOT_FOUND` is returned. - rpc GetInventory(GetInventoryRequest) returns (Inventory) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*/inventory}" - }; - option (google.api.method_signature) = "name"; - } - - // List inventory data for all VM instances in the specified zone. - rpc ListInventories(ListInventoriesRequest) - returns (ListInventoriesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/instances/*}/inventories" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the vulnerability report for the specified VM instance. Only VMs with - // inventory data have vulnerability reports associated with them. - rpc GetVulnerabilityReport(GetVulnerabilityReportRequest) - returns (VulnerabilityReport) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/instances/*/vulnerabilityReport}" - }; - option (google.api.method_signature) = "name"; - } - - // List vulnerability reports for all VM instances in the specified zone. - rpc ListVulnerabilityReports(ListVulnerabilityReportsRequest) - returns (ListVulnerabilityReportsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/instances/*}/vulnerabilityReports" - }; - option (google.api.method_signature) = "parent"; - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto deleted file mode 100644 index d5708544..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_deployments.proto +++ /dev/null @@ -1,339 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/osconfig/v1/patch_jobs.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/datetime.proto"; -import "google/type/dayofweek.proto"; -import "google/type/timeofday.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_outer_classname = "PatchDeployments"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// Patch deployments are configurations that individual patch jobs use to -// complete a patch. These configurations include instance filter, package -// repository settings, and a schedule. For more information about creating and -// managing patch deployments, see [Scheduling patch -// jobs](https://cloud.google.com/compute/docs/os-patch-management/schedule-patch-jobs). -message PatchDeployment { - option (google.api.resource) = { - type: "osconfig.googleapis.com/PatchDeployment" - pattern: "projects/{project}/patchDeployments/{patch_deployment}" - }; - - // Represents state of patch peployment. - enum State { - // The default value. This value is used if the state is omitted. - STATE_UNSPECIFIED = 0; - - // Active value means that patch deployment generates Patch Jobs. - ACTIVE = 1; - - // Paused value means that patch deployment does not generate - // Patch jobs. Requires user action to move in and out from this state. - PAUSED = 2; - } - - // Unique name for the patch deployment resource in a project. The patch - // deployment name is in the form: - // `projects/{project_id}/patchDeployments/{patch_deployment_id}`. - // This field is ignored when you create a new patch deployment. - string name = 1; - - // Optional. Description of the patch deployment. Length of the description is - // limited to 1024 characters. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. VM instances to patch. - PatchInstanceFilter instance_filter = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Patch configuration that is applied. - PatchConfig patch_config = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Duration of the patch. After the duration ends, the patch times - // out. - google.protobuf.Duration duration = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Schedule for the patch. - oneof schedule { - // Required. Schedule a one-time execution. - OneTimeSchedule one_time_schedule = 6 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Schedule recurring executions. - RecurringSchedule recurring_schedule = 7 - [(google.api.field_behavior) = REQUIRED]; - } - - // Output only. Time the patch deployment was created. Timestamp is in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - google.protobuf.Timestamp create_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Time the patch deployment was last updated. Timestamp is in - // [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. - google.protobuf.Timestamp update_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last time a patch job was started by this deployment. - // Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text - // format. - google.protobuf.Timestamp last_execute_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Rollout strategy of the patch job. - PatchRollout rollout = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Current state of the patch deployment. - State state = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Sets the time for a one time patch deployment. Timestamp is in -// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format. -message OneTimeSchedule { - // Required. The desired patch job execution time. - google.protobuf.Timestamp execute_time = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Sets the time for recurring patch deployments. -message RecurringSchedule { - // Specifies the frequency of the recurring patch deployments. - enum Frequency { - // Invalid. A frequency must be specified. - FREQUENCY_UNSPECIFIED = 0; - - // Indicates that the frequency of recurrence should be expressed in terms - // of weeks. - WEEKLY = 1; - - // Indicates that the frequency of recurrence should be expressed in terms - // of months. - MONTHLY = 2; - - // Indicates that the frequency of recurrence should be expressed in terms - // of days. - DAILY = 3; - } - - // Required. Defines the time zone that `time_of_day` is relative to. - // The rules for daylight saving time are determined by the chosen time zone. - google.type.TimeZone time_zone = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The time that the recurring schedule becomes effective. - // Defaults to `create_time` of the patch deployment. - google.protobuf.Timestamp start_time = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The end time at which a recurring patch deployment schedule is no - // longer active. - google.protobuf.Timestamp end_time = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. Time of the day to run a recurring deployment. - google.type.TimeOfDay time_of_day = 4 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The frequency unit of this recurring schedule. - Frequency frequency = 5 [(google.api.field_behavior) = REQUIRED]; - - // Configurations for this recurring schedule. - // Configurations must match frequency. - oneof schedule_config { - // Required. Schedule with weekly executions. - WeeklySchedule weekly = 6 [(google.api.field_behavior) = REQUIRED]; - - // Required. Schedule with monthly executions. - MonthlySchedule monthly = 7 [(google.api.field_behavior) = REQUIRED]; - } - - // Output only. The time the last patch job ran successfully. - google.protobuf.Timestamp last_execute_time = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the next patch job is scheduled to run. - google.protobuf.Timestamp next_execute_time = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a weekly schedule. -message WeeklySchedule { - // Required. Day of the week. - google.type.DayOfWeek day_of_week = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Represents a monthly schedule. An example of a valid monthly schedule is -// "on the third Tuesday of the month" or "on the 15th of the month". -message MonthlySchedule { - // One day in a month. - oneof day_of_month { - // Required. Week day in a month. - WeekDayOfMonth week_day_of_month = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. One day of the month. 1-31 indicates the 1st to the 31st day. - // -1 indicates the last day of the month. Months without the target day - // will be skipped. For example, a schedule to run "every month on the 31st" - // will not run in February, April, June, etc. - int32 month_day = 2 [(google.api.field_behavior) = REQUIRED]; - } -} - -// Represents one week day in a month. An example is "the 4th Sunday". -message WeekDayOfMonth { - // Required. Week number in a month. 1-4 indicates the 1st to 4th week of the - // month. -1 indicates the last week of the month. - int32 week_ordinal = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A day of the week. - google.type.DayOfWeek day_of_week = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Represents the number of days before or after the given week day - // of month that the patch deployment is scheduled for. For example if - // `week_ordinal` and `day_of_week` values point to the second day of the - // month and this `day_offset` value is set to `3`, the patch deployment takes - // place three days after the second Tuesday of the month. If this value is - // negative, for example -5, the patches are deployed five days before before - // the second Tuesday of the month. Allowed values are in range [-30, 30]. - int32 day_offset = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A request message for creating a patch deployment. -message CreatePatchDeploymentRequest { - // Required. The project to apply this patch deployment to in the form - // `projects/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. A name for the patch deployment in the project. When creating a - // name the following rules apply: - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-63 characters. - // * Must end with a number or a letter. - // * Must be unique within the project. - string patch_deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The patch deployment to create. - PatchDeployment patch_deployment = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// A request message for retrieving a patch deployment. -message GetPatchDeploymentRequest { - // Required. The resource name of the patch deployment in the form - // `projects/*/patchDeployments/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchDeployment" - } - ]; -} - -// A request message for listing patch deployments. -message ListPatchDeploymentsRequest { - // Required. The resource name of the parent in the form `projects/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. The maximum number of patch deployments to return. Default is - // 100. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A pagination token returned from a previous call to - // ListPatchDeployments that indicates where this listing should continue - // from. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A response message for listing patch deployments. -message ListPatchDeploymentsResponse { - // The list of patch deployments. - repeated PatchDeployment patch_deployments = 1; - - // A pagination token that can be used to get the next page of patch - // deployments. - string next_page_token = 2; -} - -// A request message for deleting a patch deployment. -message DeletePatchDeploymentRequest { - // Required. The resource name of the patch deployment in the form - // `projects/*/patchDeployments/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchDeployment" - } - ]; -} - -// A request message for updating a patch deployment. -message UpdatePatchDeploymentRequest { - // Required. The patch deployment to Update. - PatchDeployment patch_deployment = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Field mask that controls which fields of the patch deployment - // should be updated. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A request message for pausing a patch deployment. -message PausePatchDeploymentRequest { - // Required. The resource name of the patch deployment in the form - // `projects/*/patchDeployments/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchDeployment" - } - ]; -} - -// A request message for resuming a patch deployment. -message ResumePatchDeploymentRequest { - // Required. The resource name of the patch deployment in the form - // `projects/*/patchDeployments/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchDeployment" - } - ]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto deleted file mode 100644 index 4edfc8df..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/patch_jobs.proto +++ /dev/null @@ -1,742 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/osconfig/v1/osconfig_common.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_outer_classname = "PatchJobs"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// A request message to initiate patching across Compute Engine -// instances. -message ExecutePatchJobRequest { - // Required. The project in which to run this patch in the form `projects/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Description of the patch job. Length of the description is limited - // to 1024 characters. - string description = 2; - - // Required. Instances to patch, either explicitly or filtered by some - // criteria such as zone or labels. - PatchInstanceFilter instance_filter = 7 - [(google.api.field_behavior) = REQUIRED]; - - // Patch configuration being applied. If omitted, instances are - // patched using the default configurations. - PatchConfig patch_config = 4; - - // Duration of the patch job. After the duration ends, the patch job - // times out. - google.protobuf.Duration duration = 5; - - // If this patch is a dry-run only, instances are contacted but - // will do nothing. - bool dry_run = 6; - - // Display name for this patch job. This does not have to be unique. - string display_name = 8; - - // Rollout strategy of the patch job. - PatchRollout rollout = 9; -} - -// Request to get an active or completed patch job. -message GetPatchJobRequest { - // Required. Name of the patch in the form `projects/*/patchJobs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchJob" - } - ]; -} - -// Request to list details for all instances that are part of a patch job. -message ListPatchJobInstanceDetailsRequest { - // Required. The parent for the instances are in the form of - // `projects/*/patchJobs/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchJob" - } - ]; - - // The maximum number of instance details records to return. Default is 100. - int32 page_size = 2; - - // A pagination token returned from a previous call - // that indicates where this listing should continue from. - string page_token = 3; - - // A filter expression that filters results listed in the response. This - // field supports filtering results by instance zone, name, state, or - // `failure_reason`. - string filter = 4; -} - -// A response message for listing the instances details for a patch job. -message ListPatchJobInstanceDetailsResponse { - // A list of instance status. - repeated PatchJobInstanceDetails patch_job_instance_details = 1; - - // A pagination token that can be used to get the next page of results. - string next_page_token = 2; -} - -// Patch details for a VM instance. For more information about reviewing VM -// instance details, see -// [Listing all VM instance details for a specific patch -// job](https://cloud.google.com/compute/docs/os-patch-management/manage-patch-jobs#list-instance-details). -message PatchJobInstanceDetails { - // The instance name in the form `projects/*/zones/*/instances/*` - string name = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - }]; - - // The unique identifier for the instance. This identifier is - // defined by the server. - string instance_system_id = 2; - - // Current state of instance patch. - Instance.PatchState state = 3; - - // If the patch fails, this field provides the reason. - string failure_reason = 4; - - // The number of times the agent that the agent attempts to apply the patch. - int64 attempt_count = 5; -} - -// A request message for listing patch jobs. -message ListPatchJobsRequest { - // Required. In the form of `projects/*` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The maximum number of instance status to return. - int32 page_size = 2; - - // A pagination token returned from a previous call - // that indicates where this listing should continue from. - string page_token = 3; - - // If provided, this field specifies the criteria that must be met by patch - // jobs to be included in the response. - // Currently, filtering is only available on the patch_deployment field. - string filter = 4; -} - -// A response message for listing patch jobs. -message ListPatchJobsResponse { - // The list of patch jobs. - repeated PatchJob patch_jobs = 1; - - // A pagination token that can be used to get the next page of results. - string next_page_token = 2; -} - -// A high level representation of a patch job that is either in progress -// or has completed. -// -// Instance details are not included in the job. To paginate through instance -// details, use ListPatchJobInstanceDetails. -// -// For more information about patch jobs, see -// [Creating patch -// jobs](https://cloud.google.com/compute/docs/os-patch-management/create-patch-job). -message PatchJob { - option (google.api.resource) = { - type: "osconfig.googleapis.com/PatchJob" - pattern: "projects/{project}/patchJobs/{patch_job}" - }; - - // Enumeration of the various states a patch job passes through as it - // executes. - enum State { - // State must be specified. - STATE_UNSPECIFIED = 0; - - // The patch job was successfully initiated. - STARTED = 1; - - // The patch job is looking up instances to run the patch on. - INSTANCE_LOOKUP = 2; - - // Instances are being patched. - PATCHING = 3; - - // Patch job completed successfully. - SUCCEEDED = 4; - - // Patch job completed but there were errors. - COMPLETED_WITH_ERRORS = 5; - - // The patch job was canceled. - CANCELED = 6; - - // The patch job timed out. - TIMED_OUT = 7; - } - - // A summary of the current patch state across all instances that this patch - // job affects. Contains counts of instances in different states. These states - // map to `InstancePatchState`. List patch job instance details to see the - // specific states of each instance. - message InstanceDetailsSummary { - // Number of instances pending patch job. - int64 pending_instance_count = 1; - - // Number of instances that are inactive. - int64 inactive_instance_count = 2; - - // Number of instances notified about patch job. - int64 notified_instance_count = 3; - - // Number of instances that have started. - int64 started_instance_count = 4; - - // Number of instances that are downloading patches. - int64 downloading_patches_instance_count = 5; - - // Number of instances that are applying patches. - int64 applying_patches_instance_count = 6; - - // Number of instances rebooting. - int64 rebooting_instance_count = 7; - - // Number of instances that have completed successfully. - int64 succeeded_instance_count = 8; - - // Number of instances that require reboot. - int64 succeeded_reboot_required_instance_count = 9; - - // Number of instances that failed. - int64 failed_instance_count = 10; - - // Number of instances that have acked and will start shortly. - int64 acked_instance_count = 11; - - // Number of instances that exceeded the time out while applying the patch. - int64 timed_out_instance_count = 12; - - // Number of instances that are running the pre-patch step. - int64 pre_patch_step_instance_count = 13; - - // Number of instances that are running the post-patch step. - int64 post_patch_step_instance_count = 14; - - // Number of instances that do not appear to be running the agent. Check to - // ensure that the agent is installed, running, and able to communicate with - // the service. - int64 no_agent_detected_instance_count = 15; - } - - // Unique identifier for this patch job in the form - // `projects/*/patchJobs/*` - string name = 1; - - // Display name for this patch job. This is not a unique identifier. - string display_name = 14; - - // Description of the patch job. Length of the description is limited - // to 1024 characters. - string description = 2; - - // Time this patch job was created. - google.protobuf.Timestamp create_time = 3; - - // Last time this patch job was updated. - google.protobuf.Timestamp update_time = 4; - - // The current state of the PatchJob. - State state = 5; - - // Instances to patch. - PatchInstanceFilter instance_filter = 13; - - // Patch configuration being applied. - PatchConfig patch_config = 7; - - // Duration of the patch job. After the duration ends, the - // patch job times out. - google.protobuf.Duration duration = 8; - - // Summary of instance details. - InstanceDetailsSummary instance_details_summary = 9; - - // If this patch job is a dry run, the agent reports that it has - // finished without running any updates on the VM instance. - bool dry_run = 10; - - // If this patch job failed, this message provides information about the - // failure. - string error_message = 11; - - // Reflects the overall progress of the patch job in the range of - // 0.0 being no progress to 100.0 being complete. - double percent_complete = 12; - - // Output only. Name of the patch deployment that created this patch job. - string patch_deployment = 15 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchDeployment" - } - ]; - - // Rollout strategy being applied. - PatchRollout rollout = 16; -} - -// Patch configuration specifications. Contains details on how to apply the -// patch(es) to a VM instance. -message PatchConfig { - // Post-patch reboot settings. - enum RebootConfig { - // The default behavior is DEFAULT. - REBOOT_CONFIG_UNSPECIFIED = 0; - - // The agent decides if a reboot is necessary by checking signals such as - // registry keys on Windows or `/var/run/reboot-required` on APT based - // systems. On RPM based systems, a set of core system package install times - // are compared with system boot time. - DEFAULT = 1; - - // Always reboot the machine after the update completes. - ALWAYS = 2; - - // Never reboot the machine after the update completes. - NEVER = 3; - } - - // Post-patch reboot settings. - RebootConfig reboot_config = 1; - - // Apt update settings. Use this setting to override the default `apt` patch - // rules. - AptSettings apt = 3; - - // Yum update settings. Use this setting to override the default `yum` patch - // rules. - YumSettings yum = 4; - - // Goo update settings. Use this setting to override the default `goo` patch - // rules. - GooSettings goo = 5; - - // Zypper update settings. Use this setting to override the default `zypper` - // patch rules. - ZypperSettings zypper = 6; - - // Windows update settings. Use this override the default windows patch rules. - WindowsUpdateSettings windows_update = 7; - - // The `ExecStep` to run before the patch update. - ExecStep pre_step = 8; - - // The `ExecStep` to run after the patch update. - ExecStep post_step = 9; - - // Allows the patch job to run on Managed instance groups (MIGs). - bool mig_instances_allowed = 10; -} - -// Namespace for instance state enums. -message Instance { - // Patch state of an instance. - enum PatchState { - // Unspecified. - PATCH_STATE_UNSPECIFIED = 0; - - // The instance is not yet notified. - PENDING = 1; - - // Instance is inactive and cannot be patched. - INACTIVE = 2; - - // The instance is notified that it should be patched. - NOTIFIED = 3; - - // The instance has started the patching process. - STARTED = 4; - - // The instance is downloading patches. - DOWNLOADING_PATCHES = 5; - - // The instance is applying patches. - APPLYING_PATCHES = 6; - - // The instance is rebooting. - REBOOTING = 7; - - // The instance has completed applying patches. - SUCCEEDED = 8; - - // The instance has completed applying patches but a reboot is required. - SUCCEEDED_REBOOT_REQUIRED = 9; - - // The instance has failed to apply the patch. - FAILED = 10; - - // The instance acked the notification and will start shortly. - ACKED = 11; - - // The instance exceeded the time out while applying the patch. - TIMED_OUT = 12; - - // The instance is running the pre-patch step. - RUNNING_PRE_PATCH_STEP = 13; - - // The instance is running the post-patch step. - RUNNING_POST_PATCH_STEP = 14; - - // The service could not detect the presence of the agent. Check to ensure - // that the agent is installed, running, and able to communicate with the - // service. - NO_AGENT_DETECTED = 15; - } -} - -// Message for canceling a patch job. -message CancelPatchJobRequest { - // Required. Name of the patch in the form `projects/*/patchJobs/*` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/PatchJob" - } - ]; -} - -// Apt patching is completed by executing `apt-get update && apt-get -// upgrade`. Additional options can be set to control how this is executed. -message AptSettings { - // Apt patch type. - enum Type { - // By default, upgrade will be performed. - TYPE_UNSPECIFIED = 0; - - // Runs `apt-get dist-upgrade`. - DIST = 1; - - // Runs `apt-get upgrade`. - UPGRADE = 2; - } - - // By changing the type to DIST, the patching is performed - // using `apt-get dist-upgrade` instead. - Type type = 1; - - // List of packages to exclude from update. These packages will be excluded - repeated string excludes = 2; - - // An exclusive list of packages to be updated. These are the only packages - // that will be updated. If these packages are not installed, they will be - // ignored. This field cannot be specified with any other patch configuration - // fields. - repeated string exclusive_packages = 3; -} - -// Yum patching is performed by executing `yum update`. Additional options -// can be set to control how this is executed. -// -// Note that not all settings are supported on all platforms. -message YumSettings { - // Adds the `--security` flag to `yum update`. Not supported on - // all platforms. - bool security = 1; - - // Will cause patch to run `yum update-minimal` instead. - bool minimal = 2; - - // List of packages to exclude from update. These packages are excluded by - // using the yum `--exclude` flag. - repeated string excludes = 3; - - // An exclusive list of packages to be updated. These are the only packages - // that will be updated. If these packages are not installed, they will be - // ignored. This field must not be specified with any other patch - // configuration fields. - repeated string exclusive_packages = 4; -} - -// Googet patching is performed by running `googet update`. -message GooSettings {} - -// Zypper patching is performed by running `zypper patch`. -// See also https://en.opensuse.org/SDB:Zypper_manual. -message ZypperSettings { - // Adds the `--with-optional` flag to `zypper patch`. - bool with_optional = 1; - - // Adds the `--with-update` flag, to `zypper patch`. - bool with_update = 2; - - // Install only patches with these categories. - // Common categories include security, recommended, and feature. - repeated string categories = 3; - - // Install only patches with these severities. - // Common severities include critical, important, moderate, and low. - repeated string severities = 4; - - // List of patches to exclude from update. - repeated string excludes = 5; - - // An exclusive list of patches to be updated. These are the only patches - // that will be installed using 'zypper patch patch:' command. - // This field must not be used with any other patch configuration fields. - repeated string exclusive_patches = 6; -} - -// Windows patching is performed using the Windows Update Agent. -message WindowsUpdateSettings { - // Microsoft Windows update classifications as defined in - // [1] - // https://support.microsoft.com/en-us/help/824684/description-of-the-standard-terminology-that-is-used-to-describe-micro - enum Classification { - // Invalid. If classifications are included, they must be specified. - CLASSIFICATION_UNSPECIFIED = 0; - - // "A widely released fix for a specific problem that addresses a critical, - // non-security-related bug." [1] - CRITICAL = 1; - - // "A widely released fix for a product-specific, security-related - // vulnerability. Security vulnerabilities are rated by their severity. The - // severity rating is indicated in the Microsoft security bulletin as - // critical, important, moderate, or low." [1] - SECURITY = 2; - - // "A widely released and frequent software update that contains additions - // to a product's definition database. Definition databases are often used - // to detect objects that have specific attributes, such as malicious code, - // phishing websites, or junk mail." [1] - DEFINITION = 3; - - // "Software that controls the input and output of a device." [1] - DRIVER = 4; - - // "New product functionality that is first distributed outside the context - // of a product release and that is typically included in the next full - // product release." [1] - FEATURE_PACK = 5; - - // "A tested, cumulative set of all hotfixes, security updates, critical - // updates, and updates. Additionally, service packs may contain additional - // fixes for problems that are found internally since the release of the - // product. Service packs my also contain a limited number of - // customer-requested design changes or features." [1] - SERVICE_PACK = 6; - - // "A utility or feature that helps complete a task or set of tasks." [1] - TOOL = 7; - - // "A tested, cumulative set of hotfixes, security updates, critical - // updates, and updates that are packaged together for easy deployment. A - // rollup generally targets a specific area, such as security, or a - // component of a product, such as Internet Information Services (IIS)." [1] - UPDATE_ROLLUP = 8; - - // "A widely released fix for a specific problem. An update addresses a - // noncritical, non-security-related bug." [1] - UPDATE = 9; - } - - // Only apply updates of these windows update classifications. If empty, all - // updates are applied. - repeated Classification classifications = 1; - - // List of KBs to exclude from update. - repeated string excludes = 2; - - // An exclusive list of kbs to be updated. These are the only patches - // that will be updated. This field must not be used with other - // patch configurations. - repeated string exclusive_patches = 3; -} - -// A step that runs an executable for a PatchJob. -message ExecStep { - // The ExecStepConfig for all Linux VMs targeted by the PatchJob. - ExecStepConfig linux_exec_step_config = 1; - - // The ExecStepConfig for all Windows VMs targeted by the PatchJob. - ExecStepConfig windows_exec_step_config = 2; -} - -// Common configurations for an ExecStep. -message ExecStepConfig { - // The interpreter used to execute the a file. - enum Interpreter { - // Invalid for a Windows ExecStepConfig. For a Linux ExecStepConfig, the - // interpreter will be parsed from the shebang line of the script if - // unspecified. - INTERPRETER_UNSPECIFIED = 0; - - // Indicates that the script is run with `/bin/sh` on Linux and `cmd` - // on Windows. - SHELL = 1; - - // Indicates that the file is run with PowerShell flags - // `-NonInteractive`, `-NoProfile`, and `-ExecutionPolicy Bypass`. - POWERSHELL = 2; - } - - // Location of the executable. - oneof executable { - // An absolute path to the executable on the VM. - string local_path = 1; - - // A Cloud Storage object containing the executable. - GcsObject gcs_object = 2; - } - - // Defaults to [0]. A list of possible return values that the - // execution can return to indicate a success. - repeated int32 allowed_success_codes = 3; - - // The script interpreter to use to run the script. If no interpreter is - // specified the script will be executed directly, which will likely - // only succeed for scripts with [shebang lines] - // (https://en.wikipedia.org/wiki/Shebang_\(Unix\)). - Interpreter interpreter = 4; -} - -// Cloud Storage object representation. -message GcsObject { - // Required. Bucket of the Cloud Storage object. - string bucket = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Name of the Cloud Storage object. - string object = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Generation number of the Cloud Storage object. This is used to - // ensure that the ExecStep specified by this PatchJob does not change. - int64 generation_number = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// A filter to target VM instances for patching. The targeted -// VMs must meet all criteria specified. So if both labels and zones are -// specified, the patch job targets only VMs with those labels and in those -// zones. -message PatchInstanceFilter { - // Targets a group of VM instances by using their [assigned - // labels](https://cloud.google.com/compute/docs/labeling-resources). Labels - // are key-value pairs. A `GroupLabel` is a combination of labels - // that is used to target VMs for a patch job. - // - // For example, a patch job can target VMs that have the following - // `GroupLabel`: `{"env":"test", "app":"web"}`. This means that the patch job - // is applied to VMs that have both the labels `env=test` and `app=web`. - message GroupLabel { - // Compute Engine instance labels that must be present for a VM - // instance to be targeted by this filter. - map labels = 1; - } - - // Target all VM instances in the project. If true, no other criteria is - // permitted. - bool all = 1; - - // Targets VM instances matching ANY of these GroupLabels. This allows - // targeting of disparate groups of VM instances. - repeated GroupLabel group_labels = 2; - - // Targets VM instances in ANY of these zones. Leave empty to target VM - // instances in any zone. - repeated string zones = 3; - - // Targets any of the VM instances specified. Instances are specified by their - // URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`, - // `projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or - // `https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]` - repeated string instances = 4; - - // Targets VMs whose name starts with one of these prefixes. Similar to - // labels, this is another way to group VMs when targeting configs, for - // example prefix="prod-". - repeated string instance_name_prefixes = 5; -} - -// Patch rollout configuration specifications. Contains details on the -// concurrency control when applying patch(es) to all targeted VMs. -message PatchRollout { - // Type of the rollout. - enum Mode { - // Mode must be specified. - MODE_UNSPECIFIED = 0; - - // Patches are applied one zone at a time. The patch job begins in the - // region with the lowest number of targeted VMs. Within the region, - // patching begins in the zone with the lowest number of targeted VMs. If - // multiple regions (or zones within a region) have the same number of - // targeted VMs, a tie-breaker is achieved by sorting the regions or zones - // in alphabetical order. - ZONE_BY_ZONE = 1; - - // Patches are applied to VMs in all zones at the same time. - CONCURRENT_ZONES = 2; - } - - // Mode of the patch rollout. - Mode mode = 1; - - // The maximum number (or percentage) of VMs per zone to disrupt at any given - // moment. The number of VMs calculated from multiplying the percentage by the - // total number of VMs in a zone is rounded up. - // - // During patching, a VM is considered disrupted from the time the agent is - // notified to begin until patching has completed. This disruption time - // includes the time to complete reboot and any post-patch steps. - // - // A VM contributes to the disruption budget if its patching operation fails - // either when applying the patches, running pre or post patch steps, or if it - // fails to respond with a success notification before timing out. VMs that - // are not running or do not have an active agent do not count toward this - // disruption budget. - // - // For zone-by-zone rollouts, if the disruption budget in a zone is exceeded, - // the patch job stops, because continuing to the next zone requires - // completion of the patch process in the previous zone. - // - // For example, if the disruption budget has a fixed value of `10`, and 8 VMs - // fail to patch in the current zone, the patch job continues to patch 2 VMs - // at a time until the zone is completed. When that zone is completed - // successfully, patching begins with 10 VMs at a time in the next zone. If 10 - // VMs in the next zone fail to patch, the patch job stops. - FixedOrPercent disruption_budget = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto b/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto deleted file mode 100644 index b8ca5175..00000000 --- a/owl-bot-staging/v1/protos/google/cloud/osconfig/v1/vulnerability.proto +++ /dev/null @@ -1,365 +0,0 @@ -// Copyright 2021 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.osconfig.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.OsConfig.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1;osconfig"; -option java_multiple_files = true; -option java_outer_classname = "VulnerabilityProto"; -option java_package = "com.google.cloud.osconfig.v1"; -option php_namespace = "Google\\Cloud\\OsConfig\\V1"; -option ruby_package = "Google::Cloud::OsConfig::V1"; - -// This API resource represents the vulnerability report for a specified -// Compute Engine virtual machine (VM) instance at a given point in time. -// -// For more information, see [Vulnerability -// reports](https://cloud.google.com/compute/docs/instances/os-inventory-management#vulnerability-reports). -message VulnerabilityReport { - option (google.api.resource) = { - type: "osconfig.googleapis.com/VulnerabilityReport" - pattern: "projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport" - }; - - // A vulnerability affecting the VM instance. - message Vulnerability { - // Contains metadata information for the vulnerability. This information is - // collected from the upstream feed of the operating system. - message Details { - // A reference for this vulnerability. - message Reference { - // The url of the reference. - string url = 1; - - // The source of the reference e.g. NVD. - string source = 2; - } - - // The CVE of the vulnerability. CVE cannot be - // empty and the combination of should be unique - // across vulnerabilities for a VM. - string cve = 1; - - // The CVSS V2 score of this vulnerability. CVSS V2 score is on a scale of - // 0 - 10 where 0 indicates low severity and 10 indicates high severity. - float cvss_v2_score = 2; - - // The full description of the CVSSv3 for this vulnerability from NVD. - CVSSv3 cvss_v3 = 3; - - // Assigned severity/impact ranking from the distro. - string severity = 4; - - // The note or description describing the vulnerability from the distro. - string description = 5; - - // Corresponds to the references attached to the `VulnerabilityDetails`. - repeated Reference references = 6; - } - - // OS inventory item that is affected by a vulnerability or fixed as a - // result of a vulnerability. - message Item { - // Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM. - // This field displays the inventory items affected by this vulnerability. - // If the vulnerability report was not updated after the VM inventory - // update, these values might not display in VM inventory. For some - // operating systems, this field might be empty. - string installed_inventory_item_id = 1; - - // Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM. - // If the vulnerability report was not updated after the VM inventory - // update, these values might not display in VM inventory. If there is no - // available fix, the field is empty. The `inventory_item` value specifies - // the latest `SoftwarePackage` available to the VM that fixes the - // vulnerability. - string available_inventory_item_id = 2; - - // The recommended [CPE URI](https://cpe.mitre.org/specification/) update - // that contains a fix for this vulnerability. - string fixed_cpe_uri = 3; - - // The upstream OS patch, packages or KB that fixes the vulnerability. - string upstream_fix = 4; - } - - // Contains metadata as per the upstream feed of the operating system and - // NVD. - Details details = 1; - - // Corresponds to the `INSTALLED_PACKAGE` inventory item on the VM. - // This field displays the inventory items affected by this vulnerability. - // If the vulnerability report was not updated after the VM inventory - // update, these values might not display in VM inventory. For some distros, - // this field may be empty. - repeated string installed_inventory_item_ids = 2 [deprecated = true]; - - // Corresponds to the `AVAILABLE_PACKAGE` inventory item on the VM. - // If the vulnerability report was not updated after the VM inventory - // update, these values might not display in VM inventory. If there is no - // available fix, the field is empty. The `inventory_item` value specifies - // the latest `SoftwarePackage` available to the VM that fixes the - // vulnerability. - repeated string available_inventory_item_ids = 3 [deprecated = true]; - - // The timestamp for when the vulnerability was first detected. - google.protobuf.Timestamp create_time = 4; - - // The timestamp for when the vulnerability was last modified. - google.protobuf.Timestamp update_time = 5; - - // List of items affected by the vulnerability. - repeated Item items = 6; - } - - // Output only. The `vulnerabilityReport` API resource name. - // - // Format: - // `projects/{project_number}/locations/{location}/instances/{instance_id}/vulnerabilityReport` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. List of vulnerabilities affecting the VM. - repeated Vulnerability vulnerabilities = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp for when the last vulnerability report was generated for the - // VM. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A request message for getting the vulnerability report for the specified VM. -message GetVulnerabilityReportRequest { - // Required. API resource name for vulnerability resource. - // - // Format: - // `projects/{project}/locations/{location}/instances/{instance}/vulnerabilityReport` - // - // For `{project}`, either `project-number` or `project-id` can be provided. - // For `{instance}`, either Compute Engine `instance-id` or `instance-name` - // can be provided. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "osconfig.googleapis.com/VulnerabilityReport" - } - ]; -} - -// A request message for listing vulnerability reports for all VM instances in -// the specified location. -message ListVulnerabilityReportsRequest { - // Required. The parent resource name. - // - // Format: `projects/{project}/locations/{location}/instances/-` - // - // For `{project}`, either `project-number` or `project-id` can be provided. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - } - ]; - - // The maximum number of results to return. - int32 page_size = 2; - - // A pagination token returned from a previous call to - // `ListVulnerabilityReports` that indicates where this listing - // should continue from. - string page_token = 3; - - // If provided, this field specifies the criteria that must be met by a - // `vulnerabilityReport` API resource to be included in the response. - string filter = 4; -} - -// A response message for listing vulnerability reports for all VM instances in -// the specified location. -message ListVulnerabilityReportsResponse { - // List of vulnerabilityReport objects. - repeated VulnerabilityReport vulnerability_reports = 1; - - // The pagination token to retrieve the next page of vulnerabilityReports - // object. - string next_page_token = 2; -} - -// Common Vulnerability Scoring System version 3. -// For details, see https://www.first.org/cvss/specification-document -message CVSSv3 { - // This metric reflects the context by which vulnerability exploitation is - // possible. - enum AttackVector { - // Invalid value. - ATTACK_VECTOR_UNSPECIFIED = 0; - - // The vulnerable component is bound to the network stack and the set of - // possible attackers extends beyond the other options listed below, up to - // and including the entire Internet. - ATTACK_VECTOR_NETWORK = 1; - - // The vulnerable component is bound to the network stack, but the attack is - // limited at the protocol level to a logically adjacent topology. - ATTACK_VECTOR_ADJACENT = 2; - - // The vulnerable component is not bound to the network stack and the - // attacker's path is via read/write/execute capabilities. - ATTACK_VECTOR_LOCAL = 3; - - // The attack requires the attacker to physically touch or manipulate the - // vulnerable component. - ATTACK_VECTOR_PHYSICAL = 4; - } - - // This metric describes the conditions beyond the attacker's control that - // must exist in order to exploit the vulnerability. - enum AttackComplexity { - // Invalid value. - ATTACK_COMPLEXITY_UNSPECIFIED = 0; - - // Specialized access conditions or extenuating circumstances do not exist. - // An attacker can expect repeatable success when attacking the vulnerable - // component. - ATTACK_COMPLEXITY_LOW = 1; - - // A successful attack depends on conditions beyond the attacker's control. - // That is, a successful attack cannot be accomplished at will, but requires - // the attacker to invest in some measurable amount of effort in preparation - // or execution against the vulnerable component before a successful attack - // can be expected. - ATTACK_COMPLEXITY_HIGH = 2; - } - - // This metric describes the level of privileges an attacker must possess - // before successfully exploiting the vulnerability. - enum PrivilegesRequired { - // Invalid value. - PRIVILEGES_REQUIRED_UNSPECIFIED = 0; - - // The attacker is unauthorized prior to attack, and therefore does not - // require any access to settings or files of the vulnerable system to - // carry out an attack. - PRIVILEGES_REQUIRED_NONE = 1; - - // The attacker requires privileges that provide basic user capabilities - // that could normally affect only settings and files owned by a user. - // Alternatively, an attacker with Low privileges has the ability to access - // only non-sensitive resources. - PRIVILEGES_REQUIRED_LOW = 2; - - // The attacker requires privileges that provide significant (e.g., - // administrative) control over the vulnerable component allowing access to - // component-wide settings and files. - PRIVILEGES_REQUIRED_HIGH = 3; - } - - // This metric captures the requirement for a human user, other than the - // attacker, to participate in the successful compromise of the vulnerable - // component. - enum UserInteraction { - // Invalid value. - USER_INTERACTION_UNSPECIFIED = 0; - - // The vulnerable system can be exploited without interaction from any user. - USER_INTERACTION_NONE = 1; - - // Successful exploitation of this vulnerability requires a user to take - // some action before the vulnerability can be exploited. - USER_INTERACTION_REQUIRED = 2; - } - - // The Scope metric captures whether a vulnerability in one vulnerable - // component impacts resources in components beyond its security scope. - enum Scope { - // Invalid value. - SCOPE_UNSPECIFIED = 0; - - // An exploited vulnerability can only affect resources managed by the same - // security authority. - SCOPE_UNCHANGED = 1; - - // An exploited vulnerability can affect resources beyond the security scope - // managed by the security authority of the vulnerable component. - SCOPE_CHANGED = 2; - } - - // The Impact metrics capture the effects of a successfully exploited - // vulnerability on the component that suffers the worst outcome that is most - // directly and predictably associated with the attack. - enum Impact { - // Invalid value. - IMPACT_UNSPECIFIED = 0; - - // High impact. - IMPACT_HIGH = 1; - - // Low impact. - IMPACT_LOW = 2; - - // No impact. - IMPACT_NONE = 3; - } - - // The base score is a function of the base metric scores. - // https://www.first.org/cvss/specification-document#Base-Metrics - float base_score = 1; - - // The Exploitability sub-score equation is derived from the Base - // Exploitability metrics. - // https://www.first.org/cvss/specification-document#2-1-Exploitability-Metrics - float exploitability_score = 2; - - // The Impact sub-score equation is derived from the Base Impact metrics. - float impact_score = 3; - - // This metric reflects the context by which vulnerability exploitation is - // possible. - AttackVector attack_vector = 5; - - // This metric describes the conditions beyond the attacker's control that - // must exist in order to exploit the vulnerability. - AttackComplexity attack_complexity = 6; - - // This metric describes the level of privileges an attacker must possess - // before successfully exploiting the vulnerability. - PrivilegesRequired privileges_required = 7; - - // This metric captures the requirement for a human user, other than the - // attacker, to participate in the successful compromise of the vulnerable - // component. - UserInteraction user_interaction = 8; - - // The Scope metric captures whether a vulnerability in one vulnerable - // component impacts resources in components beyond its security scope. - Scope scope = 9; - - // This metric measures the impact to the confidentiality of the information - // resources managed by a software component due to a successfully exploited - // vulnerability. - Impact confidentiality_impact = 10; - - // This metric measures the impact to integrity of a successfully exploited - // vulnerability. - Impact integrity_impact = 11; - - // This metric measures the impact to the availability of the impacted - // component resulting from a successfully exploited vulnerability. - Impact availability_impact = 12; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js deleted file mode 100644 index fb13179b..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy.js +++ /dev/null @@ -1,89 +0,0 @@ -// 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(analysisQuery) { - // [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The request query. - */ - // const analysisQuery = {} - /** - * 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 - * execution timeout, you will get a response with partial result. - * Otherwise, your query's execution will continue until the RPC deadline. - * If it's not finished until then, you will get a DEADLINE_EXCEEDED error. - * Default is empty. - */ - // const executionTimeout = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callAnalyzeIamPolicy() { - // Construct request - const request = { - analysisQuery, - }; - - // Run request - const response = await assetClient.analyzeIamPolicy(request); - console.log(response); - } - - callAnalyzeIamPolicy(); - // [END cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js deleted file mode 100644 index 703f46b4..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js +++ /dev/null @@ -1,84 +0,0 @@ -// 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(analysisQuery, outputConfig) { - // [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The request query. - */ - // const analysisQuery = {} - /** - * 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 = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callAnalyzeIamPolicyLongrunning() { - // Construct request - const request = { - analysisQuery, - outputConfig, - }; - - // Run request - const [operation] = await assetClient.analyzeIamPolicyLongrunning(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAnalyzeIamPolicyLongrunning(); - // [END cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js deleted file mode 100644 index 0d6bdd5b..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.analyze_move.js +++ /dev/null @@ -1,78 +0,0 @@ -// 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(resource, destinationParent) { - // [START cloudasset_v1_generated_AssetService_AnalyzeMove_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the resource to perform the analysis against. - * Only GCP Project are supported as of today. Hence, this can only be Project - * ID (such as "projects/my-project-id") or a Project Number (such as - * "projects/12345"). - */ - // const resource = 'abc123' - /** - * Required. Name of the GCP Folder or Organization to reparent the target - * resource. The analysis will be performed against hypothetically moving the - * resource to this specified desitination parent. This can only be a Folder - * number (such as "folders/123") or an Organization number (such as - * "organizations/123"). - */ - // const destinationParent = 'abc123' - /** - * Analysis view indicating what information should be included in the - * analysis response. If unspecified, the default view is FULL. - */ - // const view = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callAnalyzeMove() { - // Construct request - const request = { - resource, - destinationParent, - }; - - // Run request - const response = await assetClient.analyzeMove(request); - console.log(response); - } - - callAnalyzeMove(); - // [END cloudasset_v1_generated_AssetService_AnalyzeMove_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js deleted file mode 100644 index da9d3d72..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_assets_history.js +++ /dev/null @@ -1,104 +0,0 @@ -// 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_BatchGetAssetsHistory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. It can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id")", or a project number (such as "projects/12345"). - */ - // const parent = 'abc123' - /** - * A list of the full names of the assets. - * See: https://cloud.google.com/asset-inventory/docs/resource-name-format - * Example: - * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - * The request becomes a no-op if the asset name list is empty, and the max - * size of the asset name list is 100 in one request. - */ - // const assetNames = 'abc123' - /** - * Optional. The content type. - */ - // const contentType = {} - /** - * Optional. The time window for the asset history. Both start_time and - * end_time are optional and if set, it must be after the current time minus - * 35 days. If end_time is not set, it is default to current timestamp. - * If start_time is not set, the snapshot of the assets at end_time will be - * returned. The returned results contain all temporal assets whose time - * window overlap with read_time_window. - */ - // const readTimeWindow = {} - /** - * Optional. A list of relationship types to output, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it outputs specified relationships' history on the asset_names. It - * returns an error if any of the relationship_types doesn't belong to the - * supported relationship types of the asset_names or if any of the - * asset_names's types doesn't belong to the source types of the - * relationship_types. - * * Otherwise: - * it outputs the supported relationships' history on the asset_names or - * returns an error if any of the asset_names's types has no relationship - * support. - * See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all - * supported asset types and relationship types. - */ - // const relationshipTypes = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callBatchGetAssetsHistory() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.batchGetAssetsHistory(request); - console.log(response); - } - - callBatchGetAssetsHistory(); - // [END cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js deleted file mode 100644 index eab2d1e8..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.batch_get_effective_iam_policies.js +++ /dev/null @@ -1,77 +0,0 @@ -// 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js deleted file mode 100644 index deeabb51..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.create_feed.js +++ /dev/null @@ -1,79 +0,0 @@ -// 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, feedId, feed) { - // [START cloudasset_v1_generated_AssetService_CreateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project/folder/organization where this feed - * 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. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - */ - // 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 - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const feed = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callCreateFeed() { - // Construct request - const request = { - parent, - feedId, - feed, - }; - - // Run request - const response = await assetClient.createFeed(request); - console.log(response); - } - - callCreateFeed(); - // [END cloudasset_v1_generated_AssetService_CreateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js deleted file mode 100644 index 8870f960..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.create_saved_query.js +++ /dev/null @@ -1,82 +0,0 @@ -// 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js deleted file mode 100644 index 876503f1..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_feed.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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_DeleteFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callDeleteFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.deleteFeed(request); - console.log(response); - } - - callDeleteFeed(); - // [END cloudasset_v1_generated_AssetService_DeleteFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js deleted file mode 100644 index 7ec550b0..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.delete_saved_query.js +++ /dev/null @@ -1,65 +0,0 @@ -// 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js deleted file mode 100644 index 59b7182a..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.export_assets.js +++ /dev/null @@ -1,119 +0,0 @@ -// 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, outputConfig) { - // [START cloudasset_v1_generated_AssetService_ExportAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - */ - // const parent = 'abc123' - /** - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - */ - // const readTime = {} - /** - * A list of asset types to take a snapshot for. For example: - * "compute.googleapis.com/Disk". - * Regular expressions are also supported. For example: - * * "compute.googleapis.com.*" snapshots resources whose asset type starts - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * If specified, only matching assets will be returned, otherwise, it will - * snapshot all asset types. See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - */ - // const assetTypes = 'abc123' - /** - * Asset content type. If not specified, no content but the asset name will be - * returned. - */ - // const contentType = {} - /** - * Required. Output configuration indicating where the results will be output - * to. - */ - // const outputConfig = {} - /** - * A list of relationship types to export, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it snapshots specified relationships. It returns an error if - * any of the relationship_types doesn't belong to the supported - * relationship types of the asset_types or if any of the asset_types - * doesn't belong to the source types of the relationship_types. - * * Otherwise: - * it snapshots the supported relationships for all asset_types or returns - * an error if any of the asset_types has no relationship support. - * An unspecified asset types field means all supported asset_types. - * See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) for all - * supported asset types and relationship types. - */ - // const relationshipTypes = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callExportAssets() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await assetClient.exportAssets(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAssets(); - // [END cloudasset_v1_generated_AssetService_ExportAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js deleted file mode 100644 index 5662d4ab..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.get_feed.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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_GetFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callGetFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.getFeed(request); - console.log(response); - } - - callGetFeed(); - // [END cloudasset_v1_generated_AssetService_GetFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js deleted file mode 100644 index 9d54d692..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.get_saved_query.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js deleted file mode 100644 index 29b82e4a..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_assets.js +++ /dev/null @@ -1,126 +0,0 @@ -// 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_ListAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * 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' - /** - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - */ - // const readTime = {} - /** - * A list of asset types to take a snapshot for. For example: - * "compute.googleapis.com/Disk". - * Regular expression is also supported. For example: - * * "compute.googleapis.com.*" snapshots resources whose asset type starts - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * If specified, only matching assets will be returned, otherwise, it will - * snapshot all asset types. See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - */ - // const assetTypes = 'abc123' - /** - * Asset content type. If not specified, no content but the asset name will - * be returned. - */ - // const contentType = {} - /** - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - */ - // const pageSize = 1234 - /** - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - */ - // const pageToken = 'abc123' - /** - * A list of relationship types to output, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it snapshots specified relationships. It returns an error if - * any of the relationship_types doesn't belong to the supported - * relationship types of the asset_types or if any of the asset_types - * doesn't belong to the source types of the relationship_types. - * * Otherwise: - * it snapshots the supported relationships for all asset_types or returns - * an error if any of the asset_types has no relationship support. - * An unspecified asset types field means all supported asset_types. - * See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types and relationship types. - */ - // const relationshipTypes = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await assetClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END cloudasset_v1_generated_AssetService_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js deleted file mode 100644 index 46c49c07..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_feeds.js +++ /dev/null @@ -1,63 +0,0 @@ -// 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_ListFeeds_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent project/folder/organization whose feeds 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' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callListFeeds() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.listFeeds(request); - console.log(response); - } - - callListFeeds(); - // [END cloudasset_v1_generated_AssetService_ListFeeds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js deleted file mode 100644 index e1f9a66d..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.list_saved_queries.js +++ /dev/null @@ -1,88 +0,0 @@ -// 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js deleted file mode 100644 index 09128ea3..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.query_assets.js +++ /dev/null @@ -1,123 +0,0 @@ -// 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_QueryAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - * Only assets belonging to the `parent` will be returned. - */ - // const parent = 'abc123' - /** - * Optional. A SQL statement that's compatible with BigQuery Standard - * SQL (http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). - */ - // const statement = 'abc123' - /** - * Optional. Reference to the query job, which is from the - * `QueryAssetsResponse` of previous `QueryAssets` call. - */ - // const jobReference = 'abc123' - /** - * Optional. The maximum number of rows to return in the results. Responses - * are limited to 10 MB and 1000 rows. - * By default, the maximum row count is 1000. When the byte or row count limit - * is reached, the rest of the query results will be paginated. - * The field will be ignored when output_config is specified. - */ - // const pageSize = 1234 - /** - * Optional. A page token received from previous `QueryAssets`. - * The field will be ignored when output_config is specified. - */ - // const pageToken = 'abc123' - /** - * Optional. Specifies the maximum amount of time that the client is willing - * to wait for the query to complete. By default, this limit is 5 min for the - * first query, and 1 minute for the following queries. If the query is - * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise - * false. - * Like BigQuery jobs.query - * API (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) - * The call is not guaranteed to wait for the specified timeout; it typically - * returns after around 200 seconds (200,000 milliseconds), even if the query - * is not complete. - * The field will be ignored when output_config is specified. - */ - // const timeout = {} - /** - * Optional. start_time is required. start_time must be less than - * end_time Defaults end_time to now if start_time is set and - * end_time isn't. Maximum permitted time range is 7 days. - */ - // const readTimeWindow = {} - /** - * Optional. Queries cloud assets as they appeared at the specified point in - * time. - */ - // const readTime = {} - /** - * Optional. Destination where the query results will be saved. - * When this field is specified, the query results won't be saved in the - * QueryAssetsResponse.query_result. Instead - * QueryAssetsResponse.output_config will be set. - * Meanwhile, QueryAssetsResponse.job_reference will be set and can be used - * to check the status of the query job when passed to a following - * QueryAssets API call. - */ - // const outputConfig = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callQueryAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.queryAssets(request); - console.log(response); - } - - callQueryAssets(); - // [END cloudasset_v1_generated_AssetService_QueryAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js deleted file mode 100644 index 5c3b05e6..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_iam_policies.js +++ /dev/null @@ -1,160 +0,0 @@ -// 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) { - // [START cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 - * `cloudasset.assets.searchAllIamPolicies` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) - * permission on the desired scope. - * The allowed values are: - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - */ - // const scope = 'abc123' - /** - * Optional. The query statement. See how to construct a - * 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 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 the IAM policy - * documentation (https://cloud.google.com/iam/help/allow-policies/structure). - * Examples: - * * `policy:amy@gmail.com` to find IAM policy bindings that specify user - * "amy@gmail.com". - * * `policy:roles/compute.admin` to find IAM policy bindings that specify - * the Compute Admin role. - * * `policy:comp*` to find IAM policy bindings that contain "comp" as a - * prefix of any word in the binding. - * * `policy.role.permissions:storage.buckets.update` to find IAM policy - * bindings that specify a role containing "storage.buckets.update" - * permission. Note that if callers don't have `iam.roles.get` access to a - * role's included permissions, policy bindings that specify this role will - * be dropped from the search results. - * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a - * role containing "upd" as a prefix of any word in the role permission. - * Note that if callers don't have `iam.roles.get` access to a role's - * included permissions, policy bindings that specify this role will be - * dropped from the search results. - * * `resource:organizations/123456` to find IAM policy bindings - * that are set on "organizations/123456". - * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to - * find IAM policy bindings that are set on the project named "myproject". - * * `Important` to find IAM policy bindings that contain "Important" as a - * word in any of the searchable fields (except for the included - * permissions). - * * `resource:(instance1 OR instance2) policy:amy` to find - * IAM policy bindings that are set on resources "instance1" or - * "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 - * 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. - */ - // 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. - */ - // 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 - * 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 - * starts with "compute.googleapis.com". - * * ".*Instance" snapshots IAM policies attached to asset type ends with - * "Instance". - * * ".*Instance.*" snapshots IAM policies attached to asset type contains - * "Instance". - * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - */ - // 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. - * Example: "assetType DESC, resource". - * Only singular primitive fields in the response are sortable: - * * resource - * * assetType - * * project - * All the other fields such as repeated fields (e.g., `folders`) and - * non-primitive fields (e.g., `policy`) are not supported. - */ - // const orderBy = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callSearchAllIamPolicies() { - // Construct request - const request = { - scope, - }; - - // Run request - const iterable = await assetClient.searchAllIamPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAllIamPolicies(); - // [END cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js deleted file mode 100644 index 401168ae..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.search_all_resources.js +++ /dev/null @@ -1,204 +0,0 @@ -// 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) { - // [START cloudasset_v1_generated_AssetService_SearchAllResources_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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 - * `cloudasset.assets.searchAllResources` (https://cloud.google.com/asset-inventory/docs/access-control#required_permissions) - * permission on the desired scope. - * The allowed values are: - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - */ - // const scope = 'abc123' - /** - * Optional. The query statement. See how to construct a - * query (https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) - * for more information. If not specified or empty, it will search all the - * resources within the specified `scope`. - * Examples: - * * `name:Important` to find Cloud resources whose name contains - * "Important" as a word. - * * `name=Important` to find the Cloud resource whose name is exactly - * "Important". - * * `displayName:Impor*` to find Cloud resources whose display name - * contains "Impor" as a prefix of any word in the field. - * * `location:us-west*` to find Cloud resources whose location contains both - * "us" and "west" as prefixes. - * * `labels:prod` to find Cloud resources whose labels contain "prod" as - * a key or value. - * * `labels.env:prod` to find Cloud resources that have a label "env" - * and its value is "prod". - * * `labels.env:*` to find Cloud resources that have a label "env". - * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed - * encryption key whose name contains the word "key". - * * `relationships:instance-group-1` to find Cloud resources that have - * relationships with "instance-group-1" in the related resource name. - * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that - * have relationships of type "INSTANCE_TO_INSTANCEGROUP". - * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find - * compute instances that have relationships with "instance-group-1" in the - * compute instance group resource name, for relationship type - * "INSTANCE_TO_INSTANCEGROUP". - * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a - * word. - * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain - * "ACTIVE" as a word. - * * `createTime<1609459200` to find Cloud resources that were created before - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `updateTime>1609459200` to find Cloud resources that were updated after - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `Important` to find Cloud resources that contain "Important" as a word - * in any of the searchable fields. - * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any - * word in any of the searchable fields. - * * `Important location:(us-west1 OR global)` to find Cloud - * resources that contain "Important" as a word in any of the searchable - * fields and are also located in the "us-west1" region or the "global" - * location. - */ - // const query = 'abc123' - /** - * 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 - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - */ - // 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. - */ - // 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. - */ - // 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. - * Example: "location DESC, name". - * Only singular primitive fields in the response are sortable: - * * name - * * assetType - * * project - * * displayName - * * description - * * location - * * kmsKey - * * createTime - * * updateTime - * * state - * * parentFullResourceName - * * parentAssetType - * All the other fields such as repeated fields (e.g., `networkTags`), map - * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) - * are not supported. - */ - // 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"`. - * The read_mask paths must be valid field paths listed but not limited to - * (both snake_case and camelCase are supported): - * * name - * * assetType - * * project - * * displayName - * * description - * * location - * * tagKeys - * * tagValues - * * tagValueIds - * * labels - * * networkTags - * * kmsKey - * * createTime - * * updateTime - * * state - * * additionalAttributes - * * versionedResources - * If read_mask is not specified, all fields except versionedResources will - * be returned. - * If only '*' is specified, all fields including versionedResources will be - * returned. - * Any invalid field path will trigger INVALID_ARGUMENT error. - */ - // const readMask = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callSearchAllResources() { - // Construct request - const request = { - scope, - }; - - // Run request - const iterable = await assetClient.searchAllResourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAllResources(); - // [END cloudasset_v1_generated_AssetService_SearchAllResources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js deleted file mode 100644 index 6e28a96b..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.update_feed.js +++ /dev/null @@ -1,72 +0,0 @@ -// 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(feed, updateMask) { - // [START cloudasset_v1_generated_AssetService_UpdateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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: - * projects/project_number/feeds/feed_id or - * folders/folder_number/feeds/feed_id or - * organizations/organization_number/feeds/feed_id. - */ - // const feed = {} - /** - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - */ - // const updateMask = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callUpdateFeed() { - // Construct request - const request = { - feed, - updateMask, - }; - - // Run request - const response = await assetClient.updateFeed(request); - console.log(response); - } - - callUpdateFeed(); - // [END cloudasset_v1_generated_AssetService_UpdateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js b/owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js deleted file mode 100644 index 5c30529d..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/asset_service.update_saved_query.js +++ /dev/null @@ -1,71 +0,0 @@ -// 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] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json deleted file mode 100644 index 7ac11ad6..00000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.asset.v1.json +++ /dev/null @@ -1,1015 +0,0 @@ -{ - "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 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": 111, - "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": 118, - "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": 96, - "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": 71, - "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": 56, - "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": 55, - "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": 64, - "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": 56, - "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": 196, - "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": 152, - "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": 81, - "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": "saved_analysis_query", - "type": "TYPE_STRING" - }, - { - "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": 76, - "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": "saved_analysis_query", - "type": "TYPE_STRING" - }, - { - "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": 70, - "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" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_QueryAssets_async", - "title": "AssetService queryAssets Sample", - "origin": "API_DEFINITION", - "description": " Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`. Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call. Note, the query result has approximately 10 GB limitation enforced by BigQuery https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger results will result in errors.", - "canonical": true, - "file": "asset_service.query_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 115, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "QueryAssets", - "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "statement", - "type": "TYPE_STRING" - }, - { - "name": "job_reference", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "timeout", - "type": ".google.protobuf.Duration" - }, - { - "name": "read_time_window", - "type": ".google.cloud.asset.v1.TimeWindow" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "output_config", - "type": ".google.cloud.asset.v1.QueryAssetsOutputConfig" - } - ], - "resultType": ".google.cloud.asset.v1.QueryAssetsResponse", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "QueryAssets", - "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "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": 74, - "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": 56, - "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": 80, - "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": 63, - "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": 57, - "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": 69, - "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" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index eeab755b..00000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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. ** - -import * as v1 from './v1'; -const AssetServiceClient = v1.AssetServiceClient; -type AssetServiceClient = v1.AssetServiceClient; -export {v1, AssetServiceClient}; -export default {v1, AssetServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/asset_service_client.ts b/owl-bot-staging/v1/src/v1/asset_service_client.ts deleted file mode 100644 index 5df8a433..00000000 --- a/owl-bot-staging/v1/src/v1/asset_service_client.ts +++ /dev/null @@ -1,4043 +0,0 @@ -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/asset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './asset_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Asset service definition. - * @class - * @memberof v1 - */ -export class AssetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - assetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AssetServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AssetServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AssetServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - accessLevelPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}/accessLevels/{access_level}' - ), - accessPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}' - ), - folderFeedPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/feeds/{feed}' - ), - folderSavedQueryPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/savedQueries/{saved_query}' - ), - inventoryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}/inventory' - ), - organizationFeedPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/feeds/{feed}' - ), - organizationSavedQueryPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/savedQueries/{saved_query}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectFeedPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/feeds/{feed}' - ), - projectSavedQueryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/savedQueries/{saved_query}' - ), - servicePerimeterPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets'), - searchAllResources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'), - searchAllIamPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'), - listSavedQueries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'savedQueries') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=*/*/operations/*/**}',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const exportAssetsResponse = protoFilesRoot.lookup( - '.google.cloud.asset.v1.ExportAssetsResponse') as gax.protobuf.Type; - const exportAssetsMetadata = protoFilesRoot.lookup( - '.google.cloud.asset.v1.ExportAssetsRequest') as gax.protobuf.Type; - const analyzeIamPolicyLongrunningResponse = protoFilesRoot.lookup( - '.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningResponse') as gax.protobuf.Type; - const analyzeIamPolicyLongrunningMetadata = protoFilesRoot.lookup( - '.google.cloud.asset.v1.AnalyzeIamPolicyLongrunningMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - exportAssets: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAssetsResponse.decode.bind(exportAssetsResponse), - exportAssetsMetadata.decode.bind(exportAssetsMetadata)), - analyzeIamPolicyLongrunning: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - analyzeIamPolicyLongrunningResponse.decode.bind(analyzeIamPolicyLongrunningResponse), - analyzeIamPolicyLongrunningMetadata.decode.bind(analyzeIamPolicyLongrunningMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.asset.v1.AssetService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.assetServiceStub) { - return this.assetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.asset.v1.AssetService. - this.assetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1.AssetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.asset.v1.AssetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const assetServiceStubMethods = - ['exportAssets', 'listAssets', 'batchGetAssetsHistory', 'createFeed', 'getFeed', 'listFeeds', 'updateFeed', 'deleteFeed', 'searchAllResources', 'searchAllIamPolicies', 'analyzeIamPolicy', 'analyzeIamPolicyLongrunning', 'analyzeMove', 'queryAssets', 'createSavedQuery', 'getSavedQuery', 'listSavedQueries', 'updateSavedQuery', 'deleteSavedQuery', 'batchGetEffectiveIamPolicies']; - for (const methodName of assetServiceStubMethods) { - const callPromise = this.assetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.assetServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudasset.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. It can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id")", or a project number (such as "projects/12345"). - * @param {string[]} request.assetNames - * A list of the full names of the assets. - * See: https://cloud.google.com/asset-inventory/docs/resource-name-format - * Example: - * - * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - * - * The request becomes a no-op if the asset name list is empty, and the max - * size of the asset name list is 100 in one request. - * @param {google.cloud.asset.v1.ContentType} [request.contentType] - * Optional. The content type. - * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] - * Optional. The time window for the asset history. Both start_time and - * end_time are optional and if set, it must be after the current time minus - * 35 days. If end_time is not set, it is default to current timestamp. - * If start_time is not set, the snapshot of the assets at end_time will be - * returned. The returned results contain all temporal assets whose time - * window overlap with read_time_window. - * @param {string[]} [request.relationshipTypes] - * Optional. A list of relationship types to output, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it outputs specified relationships' history on the [asset_names]. It - * returns an error if any of the [relationship_types] doesn't belong to the - * supported relationship types of the [asset_names] or if any of the - * [asset_names]'s types doesn't belong to the source types of the - * [relationship_types]. - * * Otherwise: - * it outputs the supported relationships' history on the [asset_names] or - * returns an error if any of the [asset_names]'s types has no relationship - * support. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all - * supported asset types and relationship types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchGetAssetsHistoryResponse]{@link google.cloud.asset.v1.BatchGetAssetsHistoryResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.batch_get_assets_history.js - * region_tag:cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async - */ - batchGetAssetsHistory( - request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]>; - batchGetAssetsHistory( - request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): void; - batchGetAssetsHistory( - request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): void; - batchGetAssetsHistory( - request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchGetAssetsHistory(request, options, callback); - } -/** - * Creates a feed in a parent project/folder/organization to listen to its - * asset updates. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project/folder/organization where this feed - * 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"). - * @param {string} request.feedId - * Required. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - * @param {google.cloud.asset.v1.Feed} request.feed - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1.Feed}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.create_feed.js - * region_tag:cloudasset_v1_generated_AssetService_CreateFeed_async - */ - createFeed( - request?: protos.google.cloud.asset.v1.ICreateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]>; - createFeed( - request: protos.google.cloud.asset.v1.ICreateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request: protos.google.cloud.asset.v1.ICreateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request?: protos.google.cloud.asset.v1.ICreateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFeed(request, options, callback); - } -/** - * Gets details about an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1.Feed}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.get_feed.js - * region_tag:cloudasset_v1_generated_AssetService_GetFeed_async - */ - getFeed( - request?: protos.google.cloud.asset.v1.IGetFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]>; - getFeed( - request: protos.google.cloud.asset.v1.IGetFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request: protos.google.cloud.asset.v1.IGetFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request?: protos.google.cloud.asset.v1.IGetFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFeed(request, options, callback); - } -/** - * Lists all asset feeds in a parent project/folder/organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent project/folder/organization whose feeds 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"). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListFeedsResponse]{@link google.cloud.asset.v1.ListFeedsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.list_feeds.js - * region_tag:cloudasset_v1_generated_AssetService_ListFeeds_async - */ - listFeeds( - request?: protos.google.cloud.asset.v1.IListFeedsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]>; - listFeeds( - request: protos.google.cloud.asset.v1.IListFeedsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request: protos.google.cloud.asset.v1.IListFeedsRequest, - callback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request?: protos.google.cloud.asset.v1.IListFeedsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFeeds(request, options, callback); - } -/** - * Updates an asset feed configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1.Feed} request.feed - * 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. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1.Feed}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.update_feed.js - * region_tag:cloudasset_v1_generated_AssetService_UpdateFeed_async - */ - updateFeed( - request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]>; - updateFeed( - request: protos.google.cloud.asset.v1.IUpdateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request: protos.google.cloud.asset.v1.IUpdateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'feed.name': request.feed!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFeed(request, options, callback); - } -/** - * Deletes an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.delete_feed.js - * region_tag:cloudasset_v1_generated_AssetService_DeleteFeed_async - */ - deleteFeed( - request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]>; - deleteFeed( - request: protos.google.cloud.asset.v1.IDeleteFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request: protos.google.cloud.asset.v1.IDeleteFeedRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFeed(request, options, callback); - } -/** - * Analyzes IAM policies to answer which identities have what accesses on - * which resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1.IamPolicyAnalysisQuery} request.analysisQuery - * Required. The request query. - * @param {string} [request.savedAnalysisQuery] - * 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. - * @param {google.protobuf.Duration} [request.executionTimeout] - * 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 - * execution timeout, you will get a response with partial result. - * Otherwise, your query's execution will continue until the RPC deadline. - * If it's not finished until then, you will get a DEADLINE_EXCEEDED error. - * - * Default is empty. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [AnalyzeIamPolicyResponse]{@link google.cloud.asset.v1.AnalyzeIamPolicyResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.analyze_iam_policy.js - * region_tag:cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async - */ - analyzeIamPolicy( - request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, - protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|undefined, {}|undefined - ]>; - analyzeIamPolicy( - request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, - protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - analyzeIamPolicy( - request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, - callback: Callback< - protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, - protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - analyzeIamPolicy( - request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, - protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, - protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse, - protos.google.cloud.asset.v1.IAnalyzeIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'analysis_query.scope': request.analysisQuery!.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.analyzeIamPolicy(request, options, callback); - } -/** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * Required. Name of the resource to perform the analysis against. - * Only GCP Project are supported as of today. Hence, this can only be Project - * ID (such as "projects/my-project-id") or a Project Number (such as - * "projects/12345"). - * @param {string} request.destinationParent - * Required. Name of the GCP Folder or Organization to reparent the target - * resource. The analysis will be performed against hypothetically moving the - * resource to this specified desitination parent. This can only be a Folder - * number (such as "folders/123") or an Organization number (such as - * "organizations/123"). - * @param {google.cloud.asset.v1.AnalyzeMoveRequest.AnalysisView} request.view - * Analysis view indicating what information should be included in the - * analysis response. If unspecified, the default view is FULL. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [AnalyzeMoveResponse]{@link google.cloud.asset.v1.AnalyzeMoveResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.analyze_move.js - * region_tag:cloudasset_v1_generated_AssetService_AnalyzeMove_async - */ - analyzeMove( - request?: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IAnalyzeMoveResponse, - protos.google.cloud.asset.v1.IAnalyzeMoveRequest|undefined, {}|undefined - ]>; - analyzeMove( - request: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IAnalyzeMoveResponse, - protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, - {}|null|undefined>): void; - analyzeMove( - request: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, - callback: Callback< - protos.google.cloud.asset.v1.IAnalyzeMoveResponse, - protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, - {}|null|undefined>): void; - analyzeMove( - request?: protos.google.cloud.asset.v1.IAnalyzeMoveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IAnalyzeMoveResponse, - protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IAnalyzeMoveResponse, - protos.google.cloud.asset.v1.IAnalyzeMoveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IAnalyzeMoveResponse, - protos.google.cloud.asset.v1.IAnalyzeMoveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize(); - return this.innerApiCalls.analyzeMove(request, options, callback); - } -/** - * Issue a job that queries assets using a SQL statement compatible with - * [BigQuery Standard - * SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). - * - * If the query execution finishes within timeout and there's no pagination, - * the full query results will be returned in the `QueryAssetsResponse`. - * - * Otherwise, full query results can be obtained by issuing extra requests - * with the `job_reference` from the a previous `QueryAssets` call. - * - * Note, the query result has approximately 10 GB limitation enforced by - * BigQuery - * https://cloud.google.com/bigquery/docs/best-practices-performance-output, - * queries return larger results will result in errors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - * - * Only assets belonging to the `parent` will be returned. - * @param {string} [request.statement] - * Optional. A SQL statement that's compatible with [BigQuery Standard - * SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). - * @param {string} [request.jobReference] - * Optional. Reference to the query job, which is from the - * `QueryAssetsResponse` of previous `QueryAssets` call. - * @param {number} [request.pageSize] - * Optional. The maximum number of rows to return in the results. Responses - * are limited to 10 MB and 1000 rows. - * - * By default, the maximum row count is 1000. When the byte or row count limit - * is reached, the rest of the query results will be paginated. - * - * The field will be ignored when [output_config] is specified. - * @param {string} [request.pageToken] - * Optional. A page token received from previous `QueryAssets`. - * - * The field will be ignored when [output_config] is specified. - * @param {google.protobuf.Duration} [request.timeout] - * Optional. Specifies the maximum amount of time that the client is willing - * to wait for the query to complete. By default, this limit is 5 min for the - * first query, and 1 minute for the following queries. If the query is - * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise - * false. - * - * Like BigQuery [jobs.query - * API](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) - * The call is not guaranteed to wait for the specified timeout; it typically - * returns after around 200 seconds (200,000 milliseconds), even if the query - * is not complete. - * - * The field will be ignored when [output_config] is specified. - * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] - * Optional. [start_time] is required. [start_time] must be less than - * [end_time] Defaults [end_time] to now if [start_time] is set and - * [end_time] isn't. Maximum permitted time range is 7 days. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Queries cloud assets as they appeared at the specified point in - * time. - * @param {google.cloud.asset.v1.QueryAssetsOutputConfig} [request.outputConfig] - * Optional. Destination where the query results will be saved. - * - * When this field is specified, the query results won't be saved in the - * [QueryAssetsResponse.query_result]. Instead - * [QueryAssetsResponse.output_config] will be set. - * - * Meanwhile, [QueryAssetsResponse.job_reference] will be set and can be used - * to check the status of the query job when passed to a following - * [QueryAssets] API call. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [QueryAssetsResponse]{@link google.cloud.asset.v1.QueryAssetsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.query_assets.js - * region_tag:cloudasset_v1_generated_AssetService_QueryAssets_async - */ - queryAssets( - request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IQueryAssetsResponse, - protos.google.cloud.asset.v1.IQueryAssetsRequest|undefined, {}|undefined - ]>; - queryAssets( - request: protos.google.cloud.asset.v1.IQueryAssetsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IQueryAssetsResponse, - protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, - {}|null|undefined>): void; - queryAssets( - request: protos.google.cloud.asset.v1.IQueryAssetsRequest, - callback: Callback< - protos.google.cloud.asset.v1.IQueryAssetsResponse, - protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, - {}|null|undefined>): void; - queryAssets( - request?: protos.google.cloud.asset.v1.IQueryAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IQueryAssetsResponse, - protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IQueryAssetsResponse, - protos.google.cloud.asset.v1.IQueryAssetsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IQueryAssetsResponse, - protos.google.cloud.asset.v1.IQueryAssetsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.queryAssets(request, options, callback); - } -/** - * Creates a saved query in a parent project/folder/organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {google.cloud.asset.v1.SavedQuery} request.savedQuery - * Required. The saved_query details. The `name` field must be empty as it - * will be generated based on the parent and saved_query_id. - * @param {string} request.savedQueryId - * 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 /{@link 0-9|a-z}-/. - * - * Notice that this field is required in the saved query creation, and the - * `name` field of the `saved_query` will be ignored. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.create_saved_query.js - * region_tag:cloudasset_v1_generated_AssetService_CreateSavedQuery_async - */ - createSavedQuery( - request?: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.ICreateSavedQueryRequest|undefined, {}|undefined - ]>; - createSavedQuery( - request: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - createSavedQuery( - request: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, - callback: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - createSavedQuery( - request?: protos.google.cloud.asset.v1.ICreateSavedQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.ICreateSavedQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.ICreateSavedQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createSavedQuery(request, options, callback); - } -/** - * Gets details about a saved query. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.get_saved_query.js - * region_tag:cloudasset_v1_generated_AssetService_GetSavedQuery_async - */ - getSavedQuery( - request?: protos.google.cloud.asset.v1.IGetSavedQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IGetSavedQueryRequest|undefined, {}|undefined - ]>; - getSavedQuery( - request: protos.google.cloud.asset.v1.IGetSavedQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - getSavedQuery( - request: protos.google.cloud.asset.v1.IGetSavedQueryRequest, - callback: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - getSavedQuery( - request?: protos.google.cloud.asset.v1.IGetSavedQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IGetSavedQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IGetSavedQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getSavedQuery(request, options, callback); - } -/** - * Updates a saved query. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1.SavedQuery} request.savedQuery - * 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 - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The list of fields to update. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.update_saved_query.js - * region_tag:cloudasset_v1_generated_AssetService_UpdateSavedQuery_async - */ - updateSavedQuery( - request?: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|undefined, {}|undefined - ]>; - updateSavedQuery( - request: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - updateSavedQuery( - request: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, - callback: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - updateSavedQuery( - request?: protos.google.cloud.asset.v1.IUpdateSavedQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery, - protos.google.cloud.asset.v1.IUpdateSavedQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'saved_query.name': request.savedQuery!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateSavedQuery(request, options, callback); - } -/** - * Deletes a saved query. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.delete_saved_query.js - * region_tag:cloudasset_v1_generated_AssetService_DeleteSavedQuery_async - */ - deleteSavedQuery( - request?: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|undefined, {}|undefined - ]>; - deleteSavedQuery( - request: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - deleteSavedQuery( - request: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, - {}|null|undefined>): void; - deleteSavedQuery( - request?: protos.google.cloud.asset.v1.IDeleteSavedQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteSavedQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteSavedQuery(request, options, callback); - } -/** - * Gets effective IAM policies for a batch of resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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). - * @param {string[]} request.names - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchGetEffectiveIamPoliciesResponse]{@link google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.batch_get_effective_iam_policies.js - * region_tag:cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async - */ - batchGetEffectiveIamPolicies( - request?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|undefined, {}|undefined - ]>; - batchGetEffectiveIamPolicies( - request: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, - {}|null|undefined>): void; - batchGetEffectiveIamPolicies( - request: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, - {}|null|undefined>): void; - batchGetEffectiveIamPolicies( - request?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse, - protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.batchGetEffectiveIamPolicies(request, options, callback); - } - -/** - * 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 - * {@link 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 - * {@link 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types to take a snapshot for. For example: - * "compute.googleapis.com/Disk". - * - * Regular expressions are also supported. For example: - * - * * "compute.googleapis.com.*" snapshots resources whose asset type starts - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * - * If specified, only matching assets will be returned, otherwise, it will - * snapshot all asset types. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will be - * returned. - * @param {google.cloud.asset.v1.OutputConfig} request.outputConfig - * Required. Output configuration indicating where the results will be output - * to. - * @param {string[]} request.relationshipTypes - * A list of relationship types to export, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it snapshots specified relationships. It returns an error if - * any of the [relationship_types] doesn't belong to the supported - * relationship types of the [asset_types] or if any of the [asset_types] - * doesn't belong to the source types of the [relationship_types]. - * * Otherwise: - * it snapshots the supported relationships for all [asset_types] or returns - * an error if any of the [asset_types] has no relationship support. - * An unspecified asset types field means all supported asset_types. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) for all - * supported asset types and relationship types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.export_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async - */ - exportAssets( - request?: protos.google.cloud.asset.v1.IExportAssetsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAssets( - request: protos.google.cloud.asset.v1.IExportAssetsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAssets( - request: protos.google.cloud.asset.v1.IExportAssetsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAssets( - request?: protos.google.cloud.asset.v1.IExportAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.exportAssets(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportAssets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.export_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async - */ - async checkExportAssetsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAssets, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * 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 - * {@link google.cloud.asset.v1.AnalyzeIamPolicyResponse|AnalyzeIamPolicyResponse}. - * This method implements the - * {@link 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1.IamPolicyAnalysisQuery} request.analysisQuery - * Required. The request query. - * @param {string} [request.savedAnalysisQuery] - * 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. - * @param {google.cloud.asset.v1.IamPolicyAnalysisOutputConfig} request.outputConfig - * Required. Output configuration indicating where the results will be output - * to. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js - * region_tag:cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async - */ - analyzeIamPolicyLongrunning( - request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - analyzeIamPolicyLongrunning( - request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - analyzeIamPolicyLongrunning( - request: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - analyzeIamPolicyLongrunning( - request?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyLongrunningRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'analysis_query.scope': request.analysisQuery!.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.analyzeIamPolicyLongrunning(request, options, callback); - } -/** - * Check the status of the long running operation returned by `analyzeIamPolicyLongrunning()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.analyze_iam_policy_longrunning.js - * region_tag:cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async - */ - async checkAnalyzeIamPolicyLongrunningProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.analyzeIamPolicyLongrunning, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists assets with time and resource types and returns paged results in - * response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types to take a snapshot for. For example: - * "compute.googleapis.com/Disk". - * - * Regular expression is also supported. For example: - * - * * "compute.googleapis.com.*" snapshots resources whose asset type starts - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * - * If specified, only matching assets will be returned, otherwise, it will - * snapshot all asset types. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will - * be returned. - * @param {number} request.pageSize - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - * @param {string} request.pageToken - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - * @param {string[]} request.relationshipTypes - * A list of relationship types to output, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it snapshots specified relationships. It returns an error if - * any of the [relationship_types] doesn't belong to the supported - * relationship types of the [asset_types] or if any of the [asset_types] - * doesn't belong to the source types of the [relationship_types]. - * * Otherwise: - * it snapshots the supported relationships for all [asset_types] or returns - * an error if any of the [asset_types] has no relationship support. - * An unspecified asset types field means all supported asset_types. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types and relationship types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Asset]{@link google.cloud.asset.v1.Asset}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.asset.v1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IAsset[], - protos.google.cloud.asset.v1.IListAssetsRequest|null, - protos.google.cloud.asset.v1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.asset.v1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1.IListAssetsRequest, - protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1.IAsset>): void; - listAssets( - request: protos.google.cloud.asset.v1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1.IListAssetsRequest, - protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1.IAsset>): void; - listAssets( - request?: protos.google.cloud.asset.v1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1.IListAssetsRequest, - protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1.IAsset>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1.IListAssetsRequest, - protos.google.cloud.asset.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1.IAsset>): - Promise<[ - protos.google.cloud.asset.v1.IAsset[], - protos.google.cloud.asset.v1.IListAssetsRequest|null, - protos.google.cloud.asset.v1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types to take a snapshot for. For example: - * "compute.googleapis.com/Disk". - * - * Regular expression is also supported. For example: - * - * * "compute.googleapis.com.*" snapshots resources whose asset type starts - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * - * If specified, only matching assets will be returned, otherwise, it will - * snapshot all asset types. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will - * be returned. - * @param {number} request.pageSize - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - * @param {string} request.pageToken - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - * @param {string[]} request.relationshipTypes - * A list of relationship types to output, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it snapshots specified relationships. It returns an error if - * any of the [relationship_types] doesn't belong to the supported - * relationship types of the [asset_types] or if any of the [asset_types] - * doesn't belong to the source types of the [relationship_types]. - * * Otherwise: - * it snapshots the supported relationships for all [asset_types] or returns - * an error if any of the [asset_types] has no relationship support. - * An unspecified asset types field means all supported asset_types. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types and relationship types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Asset]{@link google.cloud.asset.v1.Asset} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.asset.v1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types to take a snapshot for. For example: - * "compute.googleapis.com/Disk". - * - * Regular expression is also supported. For example: - * - * * "compute.googleapis.com.*" snapshots resources whose asset type starts - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * - * If specified, only matching assets will be returned, otherwise, it will - * snapshot all asset types. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will - * be returned. - * @param {number} request.pageSize - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - * @param {string} request.pageToken - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - * @param {string[]} request.relationshipTypes - * A list of relationship types to output, for example: - * `INSTANCE_TO_INSTANCEGROUP`. This field should only be specified if - * content_type=RELATIONSHIP. - * * If specified: - * it snapshots specified relationships. It returns an error if - * any of the [relationship_types] doesn't belong to the supported - * relationship types of the [asset_types] or if any of the [asset_types] - * doesn't belong to the source types of the [relationship_types]. - * * Otherwise: - * it snapshots the supported relationships for all [asset_types] or returns - * an error if any of the [asset_types] has no relationship support. - * An unspecified asset types field means all supported asset_types. - * See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types and relationship types. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Asset]{@link google.cloud.asset.v1.Asset}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.list_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.asset.v1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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: - * - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - * @param {string} [request.query] - * Optional. The query statement. See [how to construct a - * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) - * for more information. If not specified or empty, it will search all the - * resources within the specified `scope`. - * - * Examples: - * - * * `name:Important` to find Cloud resources whose name contains - * "Important" as a word. - * * `name=Important` to find the Cloud resource whose name is exactly - * "Important". - * * `displayName:Impor*` to find Cloud resources whose display name - * contains "Impor" as a prefix of any word in the field. - * * `location:us-west*` to find Cloud resources whose location contains both - * "us" and "west" as prefixes. - * * `labels:prod` to find Cloud resources whose labels contain "prod" as - * a key or value. - * * `labels.env:prod` to find Cloud resources that have a label "env" - * and its value is "prod". - * * `labels.env:*` to find Cloud resources that have a label "env". - * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed - * encryption key whose name contains the word "key". - * * `relationships:instance-group-1` to find Cloud resources that have - * relationships with "instance-group-1" in the related resource name. - * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that - * have relationships of type "INSTANCE_TO_INSTANCEGROUP". - * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find - * compute instances that have relationships with "instance-group-1" in the - * compute instance group resource name, for relationship type - * "INSTANCE_TO_INSTANCEGROUP". - * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a - * word. - * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain - * "ACTIVE" as a word. - * * `createTime<1609459200` to find Cloud resources that were created before - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `updateTime>1609459200` to find Cloud resources that were updated after - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `Important` to find Cloud resources that contain "Important" as a word - * in any of the searchable fields. - * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any - * word in any of the searchable fields. - * * `Important location:(us-west1 OR global)` to find Cloud - * resources that contain "Important" as a word in any of the searchable - * fields and are also located in the "us-west1" region or the "global" - * location. - * @param {string[]} [request.assetTypes] - * 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 - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.orderBy] - * 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 - * * assetType - * * project - * * displayName - * * description - * * location - * * kmsKey - * * createTime - * * updateTime - * * state - * * parentFullResourceName - * * parentAssetType - * - * All the other fields such as repeated fields (e.g., `networkTags`), map - * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) - * are not supported. - * @param {google.protobuf.FieldMask} [request.readMask] - * 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 - * * assetType - * * project - * * displayName - * * description - * * location - * * tagKeys - * * tagValues - * * tagValueIds - * * labels - * * networkTags - * * kmsKey - * * createTime - * * updateTime - * * state - * * additionalAttributes - * * versionedResources - * - * If read_mask is not specified, all fields except versionedResources will - * be returned. - * If only '*' is specified, all fields including versionedResources will be - * returned. - * Any invalid field path will trigger INVALID_ARGUMENT error. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAllResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllResources( - request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IResourceSearchResult[], - protos.google.cloud.asset.v1.ISearchAllResourcesRequest|null, - protos.google.cloud.asset.v1.ISearchAllResourcesResponse - ]>; - searchAllResources( - request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1.IResourceSearchResult>): void; - searchAllResources( - request: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1.IResourceSearchResult>): void; - searchAllResources( - request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1.IResourceSearchResult>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1.IResourceSearchResult>): - Promise<[ - protos.google.cloud.asset.v1.IResourceSearchResult[], - protos.google.cloud.asset.v1.ISearchAllResourcesRequest|null, - protos.google.cloud.asset.v1.ISearchAllResourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.searchAllResources(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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: - * - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - * @param {string} [request.query] - * Optional. The query statement. See [how to construct a - * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) - * for more information. If not specified or empty, it will search all the - * resources within the specified `scope`. - * - * Examples: - * - * * `name:Important` to find Cloud resources whose name contains - * "Important" as a word. - * * `name=Important` to find the Cloud resource whose name is exactly - * "Important". - * * `displayName:Impor*` to find Cloud resources whose display name - * contains "Impor" as a prefix of any word in the field. - * * `location:us-west*` to find Cloud resources whose location contains both - * "us" and "west" as prefixes. - * * `labels:prod` to find Cloud resources whose labels contain "prod" as - * a key or value. - * * `labels.env:prod` to find Cloud resources that have a label "env" - * and its value is "prod". - * * `labels.env:*` to find Cloud resources that have a label "env". - * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed - * encryption key whose name contains the word "key". - * * `relationships:instance-group-1` to find Cloud resources that have - * relationships with "instance-group-1" in the related resource name. - * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that - * have relationships of type "INSTANCE_TO_INSTANCEGROUP". - * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find - * compute instances that have relationships with "instance-group-1" in the - * compute instance group resource name, for relationship type - * "INSTANCE_TO_INSTANCEGROUP". - * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a - * word. - * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain - * "ACTIVE" as a word. - * * `createTime<1609459200` to find Cloud resources that were created before - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `updateTime>1609459200` to find Cloud resources that were updated after - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `Important` to find Cloud resources that contain "Important" as a word - * in any of the searchable fields. - * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any - * word in any of the searchable fields. - * * `Important location:(us-west1 OR global)` to find Cloud - * resources that contain "Important" as a word in any of the searchable - * fields and are also located in the "us-west1" region or the "global" - * location. - * @param {string[]} [request.assetTypes] - * 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 - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.orderBy] - * 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 - * * assetType - * * project - * * displayName - * * description - * * location - * * kmsKey - * * createTime - * * updateTime - * * state - * * parentFullResourceName - * * parentAssetType - * - * All the other fields such as repeated fields (e.g., `networkTags`), map - * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) - * are not supported. - * @param {google.protobuf.FieldMask} [request.readMask] - * 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 - * * assetType - * * project - * * displayName - * * description - * * location - * * tagKeys - * * tagValues - * * tagValueIds - * * labels - * * networkTags - * * kmsKey - * * createTime - * * updateTime - * * state - * * additionalAttributes - * * versionedResources - * - * If read_mask is not specified, all fields except versionedResources will - * be returned. - * If only '*' is specified, all fields including versionedResources will be - * returned. - * Any invalid field path will trigger INVALID_ARGUMENT error. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAllResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllResourcesStream( - request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllResources.createStream( - this.innerApiCalls.searchAllResources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAllResources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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: - * - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - * @param {string} [request.query] - * Optional. The query statement. See [how to construct a - * query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) - * for more information. If not specified or empty, it will search all the - * resources within the specified `scope`. - * - * Examples: - * - * * `name:Important` to find Cloud resources whose name contains - * "Important" as a word. - * * `name=Important` to find the Cloud resource whose name is exactly - * "Important". - * * `displayName:Impor*` to find Cloud resources whose display name - * contains "Impor" as a prefix of any word in the field. - * * `location:us-west*` to find Cloud resources whose location contains both - * "us" and "west" as prefixes. - * * `labels:prod` to find Cloud resources whose labels contain "prod" as - * a key or value. - * * `labels.env:prod` to find Cloud resources that have a label "env" - * and its value is "prod". - * * `labels.env:*` to find Cloud resources that have a label "env". - * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed - * encryption key whose name contains the word "key". - * * `relationships:instance-group-1` to find Cloud resources that have - * relationships with "instance-group-1" in the related resource name. - * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that - * have relationships of type "INSTANCE_TO_INSTANCEGROUP". - * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find - * compute instances that have relationships with "instance-group-1" in the - * compute instance group resource name, for relationship type - * "INSTANCE_TO_INSTANCEGROUP". - * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a - * word. - * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain - * "ACTIVE" as a word. - * * `createTime<1609459200` to find Cloud resources that were created before - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `updateTime>1609459200` to find Cloud resources that were updated after - * "2021-01-01 00:00:00 UTC". 1609459200 is the epoch timestamp of - * "2021-01-01 00:00:00 UTC" in seconds. - * * `Important` to find Cloud resources that contain "Important" as a word - * in any of the searchable fields. - * * `Impor*` to find Cloud resources that contain "Impor" as a prefix of any - * word in any of the searchable fields. - * * `Important location:(us-west1 OR global)` to find Cloud - * resources that contain "Important" as a word in any of the searchable - * fields and are also located in the "us-west1" region or the "global" - * location. - * @param {string[]} [request.assetTypes] - * 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 - * with "compute.googleapis.com". - * * ".*Instance" snapshots resources whose asset type ends with "Instance". - * * ".*Instance.*" snapshots resources whose asset type contains "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.orderBy] - * 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 - * * assetType - * * project - * * displayName - * * description - * * location - * * kmsKey - * * createTime - * * updateTime - * * state - * * parentFullResourceName - * * parentAssetType - * - * All the other fields such as repeated fields (e.g., `networkTags`), map - * fields (e.g., `labels`) and struct fields (e.g., `additionalAttributes`) - * are not supported. - * @param {google.protobuf.FieldMask} [request.readMask] - * 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 - * * assetType - * * project - * * displayName - * * description - * * location - * * tagKeys - * * tagValues - * * tagValueIds - * * labels - * * networkTags - * * kmsKey - * * createTime - * * updateTime - * * state - * * additionalAttributes - * * versionedResources - * - * If read_mask is not specified, all fields except versionedResources will - * be returned. - * If only '*' is specified, all fields including versionedResources will be - * returned. - * Any invalid field path will trigger INVALID_ARGUMENT error. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [ResourceSearchResult]{@link google.cloud.asset.v1.ResourceSearchResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.search_all_resources.js - * region_tag:cloudasset_v1_generated_AssetService_SearchAllResources_async - */ - searchAllResourcesAsync( - request?: protos.google.cloud.asset.v1.ISearchAllResourcesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllResources.asyncIterate( - this.innerApiCalls['searchAllResources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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: - * - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - * @param {string} [request.query] - * Optional. The query statement. See [how to construct a - * 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 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 the [IAM policy - * documentation](https://cloud.google.com/iam/help/allow-policies/structure). - * - * Examples: - * - * * `policy:amy@gmail.com` to find IAM policy bindings that specify user - * "amy@gmail.com". - * * `policy:roles/compute.admin` to find IAM policy bindings that specify - * the Compute Admin role. - * * `policy:comp*` to find IAM policy bindings that contain "comp" as a - * prefix of any word in the binding. - * * `policy.role.permissions:storage.buckets.update` to find IAM policy - * bindings that specify a role containing "storage.buckets.update" - * permission. Note that if callers don't have `iam.roles.get` access to a - * role's included permissions, policy bindings that specify this role will - * be dropped from the search results. - * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a - * role containing "upd" as a prefix of any word in the role permission. - * Note that if callers don't have `iam.roles.get` access to a role's - * included permissions, policy bindings that specify this role will be - * dropped from the search results. - * * `resource:organizations/123456` to find IAM policy bindings - * that are set on "organizations/123456". - * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to - * find IAM policy bindings that are set on the project named "myproject". - * * `Important` to find IAM policy bindings that contain "Important" as a - * word in any of the searchable fields (except for the included - * permissions). - * * `resource:(instance1 OR instance2) policy:amy` to find - * IAM policy bindings that are set on resources "instance1" or - * "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 - * principal type "user". - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string[]} [request.assetTypes] - * 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 - * starts with "compute.googleapis.com". - * * ".*Instance" snapshots IAM policies attached to asset type ends with - * "Instance". - * * ".*Instance.*" snapshots IAM policies attached to asset type contains - * "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * @param {string} [request.orderBy] - * 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 - * * assetType - * * project - * All the other fields such as repeated fields (e.g., `folders`) and - * non-primitive fields (e.g., `policy`) are not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAllIamPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllIamPolicies( - request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IIamPolicySearchResult[], - protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest|null, - protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse - ]>; - searchAllIamPolicies( - request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1.IIamPolicySearchResult>): void; - searchAllIamPolicies( - request: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1.IIamPolicySearchResult>): void; - searchAllIamPolicies( - request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1.IIamPolicySearchResult>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1.IIamPolicySearchResult>): - Promise<[ - protos.google.cloud.asset.v1.IIamPolicySearchResult[], - protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest|null, - protos.google.cloud.asset.v1.ISearchAllIamPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.searchAllIamPolicies(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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: - * - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - * @param {string} [request.query] - * Optional. The query statement. See [how to construct a - * 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 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 the [IAM policy - * documentation](https://cloud.google.com/iam/help/allow-policies/structure). - * - * Examples: - * - * * `policy:amy@gmail.com` to find IAM policy bindings that specify user - * "amy@gmail.com". - * * `policy:roles/compute.admin` to find IAM policy bindings that specify - * the Compute Admin role. - * * `policy:comp*` to find IAM policy bindings that contain "comp" as a - * prefix of any word in the binding. - * * `policy.role.permissions:storage.buckets.update` to find IAM policy - * bindings that specify a role containing "storage.buckets.update" - * permission. Note that if callers don't have `iam.roles.get` access to a - * role's included permissions, policy bindings that specify this role will - * be dropped from the search results. - * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a - * role containing "upd" as a prefix of any word in the role permission. - * Note that if callers don't have `iam.roles.get` access to a role's - * included permissions, policy bindings that specify this role will be - * dropped from the search results. - * * `resource:organizations/123456` to find IAM policy bindings - * that are set on "organizations/123456". - * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to - * find IAM policy bindings that are set on the project named "myproject". - * * `Important` to find IAM policy bindings that contain "Important" as a - * word in any of the searchable fields (except for the included - * permissions). - * * `resource:(instance1 OR instance2) policy:amy` to find - * IAM policy bindings that are set on resources "instance1" or - * "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 - * principal type "user". - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string[]} [request.assetTypes] - * 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 - * starts with "compute.googleapis.com". - * * ".*Instance" snapshots IAM policies attached to asset type ends with - * "Instance". - * * ".*Instance.*" snapshots IAM policies attached to asset type contains - * "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * @param {string} [request.orderBy] - * 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 - * * assetType - * * project - * All the other fields such as repeated fields (e.g., `folders`) and - * non-primitive fields (e.g., `policy`) are not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAllIamPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllIamPoliciesStream( - request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllIamPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllIamPolicies.createStream( - this.innerApiCalls.searchAllIamPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAllIamPolicies`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * 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: - * - * * projects/{PROJECT_ID} (e.g., "projects/foo-bar") - * * projects/{PROJECT_NUMBER} (e.g., "projects/12345678") - * * folders/{FOLDER_NUMBER} (e.g., "folders/1234567") - * * organizations/{ORGANIZATION_NUMBER} (e.g., "organizations/123456") - * @param {string} [request.query] - * Optional. The query statement. See [how to construct a - * 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 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 the [IAM policy - * documentation](https://cloud.google.com/iam/help/allow-policies/structure). - * - * Examples: - * - * * `policy:amy@gmail.com` to find IAM policy bindings that specify user - * "amy@gmail.com". - * * `policy:roles/compute.admin` to find IAM policy bindings that specify - * the Compute Admin role. - * * `policy:comp*` to find IAM policy bindings that contain "comp" as a - * prefix of any word in the binding. - * * `policy.role.permissions:storage.buckets.update` to find IAM policy - * bindings that specify a role containing "storage.buckets.update" - * permission. Note that if callers don't have `iam.roles.get` access to a - * role's included permissions, policy bindings that specify this role will - * be dropped from the search results. - * * `policy.role.permissions:upd*` to find IAM policy bindings that specify a - * role containing "upd" as a prefix of any word in the role permission. - * Note that if callers don't have `iam.roles.get` access to a role's - * included permissions, policy bindings that specify this role will be - * dropped from the search results. - * * `resource:organizations/123456` to find IAM policy bindings - * that are set on "organizations/123456". - * * `resource=//cloudresourcemanager.googleapis.com/projects/myproject` to - * find IAM policy bindings that are set on the project named "myproject". - * * `Important` to find IAM policy bindings that contain "Important" as a - * word in any of the searchable fields (except for the included - * permissions). - * * `resource:(instance1 OR instance2) policy:amy` to find - * IAM policy bindings that are set on resources "instance1" or - * "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 - * principal type "user". - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string[]} [request.assetTypes] - * 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 - * starts with "compute.googleapis.com". - * * ".*Instance" snapshots IAM policies attached to asset type ends with - * "Instance". - * * ".*Instance.*" snapshots IAM policies attached to asset type contains - * "Instance". - * - * See [RE2](https://github.com/google/re2/wiki/Syntax) for all supported - * regular expression syntax. If the regular expression does not match any - * supported asset type, an INVALID_ARGUMENT error will be returned. - * @param {string} [request.orderBy] - * 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 - * * assetType - * * project - * All the other fields such as repeated fields (e.g., `folders`) and - * non-primitive fields (e.g., `policy`) are not supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [IamPolicySearchResult]{@link google.cloud.asset.v1.IamPolicySearchResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.search_all_iam_policies.js - * region_tag:cloudasset_v1_generated_AssetService_SearchAllIamPolicies_async - */ - searchAllIamPoliciesAsync( - request?: protos.google.cloud.asset.v1.ISearchAllIamPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllIamPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllIamPolicies.asyncIterate( - this.innerApiCalls['searchAllIamPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all saved queries in a parent project/folder/organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {string} [request.filter] - * 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. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSavedQueriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSavedQueries( - request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery[], - protos.google.cloud.asset.v1.IListSavedQueriesRequest|null, - protos.google.cloud.asset.v1.IListSavedQueriesResponse - ]>; - listSavedQueries( - request: protos.google.cloud.asset.v1.IListSavedQueriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1.IListSavedQueriesRequest, - protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, - protos.google.cloud.asset.v1.ISavedQuery>): void; - listSavedQueries( - request: protos.google.cloud.asset.v1.IListSavedQueriesRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1.IListSavedQueriesRequest, - protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, - protos.google.cloud.asset.v1.ISavedQuery>): void; - listSavedQueries( - request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1.IListSavedQueriesRequest, - protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, - protos.google.cloud.asset.v1.ISavedQuery>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1.IListSavedQueriesRequest, - protos.google.cloud.asset.v1.IListSavedQueriesResponse|null|undefined, - protos.google.cloud.asset.v1.ISavedQuery>): - Promise<[ - protos.google.cloud.asset.v1.ISavedQuery[], - protos.google.cloud.asset.v1.IListSavedQueriesRequest|null, - protos.google.cloud.asset.v1.IListSavedQueriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listSavedQueries(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {string} [request.filter] - * 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. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [SavedQuery]{@link google.cloud.asset.v1.SavedQuery} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSavedQueriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listSavedQueriesStream( - request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSavedQueries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSavedQueries.createStream( - this.innerApiCalls.listSavedQueries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSavedQueries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * 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"). - * @param {string} [request.filter] - * 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. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [SavedQuery]{@link google.cloud.asset.v1.SavedQuery}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/asset_service.list_saved_queries.js - * region_tag:cloudasset_v1_generated_AssetService_ListSavedQueries_async - */ - listSavedQueriesAsync( - request?: protos.google.cloud.asset.v1.IListSavedQueriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSavedQueries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSavedQueries.asyncIterate( - this.innerApiCalls['listSavedQueries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * [google.longrunning.Operation]{@link - * external:"google.longrunning.Operation"}. The promise has a method named - * "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified accessLevel resource name string. - * - * @param {string} access_policy - * @param {string} access_level - * @returns {string} Resource name string. - */ - accessLevelPath(accessPolicy:string,accessLevel:string) { - return this.pathTemplates.accessLevelPathTemplate.render({ - access_policy: accessPolicy, - access_level: accessLevel, - }); - } - - /** - * Parse the access_policy from AccessLevel resource. - * - * @param {string} accessLevelName - * A fully-qualified path representing AccessLevel resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromAccessLevelName(accessLevelName: string) { - return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_policy; - } - - /** - * Parse the access_level from AccessLevel resource. - * - * @param {string} accessLevelName - * A fully-qualified path representing AccessLevel resource. - * @returns {string} A string representing the access_level. - */ - matchAccessLevelFromAccessLevelName(accessLevelName: string) { - return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_level; - } - - /** - * Return a fully-qualified accessPolicy resource name string. - * - * @param {string} access_policy - * @returns {string} Resource name string. - */ - accessPolicyPath(accessPolicy:string) { - return this.pathTemplates.accessPolicyPathTemplate.render({ - access_policy: accessPolicy, - }); - } - - /** - * Parse the access_policy from AccessPolicy resource. - * - * @param {string} accessPolicyName - * A fully-qualified path representing AccessPolicy resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromAccessPolicyName(accessPolicyName: string) { - return this.pathTemplates.accessPolicyPathTemplate.match(accessPolicyName).access_policy; - } - - /** - * Return a fully-qualified folderFeed resource name string. - * - * @param {string} folder - * @param {string} feed - * @returns {string} Resource name string. - */ - folderFeedPath(folder:string,feed:string) { - return this.pathTemplates.folderFeedPathTemplate.render({ - folder: folder, - feed: feed, - }); - } - - /** - * Parse the folder from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).folder; - } - - /** - * Parse the feed from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).feed; - } - - /** - * Return a fully-qualified folderSavedQuery resource name string. - * - * @param {string} folder - * @param {string} saved_query - * @returns {string} Resource name string. - */ - folderSavedQueryPath(folder:string,savedQuery:string) { - return this.pathTemplates.folderSavedQueryPathTemplate.render({ - folder: folder, - saved_query: savedQuery, - }); - } - - /** - * Parse the folder from FolderSavedQuery resource. - * - * @param {string} folderSavedQueryName - * A fully-qualified path representing folder_saved_query resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSavedQueryName(folderSavedQueryName: string) { - return this.pathTemplates.folderSavedQueryPathTemplate.match(folderSavedQueryName).folder; - } - - /** - * Parse the saved_query from FolderSavedQuery resource. - * - * @param {string} folderSavedQueryName - * A fully-qualified path representing folder_saved_query resource. - * @returns {string} A string representing the saved_query. - */ - matchSavedQueryFromFolderSavedQueryName(folderSavedQueryName: string) { - return this.pathTemplates.folderSavedQueryPathTemplate.match(folderSavedQueryName).saved_query; - } - - /** - * Return a fully-qualified inventory resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - inventoryPath(project:string,location:string,instance:string) { - return this.pathTemplates.inventoryPathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Inventory resource. - * - * @param {string} inventoryName - * A fully-qualified path representing Inventory resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInventoryName(inventoryName: string) { - return this.pathTemplates.inventoryPathTemplate.match(inventoryName).project; - } - - /** - * Parse the location from Inventory resource. - * - * @param {string} inventoryName - * A fully-qualified path representing Inventory resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInventoryName(inventoryName: string) { - return this.pathTemplates.inventoryPathTemplate.match(inventoryName).location; - } - - /** - * Parse the instance from Inventory resource. - * - * @param {string} inventoryName - * A fully-qualified path representing Inventory resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInventoryName(inventoryName: string) { - return this.pathTemplates.inventoryPathTemplate.match(inventoryName).instance; - } - - /** - * Return a fully-qualified organizationFeed resource name string. - * - * @param {string} organization - * @param {string} feed - * @returns {string} Resource name string. - */ - organizationFeedPath(organization:string,feed:string) { - return this.pathTemplates.organizationFeedPathTemplate.render({ - organization: organization, - feed: feed, - }); - } - - /** - * Parse the organization from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).organization; - } - - /** - * Parse the feed from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).feed; - } - - /** - * Return a fully-qualified organizationSavedQuery resource name string. - * - * @param {string} organization - * @param {string} saved_query - * @returns {string} Resource name string. - */ - organizationSavedQueryPath(organization:string,savedQuery:string) { - return this.pathTemplates.organizationSavedQueryPathTemplate.render({ - organization: organization, - saved_query: savedQuery, - }); - } - - /** - * Parse the organization from OrganizationSavedQuery resource. - * - * @param {string} organizationSavedQueryName - * A fully-qualified path representing organization_saved_query resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSavedQueryName(organizationSavedQueryName: string) { - return this.pathTemplates.organizationSavedQueryPathTemplate.match(organizationSavedQueryName).organization; - } - - /** - * Parse the saved_query from OrganizationSavedQuery resource. - * - * @param {string} organizationSavedQueryName - * A fully-qualified path representing organization_saved_query resource. - * @returns {string} A string representing the saved_query. - */ - matchSavedQueryFromOrganizationSavedQueryName(organizationSavedQueryName: string) { - return this.pathTemplates.organizationSavedQueryPathTemplate.match(organizationSavedQueryName).saved_query; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectFeed resource name string. - * - * @param {string} project - * @param {string} feed - * @returns {string} Resource name string. - */ - projectFeedPath(project:string,feed:string) { - return this.pathTemplates.projectFeedPathTemplate.render({ - project: project, - feed: feed, - }); - } - - /** - * Parse the project from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).project; - } - - /** - * Parse the feed from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).feed; - } - - /** - * Return a fully-qualified projectSavedQuery resource name string. - * - * @param {string} project - * @param {string} saved_query - * @returns {string} Resource name string. - */ - projectSavedQueryPath(project:string,savedQuery:string) { - return this.pathTemplates.projectSavedQueryPathTemplate.render({ - project: project, - saved_query: savedQuery, - }); - } - - /** - * Parse the project from ProjectSavedQuery resource. - * - * @param {string} projectSavedQueryName - * A fully-qualified path representing project_saved_query resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSavedQueryName(projectSavedQueryName: string) { - return this.pathTemplates.projectSavedQueryPathTemplate.match(projectSavedQueryName).project; - } - - /** - * Parse the saved_query from ProjectSavedQuery resource. - * - * @param {string} projectSavedQueryName - * A fully-qualified path representing project_saved_query resource. - * @returns {string} A string representing the saved_query. - */ - matchSavedQueryFromProjectSavedQueryName(projectSavedQueryName: string) { - return this.pathTemplates.projectSavedQueryPathTemplate.match(projectSavedQueryName).saved_query; - } - - /** - * Return a fully-qualified servicePerimeter resource name string. - * - * @param {string} access_policy - * @param {string} service_perimeter - * @returns {string} Resource name string. - */ - servicePerimeterPath(accessPolicy:string,servicePerimeter:string) { - return this.pathTemplates.servicePerimeterPathTemplate.render({ - access_policy: accessPolicy, - service_perimeter: servicePerimeter, - }); - } - - /** - * Parse the access_policy from ServicePerimeter resource. - * - * @param {string} servicePerimeterName - * A fully-qualified path representing ServicePerimeter resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string) { - return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).access_policy; - } - - /** - * Parse the service_perimeter from ServicePerimeter resource. - * - * @param {string} servicePerimeterName - * A fully-qualified path representing ServicePerimeter resource. - * @returns {string} A string representing the service_perimeter. - */ - matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string) { - return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).service_perimeter; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.assetServiceStub && !this._terminated) { - return this.assetServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/asset_service_client_config.json b/owl-bot-staging/v1/src/v1/asset_service_client_config.json deleted file mode 100644 index f98d630a..00000000 --- a/owl-bot-staging/v1/src/v1/asset_service_client_config.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "interfaces": { - "google.cloud.asset.v1.AssetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ExportAssets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListAssets": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "BatchGetAssetsHistory": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateFeed": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFeed": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFeeds": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFeed": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFeed": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchAllResources": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "SearchAllIamPolicies": { - "timeout_millis": 30000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "AnalyzeIamPolicy": { - "timeout_millis": 300000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "AnalyzeIamPolicyLongrunning": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AnalyzeMove": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "QueryAssets": { - "timeout_millis": 200000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - }, - "CreateSavedQuery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSavedQuery": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListSavedQueries": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateSavedQuery": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSavedQuery": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "BatchGetEffectiveIamPolicies": { - "timeout_millis": 300000, - "retry_codes_name": "unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/asset_service_proto_list.json b/owl-bot-staging/v1/src/v1/asset_service_proto_list.json deleted file mode 100644 index d519d6bf..00000000 --- a/owl-bot-staging/v1/src/v1/asset_service_proto_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "../../protos/google/cloud/asset/v1/asset_service.proto", - "../../protos/google/cloud/asset/v1/assets.proto", - "../../protos/google/cloud/orgpolicy/v1/orgpolicy.proto", - "../../protos/google/cloud/osconfig/v1/inventory.proto", - "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", - "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" -] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 452c8a6e..00000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.asset.v1", - "libraryPackage": "@google-cloud/asset", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "BatchGetAssetsHistory": { - "methods": [ - "batchGetAssetsHistory" - ] - }, - "CreateFeed": { - "methods": [ - "createFeed" - ] - }, - "GetFeed": { - "methods": [ - "getFeed" - ] - }, - "ListFeeds": { - "methods": [ - "listFeeds" - ] - }, - "UpdateFeed": { - "methods": [ - "updateFeed" - ] - }, - "DeleteFeed": { - "methods": [ - "deleteFeed" - ] - }, - "AnalyzeIamPolicy": { - "methods": [ - "analyzeIamPolicy" - ] - }, - "AnalyzeMove": { - "methods": [ - "analyzeMove" - ] - }, - "QueryAssets": { - "methods": [ - "queryAssets" - ] - }, - "CreateSavedQuery": { - "methods": [ - "createSavedQuery" - ] - }, - "GetSavedQuery": { - "methods": [ - "getSavedQuery" - ] - }, - "UpdateSavedQuery": { - "methods": [ - "updateSavedQuery" - ] - }, - "DeleteSavedQuery": { - "methods": [ - "deleteSavedQuery" - ] - }, - "BatchGetEffectiveIamPolicies": { - "methods": [ - "batchGetEffectiveIamPolicies" - ] - }, - "ExportAssets": { - "methods": [ - "exportAssets" - ] - }, - "AnalyzeIamPolicyLongrunning": { - "methods": [ - "analyzeIamPolicyLongrunning" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "SearchAllResources": { - "methods": [ - "searchAllResources", - "searchAllResourcesStream", - "searchAllResourcesAsync" - ] - }, - "SearchAllIamPolicies": { - "methods": [ - "searchAllIamPolicies", - "searchAllIamPoliciesStream", - "searchAllIamPoliciesAsync" - ] - }, - "ListSavedQueries": { - "methods": [ - "listSavedQueries", - "listSavedQueriesStream", - "listSavedQueriesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "BatchGetAssetsHistory": { - "methods": [ - "batchGetAssetsHistory" - ] - }, - "CreateFeed": { - "methods": [ - "createFeed" - ] - }, - "GetFeed": { - "methods": [ - "getFeed" - ] - }, - "ListFeeds": { - "methods": [ - "listFeeds" - ] - }, - "UpdateFeed": { - "methods": [ - "updateFeed" - ] - }, - "DeleteFeed": { - "methods": [ - "deleteFeed" - ] - }, - "AnalyzeIamPolicy": { - "methods": [ - "analyzeIamPolicy" - ] - }, - "AnalyzeMove": { - "methods": [ - "analyzeMove" - ] - }, - "QueryAssets": { - "methods": [ - "queryAssets" - ] - }, - "CreateSavedQuery": { - "methods": [ - "createSavedQuery" - ] - }, - "GetSavedQuery": { - "methods": [ - "getSavedQuery" - ] - }, - "UpdateSavedQuery": { - "methods": [ - "updateSavedQuery" - ] - }, - "DeleteSavedQuery": { - "methods": [ - "deleteSavedQuery" - ] - }, - "BatchGetEffectiveIamPolicies": { - "methods": [ - "batchGetEffectiveIamPolicies" - ] - }, - "ExportAssets": { - "methods": [ - "exportAssets" - ] - }, - "AnalyzeIamPolicyLongrunning": { - "methods": [ - "analyzeIamPolicyLongrunning" - ] - }, - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - }, - "SearchAllResources": { - "methods": [ - "searchAllResources", - "searchAllResourcesStream", - "searchAllResourcesAsync" - ] - }, - "SearchAllIamPolicies": { - "methods": [ - "searchAllIamPolicies", - "searchAllIamPoliciesStream", - "searchAllIamPoliciesAsync" - ] - }, - "ListSavedQueries": { - "methods": [ - "listSavedQueries", - "listSavedQueriesStream", - "listSavedQueriesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index 9008232c..00000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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. ** - -export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5fa01880..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const asset = require('@google-cloud/asset'); - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8fb3fb03..00000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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. ** - -import {AssetServiceClient} from '@google-cloud/asset'; - -// check that the client class type name can be used -function doStuffWithAssetServiceClient(client: AssetServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const assetServiceClient = new AssetServiceClient(); - doStuffWithAssetServiceClient(assetServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 557a5755..00000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_asset_service_v1.ts b/owl-bot-staging/v1/test/gapic_asset_service_v1.ts deleted file mode 100644 index 780f6168..00000000 --- a/owl-bot-staging/v1/test/gapic_asset_service_v1.ts +++ /dev/null @@ -1,3697 +0,0 @@ -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as assetserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.AssetServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = assetserviceModule.v1.AssetServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = assetserviceModule.v1.AssetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - await client.initialize(); - assert(client.assetServiceStub); - }); - - 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.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 () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchGetAssetsHistory', () => { - it('invokes batchGetAssetsHistory without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() - ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(expectedResponse); - const [response] = await client.batchGetAssetsHistory(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() - ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchGetAssetsHistory( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchGetAssetsHistory(request), expectedError); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchGetAssetsHistory(request), expectedError); - }); - }); - - describe('createFeed', () => { - it('invokes createFeed without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCall(expectedResponse); - const [response] = await client.createFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFeed(request), expectedError); - }); - }); - - describe('getFeed', () => { - it('invokes getFeed without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCall(expectedResponse); - const [response] = await client.getFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFeed(request), expectedError); - }); - }); - - describe('listFeeds', () => { - it('invokes listFeeds without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCall(expectedResponse); - const [response] = await client.listFeeds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeeds( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IListFeedsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeeds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeeds(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFeeds(request), expectedError); - }); - }); - - describe('updateFeed', () => { - it('invokes updateFeed without error', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCall(expectedResponse); - const [response] = await client.updateFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed without error using callback', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed with error', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFeed(request), expectedError); - }); - }); - - describe('deleteFeed', () => { - it('invokes deleteFeed without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCall(expectedResponse); - const [response] = await client.deleteFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeed( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteFeed(request), expectedError); - }); - }); - - describe('analyzeIamPolicy', () => { - it('invokes analyzeIamPolicy without error', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.AnalyzeIamPolicyResponse() - ); - client.innerApiCalls.analyzeIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeIamPolicy without error using callback', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.AnalyzeIamPolicyResponse() - ); - client.innerApiCalls.analyzeIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeIamPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IAnalyzeIamPolicyResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeIamPolicy with error', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeIamPolicy(request), expectedError); - }); - }); - - describe('analyzeMove', () => { - it('invokes analyzeMove without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.AnalyzeMoveResponse() - ); - client.innerApiCalls.analyzeMove = stubSimpleCall(expectedResponse); - const [response] = await client.analyzeMove(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeMove as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeMove as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeMove without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.AnalyzeMoveResponse() - ); - client.innerApiCalls.analyzeMove = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeMove( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IAnalyzeMoveResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeMove as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeMove as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeMove with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeMove = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.analyzeMove(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeMove as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeMove as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('AnalyzeMoveRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.analyzeMove(request), expectedError); - }); - }); - - describe('queryAssets', () => { - it('invokes queryAssets without error', 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.QueryAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('QueryAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.QueryAssetsResponse() - ); - client.innerApiCalls.queryAssets = stubSimpleCall(expectedResponse); - const [response] = await client.queryAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryAssets without error using callback', 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.QueryAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('QueryAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.QueryAssetsResponse() - ); - client.innerApiCalls.queryAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.queryAssets( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IQueryAssetsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.queryAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryAssets with error', 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.QueryAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('QueryAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.queryAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.queryAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.queryAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.queryAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes queryAssets 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.QueryAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('QueryAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.queryAssets(request), expectedError); - }); - }); - - describe('createSavedQuery', () => { - it('invokes createSavedQuery without error', 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.CreateSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.SavedQuery() - ); - client.innerApiCalls.createSavedQuery = stubSimpleCall(expectedResponse); - const [response] = await client.createSavedQuery(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSavedQuery without error using callback', 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.CreateSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.SavedQuery() - ); - client.innerApiCalls.createSavedQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSavedQuery( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSavedQuery with error', 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.CreateSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSavedQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSavedQuery(request), expectedError); - const actualRequest = (client.innerApiCalls.createSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSavedQuery 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.CreateSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('CreateSavedQueryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSavedQuery(request), expectedError); - }); - }); - - describe('getSavedQuery', () => { - it('invokes getSavedQuery without error', 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.GetSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.SavedQuery() - ); - client.innerApiCalls.getSavedQuery = stubSimpleCall(expectedResponse); - const [response] = await client.getSavedQuery(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSavedQuery without error using callback', 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.GetSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.SavedQuery() - ); - client.innerApiCalls.getSavedQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSavedQuery( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSavedQuery with error', 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.GetSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSavedQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSavedQuery(request), expectedError); - const actualRequest = (client.innerApiCalls.getSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSavedQuery 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.GetSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('GetSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSavedQuery(request), expectedError); - }); - }); - - describe('updateSavedQuery', () => { - it('invokes updateSavedQuery without error', 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.UpdateSavedQueryRequest() - ); - request.savedQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); - request.savedQuery.name = defaultValue1; - const expectedHeaderRequestParams = `saved_query.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.SavedQuery() - ); - client.innerApiCalls.updateSavedQuery = stubSimpleCall(expectedResponse); - const [response] = await client.updateSavedQuery(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSavedQuery without error using callback', 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.UpdateSavedQueryRequest() - ); - request.savedQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); - request.savedQuery.name = defaultValue1; - const expectedHeaderRequestParams = `saved_query.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.SavedQuery() - ); - client.innerApiCalls.updateSavedQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSavedQuery( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSavedQuery with error', 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.UpdateSavedQueryRequest() - ); - request.savedQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); - request.savedQuery.name = defaultValue1; - const expectedHeaderRequestParams = `saved_query.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSavedQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSavedQuery(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSavedQuery 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.UpdateSavedQueryRequest() - ); - request.savedQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateSavedQueryRequest', ['savedQuery', 'name']); - request.savedQuery.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSavedQuery(request), expectedError); - }); - }); - - describe('deleteSavedQuery', () => { - it('invokes deleteSavedQuery without error', 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.DeleteSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSavedQuery = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSavedQuery(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSavedQuery without error using callback', 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.DeleteSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSavedQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSavedQuery( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSavedQuery with error', 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.DeleteSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSavedQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSavedQuery(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSavedQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSavedQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSavedQuery 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.DeleteSavedQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteSavedQueryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSavedQuery(request), expectedError); - }); - }); - - describe('batchGetEffectiveIamPolicies', () => { - it('invokes batchGetEffectiveIamPolicies without error', 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.BatchGetEffectiveIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse() - ); - client.innerApiCalls.batchGetEffectiveIamPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.batchGetEffectiveIamPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetEffectiveIamPolicies without error using callback', 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.BatchGetEffectiveIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetEffectiveIamPoliciesResponse() - ); - client.innerApiCalls.batchGetEffectiveIamPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchGetEffectiveIamPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IBatchGetEffectiveIamPoliciesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetEffectiveIamPolicies with error', 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.BatchGetEffectiveIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchGetEffectiveIamPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchGetEffectiveIamPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetEffectiveIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetEffectiveIamPolicies 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.BatchGetEffectiveIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('BatchGetEffectiveIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.batchGetEffectiveIamPolicies(request), expectedError); - }); - }); - - describe('exportAssets', () => { - it('invokes exportAssets without error', 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.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAssets = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAssets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets without error using callback', 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.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAssets = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAssets( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets with call error', 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.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets with LRO error', 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.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAssets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportAssetsProgress without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAssetsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAssetsProgress with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAssetsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('analyzeIamPolicyLongrunning', () => { - it('invokes analyzeIamPolicyLongrunning without error', 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.AnalyzeIamPolicyLongrunningRequest() - ); - request.analysisQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall(expectedResponse); - const [operation] = await client.analyzeIamPolicyLongrunning(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeIamPolicyLongrunning without error using callback', 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.AnalyzeIamPolicyLongrunningRequest() - ); - request.analysisQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeIamPolicyLongrunning( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeIamPolicyLongrunning with call error', 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.AnalyzeIamPolicyLongrunningRequest() - ); - request.analysisQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.analyzeIamPolicyLongrunning(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes analyzeIamPolicyLongrunning with LRO error', 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.AnalyzeIamPolicyLongrunningRequest() - ); - request.analysisQuery ??= {}; - const defaultValue1 = - getTypeDefaultValue('AnalyzeIamPolicyLongrunningRequest', ['analysisQuery', 'scope']); - request.analysisQuery.scope = defaultValue1; - const expectedHeaderRequestParams = `analysis_query.scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeIamPolicyLongrunning = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.analyzeIamPolicyLongrunning(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeIamPolicyLongrunning as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAnalyzeIamPolicyLongrunningProgress without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAnalyzeIamPolicyLongrunningProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAnalyzeIamPolicyLongrunningProgress with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAnalyzeIamPolicyLongrunningProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IAsset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1.Asset()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1.IAsset[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', 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.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1.IAsset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('searchAllResources', () => { - it('invokes searchAllResources without error', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - ]; - client.innerApiCalls.searchAllResources = stubSimpleCall(expectedResponse); - const [response] = await client.searchAllResources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllResources without error using callback', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - ]; - client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAllResources( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IResourceSearchResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllResources with error', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAllResources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAllResources(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllResourcesStream without error', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - ]; - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAllResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); - assert( - (client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchAllResourcesStream with error', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAllResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.ResourceSearchResult[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.ResourceSearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); - assert( - (client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllResources without error', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.ResourceSearchResult()), - ]; - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; - const iterable = client.searchAllResourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllResources with error', 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.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAllResourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1.IResourceSearchResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('searchAllIamPolicies', () => { - it('invokes searchAllIamPolicies without error', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.searchAllIamPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllIamPolicies without error using callback', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAllIamPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IIamPolicySearchResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllIamPolicies with error', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAllIamPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllIamPoliciesStream without error', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - ]; - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAllIamPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); - assert( - (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchAllIamPoliciesStream with error', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAllIamPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.IamPolicySearchResult[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.IamPolicySearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); - assert( - (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllIamPolicies without error', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1.IamPolicySearchResult()), - ]; - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; - const iterable = client.searchAllIamPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllIamPolicies with error', 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.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAllIamPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1.IIamPolicySearchResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSavedQueries', () => { - it('invokes listSavedQueries without error', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - ]; - client.innerApiCalls.listSavedQueries = stubSimpleCall(expectedResponse); - const [response] = await client.listSavedQueries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSavedQueries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSavedQueries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSavedQueries without error using callback', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - ]; - client.innerApiCalls.listSavedQueries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSavedQueries( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.ISavedQuery[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSavedQueries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSavedQueries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSavedQueries with error', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSavedQueries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSavedQueries(request), expectedError); - const actualRequest = (client.innerApiCalls.listSavedQueries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSavedQueries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSavedQueriesStream without error', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - ]; - client.descriptors.page.listSavedQueries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSavedQueriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.SavedQuery[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.SavedQuery) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSavedQueries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSavedQueries, request)); - assert( - (client.descriptors.page.listSavedQueries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSavedQueriesStream with error', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSavedQueries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSavedQueriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1.SavedQuery[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1.SavedQuery) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSavedQueries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSavedQueries, request)); - assert( - (client.descriptors.page.listSavedQueries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSavedQueries without error', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - generateSampleMessage(new protos.google.cloud.asset.v1.SavedQuery()), - ]; - client.descriptors.page.listSavedQueries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1.ISavedQuery[] = []; - const iterable = client.listSavedQueriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSavedQueries with error', 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.ListSavedQueriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListSavedQueriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listSavedQueries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSavedQueriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1.ISavedQuery[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSavedQueries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('accessLevel', () => { - const fakePath = "/rendered/path/accessLevel"; - const expectedParameters = { - access_policy: "accessPolicyValue", - access_level: "accessLevelValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.accessLevelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.accessLevelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('accessLevelPath', () => { - const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromAccessLevelName', () => { - const result = client.matchAccessPolicyFromAccessLevelName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAccessLevelFromAccessLevelName', () => { - const result = client.matchAccessLevelFromAccessLevelName(fakePath); - assert.strictEqual(result, "accessLevelValue"); - assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('accessPolicy', () => { - const fakePath = "/rendered/path/accessPolicy"; - const expectedParameters = { - access_policy: "accessPolicyValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.accessPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.accessPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('accessPolicyPath', () => { - const result = client.accessPolicyPath("accessPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromAccessPolicyName', () => { - const result = client.matchAccessPolicyFromAccessPolicyName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderFeed', () => { - const fakePath = "/rendered/path/folderFeed"; - const expectedParameters = { - folder: "folderValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderFeedPath', () => { - const result = client.folderFeedPath("folderValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderFeedName', () => { - const result = client.matchFolderFromFolderFeedName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromFolderFeedName', () => { - const result = client.matchFeedFromFolderFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSavedQuery', () => { - const fakePath = "/rendered/path/folderSavedQuery"; - const expectedParameters = { - folder: "folderValue", - saved_query: "savedQueryValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderSavedQueryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSavedQueryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSavedQueryPath', () => { - const result = client.folderSavedQueryPath("folderValue", "savedQueryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSavedQueryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSavedQueryName', () => { - const result = client.matchFolderFromFolderSavedQueryName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSavedQueryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSavedQueryFromFolderSavedQueryName', () => { - const result = client.matchSavedQueryFromFolderSavedQueryName(fakePath); - assert.strictEqual(result, "savedQueryValue"); - assert((client.pathTemplates.folderSavedQueryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('inventory', () => { - const fakePath = "/rendered/path/inventory"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.inventoryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.inventoryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('inventoryPath', () => { - const result = client.inventoryPath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.inventoryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInventoryName', () => { - const result = client.matchProjectFromInventoryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.inventoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInventoryName', () => { - const result = client.matchLocationFromInventoryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.inventoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInventoryName', () => { - const result = client.matchInstanceFromInventoryName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.inventoryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationFeed', () => { - const fakePath = "/rendered/path/organizationFeed"; - const expectedParameters = { - organization: "organizationValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationFeedPath', () => { - const result = client.organizationFeedPath("organizationValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationFeedName', () => { - const result = client.matchOrganizationFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromOrganizationFeedName', () => { - const result = client.matchFeedFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSavedQuery', () => { - const fakePath = "/rendered/path/organizationSavedQuery"; - const expectedParameters = { - organization: "organizationValue", - saved_query: "savedQueryValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationSavedQueryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSavedQueryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSavedQueryPath', () => { - const result = client.organizationSavedQueryPath("organizationValue", "savedQueryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSavedQueryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSavedQueryName', () => { - const result = client.matchOrganizationFromOrganizationSavedQueryName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSavedQueryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSavedQueryFromOrganizationSavedQueryName', () => { - const result = client.matchSavedQueryFromOrganizationSavedQueryName(fakePath); - assert.strictEqual(result, "savedQueryValue"); - assert((client.pathTemplates.organizationSavedQueryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectFeed', () => { - const fakePath = "/rendered/path/projectFeed"; - const expectedParameters = { - project: "projectValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectFeedPath', () => { - const result = client.projectFeedPath("projectValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectFeedName', () => { - const result = client.matchProjectFromProjectFeedName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromProjectFeedName', () => { - const result = client.matchFeedFromProjectFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSavedQuery', () => { - const fakePath = "/rendered/path/projectSavedQuery"; - const expectedParameters = { - project: "projectValue", - saved_query: "savedQueryValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectSavedQueryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSavedQueryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSavedQueryPath', () => { - const result = client.projectSavedQueryPath("projectValue", "savedQueryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSavedQueryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSavedQueryName', () => { - const result = client.matchProjectFromProjectSavedQueryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSavedQueryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSavedQueryFromProjectSavedQueryName', () => { - const result = client.matchSavedQueryFromProjectSavedQueryName(fakePath); - assert.strictEqual(result, "savedQueryValue"); - assert((client.pathTemplates.projectSavedQueryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servicePerimeter', () => { - const fakePath = "/rendered/path/servicePerimeter"; - const expectedParameters = { - access_policy: "accessPolicyValue", - service_perimeter: "servicePerimeterValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePerimeterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePerimeterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePerimeterPath', () => { - const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromServicePerimeterName', () => { - const result = client.matchAccessPolicyFromServicePerimeterName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServicePerimeterFromServicePerimeterName', () => { - const result = client.matchServicePerimeterFromServicePerimeterName(fakePath); - assert.strictEqual(result, "servicePerimeterValue"); - assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 9d42a74b..00000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'AssetService', - filename: './asset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v1p1beta1/.eslintignore b/owl-bot-staging/v1p1beta1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1p1beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1p1beta1/.eslintrc.json b/owl-bot-staging/v1p1beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1p1beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1p1beta1/.gitignore b/owl-bot-staging/v1p1beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1p1beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1p1beta1/.jsdoc.js b/owl-bot-staging/v1p1beta1/.jsdoc.js deleted file mode 100644 index a40ee8ff..00000000 --- a/owl-bot-staging/v1p1beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/asset', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1p1beta1/.mocharc.js b/owl-bot-staging/v1p1beta1/.mocharc.js deleted file mode 100644 index 481c522b..00000000 --- a/owl-bot-staging/v1p1beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1p1beta1/.prettierrc.js b/owl-bot-staging/v1p1beta1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1p1beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1p1beta1/README.md b/owl-bot-staging/v1p1beta1/README.md deleted file mode 100644 index b35f3a5e..00000000 --- a/owl-bot-staging/v1p1beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Asset: Nodejs Client diff --git a/owl-bot-staging/v1p1beta1/linkinator.config.json b/owl-bot-staging/v1p1beta1/linkinator.config.json deleted file mode 100644 index befd23c8..00000000 --- a/owl-bot-staging/v1p1beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1p1beta1/package.json b/owl-bot-staging/v1p1beta1/package.json deleted file mode 100644 index 4d04e08d..00000000 --- a/owl-bot-staging/v1p1beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/asset", - "version": "0.1.0", - "description": "Asset client for Node.js", - "repository": "googleapis/nodejs-asset", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google asset", - "asset", - "asset service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto deleted file mode 100644 index d5a0d8c4..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/asset_service.proto +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.asset.v1p1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/asset/v1p1beta1/assets.proto"; - -option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetServiceProto"; -option java_package = "com.google.cloud.asset.v1p1beta1"; -option php_namespace = "Google\\Cloud\\Asset\\V1p1beta1"; - -// Asset service definition. -service AssetService { - option (google.api.default_host) = "cloudasset.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // 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. - rpc SearchAllResources(SearchAllResourcesRequest) returns (SearchAllResourcesResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{scope=*/*}/resources:searchAll" - }; - option (google.api.method_signature) = "scope,query,asset_types"; - } - - // 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. - rpc SearchAllIamPolicies(SearchAllIamPoliciesRequest) returns (SearchAllIamPoliciesResponse) { - option (google.api.http) = { - get: "/v1p1beta1/{scope=*/*}/iamPolicies:searchAll" - }; - option (google.api.method_signature) = "scope,query"; - } -} - -// Search all resources request. -message SearchAllResourcesRequest { - // Required. The relative name of an asset. The search is limited to the resources - // within the `scope`. The allowed value must be: - // * Organization number (such as "organizations/123") - // * Folder number(such as "folders/1234") - // * Project number (such as "projects/12345") - // * Project id (such as "projects/abc") - string scope = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The query statement. - string query = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A list of asset types that this request searches for. If empty, it will - // search all the supported asset types. - repeated string asset_types = 3 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; - - // 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. For - // example, " foo , bar desc ". - string order_by = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -// Search all resources response. -message SearchAllResourcesResponse { - // A list of resource that match the search query. - repeated StandardResourceMetadata results = 1; - - // If there are more results than those appearing in this response, then - // `next_page_token` is included. To get the next set of results, call this - // method again using the value of `next_page_token` as `page_token`. - string next_page_token = 2; -} - -// Search all IAM policies request. -message SearchAllIamPoliciesRequest { - // Required. The relative name of an asset. The search is limited to the resources - // within the `scope`. The allowed value must be: - // * Organization number (such as "organizations/123") - // * Folder number(such as "folders/1234") - // * Project number (such as "projects/12345") - // * Project id (such as "projects/abc") - string scope = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The query statement. - // Examples: - // * "policy:myuser@mydomain.com" - // * "policy:(myuser@mydomain.com viewer)" - string query = 2 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; - - // 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. - string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Search all IAM policies response. -message SearchAllIamPoliciesResponse { - // A list of IamPolicy that match the search query. Related information such - // as the associated resource is returned along with the policy. - repeated IamPolicySearchResult results = 1; - - // Set if there are more results than those appearing in this response; to get - // the next set of results, call this method again, using this value as the - // `page_token`. - string next_page_token = 2; -} diff --git a/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto b/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto deleted file mode 100644 index c0ac1403..00000000 --- a/owl-bot-staging/v1p1beta1/protos/google/cloud/asset/v1p1beta1/assets.proto +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.asset.v1p1beta1; - -import "google/iam/v1/policy.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Asset.V1P1Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetProto"; -option java_package = "com.google.cloud.asset.v1p1beta1"; -option php_namespace = "Google\\Cloud\\Asset\\V1p1beta1"; - -// The standard metadata of a cloud resource. -message StandardResourceMetadata { - // The full resource name. For example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string name = 1; - - // The type of this resource. - // For example: "compute.googleapis.com/Disk". - string asset_type = 2; - - // The project that this resource belongs to, in the form of - // `projects/{project_number}`. - string project = 3; - - // The display name of this resource. - string display_name = 4; - - // One or more paragraphs of text description of this resource. Maximum length - // could be up to 1M bytes. - string description = 5; - - // Additional searchable attributes of this resource. - // Informational only. The exact set of attributes is subject to change. - // For example: project id, DNS name etc. - repeated string additional_attributes = 10; - - // Location can be "global", regional like "us-east1", or zonal like - // "us-west1-b". - string location = 11; - - // Labels associated with this resource. See [Labelling and grouping GCP - // resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) - // for more information. - map labels = 12; - - // Network tags associated with this resource. Like labels, network tags are a - // type of annotations used to group GCP resources. See [Labelling GCP - // resources](lhttps://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) - // for more information. - repeated string network_tags = 13; -} - -// The result for a IAM Policy search. -message IamPolicySearchResult { - // Explanation about the IAM policy search result. - message Explanation { - // The map from roles to their included permission matching the permission - // query (e.g. containing `policy.role.permissions:`). A sample role string: - // "roles/compute.instanceAdmin". The roles can also be found in the - // returned `policy` bindings. Note that the map is populated only if - // requesting with a permission query. - map matched_permissions = 1; - } - - // The [full resource - // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // of the resource associated with this IAM policy. - string resource = 1; - - // The project that the associated GCP resource belongs to, in the form of - // `projects/{project_number}`. If an IAM policy is set on a resource (like VM - // instance, Cloud Storage bucket), the project field will indicate the - // project that contains the resource. If an IAM policy is set on a folder or - // orgnization, the project field will be empty. - string project = 3; - - // The IAM policy directly set on the given resource. Note that the original - // IAM policy can contain multiple bindings. This only contains the bindings - // that match the given query. For queries that don't contain a constrain on - // policies (e.g. an empty query), this contains all the bindings. - google.iam.v1.Policy policy = 4; - - // Explanation about the IAM policy search result. It contains additional - // information to explain why the search result matches the query. - Explanation explanation = 5; -} - -// IAM permissions -message Permissions { - // A list of permissions. A sample permission string: "compute.disk.get". - repeated string permissions = 1; -} diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js deleted file mode 100644 index 8c4de0d4..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js +++ /dev/null @@ -1,89 +0,0 @@ -// 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) { - // [START cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - */ - // const scope = 'abc123' - /** - * Optional. The query statement. - * Examples: - * * "policy:myuser@mydomain.com" - * * "policy:(myuser@mydomain.com viewer)" - */ - // 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. - */ - // 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. - */ - // const pageToken = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p1beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callSearchAllIamPolicies() { - // Construct request - const request = { - scope, - }; - - // Run request - const iterable = await assetClient.searchAllIamPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAllIamPolicies(); - // [END cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js deleted file mode 100644 index 201744f6..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/asset_service.search_all_resources.js +++ /dev/null @@ -1,98 +0,0 @@ -// 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) { - // [START cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - */ - // const scope = 'abc123' - /** - * Optional. The query statement. - */ - // const query = 'abc123' - /** - * Optional. A list of asset types that this request searches for. If empty, it will - * search all the supported asset types. - */ - // 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. - */ - // 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. - */ - // 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. For - * example, " foo , bar desc ". - */ - // const orderBy = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p1beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callSearchAllResources() { - // Construct request - const request = { - scope, - }; - - // Run request - const iterable = await assetClient.searchAllResourcesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearchAllResources(); - // [END cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json b/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json deleted file mode 100644 index ba390b3e..00000000 --- a/owl-bot-staging/v1p1beta1/samples/generated/v1p1beta1/snippet_metadata.google.cloud.asset.v1p1beta1.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "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": 90, - "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": 81, - "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/owl-bot-staging/v1p1beta1/src/index.ts b/owl-bot-staging/v1p1beta1/src/index.ts deleted file mode 100644 index 2f9d6008..00000000 --- a/owl-bot-staging/v1p1beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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. ** - -import * as v1p1beta1 from './v1p1beta1'; -const AssetServiceClient = v1p1beta1.AssetServiceClient; -type AssetServiceClient = v1p1beta1.AssetServiceClient; -export {v1p1beta1, AssetServiceClient}; -export default {v1p1beta1, AssetServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts deleted file mode 100644 index 3cffcbbe..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client.ts +++ /dev/null @@ -1,782 +0,0 @@ -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p1beta1/asset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './asset_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Asset service definition. - * @class - * @memberof v1p1beta1 - */ -export class AssetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - assetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AssetServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AssetServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AssetServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - searchAllResources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'), - searchAllIamPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.asset.v1p1beta1.AssetService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.assetServiceStub) { - return this.assetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.asset.v1p1beta1.AssetService. - this.assetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1p1beta1.AssetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.asset.v1p1beta1.AssetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const assetServiceStubMethods = - ['searchAllResources', 'searchAllIamPolicies']; - for (const methodName of assetServiceStubMethods) { - const callPromise = this.assetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.assetServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudasset.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - * @param {string} [request.query] - * Optional. The query statement. - * @param {string[]} [request.assetTypes] - * Optional. A list of asset types that this request searches for. If empty, it will - * search all the supported asset types. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.orderBy] - * 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. For - * example, " foo , bar desc ". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [StandardResourceMetadata]{@link google.cloud.asset.v1p1beta1.StandardResourceMetadata}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAllResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllResources( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[], - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest|null, - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse - ]>; - searchAllResources( - request: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>): void; - searchAllResources( - request: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>): void; - searchAllResources( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata>): - Promise<[ - protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[], - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest|null, - protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.searchAllResources(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - * @param {string} [request.query] - * Optional. The query statement. - * @param {string[]} [request.assetTypes] - * Optional. A list of asset types that this request searches for. If empty, it will - * search all the supported asset types. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.orderBy] - * 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. For - * example, " foo , bar desc ". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [StandardResourceMetadata]{@link google.cloud.asset.v1p1beta1.StandardResourceMetadata} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAllResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllResourcesStream( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllResources.createStream( - this.innerApiCalls.searchAllResources as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAllResources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - * @param {string} [request.query] - * Optional. The query statement. - * @param {string[]} [request.assetTypes] - * Optional. A list of asset types that this request searches for. If empty, it will - * search all the supported asset types. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.orderBy] - * 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. For - * example, " foo , bar desc ". - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [StandardResourceMetadata]{@link google.cloud.asset.v1p1beta1.StandardResourceMetadata}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/asset_service.search_all_resources.js - * region_tag:cloudasset_v1p1beta1_generated_AssetService_SearchAllResources_async - */ - searchAllResourcesAsync( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllResourcesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllResources']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllResources.asyncIterate( - this.innerApiCalls['searchAllResources'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * 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. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - * @param {string} [request.query] - * Optional. The query statement. - * Examples: - * * "policy:myuser@mydomain.com" - * * "policy:(myuser@mydomain.com viewer)" - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [IamPolicySearchResult]{@link google.cloud.asset.v1p1beta1.IamPolicySearchResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAllIamPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllIamPolicies( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[], - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest|null, - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse - ]>; - searchAllIamPolicies( - request: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>): void; - searchAllIamPolicies( - request: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>): void; - searchAllIamPolicies( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse|null|undefined, - protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult>): - Promise<[ - protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[], - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest|null, - protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - this.initialize(); - return this.innerApiCalls.searchAllIamPolicies(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - * @param {string} [request.query] - * Optional. The query statement. - * Examples: - * * "policy:myuser@mydomain.com" - * * "policy:(myuser@mydomain.com viewer)" - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [IamPolicySearchResult]{@link google.cloud.asset.v1p1beta1.IamPolicySearchResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAllIamPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - searchAllIamPoliciesStream( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllIamPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllIamPolicies.createStream( - this.innerApiCalls.searchAllIamPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `searchAllIamPolicies`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.scope - * Required. The relative name of an asset. The search is limited to the resources - * within the `scope`. The allowed value must be: - * * Organization number (such as "organizations/123") - * * Folder number(such as "folders/1234") - * * Project number (such as "projects/12345") - * * Project id (such as "projects/abc") - * @param {string} [request.query] - * Optional. The query statement. - * Examples: - * * "policy:myuser@mydomain.com" - * * "policy:(myuser@mydomain.com viewer)" - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [IamPolicySearchResult]{@link google.cloud.asset.v1p1beta1.IamPolicySearchResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p1beta1/asset_service.search_all_iam_policies.js - * region_tag:cloudasset_v1p1beta1_generated_AssetService_SearchAllIamPolicies_async - */ - searchAllIamPoliciesAsync( - request?: protos.google.cloud.asset.v1p1beta1.ISearchAllIamPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scope': request.scope ?? '', - }); - const defaultCallSettings = this._defaults['searchAllIamPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.searchAllIamPolicies.asyncIterate( - this.innerApiCalls['searchAllIamPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.assetServiceStub && !this._terminated) { - return this.assetServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json deleted file mode 100644 index fe7cd34b..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_client_config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "interfaces": { - "google.cloud.asset.v1p1beta1.AssetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "SearchAllResources": { - "timeout_millis": 15000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SearchAllIamPolicies": { - "timeout_millis": 15000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json deleted file mode 100644 index 4eba2431..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/asset_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/asset/v1p1beta1/asset_service.proto", - "../../protos/google/cloud/asset/v1p1beta1/assets.proto" -] diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json b/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json deleted file mode 100644 index 4376c498..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/gapic_metadata.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.asset.v1p1beta1", - "libraryPackage": "@google-cloud/asset", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "SearchAllResources": { - "methods": [ - "searchAllResources", - "searchAllResourcesStream", - "searchAllResourcesAsync" - ] - }, - "SearchAllIamPolicies": { - "methods": [ - "searchAllIamPolicies", - "searchAllIamPoliciesStream", - "searchAllIamPoliciesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "SearchAllResources": { - "methods": [ - "searchAllResources", - "searchAllResourcesStream", - "searchAllResourcesAsync" - ] - }, - "SearchAllIamPolicies": { - "methods": [ - "searchAllIamPolicies", - "searchAllIamPoliciesStream", - "searchAllIamPoliciesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts b/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts deleted file mode 100644 index 9008232c..00000000 --- a/owl-bot-staging/v1p1beta1/src/v1p1beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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. ** - -export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5fa01880..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const asset = require('@google-cloud/asset'); - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8fb3fb03..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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. ** - -import {AssetServiceClient} from '@google-cloud/asset'; - -// check that the client class type name can be used -function doStuffWithAssetServiceClient(client: AssetServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const assetServiceClient = new AssetServiceClient(); - doStuffWithAssetServiceClient(assetServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1p1beta1/system-test/install.ts b/owl-bot-staging/v1p1beta1/system-test/install.ts deleted file mode 100644 index 557a5755..00000000 --- a/owl-bot-staging/v1p1beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts b/owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts deleted file mode 100644 index e7fd3ca8..00000000 --- a/owl-bot-staging/v1p1beta1/test/gapic_asset_service_v1p1beta1.ts +++ /dev/null @@ -1,687 +0,0 @@ -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as assetserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1p1beta1.AssetServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = assetserviceModule.v1p1beta1.AssetServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = assetserviceModule.v1p1beta1.AssetServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = assetserviceModule.v1p1beta1.AssetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - await client.initialize(); - assert(client.assetServiceStub); - }); - - 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.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 () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('searchAllResources', () => { - it('invokes searchAllResources without error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - ]; - client.innerApiCalls.searchAllResources = stubSimpleCall(expectedResponse); - const [response] = await client.searchAllResources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllResources without error using callback', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - ]; - client.innerApiCalls.searchAllResources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAllResources( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllResources with error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAllResources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAllResources(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllResourcesStream without error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - ]; - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAllResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); - assert( - (client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchAllResourcesStream with error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAllResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllResources, request)); - assert( - (client.descriptors.page.searchAllResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllResources without error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.StandardResourceMetadata()), - ]; - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = []; - const iterable = client.searchAllResourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllResources with error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllResourcesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAllResourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1p1beta1.IStandardResourceMetadata[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('searchAllIamPolicies', () => { - it('invokes searchAllIamPolicies without error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.searchAllIamPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllIamPolicies without error using callback', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - ]; - client.innerApiCalls.searchAllIamPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAllIamPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllIamPolicies with error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAllIamPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAllIamPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAllIamPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchAllIamPoliciesStream without error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - ]; - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAllIamPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); - assert( - (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchAllIamPoliciesStream with error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAllIamPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAllIamPolicies, request)); - assert( - (client.descriptors.page.searchAllIamPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllIamPolicies without error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - generateSampleMessage(new protos.google.cloud.asset.v1p1beta1.IamPolicySearchResult()), - ]; - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = []; - const iterable = client.searchAllIamPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAllIamPolicies with error', async () => { - const client = new assetserviceModule.v1p1beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p1beta1.SearchAllIamPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('SearchAllIamPoliciesRequest', ['scope']); - request.scope = defaultValue1; - const expectedHeaderRequestParams = `scope=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAllIamPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAllIamPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1p1beta1.IIamPolicySearchResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAllIamPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/owl-bot-staging/v1p1beta1/tsconfig.json b/owl-bot-staging/v1p1beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1p1beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1p1beta1/webpack.config.js b/owl-bot-staging/v1p1beta1/webpack.config.js deleted file mode 100644 index 9d42a74b..00000000 --- a/owl-bot-staging/v1p1beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'AssetService', - filename: './asset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v1p2beta1/.eslintignore b/owl-bot-staging/v1p2beta1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1p2beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1p2beta1/.eslintrc.json b/owl-bot-staging/v1p2beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1p2beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1p2beta1/.gitignore b/owl-bot-staging/v1p2beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1p2beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1p2beta1/.jsdoc.js b/owl-bot-staging/v1p2beta1/.jsdoc.js deleted file mode 100644 index a40ee8ff..00000000 --- a/owl-bot-staging/v1p2beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/asset', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1p2beta1/.mocharc.js b/owl-bot-staging/v1p2beta1/.mocharc.js deleted file mode 100644 index 481c522b..00000000 --- a/owl-bot-staging/v1p2beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1p2beta1/.prettierrc.js b/owl-bot-staging/v1p2beta1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1p2beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1p2beta1/README.md b/owl-bot-staging/v1p2beta1/README.md deleted file mode 100644 index b35f3a5e..00000000 --- a/owl-bot-staging/v1p2beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Asset: Nodejs Client diff --git a/owl-bot-staging/v1p2beta1/linkinator.config.json b/owl-bot-staging/v1p2beta1/linkinator.config.json deleted file mode 100644 index befd23c8..00000000 --- a/owl-bot-staging/v1p2beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1p2beta1/package.json b/owl-bot-staging/v1p2beta1/package.json deleted file mode 100644 index 4d04e08d..00000000 --- a/owl-bot-staging/v1p2beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/asset", - "version": "0.1.0", - "description": "Asset client for Node.js", - "repository": "googleapis/nodejs-asset", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google asset", - "asset", - "asset service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto b/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto deleted file mode 100644 index 92f285f8..00000000 --- a/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/asset_service.proto +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2019 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 -// -// 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. -// - -syntax = "proto3"; - -package google.cloud.asset.v1p2beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/asset/v1p2beta1/assets.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Asset.V1p2Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetServiceProto"; -option java_package = "com.google.cloud.asset.v1p2beta1"; -option php_namespace = "Google\\Cloud\\Asset\\V1p2beta1"; - -// Asset service definition. -service AssetService { - option (google.api.default_host) = "cloudasset.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a feed in a parent project/folder/organization to listen to its - // asset updates. - rpc CreateFeed(CreateFeedRequest) returns (Feed) { - option (google.api.http) = { - post: "/v1p2beta1/{parent=*/*}/feeds" - body: "*" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about an asset feed. - rpc GetFeed(GetFeedRequest) returns (Feed) { - option (google.api.http) = { - get: "/v1p2beta1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all asset feeds in a parent project/folder/organization. - rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { - option (google.api.http) = { - get: "/v1p2beta1/{parent=*/*}/feeds" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an asset feed configuration. - rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { - option (google.api.http) = { - patch: "/v1p2beta1/{feed.name=*/*/feeds/*}" - body: "*" - }; - option (google.api.method_signature) = "feed"; - } - - // Deletes an asset feed. - rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1p2beta1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Create asset feed request. -message CreateFeedRequest { - // Required. The name of the project/folder/organization where this feed - // 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"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. This is the client-assigned asset feed identifier and it needs to - // be unique under a specific parent project/folder/organization. - string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // 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 - Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Get asset feed request. -message GetFeedRequest { - // Required. The name of the Feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } - ]; -} - -// List asset feeds request. -message ListFeedsRequest { - // Required. The parent project/folder/organization whose feeds 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"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message ListFeedsResponse { - // A list of feeds. - repeated Feed feeds = 1; -} - -// Update asset feed request. -message UpdateFeedRequest { - // 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. - Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `feed` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteFeedRequest { - // Required. The name of the feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } - ]; -} - -// Output configuration for export assets destination. -message OutputConfig { - // Asset export destination. - oneof destination { - // Destination on Cloud Storage. - GcsDestination gcs_destination = 1; - } -} - -// A Cloud Storage location. -message GcsDestination { - // Required. - oneof object_uri { - // The uri of the Cloud Storage object. It's the same uri that is used by - // gsutil. For example: "gs://bucket_name/object_name". See [Viewing and - // Editing Object - // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) - // for more information. - string uri = 1; - } -} - -// A Cloud Pubsub destination. -message PubsubDestination { - // The name of the Cloud Pub/Sub topic to publish to. - // For example: `projects/PROJECT_ID/topics/TOPIC_ID`. - string topic = 1; -} - -// Output configuration for asset feed destination. -message FeedOutputConfig { - // Asset feed destination. - oneof destination { - // Destination on Cloud Pubsub. - PubsubDestination pubsub_destination = 1; - } -} - -// An asset feed used to export asset updates to a destinations. -// An asset feed filter controls what updates are exported. -// The asset feed must be created within a project, organization, or -// folder. Supported destinations are: -// Cloud Pub/Sub topics. -message Feed { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Feed" - pattern: "projects/{project}/feeds/{feed}" - pattern: "folders/{folder}/feeds/{feed}" - pattern: "organizations/{organization}/feeds/{feed}" - history: ORIGINALLY_SINGLE_PATTERN - }; - - // Required. The format will be - // projects/{project_number}/feeds/{client-assigned_feed_identifier} or - // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or - // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} - // - // The client-assigned feed identifier must be unique within the parent - // project/folder/organization. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of the full names of the assets to receive updates. You must specify - // either or both of asset_names and asset_types. Only asset updates matching - // specified asset_names and asset_types are exported to the feed. For - // example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more info. - repeated string asset_names = 2; - - // A list of types of the assets to receive updates. You must specify either - // or both of asset_names and asset_types. Only asset updates matching - // specified asset_names and asset_types are exported to the feed. - // For example: - // "compute.googleapis.com/Disk" See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) - // for all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name and - // type will be returned. - ContentType content_type = 4; - - // Required. Feed output configuration defining where the asset updates are - // published to. - FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// Asset content type. -enum ContentType { - // Unspecified content type. - CONTENT_TYPE_UNSPECIFIED = 0; - - // Resource metadata. - RESOURCE = 1; - - // The actual IAM policy set on a resource. - IAM_POLICY = 2; -} diff --git a/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto b/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto deleted file mode 100644 index bc2a9c51..00000000 --- a/owl-bot-staging/v1p2beta1/protos/google/cloud/asset/v1p2beta1/assets.proto +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2019 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 -// -// 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. -// - -syntax = "proto3"; - -package google.cloud.asset.v1p2beta1; - -import "google/iam/v1/policy.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Asset.v1p2beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetProto"; -option java_package = "com.google.cloud.asset.v1p2beta1"; -option php_namespace = "Google\\Cloud\\Asset\\V1p2beta1"; - -// Temporal asset. In addition to the asset, the temporal asset includes the -// status of the asset and valid from and to time of it. -message TemporalAsset { - // The time window when the asset data and state was observed. - TimeWindow window = 1; - - // If the asset is deleted or not. - bool deleted = 2; - - // Asset. - Asset asset = 3; -} - -// A time window of (start_time, end_time]. -message TimeWindow { - // Start time of the time window (exclusive). - google.protobuf.Timestamp start_time = 1; - - // End time of the time window (inclusive). - // Current timestamp if not specified. - google.protobuf.Timestamp end_time = 2; -} - -// Cloud asset. This includes all Google Cloud Platform resources, -// Cloud IAM policies, and other non-GCP assets. -message Asset { - // The full name of the asset. For example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string name = 1; - - // Type of the asset. Example: "compute.googleapis.com/Disk". - string asset_type = 2; - - // Representation of the resource. - Resource resource = 3; - - // Representation of the actual Cloud IAM policy set on a cloud resource. For - // each resource, there must be at most one Cloud IAM policy set on it. - google.iam.v1.Policy iam_policy = 4; - - // Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, - // represented as a list of relative resource names. Ancestry path starts with - // the closest CRM ancestor and ends at root. If the asset is a CRM - // project/folder/organization, this starts from the asset itself. - // - // Example: ["projects/123456789", "folders/5432", "organizations/1234"] - repeated string ancestors = 6; -} - -// Representation of a cloud resource. -message Resource { - // The API version. Example: "v1". - string version = 1; - - // The URL of the discovery document containing the resource's JSON schema. - // For example: - // `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`. - // It will be left unspecified for resources without a discovery-based API, - // such as Cloud Bigtable. - string discovery_document_uri = 2; - - // The JSON schema name listed in the discovery document. - // Example: "Project". It will be left unspecified for resources (such as - // Cloud Bigtable) without a discovery-based API. - string discovery_name = 3; - - // The REST URL for accessing the resource. An HTTP GET operation using this - // URL returns the resource itself. - // Example: - // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`. - // It will be left unspecified for resources without a REST API. - string resource_url = 4; - - // The full name of the immediate parent of this resource. See - // [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - // - // For GCP assets, it is the parent resource defined in the [Cloud IAM policy - // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). - // For example: - // `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. - // - // For third-party assets, it is up to the users to define. - string parent = 5; - - // The content of the resource, in which some sensitive fields are scrubbed - // away and may not be present. - google.protobuf.Struct data = 6; -} diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js deleted file mode 100644 index 5a9b6fcc..00000000 --- a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.create_feed.js +++ /dev/null @@ -1,80 +0,0 @@ -// 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, feedId, feed) { - // [START cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project/folder/organization where this feed - * 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. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - */ - // 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 - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const feed = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callCreateFeed() { - // Construct request - const request = { - parent, - feedId, - feed, - }; - - // Run request - const response = await assetClient.createFeed(request); - console.log(response); - } - - callCreateFeed(); - // [END cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js deleted file mode 100644 index 7f201ef9..00000000 --- a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.delete_feed.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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_v1p2beta1_generated_AssetService_DeleteFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callDeleteFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.deleteFeed(request); - console.log(response); - } - - callDeleteFeed(); - // [END cloudasset_v1p2beta1_generated_AssetService_DeleteFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js deleted file mode 100644 index 69fab689..00000000 --- a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.get_feed.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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_v1p2beta1_generated_AssetService_GetFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callGetFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.getFeed(request); - console.log(response); - } - - callGetFeed(); - // [END cloudasset_v1p2beta1_generated_AssetService_GetFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js deleted file mode 100644 index 04eaca34..00000000 --- a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.list_feeds.js +++ /dev/null @@ -1,63 +0,0 @@ -// 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_v1p2beta1_generated_AssetService_ListFeeds_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent project/folder/organization whose feeds 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' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callListFeeds() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.listFeeds(request); - console.log(response); - } - - callListFeeds(); - // [END cloudasset_v1p2beta1_generated_AssetService_ListFeeds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js deleted file mode 100644 index f49d4ab1..00000000 --- a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/asset_service.update_feed.js +++ /dev/null @@ -1,72 +0,0 @@ -// 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(feed, updateMask) { - // [START cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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: - * projects/project_number/feeds/feed_id or - * folders/folder_number/feeds/feed_id or - * organizations/organization_number/feeds/feed_id. - */ - // const feed = {} - /** - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - */ - // const updateMask = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1p2beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callUpdateFeed() { - // Construct request - const request = { - feed, - updateMask, - }; - - // Run request - const response = await assetClient.updateFeed(request); - console.log(response); - } - - callUpdateFeed(); - // [END cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json b/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json deleted file mode 100644 index 90c36e9d..00000000 --- a/owl-bot-staging/v1p2beta1/samples/generated/v1p2beta1/snippet_metadata.google.cloud.asset.v1p2beta1.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "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": 72, - "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": 56, - "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": 55, - "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": 64, - "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": 56, - "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/owl-bot-staging/v1p2beta1/src/index.ts b/owl-bot-staging/v1p2beta1/src/index.ts deleted file mode 100644 index faba3a31..00000000 --- a/owl-bot-staging/v1p2beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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. ** - -import * as v1p2beta1 from './v1p2beta1'; -const AssetServiceClient = v1p2beta1.AssetServiceClient; -type AssetServiceClient = v1p2beta1.AssetServiceClient; -export {v1p2beta1, AssetServiceClient}; -export default {v1p2beta1, AssetServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts deleted file mode 100644 index 4799c59a..00000000 --- a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client.ts +++ /dev/null @@ -1,816 +0,0 @@ -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p2beta1/asset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './asset_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Asset service definition. - * @class - * @memberof v1p2beta1 - */ -export class AssetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - assetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AssetServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AssetServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AssetServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderFeedPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/feeds/{feed}' - ), - organizationFeedPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/feeds/{feed}' - ), - projectFeedPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/feeds/{feed}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.asset.v1p2beta1.AssetService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.assetServiceStub) { - return this.assetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.asset.v1p2beta1.AssetService. - this.assetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1p2beta1.AssetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.asset.v1p2beta1.AssetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const assetServiceStubMethods = - ['createFeed', 'getFeed', 'listFeeds', 'updateFeed', 'deleteFeed']; - for (const methodName of assetServiceStubMethods) { - const callPromise = this.assetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.assetServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudasset.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a feed in a parent project/folder/organization to listen to its - * asset updates. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project/folder/organization where this feed - * 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"). - * @param {string} request.feedId - * Required. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - * @param {google.cloud.asset.v1p2beta1.Feed} request.feed - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1p2beta1.Feed}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/asset_service.create_feed.js - * region_tag:cloudasset_v1p2beta1_generated_AssetService_CreateFeed_async - */ - createFeed( - request?: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|undefined, {}|undefined - ]>; - createFeed( - request: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request?: protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.ICreateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createFeed(request, options, callback); - } -/** - * Gets details about an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1p2beta1.Feed}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/asset_service.get_feed.js - * region_tag:cloudasset_v1p2beta1_generated_AssetService_GetFeed_async - */ - getFeed( - request?: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|undefined, {}|undefined - ]>; - getFeed( - request: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request?: protos.google.cloud.asset.v1p2beta1.IGetFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IGetFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getFeed(request, options, callback); - } -/** - * Lists all asset feeds in a parent project/folder/organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent project/folder/organization whose feeds 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"). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListFeedsResponse]{@link google.cloud.asset.v1p2beta1.ListFeedsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/asset_service.list_feeds.js - * region_tag:cloudasset_v1p2beta1_generated_AssetService_ListFeeds_async - */ - listFeeds( - request?: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, - protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|undefined, {}|undefined - ]>; - listFeeds( - request: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, - protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, - protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request?: protos.google.cloud.asset.v1p2beta1.IListFeedsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, - protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, - protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IListFeedsResponse, - protos.google.cloud.asset.v1p2beta1.IListFeedsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listFeeds(request, options, callback); - } -/** - * Updates an asset feed configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1p2beta1.Feed} request.feed - * 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. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Feed]{@link google.cloud.asset.v1p2beta1.Feed}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/asset_service.update_feed.js - * region_tag:cloudasset_v1p2beta1_generated_AssetService_UpdateFeed_async - */ - updateFeed( - request?: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|undefined, {}|undefined - ]>; - updateFeed( - request: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request?: protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1p2beta1.IFeed, - protos.google.cloud.asset.v1p2beta1.IUpdateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'feed.name': request.feed!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateFeed(request, options, callback); - } -/** - * Deletes an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1p2beta1/asset_service.delete_feed.js - * region_tag:cloudasset_v1p2beta1_generated_AssetService_DeleteFeed_async - */ - deleteFeed( - request?: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|undefined, {}|undefined - ]>; - deleteFeed( - request: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request?: protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1p2beta1.IDeleteFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteFeed(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderFeed resource name string. - * - * @param {string} folder - * @param {string} feed - * @returns {string} Resource name string. - */ - folderFeedPath(folder:string,feed:string) { - return this.pathTemplates.folderFeedPathTemplate.render({ - folder: folder, - feed: feed, - }); - } - - /** - * Parse the folder from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).folder; - } - - /** - * Parse the feed from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).feed; - } - - /** - * Return a fully-qualified organizationFeed resource name string. - * - * @param {string} organization - * @param {string} feed - * @returns {string} Resource name string. - */ - organizationFeedPath(organization:string,feed:string) { - return this.pathTemplates.organizationFeedPathTemplate.render({ - organization: organization, - feed: feed, - }); - } - - /** - * Parse the organization from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).organization; - } - - /** - * Parse the feed from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).feed; - } - - /** - * Return a fully-qualified projectFeed resource name string. - * - * @param {string} project - * @param {string} feed - * @returns {string} Resource name string. - */ - projectFeedPath(project:string,feed:string) { - return this.pathTemplates.projectFeedPathTemplate.render({ - project: project, - feed: feed, - }); - } - - /** - * Parse the project from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).project; - } - - /** - * Parse the feed from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).feed; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.assetServiceStub && !this._terminated) { - return this.assetServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json deleted file mode 100644 index aa7547b8..00000000 --- a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.asset.v1p2beta1.AssetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateFeed": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFeed": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFeeds": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateFeed": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFeed": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json b/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json deleted file mode 100644 index 060b4598..00000000 --- a/owl-bot-staging/v1p2beta1/src/v1p2beta1/asset_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/asset/v1p2beta1/asset_service.proto", - "../../protos/google/cloud/asset/v1p2beta1/assets.proto" -] diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json b/owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json deleted file mode 100644 index 5e7034b0..00000000 --- a/owl-bot-staging/v1p2beta1/src/v1p2beta1/gapic_metadata.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.asset.v1p2beta1", - "libraryPackage": "@google-cloud/asset", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "CreateFeed": { - "methods": [ - "createFeed" - ] - }, - "GetFeed": { - "methods": [ - "getFeed" - ] - }, - "ListFeeds": { - "methods": [ - "listFeeds" - ] - }, - "UpdateFeed": { - "methods": [ - "updateFeed" - ] - }, - "DeleteFeed": { - "methods": [ - "deleteFeed" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "CreateFeed": { - "methods": [ - "createFeed" - ] - }, - "GetFeed": { - "methods": [ - "getFeed" - ] - }, - "ListFeeds": { - "methods": [ - "listFeeds" - ] - }, - "UpdateFeed": { - "methods": [ - "updateFeed" - ] - }, - "DeleteFeed": { - "methods": [ - "deleteFeed" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts b/owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts deleted file mode 100644 index 9008232c..00000000 --- a/owl-bot-staging/v1p2beta1/src/v1p2beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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. ** - -export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 5fa01880..00000000 --- a/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const asset = require('@google-cloud/asset'); - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8fb3fb03..00000000 --- a/owl-bot-staging/v1p2beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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. ** - -import {AssetServiceClient} from '@google-cloud/asset'; - -// check that the client class type name can be used -function doStuffWithAssetServiceClient(client: AssetServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const assetServiceClient = new AssetServiceClient(); - doStuffWithAssetServiceClient(assetServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1p2beta1/system-test/install.ts b/owl-bot-staging/v1p2beta1/system-test/install.ts deleted file mode 100644 index 557a5755..00000000 --- a/owl-bot-staging/v1p2beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts b/owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts deleted file mode 100644 index 00426d83..00000000 --- a/owl-bot-staging/v1p2beta1/test/gapic_asset_service_v1p2beta1.ts +++ /dev/null @@ -1,811 +0,0 @@ -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as assetserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1p2beta1.AssetServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = assetserviceModule.v1p2beta1.AssetServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = assetserviceModule.v1p2beta1.AssetServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = assetserviceModule.v1p2beta1.AssetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new assetserviceModule.v1p2beta1.AssetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - await client.initialize(); - assert(client.assetServiceStub); - }); - - 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.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 () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createFeed', () => { - it('invokes createFeed without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCall(expectedResponse); - const [response] = await client.createFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createFeed(request), expectedError); - }); - }); - - describe('getFeed', () => { - it('invokes getFeed without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCall(expectedResponse); - const [response] = await client.getFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFeed(request), expectedError); - }); - }); - - describe('listFeeds', () => { - it('invokes listFeeds without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCall(expectedResponse); - const [response] = await client.listFeeds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeeds( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IListFeedsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeeds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeeds(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFeeds(request), expectedError); - }); - }); - - describe('updateFeed', () => { - it('invokes updateFeed without error', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCall(expectedResponse); - const [response] = await client.updateFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed without error using callback', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1p2beta1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p2beta1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed with error', 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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 ??= {}; - const defaultValue1 = - getTypeDefaultValue('UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateFeed(request), expectedError); - }); - }); - - describe('deleteFeed', () => { - it('invokes deleteFeed without error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCall(expectedResponse); - const [response] = await client.deleteFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed without error using callback', 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeed( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed with error', 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - 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() - ); - const defaultValue1 = - getTypeDefaultValue('DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteFeed(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('folderFeed', () => { - const fakePath = "/rendered/path/folderFeed"; - const expectedParameters = { - folder: "folderValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.folderFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderFeedPath', () => { - const result = client.folderFeedPath("folderValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderFeedName', () => { - const result = client.matchFolderFromFolderFeedName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromFolderFeedName', () => { - const result = client.matchFeedFromFolderFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationFeed', () => { - const fakePath = "/rendered/path/organizationFeed"; - const expectedParameters = { - organization: "organizationValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.organizationFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationFeedPath', () => { - const result = client.organizationFeedPath("organizationValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationFeedName', () => { - const result = client.matchOrganizationFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromOrganizationFeedName', () => { - const result = client.matchFeedFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectFeed', () => { - const fakePath = "/rendered/path/projectFeed"; - const expectedParameters = { - project: "projectValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1p2beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectFeedPath', () => { - const result = client.projectFeedPath("projectValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectFeedName', () => { - const result = client.matchProjectFromProjectFeedName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromProjectFeedName', () => { - const result = client.matchFeedFromProjectFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1p2beta1/tsconfig.json b/owl-bot-staging/v1p2beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1p2beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1p2beta1/webpack.config.js b/owl-bot-staging/v1p2beta1/webpack.config.js deleted file mode 100644 index 9d42a74b..00000000 --- a/owl-bot-staging/v1p2beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'AssetService', - filename: './asset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/v1p5beta1/.eslintignore b/owl-bot-staging/v1p5beta1/.eslintignore deleted file mode 100644 index cfc348ec..00000000 --- a/owl-bot-staging/v1p5beta1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1p5beta1/.eslintrc.json b/owl-bot-staging/v1p5beta1/.eslintrc.json deleted file mode 100644 index 78215349..00000000 --- a/owl-bot-staging/v1p5beta1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1p5beta1/.gitignore b/owl-bot-staging/v1p5beta1/.gitignore deleted file mode 100644 index 5d32b237..00000000 --- a/owl-bot-staging/v1p5beta1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -.coverage -coverage -.nyc_output -docs/ -out/ -build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/v1p5beta1/.jsdoc.js b/owl-bot-staging/v1p5beta1/.jsdoc.js deleted file mode 100644 index 6f00d201..00000000 --- a/owl-bot-staging/v1p5beta1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// 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'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'asset', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1p5beta1/.mocharc.js b/owl-bot-staging/v1p5beta1/.mocharc.js deleted file mode 100644 index 481c522b..00000000 --- a/owl-bot-staging/v1p5beta1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1p5beta1/.prettierrc.js b/owl-bot-staging/v1p5beta1/.prettierrc.js deleted file mode 100644 index 494e1478..00000000 --- a/owl-bot-staging/v1p5beta1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1p5beta1/README.md b/owl-bot-staging/v1p5beta1/README.md deleted file mode 100644 index b35f3a5e..00000000 --- a/owl-bot-staging/v1p5beta1/README.md +++ /dev/null @@ -1 +0,0 @@ -Asset: Nodejs Client diff --git a/owl-bot-staging/v1p5beta1/linkinator.config.json b/owl-bot-staging/v1p5beta1/linkinator.config.json deleted file mode 100644 index befd23c8..00000000 --- a/owl-bot-staging/v1p5beta1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/v1p5beta1/package.json b/owl-bot-staging/v1p5beta1/package.json deleted file mode 100644 index a96ec6da..00000000 --- a/owl-bot-staging/v1p5beta1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "asset", - "version": "0.1.0", - "description": "Asset client for Node.js", - "repository": "googleapis/nodejs-asset", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google asset", - "asset", - "asset service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.1", - "@types/node": "^16.11.59", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^3.6.11", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.0.3", - "mocha": "^10.0.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^14.0.0", - "ts-loader": "^8.4.0", - "typescript": "^4.8.3", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto b/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto deleted file mode 100644 index 52233ad0..00000000 --- a/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/asset_service.proto +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.asset.v1p5beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/asset/v1p5beta1/assets.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Asset.V1P5Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetServiceProto"; -option java_package = "com.google.cloud.asset.v1p5beta1"; -option php_namespace = "Google\\Cloud\\Asset\\V1p5beta1"; - -// Asset service definition. -service AssetService { - option (google.api.default_host) = "cloudasset.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists assets with time and resource types and returns paged results in - // response. - rpc ListAssets(ListAssetsRequest) returns (ListAssetsResponse) { - option (google.api.http) = { - get: "/v1p5beta1/{parent=*/*}/assets" - }; - } -} - -// ListAssets request. -message ListAssetsRequest { - // Required. Name of the organization or project the assets belong to. Format: - // "organizations/[organization-number]" (such as "organizations/123"), - // "projects/[project-number]" (such as "projects/my-project-id"), or - // "projects/[project-id]" (such as "projects/12345"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Timestamp to take an asset snapshot. This can only be set to a timestamp - // between 2018-10-02 UTC (inclusive) and the current time. If not specified, - // the current time will be used. Due to delays in resource data collection - // and indexing, there is a volatile window during which running the same - // query may get different results. - google.protobuf.Timestamp read_time = 2; - - // A list of asset types of which to take a snapshot for. For example: - // "compute.googleapis.com/Disk". If specified, only matching assets will be - // returned. See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) - // for all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name will - // be returned. - ContentType content_type = 4; - - // The maximum number of assets to be returned in a single response. Default - // is 100, minimum is 1, and maximum is 1000. - int32 page_size = 5; - - // The `next_page_token` returned from the previous `ListAssetsResponse`, or - // unspecified for the first `ListAssetsRequest`. It is a continuation of a - // prior `ListAssets` call, and the API should return the next page of assets. - string page_token = 6; -} - -// Asset content type. -enum ContentType { - // Unspecified content type. - CONTENT_TYPE_UNSPECIFIED = 0; - - // Resource metadata. - RESOURCE = 1; - - // The actual IAM policy set on a resource. - IAM_POLICY = 2; - - // The Cloud Organization Policy set on an asset. - ORG_POLICY = 4; - - // The Cloud Access context mananger Policy set on an asset. - ACCESS_POLICY = 5; -} - -// ListAssets response. -message ListAssetsResponse { - // Time the snapshot was taken. - google.protobuf.Timestamp read_time = 1; - - // Assets. - repeated Asset assets = 2; - - // Token to retrieve the next page of results. Set to empty if there are no - // remaining results. - string next_page_token = 3; -} diff --git a/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto b/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto deleted file mode 100644 index 7ad133a5..00000000 --- a/owl-bot-staging/v1p5beta1/protos/google/cloud/asset/v1p5beta1/assets.proto +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2020 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 -// -// 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. - -syntax = "proto3"; - -package google.cloud.asset.v1p5beta1; - -import "google/api/resource.proto"; -import "google/cloud/orgpolicy/v1/orgpolicy.proto"; -import "google/iam/v1/policy.proto"; -import "google/identity/accesscontextmanager/v1/access_level.proto"; -import "google/identity/accesscontextmanager/v1/access_policy.proto"; -import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Asset.V1p5Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetProto"; -option java_package = "com.google.cloud.asset.v1p5beta1"; -option php_namespace = "Google\\Cloud\\Asset\\V1p5beta1"; - -// Cloud asset. This includes all Google Cloud Platform resources, -// Cloud IAM policies, and other non-GCP assets. -message Asset { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Asset" - pattern: "*" - }; - - // The full name of the asset. For example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string name = 1; - - // Type of the asset. Example: "compute.googleapis.com/Disk". - string asset_type = 2; - - // Representation of the resource. - Resource resource = 3; - - // Representation of the actual Cloud IAM policy set on a cloud resource. For - // each resource, there must be at most one Cloud IAM policy set on it. - google.iam.v1.Policy iam_policy = 4; - - // Representation of the Cloud Organization Policy set on an asset. For each - // asset, there could be multiple Organization policies with different - // constraints. - repeated google.cloud.orgpolicy.v1.Policy org_policy = 6; - - // Representation of the Cloud Organization access policy. - oneof access_context_policy { - google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7; - - google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; - - google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = - 9; - } - - // Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, - // represented as a list of relative resource names. Ancestry path starts with - // the closest CRM ancestor and ends at root. If the asset is a CRM - // project/folder/organization, this starts from the asset itself. - // - // Example: ["projects/123456789", "folders/5432", "organizations/1234"] - repeated string ancestors = 10; -} - -// Representation of a cloud resource. -message Resource { - // The API version. Example: "v1". - string version = 1; - - // The URL of the discovery document containing the resource's JSON schema. - // For example: - // `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`. - // It will be left unspecified for resources without a discovery-based API, - // such as Cloud Bigtable. - string discovery_document_uri = 2; - - // The JSON schema name listed in the discovery document. - // Example: "Project". It will be left unspecified for resources (such as - // Cloud Bigtable) without a discovery-based API. - string discovery_name = 3; - - // The REST URL for accessing the resource. An HTTP GET operation using this - // URL returns the resource itself. - // Example: - // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`. - // It will be left unspecified for resources without a REST API. - string resource_url = 4; - - // The full name of the immediate parent of this resource. See - // [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - // - // For GCP assets, it is the parent resource defined in the [Cloud IAM policy - // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). - // For example: - // `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. - // - // For third-party assets, it is up to the users to define. - string parent = 5; - - // The content of the resource, in which some sensitive fields are scrubbed - // away and may not be present. - google.protobuf.Struct data = 6; -} diff --git a/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js b/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js deleted file mode 100644 index 0306d7ce..00000000 --- a/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/asset_service.list_assets.js +++ /dev/null @@ -1,98 +0,0 @@ -// 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_v1p5beta1_generated_AssetService_ListAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * 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-number]" (such as "projects/my-project-id"), or - * "projects/[project-id]" (such as "projects/12345"). - */ - // const parent = 'abc123' - /** - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between 2018-10-02 UTC (inclusive) and the current time. If not specified, - * the current time will be used. Due to delays in resource data collection - * and indexing, there is a volatile window during which running the same - * query may get different results. - */ - // const readTime = {} - /** - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) - * for all supported asset types. - */ - // const assetTypes = 'abc123' - /** - * Asset content type. If not specified, no content but the asset name will - * be returned. - */ - // const contentType = {} - /** - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - */ - // const pageSize = 1234 - /** - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - */ - // const pageToken = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('asset').v1p5beta1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callListAssets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await assetClient.listAssetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAssets(); - // [END cloudasset_v1p5beta1_generated_AssetService_ListAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json b/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json deleted file mode 100644 index e5212114..00000000 --- a/owl-bot-staging/v1p5beta1/samples/generated/v1p5beta1/snippet_metadata.google.cloud.asset.v1p5beta1.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "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": 90, - "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/owl-bot-staging/v1p5beta1/src/index.ts b/owl-bot-staging/v1p5beta1/src/index.ts deleted file mode 100644 index 38a700fb..00000000 --- a/owl-bot-staging/v1p5beta1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// 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. ** - -import * as v1p5beta1 from './v1p5beta1'; -const AssetServiceClient = v1p5beta1.AssetServiceClient; -type AssetServiceClient = v1p5beta1.AssetServiceClient; -export {v1p5beta1, AssetServiceClient}; -export default {v1p5beta1, AssetServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts deleted file mode 100644 index 7b856703..00000000 --- a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client.ts +++ /dev/null @@ -1,664 +0,0 @@ -// 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1p5beta1/asset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './asset_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Asset service definition. - * @class - * @memberof v1p5beta1 - */ -export class AssetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - assetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AssetServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new AssetServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AssetServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - accessLevelPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}/accessLevels/{access_level}' - ), - accessPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}' - ), - servicePerimeterPathTemplate: new this._gaxModule.PathTemplate( - 'accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.asset.v1p5beta1.AssetService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.assetServiceStub) { - return this.assetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.asset.v1p5beta1.AssetService. - this.assetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1p5beta1.AssetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.asset.v1p5beta1.AssetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const assetServiceStubMethods = - ['listAssets']; - for (const methodName of assetServiceStubMethods) { - const callPromise = this.assetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.assetServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - return 'cloudasset.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Lists assets with time and resource types and returns paged results in - * response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization or project the assets belong to. Format: - * "organizations/[organization-number]" (such as "organizations/123"), - * "projects/[project-number]" (such as "projects/my-project-id"), or - * "projects/[project-id]" (such as "projects/12345"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between 2018-10-02 UTC (inclusive) and the current time. If not specified, - * the current time will be used. Due to delays in resource data collection - * and indexing, there is a volatile window during which running the same - * query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1p5beta1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will - * be returned. - * @param {number} request.pageSize - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - * @param {string} request.pageToken - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Asset]{@link google.cloud.asset.v1p5beta1.Asset}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssets( - request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1p5beta1.IAsset[], - protos.google.cloud.asset.v1p5beta1.IListAssetsRequest|null, - protos.google.cloud.asset.v1p5beta1.IListAssetsResponse - ]>; - listAssets( - request: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1p5beta1.IAsset>): void; - listAssets( - request: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1p5beta1.IAsset>): void; - listAssets( - request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1p5beta1.IAsset>, - callback?: PaginationCallback< - protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - protos.google.cloud.asset.v1p5beta1.IListAssetsResponse|null|undefined, - protos.google.cloud.asset.v1p5beta1.IAsset>): - Promise<[ - protos.google.cloud.asset.v1p5beta1.IAsset[], - protos.google.cloud.asset.v1p5beta1.IListAssetsRequest|null, - protos.google.cloud.asset.v1p5beta1.IListAssetsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listAssets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization or project the assets belong to. Format: - * "organizations/[organization-number]" (such as "organizations/123"), - * "projects/[project-number]" (such as "projects/my-project-id"), or - * "projects/[project-id]" (such as "projects/12345"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between 2018-10-02 UTC (inclusive) and the current time. If not specified, - * the current time will be used. Due to delays in resource data collection - * and indexing, there is a volatile window during which running the same - * query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1p5beta1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will - * be returned. - * @param {number} request.pageSize - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - * @param {string} request.pageToken - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing [Asset]{@link google.cloud.asset.v1p5beta1.Asset} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - */ - listAssetsStream( - request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.createStream( - this.innerApiCalls.listAssets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the organization or project the assets belong to. Format: - * "organizations/[organization-number]" (such as "organizations/123"), - * "projects/[project-number]" (such as "projects/my-project-id"), or - * "projects/[project-id]" (such as "projects/12345"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between 2018-10-02 UTC (inclusive) and the current time. If not specified, - * the current time will be used. Due to delays in resource data collection - * and indexing, there is a volatile window during which running the same - * query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1p5beta1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will - * be returned. - * @param {number} request.pageSize - * The maximum number of assets to be returned in a single response. Default - * is 100, minimum is 1, and maximum is 1000. - * @param {string} request.pageToken - * The `next_page_token` returned from the previous `ListAssetsResponse`, or - * unspecified for the first `ListAssetsRequest`. It is a continuation of a - * prior `ListAssets` call, and the API should return the next page of assets. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * [Asset]{@link google.cloud.asset.v1p5beta1.Asset}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1p5beta1/asset_service.list_assets.js - * region_tag:cloudasset_v1p5beta1_generated_AssetService_ListAssets_async - */ - listAssetsAsync( - request?: protos.google.cloud.asset.v1p5beta1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listAssets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAssets.asyncIterate( - this.innerApiCalls['listAssets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified accessLevel resource name string. - * - * @param {string} access_policy - * @param {string} access_level - * @returns {string} Resource name string. - */ - accessLevelPath(accessPolicy:string,accessLevel:string) { - return this.pathTemplates.accessLevelPathTemplate.render({ - access_policy: accessPolicy, - access_level: accessLevel, - }); - } - - /** - * Parse the access_policy from AccessLevel resource. - * - * @param {string} accessLevelName - * A fully-qualified path representing AccessLevel resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromAccessLevelName(accessLevelName: string) { - return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_policy; - } - - /** - * Parse the access_level from AccessLevel resource. - * - * @param {string} accessLevelName - * A fully-qualified path representing AccessLevel resource. - * @returns {string} A string representing the access_level. - */ - matchAccessLevelFromAccessLevelName(accessLevelName: string) { - return this.pathTemplates.accessLevelPathTemplate.match(accessLevelName).access_level; - } - - /** - * Return a fully-qualified accessPolicy resource name string. - * - * @param {string} access_policy - * @returns {string} Resource name string. - */ - accessPolicyPath(accessPolicy:string) { - return this.pathTemplates.accessPolicyPathTemplate.render({ - access_policy: accessPolicy, - }); - } - - /** - * Parse the access_policy from AccessPolicy resource. - * - * @param {string} accessPolicyName - * A fully-qualified path representing AccessPolicy resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromAccessPolicyName(accessPolicyName: string) { - return this.pathTemplates.accessPolicyPathTemplate.match(accessPolicyName).access_policy; - } - - /** - * Return a fully-qualified servicePerimeter resource name string. - * - * @param {string} access_policy - * @param {string} service_perimeter - * @returns {string} Resource name string. - */ - servicePerimeterPath(accessPolicy:string,servicePerimeter:string) { - return this.pathTemplates.servicePerimeterPathTemplate.render({ - access_policy: accessPolicy, - service_perimeter: servicePerimeter, - }); - } - - /** - * Parse the access_policy from ServicePerimeter resource. - * - * @param {string} servicePerimeterName - * A fully-qualified path representing ServicePerimeter resource. - * @returns {string} A string representing the access_policy. - */ - matchAccessPolicyFromServicePerimeterName(servicePerimeterName: string) { - return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).access_policy; - } - - /** - * Parse the service_perimeter from ServicePerimeter resource. - * - * @param {string} servicePerimeterName - * A fully-qualified path representing ServicePerimeter resource. - * @returns {string} A string representing the service_perimeter. - */ - matchServicePerimeterFromServicePerimeterName(servicePerimeterName: string) { - return this.pathTemplates.servicePerimeterPathTemplate.match(servicePerimeterName).service_perimeter; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.assetServiceStub && !this._terminated) { - return this.assetServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json deleted file mode 100644 index 1ac24652..00000000 --- a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_client_config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.asset.v1p5beta1.AssetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListAssets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json b/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json deleted file mode 100644 index 98ff312c..00000000 --- a/owl-bot-staging/v1p5beta1/src/v1p5beta1/asset_service_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/asset/v1p5beta1/asset_service.proto", - "../../protos/google/cloud/asset/v1p5beta1/assets.proto", - "../../protos/google/cloud/orgpolicy/v1/orgpolicy.proto", - "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", - "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" -] diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json b/owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json deleted file mode 100644 index cd06433c..00000000 --- a/owl-bot-staging/v1p5beta1/src/v1p5beta1/gapic_metadata.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.asset.v1p5beta1", - "libraryPackage": "asset", - "services": { - "AssetService": { - "clients": { - "grpc": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "AssetServiceClient", - "rpcs": { - "ListAssets": { - "methods": [ - "listAssets", - "listAssetsStream", - "listAssetsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts b/owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts deleted file mode 100644 index 9008232c..00000000 --- a/owl-bot-staging/v1p5beta1/src/v1p5beta1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// 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. ** - -export {AssetServiceClient} from './asset_service_client'; diff --git a/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index d3eaebbd..00000000 --- a/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const asset = require('asset'); - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 131cdf8c..00000000 --- a/owl-bot-staging/v1p5beta1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// 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. ** - -import {AssetServiceClient} from 'asset'; - -// check that the client class type name can be used -function doStuffWithAssetServiceClient(client: AssetServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const assetServiceClient = new AssetServiceClient(); - doStuffWithAssetServiceClient(assetServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1p5beta1/system-test/install.ts b/owl-bot-staging/v1p5beta1/system-test/install.ts deleted file mode 100644 index 557a5755..00000000 --- a/owl-bot-staging/v1p5beta1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts b/owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts deleted file mode 100644 index 32414708..00000000 --- a/owl-bot-staging/v1p5beta1/test/gapic_asset_service_v1p5beta1.ts +++ /dev/null @@ -1,551 +0,0 @@ -// 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as assetserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1p5beta1.AssetServiceClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = assetserviceModule.v1p5beta1.AssetServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = assetserviceModule.v1p5beta1.AssetServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = assetserviceModule.v1p5beta1.AssetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - await client.initialize(); - assert(client.assetServiceStub); - }); - - 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.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 () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1p5beta1.IAsset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p5beta1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1p5beta1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.asset.v1p5beta1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.asset.v1p5beta1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - generateSampleMessage(new protos.google.cloud.asset.v1p5beta1.Asset()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.asset.v1p5beta1.IAsset[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1p5beta1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.asset.v1p5beta1.IAsset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('accessLevel', () => { - const fakePath = "/rendered/path/accessLevel"; - const expectedParameters = { - access_policy: "accessPolicyValue", - access_level: "accessLevelValue", - }; - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.accessLevelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.accessLevelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('accessLevelPath', () => { - const result = client.accessLevelPath("accessPolicyValue", "accessLevelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.accessLevelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromAccessLevelName', () => { - const result = client.matchAccessPolicyFromAccessLevelName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAccessLevelFromAccessLevelName', () => { - const result = client.matchAccessLevelFromAccessLevelName(fakePath); - assert.strictEqual(result, "accessLevelValue"); - assert((client.pathTemplates.accessLevelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('accessPolicy', () => { - const fakePath = "/rendered/path/accessPolicy"; - const expectedParameters = { - access_policy: "accessPolicyValue", - }; - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.accessPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.accessPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('accessPolicyPath', () => { - const result = client.accessPolicyPath("accessPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.accessPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromAccessPolicyName', () => { - const result = client.matchAccessPolicyFromAccessPolicyName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.accessPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servicePerimeter', () => { - const fakePath = "/rendered/path/servicePerimeter"; - const expectedParameters = { - access_policy: "accessPolicyValue", - service_perimeter: "servicePerimeterValue", - }; - const client = new assetserviceModule.v1p5beta1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.servicePerimeterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servicePerimeterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servicePerimeterPath', () => { - const result = client.servicePerimeterPath("accessPolicyValue", "servicePerimeterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servicePerimeterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchAccessPolicyFromServicePerimeterName', () => { - const result = client.matchAccessPolicyFromServicePerimeterName(fakePath); - assert.strictEqual(result, "accessPolicyValue"); - assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServicePerimeterFromServicePerimeterName', () => { - const result = client.matchServicePerimeterFromServicePerimeterName(fakePath); - assert.strictEqual(result, "servicePerimeterValue"); - assert((client.pathTemplates.servicePerimeterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1p5beta1/tsconfig.json b/owl-bot-staging/v1p5beta1/tsconfig.json deleted file mode 100644 index c78f1c88..00000000 --- a/owl-bot-staging/v1p5beta1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1p5beta1/webpack.config.js b/owl-bot-staging/v1p5beta1/webpack.config.js deleted file mode 100644 index 9d42a74b..00000000 --- a/owl-bot-staging/v1p5beta1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'AssetService', - filename: './asset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/src/index.ts b/src/index.ts index fc2b6f63..d7bc28e8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,20 +19,12 @@ import * as v1 from './v1'; import * as v1p1beta1 from './v1p1beta1'; import * as v1p2beta1 from './v1p2beta1'; -import * as v1p4beta1 from './v1p4beta1'; import * as v1p5beta1 from './v1p5beta1'; const AssetServiceClient = v1.AssetServiceClient; type AssetServiceClient = v1.AssetServiceClient; -export {v1, v1p1beta1, v1p2beta1, v1p4beta1, v1p5beta1, AssetServiceClient}; -export default { - v1, - v1p1beta1, - v1p2beta1, - v1p4beta1, - v1p5beta1, - AssetServiceClient, -}; +export {v1, v1p1beta1, v1p2beta1, v1p5beta1, AssetServiceClient}; +export default {v1, v1p1beta1, v1p2beta1, v1p5beta1, AssetServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/src/v1/asset_service_client_config.json b/src/v1/asset_service_client_config.json index c74ddac1..f98d630a 100644 --- a/src/v1/asset_service_client_config.json +++ b/src/v1/asset_service_client_config.json @@ -93,23 +93,28 @@ "retry_params_name": "default" }, "CreateSavedQuery": { + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "GetSavedQuery": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 60000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ListSavedQueries": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 60000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateSavedQuery": { + "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteSavedQuery": { - "retry_codes_name": "non_idempotent", + "timeout_millis": 60000, + "retry_codes_name": "idempotent", "retry_params_name": "default" }, "BatchGetEffectiveIamPolicies": { From 76e50e3eb37aa1abacf06bb519e3175333d6940f Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 19 Sep 2022 22:03:27 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- src/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d7bc28e8..fc2b6f63 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,12 +19,20 @@ import * as v1 from './v1'; import * as v1p1beta1 from './v1p1beta1'; import * as v1p2beta1 from './v1p2beta1'; +import * as v1p4beta1 from './v1p4beta1'; import * as v1p5beta1 from './v1p5beta1'; const AssetServiceClient = v1.AssetServiceClient; type AssetServiceClient = v1.AssetServiceClient; -export {v1, v1p1beta1, v1p2beta1, v1p5beta1, AssetServiceClient}; -export default {v1, v1p1beta1, v1p2beta1, v1p5beta1, AssetServiceClient}; +export {v1, v1p1beta1, v1p2beta1, v1p4beta1, v1p5beta1, AssetServiceClient}; +export default { + v1, + v1p1beta1, + v1p2beta1, + v1p4beta1, + v1p5beta1, + AssetServiceClient, +}; import * as protos from '../protos/protos'; export {protos};