From 665d650c035a3801023bad2b44a1f343695b0a15 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 09:49:00 +0000 Subject: [PATCH 1/2] feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 --- 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 + .../websecurityscanner/v1/crawled_url.proto | 40 + .../cloud/websecurityscanner/v1/finding.proto | 119 + .../websecurityscanner/v1/finding_addon.proto | 147 ++ .../v1/finding_type_stats.proto | 35 + .../websecurityscanner/v1/scan_config.proto | 188 ++ .../v1/scan_config_error.proto | 189 ++ .../websecurityscanner/v1/scan_run.proto | 110 + .../v1/scan_run_error_trace.proto | 75 + .../v1/scan_run_warning_trace.proto | 58 + .../v1/web_security_scanner.proto | 337 +++ ...ta.google.cloud.websecurityscanner.v1.json | 579 +++++ ...web_security_scanner.create_scan_config.js | 62 + ...web_security_scanner.delete_scan_config.js | 58 + .../v1/web_security_scanner.get_finding.js | 59 + .../web_security_scanner.get_scan_config.js | 58 + .../v1/web_security_scanner.get_scan_run.js | 59 + .../web_security_scanner.list_crawled_urls.js | 73 + ...ecurity_scanner.list_finding_type_stats.js | 59 + .../v1/web_security_scanner.list_findings.js | 80 + .../web_security_scanner.list_scan_configs.js | 72 + .../v1/web_security_scanner.list_scan_runs.js | 72 + .../v1/web_security_scanner.start_scan_run.js | 58 + .../v1/web_security_scanner.stop_scan_run.js | 59 + ...web_security_scanner.update_scan_config.js | 65 + owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 169 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/src/v1/web_security_scanner_client.ts | 1819 ++++++++++++++ .../web_security_scanner_client_config.json | 91 + .../v1/web_security_scanner_proto_list.json | 12 + .../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_web_security_scanner_v1.ts | 2008 ++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1alpha/.eslintignore | 7 + owl-bot-staging/v1alpha/.eslintrc.json | 3 + owl-bot-staging/v1alpha/.gitignore | 14 + owl-bot-staging/v1alpha/.jsdoc.js | 55 + owl-bot-staging/v1alpha/.mocharc.js | 33 + owl-bot-staging/v1alpha/.prettierrc.js | 22 + owl-bot-staging/v1alpha/README.md | 1 + .../v1alpha/linkinator.config.json | 16 + owl-bot-staging/v1alpha/package.json | 64 + .../v1alpha/crawled_url.proto | 38 + .../websecurityscanner/v1alpha/finding.proto | 152 ++ .../v1alpha/finding_addon.proto | 78 + .../v1alpha/finding_type_stats.proto | 35 + .../v1alpha/scan_config.proto | 157 ++ .../websecurityscanner/v1alpha/scan_run.proto | 104 + .../v1alpha/web_security_scanner.proto | 410 ++++ ...ogle.cloud.websecurityscanner.v1alpha.json | 579 +++++ ...web_security_scanner.create_scan_config.js | 64 + ...web_security_scanner.delete_scan_config.js | 59 + .../web_security_scanner.get_finding.js | 60 + .../web_security_scanner.get_scan_config.js | 59 + .../web_security_scanner.get_scan_run.js | 60 + .../web_security_scanner.list_crawled_urls.js | 74 + ...ecurity_scanner.list_finding_type_stats.js | 60 + .../web_security_scanner.list_findings.js | 82 + .../web_security_scanner.list_scan_configs.js | 73 + .../web_security_scanner.list_scan_runs.js | 73 + .../web_security_scanner.start_scan_run.js | 59 + .../web_security_scanner.stop_scan_run.js | 60 + ...web_security_scanner.update_scan_config.js | 67 + owl-bot-staging/v1alpha/src/index.ts | 25 + .../v1alpha/src/v1alpha/gapic_metadata.json | 169 ++ owl-bot-staging/v1alpha/src/v1alpha/index.ts | 19 + .../v1alpha/web_security_scanner_client.ts | 1936 +++++++++++++++ .../web_security_scanner_client_config.json | 91 + .../web_security_scanner_proto_list.json | 9 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha/system-test/install.ts | 49 + .../gapic_web_security_scanner_v1alpha.ts | 2122 +++++++++++++++++ owl-bot-staging/v1alpha/tsconfig.json | 19 + owl-bot-staging/v1alpha/webpack.config.js | 64 + owl-bot-staging/v1beta/.eslintignore | 7 + owl-bot-staging/v1beta/.eslintrc.json | 3 + owl-bot-staging/v1beta/.gitignore | 14 + owl-bot-staging/v1beta/.jsdoc.js | 55 + owl-bot-staging/v1beta/.mocharc.js | 33 + owl-bot-staging/v1beta/.prettierrc.js | 22 + owl-bot-staging/v1beta/README.md | 1 + owl-bot-staging/v1beta/linkinator.config.json | 16 + owl-bot-staging/v1beta/package.json | 64 + .../v1beta/crawled_url.proto | 41 + .../websecurityscanner/v1beta/finding.proto | 98 + .../v1beta/finding_addon.proto | 90 + .../v1beta/finding_type_stats.proto | 36 + .../v1beta/scan_config.proto | 193 ++ .../v1beta/scan_config_error.proto | 190 ++ .../websecurityscanner/v1beta/scan_run.proto | 117 + .../v1beta/scan_run_error_trace.proto | 76 + .../v1beta/scan_run_warning_trace.proto | 59 + .../v1beta/web_security_scanner.proto | 413 ++++ ...oogle.cloud.websecurityscanner.v1beta.json | 579 +++++ ...web_security_scanner.create_scan_config.js | 64 + ...web_security_scanner.delete_scan_config.js | 59 + .../web_security_scanner.get_finding.js | 60 + .../web_security_scanner.get_scan_config.js | 59 + .../web_security_scanner.get_scan_run.js | 60 + .../web_security_scanner.list_crawled_urls.js | 74 + ...ecurity_scanner.list_finding_type_stats.js | 60 + .../web_security_scanner.list_findings.js | 82 + .../web_security_scanner.list_scan_configs.js | 73 + .../web_security_scanner.list_scan_runs.js | 73 + .../web_security_scanner.start_scan_run.js | 59 + .../web_security_scanner.stop_scan_run.js | 60 + ...web_security_scanner.update_scan_config.js | 67 + owl-bot-staging/v1beta/src/index.ts | 25 + .../v1beta/src/v1beta/gapic_metadata.json | 169 ++ owl-bot-staging/v1beta/src/v1beta/index.ts | 19 + .../src/v1beta/web_security_scanner_client.ts | 1936 +++++++++++++++ .../web_security_scanner_client_config.json | 91 + .../web_security_scanner_proto_list.json | 12 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1beta/system-test/install.ts | 49 + .../test/gapic_web_security_scanner_v1beta.ts | 2122 +++++++++++++++++ owl-bot-staging/v1beta/tsconfig.json | 19 + owl-bot-staging/v1beta/webpack.config.js | 64 + 132 files changed, 21962 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/websecurityscanner/v1/crawled_url.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_finding.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_config.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_run.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_findings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.start_scan_run.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.update_scan_config.js create mode 100644 owl-bot-staging/v1/src/index.ts 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/src/v1/web_security_scanner_client.ts create mode 100644 owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json 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_web_security_scanner_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/v1alpha/.eslintignore create mode 100644 owl-bot-staging/v1alpha/.eslintrc.json create mode 100644 owl-bot-staging/v1alpha/.gitignore create mode 100644 owl-bot-staging/v1alpha/.jsdoc.js create mode 100644 owl-bot-staging/v1alpha/.mocharc.js create mode 100644 owl-bot-staging/v1alpha/.prettierrc.js create mode 100644 owl-bot-staging/v1alpha/README.md create mode 100644 owl-bot-staging/v1alpha/linkinator.config.json create mode 100644 owl-bot-staging/v1alpha/package.json create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto create mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js create mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js create mode 100644 owl-bot-staging/v1alpha/src/index.ts create mode 100644 owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json create mode 100644 owl-bot-staging/v1alpha/src/v1alpha/index.ts create mode 100644 owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts create mode 100644 owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json create mode 100644 owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json create mode 100644 owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1alpha/system-test/install.ts create mode 100644 owl-bot-staging/v1alpha/test/gapic_web_security_scanner_v1alpha.ts create mode 100644 owl-bot-staging/v1alpha/tsconfig.json create mode 100644 owl-bot-staging/v1alpha/webpack.config.js create mode 100644 owl-bot-staging/v1beta/.eslintignore create mode 100644 owl-bot-staging/v1beta/.eslintrc.json create mode 100644 owl-bot-staging/v1beta/.gitignore create mode 100644 owl-bot-staging/v1beta/.jsdoc.js create mode 100644 owl-bot-staging/v1beta/.mocharc.js create mode 100644 owl-bot-staging/v1beta/.prettierrc.js create mode 100644 owl-bot-staging/v1beta/README.md create mode 100644 owl-bot-staging/v1beta/linkinator.config.json create mode 100644 owl-bot-staging/v1beta/package.json create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto create mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js create mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js create mode 100644 owl-bot-staging/v1beta/src/index.ts create mode 100644 owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json create mode 100644 owl-bot-staging/v1beta/src/v1beta/index.ts create mode 100644 owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts create mode 100644 owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json create mode 100644 owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json create mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1beta/system-test/install.ts create mode 100644 owl-bot-staging/v1beta/test/gapic_web_security_scanner_v1beta.ts create mode 100644 owl-bot-staging/v1beta/tsconfig.json create mode 100644 owl-bot-staging/v1beta/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /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 0000000..7821534 --- /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 0000000..5d32b23 --- /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 0000000..65475a4 --- /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/web-security-scanner', + 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 0000000..481c522 --- /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 0000000..494e147 --- /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 0000000..727d3b6 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Websecurityscanner: 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 0000000..befd23c --- /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 0000000..d42ee9b --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/web-security-scanner", + "version": "0.1.0", + "description": "Websecurityscanner client for Node.js", + "repository": "googleapis/nodejs-websecurityscanner", + "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 websecurityscanner", + "websecurityscanner", + "web security scanner" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "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.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto new file mode 100644 index 0000000..37724b8 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto @@ -0,0 +1,40 @@ +// 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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "CrawledUrlProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web +// Security Scanner Service crawls the web applications, following all links +// within the scope of sites, to find the URLs to test against. +message CrawledUrl { + // Output only. The http method of the request that was used to visit the URL, in + // uppercase. + string http_method = 1; + + // Output only. The URL that was crawled. + string url = 2; + + // Output only. The body of the request that was used to visit the URL. + string body = 3; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto new file mode 100644 index 0000000..32bd5d8 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto @@ -0,0 +1,119 @@ +// 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.websecurityscanner.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1/finding_addon.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A Finding resource represents a vulnerability instance identified during a +// ScanRun. +message Finding { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/Finding" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" + }; + + // The severity level of a vulnerability. + enum Severity { + // No severity specified. The default value. + SEVERITY_UNSPECIFIED = 0; + + // Critical severity. + CRITICAL = 1; + + // High severity. + HIGH = 2; + + // Medium severity. + MEDIUM = 3; + + // Low severity. + LOW = 4; + } + + // Output only. The resource name of the Finding. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + // The finding IDs are generated by the system. + string name = 1; + + // Output only. The type of the Finding. + // Detailed and up-to-date information on findings can be found here: + // https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings + string finding_type = 2; + + // Output only. The severity level of the reported vulnerability. + Severity severity = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The http method of the request that triggered the vulnerability, in + // uppercase. + string http_method = 3; + + // Output only. The URL produced by the server-side fuzzer and used in the request that + // triggered the vulnerability. + string fuzzed_url = 4; + + // Output only. The body of the request that triggered the vulnerability. + string body = 5; + + // Output only. The description of the vulnerability. + string description = 6; + + // Output only. The URL containing human-readable payload that user can leverage to + // reproduce the vulnerability. + string reproduction_url = 7; + + // Output only. If the vulnerability was originated from nested IFrame, the immediate + // parent IFrame is reported. + string frame_url = 8; + + // Output only. The URL where the browser lands when the vulnerability is detected. + string final_url = 9; + + // Output only. The tracking ID uniquely identifies a vulnerability instance across + // multiple ScanRuns. + string tracking_id = 10; + + // Output only. An addon containing information reported for a vulnerability with an HTML + // form, if any. + Form form = 16; + + // Output only. An addon containing information about outdated libraries. + OutdatedLibrary outdated_library = 11; + + // Output only. An addon containing detailed information regarding any resource causing the + // vulnerability such as JavaScript sources, image, audio files, etc. + ViolatingResource violating_resource = 12; + + // Output only. An addon containing information about vulnerable or missing HTTP headers. + VulnerableHeaders vulnerable_headers = 15; + + // Output only. An addon containing information about request parameters which were found + // to be vulnerable. + VulnerableParameters vulnerable_parameters = 13; + + // Output only. An addon containing information reported for an XSS, if any. + Xss xss = 14; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto new file mode 100644 index 0000000..4fb7ec1 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto @@ -0,0 +1,147 @@ +// 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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingAddonProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// ! Information about a vulnerability with an HTML. +message Form { + // ! The URI where to send the form when it's submitted. + string action_uri = 1; + + // ! The names of form fields related to the vulnerability. + repeated string fields = 2; +} + +// Information reported for an outdated library. +message OutdatedLibrary { + // The name of the outdated library. + string library_name = 1; + + // The version number. + string version = 2; + + // URLs to learn more information about the vulnerabilities in the library. + repeated string learn_more_urls = 3; +} + +// Information regarding any resource causing the vulnerability such +// as JavaScript sources, image, audio files, etc. +message ViolatingResource { + // The MIME type of this resource. + string content_type = 1; + + // URL of this violating resource. + string resource_url = 2; +} + +// Information about vulnerable request parameters. +message VulnerableParameters { + // The vulnerable parameter names. + repeated string parameter_names = 1; +} + +// Information about vulnerable or missing HTTP Headers. +message VulnerableHeaders { + // Describes a HTTP Header. + message Header { + // Header name. + string name = 1; + + // Header value. + string value = 2; + } + + // List of vulnerable headers. + repeated Header headers = 1; + + // List of missing headers. + repeated Header missing_headers = 2; +} + +// Information reported for an XSS. +message Xss { + // Types of XSS attack vector. + enum AttackVector { + // Unknown attack vector. + ATTACK_VECTOR_UNSPECIFIED = 0; + + // The attack comes from fuzzing the browser's localStorage. + LOCAL_STORAGE = 1; + + // The attack comes from fuzzing the browser's sessionStorage. + SESSION_STORAGE = 2; + + // The attack comes from fuzzing the window's name property. + WINDOW_NAME = 3; + + // The attack comes from fuzzing the referrer property. + REFERRER = 4; + + // The attack comes from fuzzing an input element. + FORM_INPUT = 5; + + // The attack comes from fuzzing the browser's cookies. + COOKIE = 6; + + // The attack comes from hijacking the post messaging mechanism. + POST_MESSAGE = 7; + + // The attack comes from fuzzing parameters in the url. + GET_PARAMETERS = 8; + + // The attack comes from fuzzing the fragment in the url. + URL_FRAGMENT = 9; + + // The attack comes from fuzzing the HTML comments. + HTML_COMMENT = 10; + + // The attack comes from fuzzing the POST parameters. + POST_PARAMETERS = 11; + + // The attack comes from fuzzing the protocol. + PROTOCOL = 12; + + // The attack comes from the server side and is stored. + STORED_XSS = 13; + + // The attack is a Same-Origin Method Execution attack via a GET parameter. + SAME_ORIGIN = 14; + + // The attack payload is received from a third-party host via a URL that is + // user-controllable + USER_CONTROLLABLE_URL = 15; + } + + // Stack traces leading to the point where the XSS occurred. + repeated string stack_traces = 1; + + // An error message generated by a javascript breakage. + string error_message = 2; + + // The attack vector of the payload triggering this XSS. + AttackVector attack_vector = 3; + + // The reproduction url for the seeding POST request of a Stored XSS. + string stored_xss_seeding_url = 4; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto new file mode 100644 index 0000000..7eca01e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto @@ -0,0 +1,35 @@ +// 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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingTypeStatsProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A FindingTypeStats resource represents stats regarding a specific FindingType +// of Findings under a given ScanRun. +message FindingTypeStats { + // Output only. The finding type associated with the stats. + string finding_type = 1; + + // Output only. The count of findings belonging to this finding type. + int32 finding_count = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto new file mode 100644 index 0000000..901d01e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto @@ -0,0 +1,188 @@ +// 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.websecurityscanner.v1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A ScanConfig resource contains the configurations to launch a scan. +message ScanConfig { + // Scan authentication configuration. + message Authentication { + // Describes authentication configuration that uses a Google account. + message GoogleAccount { + // Required. The user name of the Google account. + string username = 1; + + // Required. Input only. The password of the Google account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2; + } + + // Describes authentication configuration that uses a custom account. + message CustomAccount { + // Required. The user name of the custom account. + string username = 1; + + // Required. Input only. The password of the custom account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2; + + // Required. The login form URL of the website. + string login_url = 3; + } + + // Describes authentication configuration for Identity-Aware-Proxy (IAP). + message IapCredential { + // Describes authentication configuration when Web-Security-Scanner + // service account is added in Identity-Aware-Proxy (IAP) access policies. + message IapTestServiceAccountInfo { + // Required. Describes OAuth2 client id of resources protected by + // Identity-Aware-Proxy (IAP). + string target_audience_client_id = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Identity-Aware-Proxy (IAP) Authentication Configuration + oneof iap_credentials { + // Authentication configuration when Web-Security-Scanner service + // account is added in Identity-Aware-Proxy (IAP) access policies. + IapTestServiceAccountInfo iap_test_service_account_info = 1; + } + } + + // Required. + // Authentication configuration + oneof authentication { + // Authentication using a Google account. + GoogleAccount google_account = 1; + + // Authentication using a custom account. + CustomAccount custom_account = 2; + + // Authentication using Identity-Aware-Proxy (IAP). + IapCredential iap_credential = 4; + } + } + + // Scan schedule configuration. + message Schedule { + // A timestamp indicates when the next run will be scheduled. The value is + // refreshed by the server after each run. If unspecified, it will default + // to current server time, which means the scan will be scheduled to start + // immediately. + google.protobuf.Timestamp schedule_time = 1; + + // Required. The duration of time between executions in days. + int32 interval_duration_days = 2; + } + + // Type of user agents used for scanning. + enum UserAgent { + // The user agent is unknown. Service will default to CHROME_LINUX. + USER_AGENT_UNSPECIFIED = 0; + + // Chrome on Linux. This is the service default if unspecified. + CHROME_LINUX = 1; + + // Chrome on Android. + CHROME_ANDROID = 2; + + // Safari on IPhone. + SAFARI_IPHONE = 3; + } + + // Scan risk levels supported by Web Security Scanner. LOW impact + // scanning will minimize requests with the potential to modify data. To + // achieve the maximum scan coverage, NORMAL risk level is recommended. + enum RiskLevel { + // Use default, which is NORMAL. + RISK_LEVEL_UNSPECIFIED = 0; + + // Normal scanning (Recommended) + NORMAL = 1; + + // Lower impact scanning + LOW = 2; + } + + // Controls export of scan configurations and results to Security + // Command Center. + enum ExportToSecurityCommandCenter { + // Use default, which is ENABLED. + EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + + // Export results of this scan to Security Command Center. + ENABLED = 1; + + // Do not export results of this scan to Security Command Center. + DISABLED = 2; + } + + // The resource name of the ScanConfig. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + // generated by the system. + string name = 1; + + // Required. The user provided display name of the ScanConfig. + string display_name = 2; + + // The maximum QPS during scanning. A valid value ranges from 5 to 20 + // inclusively. If the field is unspecified or its value is set 0, server will + // default to 15. Other values outside of [5, 20] range will be rejected with + // INVALID_ARGUMENT error. + int32 max_qps = 3; + + // Required. The starting URLs from which the scanner finds site pages. + repeated string starting_urls = 4; + + // The authentication configuration. If specified, service will use the + // authentication configuration during scanning. + Authentication authentication = 5; + + // The user agent used during scanning. + UserAgent user_agent = 6; + + // The excluded URL patterns as described in + // https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls + repeated string blacklist_patterns = 7; + + // The schedule of the ScanConfig. + Schedule schedule = 8; + + // Controls export of scan configurations and results to Security + // Command Center. + ExportToSecurityCommandCenter export_to_security_command_center = 10; + + // The risk level selected for the scan + RiskLevel risk_level = 12; + + // Whether the scan config is managed by Web Security Scanner, output + // only. + bool managed_scan = 13; + + // Whether the scan configuration has enabled static IP address scan feature. + // If enabled, the scanner will access applications from static IP addresses. + bool static_ip_scan = 14; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto new file mode 100644 index 0000000..5d54457 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto @@ -0,0 +1,189 @@ +// 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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigErrorProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Defines a custom error message used by CreateScanConfig and UpdateScanConfig +// APIs when scan configuration validation fails. It is also reported as part of +// a ScanRunErrorTrace message if scan validation fails due to a scan +// configuration error. +message ScanConfigError { + // Output only. + // Defines an error reason code. + // Next id: 44 + enum Code { + option allow_alias = true; + + // There is no error. + CODE_UNSPECIFIED = 0; + + // There is no error. + OK = 0; + + // Indicates an internal server error. + // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. + INTERNAL_ERROR = 1; + + // One of the seed URLs is an App Engine URL but we cannot validate the scan + // settings due to an App Engine API backend error. + APPENGINE_API_BACKEND_ERROR = 2; + + // One of the seed URLs is an App Engine URL but we cannot access the + // App Engine API to validate scan settings. + APPENGINE_API_NOT_ACCESSIBLE = 3; + + // One of the seed URLs is an App Engine URL but the Default Host of the + // App Engine is not set. + APPENGINE_DEFAULT_HOST_MISSING = 4; + + // Google corporate accounts can not be used for scanning. + CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + + // The account of the scan creator can not be used for scanning. + CANNOT_USE_OWNER_ACCOUNT = 7; + + // This scan targets Compute Engine, but we cannot validate scan settings + // due to a Compute Engine API backend error. + COMPUTE_API_BACKEND_ERROR = 8; + + // This scan targets Compute Engine, but we cannot access the Compute Engine + // API to validate the scan settings. + COMPUTE_API_NOT_ACCESSIBLE = 9; + + // The Custom Login URL does not belong to the current project. + CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + + // The Custom Login URL is malformed (can not be parsed). + CUSTOM_LOGIN_URL_MALFORMED = 11; + + // The Custom Login URL is mapped to a non-routable IP address in DNS. + CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + + // The Custom Login URL is mapped to an IP address which is not reserved for + // the current project. + CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + + // The Custom Login URL has a non-routable IP address. + CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + + // The Custom Login URL has an IP address which is not reserved for the + // current project. + CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + + // Another scan with the same name (case-sensitive) already exists. + DUPLICATE_SCAN_NAME = 16; + + // A field is set to an invalid value. + INVALID_FIELD_VALUE = 18; + + // There was an error trying to authenticate to the scan target. + FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + + // Finding type value is not specified in the list findings request. + FINDING_TYPE_UNSPECIFIED = 20; + + // Scan targets Compute Engine, yet current project was not whitelisted for + // Google Compute Engine Scanning Alpha access. + FORBIDDEN_TO_SCAN_COMPUTE = 21; + + // User tries to update managed scan + FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + + // The supplied filter is malformed. For example, it can not be parsed, does + // not have a filter type in expression, or the same filter type appears + // more than once. + MALFORMED_FILTER = 22; + + // The supplied resource name is malformed (can not be parsed). + MALFORMED_RESOURCE_NAME = 23; + + // The current project is not in an active state. + PROJECT_INACTIVE = 24; + + // A required field is not set. + REQUIRED_FIELD = 25; + + // Project id, scanconfig id, scanrun id, or finding id are not consistent + // with each other in resource name. + RESOURCE_NAME_INCONSISTENT = 26; + + // The scan being requested to start is already running. + SCAN_ALREADY_RUNNING = 27; + + // The scan that was requested to be stopped is not running. + SCAN_NOT_RUNNING = 28; + + // One of the seed URLs does not belong to the current project. + SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + + // One of the seed URLs is malformed (can not be parsed). + SEED_URL_MALFORMED = 30; + + // One of the seed URLs is mapped to a non-routable IP address in DNS. + SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + + // One of the seed URLs is mapped to an IP address which is not reserved + // for the current project. + SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + + // One of the seed URLs has on-routable IP address. + SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + + // One of the seed URLs has an IP address that is not reserved + // for the current project. + SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + + // The Web Security Scanner service account is not configured under the + // project. + SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + + // A project has reached the maximum number of scans. + TOO_MANY_SCANS = 37; + + // Resolving the details of the current project fails. + UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + + // One or more blacklist patterns were in the wrong format. + UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + + // The supplied filter is not supported. + UNSUPPORTED_FILTER = 40; + + // The supplied finding type is not supported. For example, we do not + // provide findings of the given finding type. + UNSUPPORTED_FINDING_TYPE = 41; + + // The URL scheme of one or more of the supplied URLs is not supported. + UNSUPPORTED_URL_SCHEME = 42; + } + + // Output only. Indicates the reason code for a configuration failure. + Code code = 1; + + // Output only. Indicates the full name of the ScanConfig field that triggers this error, + // for example "scan_config.max_qps". This field is provided for + // troubleshooting purposes only and its actual value can change in the + // future. + string field_name = 2; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto new file mode 100644 index 0000000..465c6cb --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto @@ -0,0 +1,110 @@ +// 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.websecurityscanner.v1; + +import "google/cloud/websecurityscanner/v1/scan_run_error_trace.proto"; +import "google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// A ScanRun is a output-only resource representing an actual run of the scan. +// Next id: 12 +message ScanRun { + // Types of ScanRun execution state. + enum ExecutionState { + // Represents an invalid state caused by internal server error. This value + // should never be returned. + EXECUTION_STATE_UNSPECIFIED = 0; + + // The scan is waiting in the queue. + QUEUED = 1; + + // The scan is in progress. + SCANNING = 2; + + // The scan is either finished or stopped by user. + FINISHED = 3; + } + + // Types of ScanRun result state. + enum ResultState { + // Default value. This value is returned when the ScanRun is not yet + // finished. + RESULT_STATE_UNSPECIFIED = 0; + + // The scan finished without errors. + SUCCESS = 1; + + // The scan finished with errors. + ERROR = 2; + + // The scan was terminated by user. + KILLED = 3; + } + + // Output only. The resource name of the ScanRun. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + // The ScanRun IDs are generated by the system. + string name = 1; + + // Output only. The execution state of the ScanRun. + ExecutionState execution_state = 2; + + // Output only. The result state of the ScanRun. This field is only available after the + // execution state reaches "FINISHED". + ResultState result_state = 3; + + // Output only. The time at which the ScanRun started. + google.protobuf.Timestamp start_time = 4; + + // Output only. The time at which the ScanRun reached termination state - that the ScanRun + // is either finished or stopped by user. + google.protobuf.Timestamp end_time = 5; + + // Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, + // the value represents the number of URLs crawled up to now. + int64 urls_crawled_count = 6; + + // Output only. The number of URLs tested during this ScanRun. If the scan is in progress, + // the value represents the number of URLs tested up to now. The number of + // URLs tested is usually larger than the number URLS crawled because + // typically a crawled URL is tested with multiple test payloads. + int64 urls_tested_count = 7; + + // Output only. Whether the scan run has found any vulnerabilities. + bool has_vulnerabilities = 8; + + // Output only. The percentage of total completion ranging from 0 to 100. + // If the scan is in queue, the value is 0. + // If the scan is running, the value ranges from 0 to 100. + // If the scan is finished, the value is 100. + int32 progress_percent = 9; + + // Output only. If result_state is an ERROR, this field provides the primary reason for + // scan's termination and more details, if such are available. + ScanRunErrorTrace error_trace = 10; + + // Output only. A list of warnings, if such are encountered during this scan run. + repeated ScanRunWarningTrace warning_traces = 11; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto new file mode 100644 index 0000000..5234eee --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto @@ -0,0 +1,75 @@ +// 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.websecurityscanner.v1; + +import "google/cloud/websecurityscanner/v1/scan_config_error.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunErrorTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Output only. +// Defines an error trace message for a ScanRun. +message ScanRunErrorTrace { + // Output only. + // Defines an error reason code. + // Next id: 7 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that the scan run failed due to an internal server error. + INTERNAL_ERROR = 1; + + // Indicates a scan configuration error, usually due to outdated ScanConfig + // settings, such as starting_urls or the DNS configuration. + SCAN_CONFIG_ISSUE = 2; + + // Indicates an authentication error, usually due to outdated ScanConfig + // authentication settings. + AUTHENTICATION_CONFIG_ISSUE = 3; + + // Indicates a scan operation timeout, usually caused by a very large site. + TIMED_OUT_WHILE_SCANNING = 4; + + // Indicates that a scan encountered excessive redirects, either to + // authentication or some other page outside of the scan scope. + TOO_MANY_REDIRECTS = 5; + + // Indicates that a scan encountered numerous errors from the web site + // pages. When available, most_common_http_error_code field indicates the + // most common HTTP error code encountered during the scan. + TOO_MANY_HTTP_ERRORS = 6; + } + + // Output only. Indicates the error reason code. + Code code = 1; + + // Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + // message encountered during scan configuration validation that is performed + // before each scan run. + ScanConfigError scan_config_error = 2; + + // Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + // common HTTP error code, if such is available. For example, if this code is + // 404, the scan has encountered too many NOT_FOUND responses. + int32 most_common_http_error_code = 3; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto new file mode 100644 index 0000000..43a5017 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto @@ -0,0 +1,58 @@ +// 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.websecurityscanner.v1; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunWarningTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Output only. +// Defines a warning trace message for ScanRun. Warning traces provide customers +// with useful information that helps make the scanning process more effective. +message ScanRunWarningTrace { + // Output only. + // Defines a warning message code. + // Next id: 6 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that a scan discovered an unexpectedly low number of URLs. This + // is sometimes caused by complex navigation features or by using a single + // URL for numerous pages. + INSUFFICIENT_CRAWL_RESULTS = 1; + + // Indicates that a scan discovered too many URLs to test, or excessive + // redundant URLs. + TOO_MANY_CRAWL_RESULTS = 2; + + // Indicates that too many tests have been generated for the scan. Customer + // should try reducing the number of starting URLs, increasing the QPS rate, + // or narrowing down the scope of the scan using the excluded patterns. + TOO_MANY_FUZZ_TASKS = 3; + + // Indicates that a scan is blocked by IAP. + BLOCKED_BY_IAP = 4; + } + + // Output only. Indicates the warning code. + Code code = 1; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto new file mode 100644 index 0000000..5f1bfcd --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto @@ -0,0 +1,337 @@ +// 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.websecurityscanner.v1; + +import "google/api/annotations.proto"; +import "google/cloud/websecurityscanner/v1/crawled_url.proto"; +import "google/cloud/websecurityscanner/v1/finding.proto"; +import "google/cloud/websecurityscanner/v1/finding_type_stats.proto"; +import "google/cloud/websecurityscanner/v1/scan_config.proto"; +import "google/cloud/websecurityscanner/v1/scan_run.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/api/client.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "WebSecurityScannerProto"; +option java_package = "com.google.cloud.websecurityscanner.v1"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; + +// Web Security Scanner Service identifies security vulnerabilities in web +// applications hosted on Google Cloud. It crawls your application, and +// attempts to exercise as many user inputs and event handlers as possible. +service WebSecurityScanner { + option (google.api.default_host) = "websecurityscanner.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new ScanConfig. + rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/scanConfigs" + body: "scan_config" + }; + } + + // Deletes an existing ScanConfig and its child resources. + rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/scanConfigs/*}" + }; + } + + // Gets a ScanConfig. + rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + get: "/v1/{name=projects/*/scanConfigs/*}" + }; + } + + // Lists ScanConfigs under a given project. + rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/scanConfigs" + }; + } + + // Updates a ScanConfig. This method support partial update of a ScanConfig. + rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + patch: "/v1/{scan_config.name=projects/*/scanConfigs/*}" + body: "scan_config" + }; + } + + // Start a ScanRun according to the given ScanConfig. + rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1/{name=projects/*/scanConfigs/*}:start" + body: "*" + }; + } + + // Gets a ScanRun. + rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}" + }; + } + + // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + // stop time. + rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*}/scanRuns" + }; + } + + // Stops a ScanRun. The stopped ScanRun is returned. + rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" + body: "*" + }; + } + + // List CrawledUrls under a given ScanRun. + rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" + }; + } + + // Gets a Finding. + rpc GetFinding(GetFindingRequest) returns (Finding) { + option (google.api.http) = { + get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" + }; + } + + // List Findings under a given ScanRun. + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" + }; + } + + // List all FindingTypeStats under a given ScanRun. + rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" + }; + } +} + +// Request for the `CreateScanConfig` method. +message CreateScanConfigRequest { + // Required. The parent resource name where the scan is created, which should be a + // project resource name in the format 'projects/{projectId}'. + string parent = 1; + + // Required. The ScanConfig to be created. + ScanConfig scan_config = 2; +} + +// Request for the `DeleteScanConfig` method. +message DeleteScanConfigRequest { + // Required. The resource name of the ScanConfig to be deleted. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1; +} + +// Request for the `GetScanConfig` method. +message GetScanConfigRequest { + // Required. The resource name of the ScanConfig to be returned. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1; +} + +// Request for the `ListScanConfigs` method. +message ListScanConfigsRequest { + // Required. The parent resource name, which should be a project resource name in the + // format 'projects/{projectId}'. + string parent = 1; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanConfigs to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Request for the `UpdateScanConfigRequest` method. +message UpdateScanConfigRequest { + // Required. The ScanConfig to be updated. The name field must be set to identify the + // resource to be updated. The values of fields not covered by the mask + // will be ignored. + ScanConfig scan_config = 2; + + // Required. The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3; +} + +// Response for the `ListScanConfigs` method. +message ListScanConfigsResponse { + // The list of ScanConfigs returned. + repeated ScanConfig scan_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `StartScanRun` method. +message StartScanRunRequest { + // Required. The resource name of the ScanConfig to be used. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1; +} + +// Request for the `GetScanRun` method. +message GetScanRunRequest { + // Required. The resource name of the ScanRun to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1; +} + +// Request for the `ListScanRuns` method. +message ListScanRunsRequest { + // Required. The parent resource name, which should be a scan resource name in the + // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string parent = 1; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanRuns to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListScanRuns` method. +message ListScanRunsResponse { + // The list of ScanRuns returned. + repeated ScanRun scan_runs = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `StopScanRun` method. +message StopScanRunRequest { + // Required. The resource name of the ScanRun to be stopped. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1; +} + +// Request for the `ListCrawledUrls` method. +message ListCrawledUrlsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of CrawledUrls to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListCrawledUrls` method. +message ListCrawledUrlsResponse { + // The list of CrawledUrls returned. + repeated CrawledUrl crawled_urls = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `GetFinding` method. +message GetFindingRequest { + // Required. The resource name of the Finding to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + string name = 1; +} + +// Request for the `ListFindings` method. +message ListFindingsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1; + + // The filter expression. The expression must be in the format: + // . + // Supported field: 'finding_type'. + // Supported operator: '='. + string filter = 2; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 3; + + // The maximum number of Findings to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 4; +} + +// Response for the `ListFindings` method. +message ListFindingsResponse { + // The list of Findings returned. + repeated Finding findings = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `ListFindingTypeStats` method. +message ListFindingTypeStatsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1; +} + +// Response for the `ListFindingTypeStats` method. +message ListFindingTypeStatsResponse { + // The list of FindingTypeStats returned. + repeated FindingTypeStats finding_type_stats = 1; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json new file mode 100644 index 0000000..a1b7591 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json @@ -0,0 +1,579 @@ +{ + "clientLibrary": { + "name": "nodejs-websecurityscanner", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.websecurityscanner.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async", + "title": "WebSecurityScanner createScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new ScanConfig.", + "canonical": true, + "file": "web_security_scanner.create_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1.ScanConfig" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async", + "title": "WebSecurityScanner deleteScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing ScanConfig and its child resources.", + "canonical": true, + "file": "web_security_scanner.delete_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async", + "title": "WebSecurityScanner getScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.get_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async", + "title": "WebSecurityScanner listScanConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanConfigs under a given project.", + "canonical": true, + "file": "web_security_scanner.list_scan_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListScanConfigsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async", + "title": "WebSecurityScanner updateScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.update_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", + "async": true, + "parameters": [ + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1.ScanConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async", + "title": "WebSecurityScanner startScanRun Sample", + "origin": "API_DEFINITION", + "description": " Start a ScanRun according to the given ScanConfig.", + "canonical": true, + "file": "web_security_scanner.start_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async", + "title": "WebSecurityScanner getScanRun Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanRun.", + "canonical": true, + "file": "web_security_scanner.get_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async", + "title": "WebSecurityScanner listScanRuns Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", + "canonical": true, + "file": "web_security_scanner.list_scan_runs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListScanRunsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async", + "title": "WebSecurityScanner stopScanRun Sample", + "origin": "API_DEFINITION", + "description": " Stops a ScanRun. The stopped ScanRun is returned.", + "canonical": true, + "file": "web_security_scanner.stop_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async", + "title": "WebSecurityScanner listCrawledUrls Sample", + "origin": "API_DEFINITION", + "description": " List CrawledUrls under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_crawled_urls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async", + "title": "WebSecurityScanner getFinding Sample", + "origin": "API_DEFINITION", + "description": " Gets a Finding.", + "canonical": true, + "file": "web_security_scanner.get_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.Finding", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async", + "title": "WebSecurityScanner listFindings Sample", + "origin": "API_DEFINITION", + "description": " List Findings under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListFindingsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async", + "title": "WebSecurityScanner listFindingTypeStats Sample", + "origin": "API_DEFINITION", + "description": " List all FindingTypeStats under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_finding_type_stats.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js new file mode 100644 index 0000000..e34cb80 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * Required. The ScanConfig to be created. + */ + // const scanConfig = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callCreateScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.createScanConfig(request); + console.log(response); + } + + callCreateScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_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/web_security_scanner.delete_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js new file mode 100644 index 0000000..ec72736 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js @@ -0,0 +1,58 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callDeleteScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.deleteScanConfig(request); + console.log(response); + } + + callDeleteScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_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/web_security_scanner.get_finding.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_finding.js new file mode 100644 index 0000000..d74e438 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_finding.js @@ -0,0 +1,59 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetFinding() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.getFinding(request); + console.log(response); + } + + callGetFinding(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_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/web_security_scanner.get_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_config.js new file mode 100644 index 0000000..3811ccc --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_config.js @@ -0,0 +1,58 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.getScanConfig(request); + console.log(response); + } + + callGetScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_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/web_security_scanner.get_scan_run.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_run.js new file mode 100644 index 0000000..baab4b6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_run.js @@ -0,0 +1,59 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanRun() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.getScanRun(request); + console.log(response); + } + + callGetScanRun(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_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/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js new file mode 100644 index 0000000..64aca05 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js @@ -0,0 +1,73 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListCrawledUrls() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCrawledUrls(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_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/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js new file mode 100644 index 0000000..59fa9a4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js @@ -0,0 +1,59 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindingTypeStats() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.listFindingTypeStats(request); + console.log(response); + } + + callListFindingTypeStats(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_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/web_security_scanner.list_findings.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_findings.js new file mode 100644 index 0000000..12f4bf7 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_findings.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ + // const filter = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindings() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_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/web_security_scanner.list_scan_configs.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js new file mode 100644 index 0000000..0649641 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_configs.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanConfigs() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listScanConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanConfigs(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_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/web_security_scanner.list_scan_runs.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js new file mode 100644 index 0000000..020c4ea --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_runs.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanRuns() { + // Construct request + const request = { + }; + + // Run request + const iterable = await websecurityscannerClient.listScanRunsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanRuns(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_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/web_security_scanner.start_scan_run.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.start_scan_run.js new file mode 100644 index 0000000..0520702 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.start_scan_run.js @@ -0,0 +1,58 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStartScanRun() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.startScanRun(request); + console.log(response); + } + + callStartScanRun(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_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/web_security_scanner.stop_scan_run.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js new file mode 100644 index 0000000..4779856 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js @@ -0,0 +1,59 @@ +// 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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStopScanRun() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.stopScanRun(request); + console.log(response); + } + + callStopScanRun(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_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/web_security_scanner.update_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.update_scan_config.js new file mode 100644 index 0000000..ff6e7b5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.update_scan_config.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() { + // [START websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + */ + // const scanConfig = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callUpdateScanConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await websecurityscannerClient.updateScanConfig(request); + console.log(response); + } + + callUpdateScanConfig(); + // [END websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..76ce24a --- /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 WebSecurityScannerClient = v1.WebSecurityScannerClient; +type WebSecurityScannerClient = v1.WebSecurityScannerClient; +export {v1, WebSecurityScannerClient}; +export default {v1, WebSecurityScannerClient}; +import * as protos from '../protos/protos'; +export {protos} 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 0000000..6c589c5 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.websecurityscanner.v1", + "libraryPackage": "@google-cloud/web-security-scanner", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + } + } + } + } +} 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 0000000..515d336 --- /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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/v1/src/v1/web_security_scanner_client.ts b/owl-bot-staging/v1/src/v1/web_security_scanner_client.ts new file mode 100644 index 0000000..567672e --- /dev/null +++ b/owl-bot-staging/v1/src/v1/web_security_scanner_client.ts @@ -0,0 +1,1819 @@ +// 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/web_security_scanner_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_security_scanner_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Web Security Scanner Service identifies security vulnerabilities in web + * applications hosted on Google Cloud. It crawls your application, and + * attempts to exercise as many user inputs and event handlers as possible. + * @class + * @memberof v1 + */ +export class WebSecurityScannerClient { + 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}; + webSecurityScannerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebSecurityScannerClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WebSecurityScannerClient; + 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + ), + }; + + // 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 = { + listScanConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), + listScanRuns: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), + listCrawledUrls: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.websecurityscanner.v1.WebSecurityScanner', 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 = gax.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.webSecurityScannerStub) { + return this.webSecurityScannerStub; + } + + // Put together the "service stub" for + // google.cloud.websecurityscanner.v1.WebSecurityScanner. + this.webSecurityScannerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1.WebSecurityScanner') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1.WebSecurityScanner, + 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 webSecurityScannerStubMethods = + ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + for (const methodName of webSecurityScannerStubMethods) { + const callPromise = this.webSecurityScannerStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.webSecurityScannerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'websecurityscanner.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 'websecurityscanner.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 new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig + * Required. The ScanConfig to be created. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. + * 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/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async + */ + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined + ]>; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createScanConfig(request, options, callback); + } +/** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async + */ + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined + ]>; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteScanConfig(request, options, callback); + } +/** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. + * 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/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async + */ + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined + ]>; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getScanConfig(request, options, callback); + } +/** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. + * 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/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async + */ + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined + ]>; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateScanConfig(request, options, callback); + } +/** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. + * 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/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async + */ + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined + ]>; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.startScanRun(request, options, callback); + } +/** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. + * 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/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async + */ + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined + ]>; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getScanRun(request, options, callback); + } +/** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. + * 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/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async + */ + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined + ]>; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.stopScanRun(request, options, callback); + } +/** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1.Finding}. + * 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/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async + */ + getFinding( + request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined + ]>; + getFinding( + request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFinding(request, options, callback); + } +/** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ListFindingTypeStatsResponse]{@link google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse}. + * 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/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async + */ + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFindingTypeStats(request, options, callback); + } + + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. + * 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 `listScanConfigsAsync()` + * 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. + */ + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + ]>; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listScanConfigs(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 resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig} 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 `listScanConfigsAsync()` + * 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. + */ + listScanConfigsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.createStream( + this.innerApiCalls.listScanConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanConfigs`, 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 resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. 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/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async + */ + listScanConfigsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.asyncIterate( + this.innerApiCalls['listScanConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. + * 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 `listScanRunsAsync()` + * 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. + */ + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + ]>; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>): void; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>): void; + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listScanRuns(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 resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun} 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 `listScanRunsAsync()` + * 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. + */ + listScanRunsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.createStream( + this.innerApiCalls.listScanRuns as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanRuns`, 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 resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. 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/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async + */ + listScanRunsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.asyncIterate( + this.innerApiCalls['listScanRuns'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1.CrawledUrl}. + * 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 `listCrawledUrlsAsync()` + * 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. + */ + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + ]>; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCrawledUrls(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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1.CrawledUrl} 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 `listCrawledUrlsAsync()` + * 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. + */ + listCrawledUrlsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.createStream( + this.innerApiCalls.listCrawledUrls as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCrawledUrls`, 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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [CrawledUrl]{@link google.cloud.websecurityscanner.v1.CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async + */ + listCrawledUrlsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.asyncIterate( + this.innerApiCalls['listCrawledUrls'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1.Finding}. + * 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 `listFindingsAsync()` + * 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. + */ + listFindings( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>): void; + listFindings( + request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>): void; + listFindings( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1.IFinding>): + Promise<[ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1.Finding} 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 `listFindingsAsync()` + * 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. + */ + listFindingsStream( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, 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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [Finding]{@link google.cloud.websecurityscanner.v1.Finding}. 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/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the scan_config from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + } + + /** + * Parse the scan_run from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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.webSecurityScannerStub && !this._terminated) { + return this.webSecurityScannerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json b/owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json new file mode 100644 index 0000000..2e226cb --- /dev/null +++ b/owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1.WebSecurityScanner": { + "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": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json b/owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json new file mode 100644 index 0000000..d036fd8 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/websecurityscanner/v1/crawled_url.proto", + "../../protos/google/cloud/websecurityscanner/v1/finding.proto", + "../../protos/google/cloud/websecurityscanner/v1/finding_addon.proto", + "../../protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_config.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_config_error.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto" +] 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 0000000..2c742f5 --- /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 websecurityscanner = require('@google-cloud/web-security-scanner'); + +function main() { + const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); +} + +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 0000000..8bd7a23 --- /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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; + +// check that the client class type name can be used +function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webSecurityScannerClient = new WebSecurityScannerClient(); + doStuffWithWebSecurityScannerClient(webSecurityScannerClient); +} + +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 0000000..8ec4522 --- /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_web_security_scanner_v1.ts b/owl-bot-staging/v1/test/gapic_web_security_scanner_v1.ts new file mode 100644 index 0000000..52769bf --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_web_security_scanner_v1.ts @@ -0,0 +1,2008 @@ +// 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 websecurityscannerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +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('v1.WebSecurityScannerClient', () => { + it('has servicePath', () => { + const servicePath = websecurityscannerModule.v1.WebSecurityScannerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = websecurityscannerModule.v1.WebSecurityScannerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = websecurityscannerModule.v1.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); + + it('has close method for the initialized client', done => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webSecurityScannerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + 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 websecurityscannerModule.v1.WebSecurityScannerClient({ + 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('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); + client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createScanConfig(request), expectedError); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + 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); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteScanConfig(request), expectedError); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); + client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanConfig(request), expectedError); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); + client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateScanConfig(request), expectedError); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); + client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startScanRun(request), expectedError); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); + client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanRun(request), expectedError); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); + client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopScanRun(request), expectedError); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()); + client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFinding(request), expectedError); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse()); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse()); + client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanConfigs(request), expectedError); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { + 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.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanRuns(request), expectedError); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { + 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.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert.strictEqual( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert.strictEqual( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), + ]; + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCrawledUrls(request), expectedError); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { + 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.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { + 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.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert.strictEqual( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert.strictEqual( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + finding: "findingValue", + }; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.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 0000000..c78f1c8 --- /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 0000000..ad3467d --- /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: 'WebSecurityScanner', + filename: './web-security-scanner.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/v1alpha/.eslintignore b/owl-bot-staging/v1alpha/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1alpha/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1alpha/.eslintrc.json b/owl-bot-staging/v1alpha/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1alpha/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1alpha/.gitignore b/owl-bot-staging/v1alpha/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1alpha/.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/v1alpha/.jsdoc.js b/owl-bot-staging/v1alpha/.jsdoc.js new file mode 100644 index 0000000..65475a4 --- /dev/null +++ b/owl-bot-staging/v1alpha/.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/web-security-scanner', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1alpha/.mocharc.js b/owl-bot-staging/v1alpha/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1alpha/.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/v1alpha/.prettierrc.js b/owl-bot-staging/v1alpha/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1alpha/.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/v1alpha/README.md b/owl-bot-staging/v1alpha/README.md new file mode 100644 index 0000000..727d3b6 --- /dev/null +++ b/owl-bot-staging/v1alpha/README.md @@ -0,0 +1 @@ +Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/v1alpha/linkinator.config.json b/owl-bot-staging/v1alpha/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1alpha/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/v1alpha/package.json b/owl-bot-staging/v1alpha/package.json new file mode 100644 index 0000000..d42ee9b --- /dev/null +++ b/owl-bot-staging/v1alpha/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/web-security-scanner", + "version": "0.1.0", + "description": "Websecurityscanner client for Node.js", + "repository": "googleapis/nodejs-websecurityscanner", + "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 websecurityscanner", + "websecurityscanner", + "web security scanner" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "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.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto new file mode 100644 index 0000000..c22f427 --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto @@ -0,0 +1,38 @@ +// 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.websecurityscanner.v1alpha; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "CrawledUrlProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web +// Security Scanner Service crawls the web applications, following all links +// within the scope of sites, to find the URLs to test against. +message CrawledUrl { + // Output only. The http method of the request that was used to visit the URL, in + // uppercase. + string http_method = 1; + + // Output only. The URL that was crawled. + string url = 2; + + // Output only. The body of the request that was used to visit the URL. + string body = 3; +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto new file mode 100644 index 0000000..c02020f --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto @@ -0,0 +1,152 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1alpha/finding_addon.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A Finding resource represents a vulnerability instance identified during a +// ScanRun. +message Finding { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/Finding" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" + }; + + // Types of Findings. + enum FindingType { + // The invalid finding type. + FINDING_TYPE_UNSPECIFIED = 0; + + // A page that was served over HTTPS also resources over HTTP. A + // man-in-the-middle attacker could tamper with the HTTP resource and gain + // full access to the website that loads the resource or to monitor the + // actions taken by the user. + MIXED_CONTENT = 1; + + // The version of an included library is known to contain a security issue. + // The scanner checks the version of library in use against a known list of + // vulnerable libraries. False positives are possible if the version + // detection fails or if the library has been manually patched. + OUTDATED_LIBRARY = 2; + + // This type of vulnerability occurs when the value of a request parameter + // is reflected at the beginning of the response, for example, in requests + // using JSONP. Under certain circumstances, an attacker may be able to + // supply an alphanumeric-only Flash file in the vulnerable parameter + // causing the browser to execute the Flash file as if it originated on the + // vulnerable server. + ROSETTA_FLASH = 5; + + // A cross-site scripting (XSS) bug is found via JavaScript callback. For + // detailed explanations on XSS, see + // https://www.google.com/about/appsecurity/learning/xss/. + XSS_CALLBACK = 3; + + // A potential cross-site scripting (XSS) bug due to JavaScript breakage. + // In some circumstances, the application under test might modify the test + // string before it is parsed by the browser. When the browser attempts to + // runs this modified test string, it will likely break and throw a + // JavaScript execution error, thus an injection issue is occurring. + // However, it may not be exploitable. Manual verification is needed to see + // if the test string modifications can be evaded and confirm that the issue + // is in fact an XSS vulnerability. For detailed explanations on XSS, see + // https://www.google.com/about/appsecurity/learning/xss/. + XSS_ERROR = 4; + + // An application appears to be transmitting a password field in clear text. + // An attacker can eavesdrop network traffic and sniff the password field. + CLEAR_TEXT_PASSWORD = 6; + + // An application returns sensitive content with an invalid content type, + // or without an 'X-Content-Type-Options: nosniff' header. + INVALID_CONTENT_TYPE = 7; + + // A cross-site scripting (XSS) vulnerability in AngularJS module that + // occurs when a user-provided string is interpolated by Angular. + XSS_ANGULAR_CALLBACK = 8; + + // A malformed or invalid valued header. + INVALID_HEADER = 9; + + // Misspelled security header name. + MISSPELLED_SECURITY_HEADER_NAME = 10; + + // Mismatching values in a duplicate security header. + MISMATCHING_SECURITY_HEADER_VALUES = 11; + } + + // The resource name of the Finding. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + // The finding IDs are generated by the system. + string name = 1; + + // The type of the Finding. + FindingType finding_type = 2; + + // The http method of the request that triggered the vulnerability, in + // uppercase. + string http_method = 3; + + // The URL produced by the server-side fuzzer and used in the request that + // triggered the vulnerability. + string fuzzed_url = 4; + + // The body of the request that triggered the vulnerability. + string body = 5; + + // The description of the vulnerability. + string description = 6; + + // The URL containing human-readable payload that user can leverage to + // reproduce the vulnerability. + string reproduction_url = 7; + + // If the vulnerability was originated from nested IFrame, the immediate + // parent IFrame is reported. + string frame_url = 8; + + // The URL where the browser lands when the vulnerability is detected. + string final_url = 9; + + // The tracking ID uniquely identifies a vulnerability instance across + // multiple ScanRuns. + string tracking_id = 10; + + // An addon containing information about outdated libraries. + OutdatedLibrary outdated_library = 11; + + // An addon containing detailed information regarding any resource causing the + // vulnerability such as JavaScript sources, image, audio files, etc. + ViolatingResource violating_resource = 12; + + // An addon containing information about vulnerable or missing HTTP headers. + VulnerableHeaders vulnerable_headers = 15; + + // An addon containing information about request parameters which were found + // to be vulnerable. + VulnerableParameters vulnerable_parameters = 13; + + // An addon containing information reported for an XSS, if any. + Xss xss = 14; +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto new file mode 100644 index 0000000..3fafdb4 --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto @@ -0,0 +1,78 @@ +// 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.websecurityscanner.v1alpha; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingAddonProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// Information reported for an outdated library. +message OutdatedLibrary { + // The name of the outdated library. + string library_name = 1; + + // The version number. + string version = 2; + + // URLs to learn more information about the vulnerabilities in the library. + repeated string learn_more_urls = 3; +} + +// Information regarding any resource causing the vulnerability such +// as JavaScript sources, image, audio files, etc. +message ViolatingResource { + // The MIME type of this resource. + string content_type = 1; + + // URL of this violating resource. + string resource_url = 2; +} + +// Information about vulnerable request parameters. +message VulnerableParameters { + // The vulnerable parameter names. + repeated string parameter_names = 1; +} + +// Information about vulnerable or missing HTTP Headers. +message VulnerableHeaders { + // Describes a HTTP Header. + message Header { + // Header name. + string name = 1; + + // Header value. + string value = 2; + } + + // List of vulnerable headers. + repeated Header headers = 1; + + // List of missing headers. + repeated Header missing_headers = 2; +} + +// Information reported for an XSS. +message Xss { + // Stack traces leading to the point where the XSS occurred. + repeated string stack_traces = 1; + + // An error message generated by a javascript breakage. + string error_message = 2; +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto new file mode 100644 index 0000000..e46b330 --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto @@ -0,0 +1,35 @@ +// 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.websecurityscanner.v1alpha; + +import "google/cloud/websecurityscanner/v1alpha/finding.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingTypeStatsProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A FindingTypeStats resource represents stats regarding a specific FindingType +// of Findings under a given ScanRun. +message FindingTypeStats { + // The finding type associated with the stats. + Finding.FindingType finding_type = 1; + + // The count of findings belonging to this finding type. + int32 finding_count = 2; +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto new file mode 100644 index 0000000..5497b1a --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto @@ -0,0 +1,157 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A ScanConfig resource contains the configurations to launch a scan. +// next id: 12 +message ScanConfig { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + pattern: "projects/{project}/scanConfigs/{scan_config}" + }; + + // Scan authentication configuration. + message Authentication { + // Describes authentication configuration that uses a Google account. + message GoogleAccount { + // Required. The user name of the Google account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the Google account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + } + + // Describes authentication configuration that uses a custom account. + message CustomAccount { + // Required. The user name of the custom account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the custom account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Required. The login form URL of the website. + string login_url = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. + // Authentication configuration + oneof authentication { + // Authentication using a Google account. + GoogleAccount google_account = 1; + + // Authentication using a custom account. + CustomAccount custom_account = 2; + } + } + + // Scan schedule configuration. + message Schedule { + // A timestamp indicates when the next run will be scheduled. The value is + // refreshed by the server after each run. If unspecified, it will default + // to current server time, which means the scan will be scheduled to start + // immediately. + google.protobuf.Timestamp schedule_time = 1; + + // Required. The duration of time between executions in days. + int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Type of user agents used for scanning. + enum UserAgent { + // The user agent is unknown. Service will default to CHROME_LINUX. + USER_AGENT_UNSPECIFIED = 0; + + // Chrome on Linux. This is the service default if unspecified. + CHROME_LINUX = 1; + + // Chrome on Android. + CHROME_ANDROID = 2; + + // Safari on IPhone. + SAFARI_IPHONE = 3; + } + + // Cloud platforms supported by Cloud Web Security Scanner. + enum TargetPlatform { + // The target platform is unknown. Requests with this enum value will be + // rejected with INVALID_ARGUMENT error. + TARGET_PLATFORM_UNSPECIFIED = 0; + + // Google App Engine service. + APP_ENGINE = 1; + + // Google Compute Engine service. + COMPUTE = 2; + } + + // The resource name of the ScanConfig. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + // generated by the system. + string name = 1; + + // Required. The user provided display name of the ScanConfig. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The maximum QPS during scanning. A valid value ranges from 5 to 20 + // inclusively. If the field is unspecified or its value is set 0, server will + // default to 15. Other values outside of [5, 20] range will be rejected with + // INVALID_ARGUMENT error. + int32 max_qps = 3; + + // Required. The starting URLs from which the scanner finds site pages. + repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; + + // The authentication configuration. If specified, service will use the + // authentication configuration during scanning. + Authentication authentication = 5; + + // The user agent used during scanning. + UserAgent user_agent = 6; + + // The blacklist URL patterns as described in + // https://cloud.google.com/security-scanner/docs/excluded-urls + repeated string blacklist_patterns = 7; + + // The schedule of the ScanConfig. + Schedule schedule = 8; + + // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + // used as a default. + repeated TargetPlatform target_platforms = 9; + + // Latest ScanRun if available. + ScanRun latest_run = 11; +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto new file mode 100644 index 0000000..79c5419 --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto @@ -0,0 +1,104 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// A ScanRun is a output-only resource representing an actual run of the scan. +message ScanRun { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanRun" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" + }; + + // Types of ScanRun execution state. + enum ExecutionState { + // Represents an invalid state caused by internal server error. This value + // should never be returned. + EXECUTION_STATE_UNSPECIFIED = 0; + + // The scan is waiting in the queue. + QUEUED = 1; + + // The scan is in progress. + SCANNING = 2; + + // The scan is either finished or stopped by user. + FINISHED = 3; + } + + // Types of ScanRun result state. + enum ResultState { + // Default value. This value is returned when the ScanRun is not yet + // finished. + RESULT_STATE_UNSPECIFIED = 0; + + // The scan finished without errors. + SUCCESS = 1; + + // The scan finished with errors. + ERROR = 2; + + // The scan was terminated by user. + KILLED = 3; + } + + // The resource name of the ScanRun. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + // The ScanRun IDs are generated by the system. + string name = 1; + + // The execution state of the ScanRun. + ExecutionState execution_state = 2; + + // The result state of the ScanRun. This field is only available after the + // execution state reaches "FINISHED". + ResultState result_state = 3; + + // The time at which the ScanRun started. + google.protobuf.Timestamp start_time = 4; + + // The time at which the ScanRun reached termination state - that the ScanRun + // is either finished or stopped by user. + google.protobuf.Timestamp end_time = 5; + + // The number of URLs crawled during this ScanRun. If the scan is in progress, + // the value represents the number of URLs crawled up to now. + int64 urls_crawled_count = 6; + + // The number of URLs tested during this ScanRun. If the scan is in progress, + // the value represents the number of URLs tested up to now. The number of + // URLs tested is usually larger than the number URLS crawled because + // typically a crawled URL is tested with multiple test payloads. + int64 urls_tested_count = 7; + + // Whether the scan run has found any vulnerabilities. + bool has_vulnerabilities = 8; + + // The percentage of total completion ranging from 0 to 100. + // If the scan is in queue, the value is 0. + // If the scan is running, the value ranges from 0 to 100. + // If the scan is finished, the value is 100. + int32 progress_percent = 9; +} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto new file mode 100644 index 0000000..f34bd74 --- /dev/null +++ b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto @@ -0,0 +1,410 @@ +// 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.websecurityscanner.v1alpha; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1alpha/crawled_url.proto"; +import "google/cloud/websecurityscanner/v1alpha/finding.proto"; +import "google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto"; +import "google/cloud/websecurityscanner/v1alpha/scan_config.proto"; +import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "WebSecurityScannerProto"; +option java_package = "com.google.cloud.websecurityscanner.v1alpha"; + +// Cloud Web Security Scanner Service identifies security vulnerabilities in web +// applications hosted on Google Cloud Platform. It crawls your application, and +// attempts to exercise as many user inputs and event handlers as possible. +service WebSecurityScanner { + option (google.api.default_host) = "websecurityscanner.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new ScanConfig. + rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*}/scanConfigs" + body: "scan_config" + }; + option (google.api.method_signature) = "parent,scan_config"; + } + + // Deletes an existing ScanConfig and its child resources. + rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanConfig. + rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanConfigs under a given project. + rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*}/scanConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a ScanConfig. This method support partial update of a ScanConfig. + rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + patch: "/v1alpha/{scan_config.name=projects/*/scanConfigs/*}" + body: "scan_config" + }; + option (google.api.method_signature) = "scan_config,update_mask"; + } + + // Start a ScanRun according to the given ScanConfig. + rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1alpha/{name=projects/*/scanConfigs/*}:start" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanRun. + rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + // stop time. + rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*}/scanRuns" + }; + option (google.api.method_signature) = "parent"; + } + + // Stops a ScanRun. The stopped ScanRun is returned. + rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // List CrawledUrls under a given ScanRun. + rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a Finding. + rpc GetFinding(GetFindingRequest) returns (Finding) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List Findings under a given ScanRun. + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // List all FindingTypeStats under a given ScanRun. + rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for the `CreateScanConfig` method. +message CreateScanConfigRequest { + // Required. The parent resource name where the scan is created, which should be a + // project resource name in the format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The ScanConfig to be created. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteScanConfig` method. +message DeleteScanConfigRequest { + // Required. The resource name of the ScanConfig to be deleted. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanConfig` method. +message GetScanConfigRequest { + // Required. The resource name of the ScanConfig to be returned. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `ListScanConfigs` method. +message ListScanConfigsRequest { + // Required. The parent resource name, which should be a project resource name in the + // format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanConfigs to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Request for the `UpdateScanConfigRequest` method. +message UpdateScanConfigRequest { + // Required. The ScanConfig to be updated. The name field must be set to identify the + // resource to be updated. The values of fields not covered by the mask + // will be ignored. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the `ListScanConfigs` method. +message ListScanConfigsResponse { + // The list of ScanConfigs returned. + repeated ScanConfig scan_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `StartScanRun` method. +message StartScanRunRequest { + // Required. The resource name of the ScanConfig to be used. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanRun` method. +message GetScanRunRequest { + // Required. The resource name of the ScanRun to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListScanRuns` method. +message ListScanRunsRequest { + // Required. The parent resource name, which should be a scan resource name in the + // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanRuns to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListScanRuns` method. +message ListScanRunsResponse { + // The list of ScanRuns returned. + repeated ScanRun scan_runs = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `StopScanRun` method. +message StopScanRunRequest { + // Required. The resource name of the ScanRun to be stopped. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListCrawledUrls` method. +message ListCrawledUrlsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of CrawledUrls to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListCrawledUrls` method. +message ListCrawledUrlsResponse { + // The list of CrawledUrls returned. + repeated CrawledUrl crawled_urls = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `GetFinding` method. +message GetFindingRequest { + // Required. The resource name of the Finding to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/Finding" + } + ]; +} + +// Request for the `ListFindings` method. +message ListFindingsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // Required. The filter expression. The expression must be in the format: + // . + // Supported field: 'finding_type'. + // Supported operator: '='. + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 3; + + // The maximum number of Findings to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 4; +} + +// Response for the `ListFindings` method. +message ListFindingsResponse { + // The list of Findings returned. + repeated Finding findings = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `ListFindingTypeStats` method. +message ListFindingTypeStatsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Response for the `ListFindingTypeStats` method. +message ListFindingTypeStatsResponse { + // The list of FindingTypeStats returned. + repeated FindingTypeStats finding_type_stats = 1; +} diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json b/owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json new file mode 100644 index 0000000..28ee273 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json @@ -0,0 +1,579 @@ +{ + "clientLibrary": { + "name": "nodejs-websecurityscanner", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.websecurityscanner.v1alpha", + "version": "v1alpha" + } + ] + }, + "snippets": [ + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async", + "title": "WebSecurityScanner createScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new ScanConfig.", + "canonical": true, + "file": "web_security_scanner.create_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async", + "title": "WebSecurityScanner deleteScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing ScanConfig and its child resources.", + "canonical": true, + "file": "web_security_scanner.delete_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async", + "title": "WebSecurityScanner getScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.get_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async", + "title": "WebSecurityScanner listScanConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanConfigs under a given project.", + "canonical": true, + "file": "web_security_scanner.list_scan_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanConfigsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async", + "title": "WebSecurityScanner updateScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.update_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", + "async": true, + "parameters": [ + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async", + "title": "WebSecurityScanner startScanRun Sample", + "origin": "API_DEFINITION", + "description": " Start a ScanRun according to the given ScanConfig.", + "canonical": true, + "file": "web_security_scanner.start_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async", + "title": "WebSecurityScanner getScanRun Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanRun.", + "canonical": true, + "file": "web_security_scanner.get_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async", + "title": "WebSecurityScanner listScanRuns Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", + "canonical": true, + "file": "web_security_scanner.list_scan_runs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanRunsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async", + "title": "WebSecurityScanner stopScanRun Sample", + "origin": "API_DEFINITION", + "description": " Stops a ScanRun. The stopped ScanRun is returned.", + "canonical": true, + "file": "web_security_scanner.stop_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async", + "title": "WebSecurityScanner listCrawledUrls Sample", + "origin": "API_DEFINITION", + "description": " List CrawledUrls under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_crawled_urls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async", + "title": "WebSecurityScanner getFinding Sample", + "origin": "API_DEFINITION", + "description": " Gets a Finding.", + "canonical": true, + "file": "web_security_scanner.get_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.Finding", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async", + "title": "WebSecurityScanner listFindings Sample", + "origin": "API_DEFINITION", + "description": " List Findings under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async", + "title": "WebSecurityScanner listFindingTypeStats Sample", + "origin": "API_DEFINITION", + "description": " List all FindingTypeStats under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_finding_type_stats.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js new file mode 100644 index 0000000..fb3314b --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.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(parent, scanConfig) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * Required. The ScanConfig to be created. + */ + // const scanConfig = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callCreateScanConfig() { + // Construct request + const request = { + parent, + scanConfig, + }; + + // Run request + const response = await websecurityscannerClient.createScanConfig(request); + console.log(response); + } + + callCreateScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js new file mode 100644 index 0000000..1249e4e --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js @@ -0,0 +1,59 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callDeleteScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.deleteScanConfig(request); + console.log(response); + } + + callDeleteScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js new file mode 100644 index 0000000..9e4b0d1 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetFinding() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getFinding(request); + console.log(response); + } + + callGetFinding(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js new file mode 100644 index 0000000..c18c788 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js @@ -0,0 +1,59 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanConfig(request); + console.log(response); + } + + callGetScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js new file mode 100644 index 0000000..85b2c50 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanRun(request); + console.log(response); + } + + callGetScanRun(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js new file mode 100644 index 0000000..d5a4fcb --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListCrawledUrls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCrawledUrls(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js new file mode 100644 index 0000000..215567d --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindingTypeStats() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await websecurityscannerClient.listFindingTypeStats(request); + console.log(response); + } + + callListFindingTypeStats(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js new file mode 100644 index 0000000..406c31f --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.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, filter) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ + // const filter = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const iterable = await websecurityscannerClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js new file mode 100644 index 0000000..def6c77 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js @@ -0,0 +1,73 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanConfigs(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js new file mode 100644 index 0000000..98d3c69 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js @@ -0,0 +1,73 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanRuns() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanRunsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanRuns(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js new file mode 100644 index 0000000..094582c --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js @@ -0,0 +1,59 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStartScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.startScanRun(request); + console.log(response); + } + + callStartScanRun(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js new file mode 100644 index 0000000..70c97f1 --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStopScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.stopScanRun(request); + console.log(response); + } + + callStopScanRun(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js new file mode 100644 index 0000000..6bfa7ee --- /dev/null +++ b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js @@ -0,0 +1,67 @@ +// 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(scanConfig, updateMask) { + // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + */ + // const scanConfig = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callUpdateScanConfig() { + // Construct request + const request = { + scanConfig, + updateMask, + }; + + // Run request + const response = await websecurityscannerClient.updateScanConfig(request); + console.log(response); + } + + callUpdateScanConfig(); + // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/src/index.ts b/owl-bot-staging/v1alpha/src/index.ts new file mode 100644 index 0000000..a07223c --- /dev/null +++ b/owl-bot-staging/v1alpha/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 v1alpha from './v1alpha'; +const WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; +type WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; +export {v1alpha, WebSecurityScannerClient}; +export default {v1alpha, WebSecurityScannerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json new file mode 100644 index 0000000..72e2c6b --- /dev/null +++ b/owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.websecurityscanner.v1alpha", + "libraryPackage": "@google-cloud/web-security-scanner", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/v1alpha/src/v1alpha/index.ts new file mode 100644 index 0000000..515d336 --- /dev/null +++ b/owl-bot-staging/v1alpha/src/v1alpha/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts new file mode 100644 index 0000000..a69036f --- /dev/null +++ b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts @@ -0,0 +1,1936 @@ +// 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha/web_security_scanner_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_security_scanner_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Cloud Web Security Scanner Service identifies security vulnerabilities in web + * applications hosted on Google Cloud Platform. It crawls your application, and + * attempts to exercise as many user inputs and event handlers as possible. + * @class + * @memberof v1alpha + */ +export class WebSecurityScannerClient { + 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}; + webSecurityScannerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebSecurityScannerClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WebSecurityScannerClient; + 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + scanConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}' + ), + scanRunPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' + ), + }; + + // 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 = { + listScanConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), + listScanRuns: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), + listCrawledUrls: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', 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 = gax.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.webSecurityScannerStub) { + return this.webSecurityScannerStub; + } + + // Put together the "service stub" for + // google.cloud.websecurityscanner.v1alpha.WebSecurityScanner. + this.webSecurityScannerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1alpha.WebSecurityScanner') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1alpha.WebSecurityScanner, + 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 webSecurityScannerStubMethods = + ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + for (const methodName of webSecurityScannerStubMethods) { + const callPromise = this.webSecurityScannerStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.webSecurityScannerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'websecurityscanner.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 'websecurityscanner.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 new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig + * Required. The ScanConfig to be created. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. + * 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/v1alpha/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async + */ + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined + ]>; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createScanConfig(request, options, callback); + } +/** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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/v1alpha/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async + */ + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined + ]>; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteScanConfig(request, options, callback); + } +/** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. + * 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/v1alpha/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async + */ + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined + ]>; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getScanConfig(request, options, callback); + } +/** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. + * 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/v1alpha/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async + */ + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined + ]>; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateScanConfig(request, options, callback); + } +/** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. + * 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/v1alpha/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async + */ + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined + ]>; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.startScanRun(request, options, callback); + } +/** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. + * 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/v1alpha/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async + */ + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined + ]>; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getScanRun(request, options, callback); + } +/** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. + * 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/v1alpha/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async + */ + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined + ]>; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.stopScanRun(request, options, callback); + } +/** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding}. + * 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/v1alpha/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async + */ + getFinding( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined + ]>; + getFinding( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFinding(request, options, callback); + } +/** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ListFindingTypeStatsResponse]{@link google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse}. + * 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/v1alpha/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async + */ + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFindingTypeStats(request, options, callback); + } + + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. + * 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 `listScanConfigsAsync()` + * 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. + */ + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + ]>; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listScanConfigs(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 resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig} 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 `listScanConfigsAsync()` + * 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. + */ + listScanConfigsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.createStream( + this.innerApiCalls.listScanConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanConfigs`, 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 resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. 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/v1alpha/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async + */ + listScanConfigsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.asyncIterate( + this.innerApiCalls['listScanConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. + * 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 `listScanRunsAsync()` + * 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. + */ + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + ]>; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listScanRuns(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 resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun} 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 `listScanRunsAsync()` + * 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. + */ + listScanRunsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.createStream( + this.innerApiCalls.listScanRuns as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanRuns`, 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 resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. 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/v1alpha/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async + */ + listScanRunsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.asyncIterate( + this.innerApiCalls['listScanRuns'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1alpha.CrawledUrl}. + * 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 `listCrawledUrlsAsync()` + * 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. + */ + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + ]>; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCrawledUrls(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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1alpha.CrawledUrl} 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 `listCrawledUrlsAsync()` + * 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. + */ + listCrawledUrlsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.createStream( + this.innerApiCalls.listCrawledUrls as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCrawledUrls`, 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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [CrawledUrl]{@link google.cloud.websecurityscanner.v1alpha.CrawledUrl}. 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/v1alpha/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async + */ + listCrawledUrlsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.asyncIterate( + this.innerApiCalls['listCrawledUrls'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding}. + * 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 `listFindingsAsync()` + * 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. + */ + listFindings( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; + listFindings( + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; + listFindings( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding>): + Promise<[ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding} 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 `listFindingsAsync()` + * 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. + */ + listFindingsStream( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, 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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding}. 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/v1alpha/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the scan_config from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + } + + /** + * Parse the scan_run from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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 scanConfig resource name string. + * + * @param {string} project + * @param {string} scan_config + * @returns {string} Resource name string. + */ + scanConfigPath(project:string,scanConfig:string) { + return this.pathTemplates.scanConfigPathTemplate.render({ + project: project, + scan_config: scanConfig, + }); + } + + /** + * Parse the project from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; + } + + /** + * Parse the scan_config from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; + } + + /** + * Return a fully-qualified scanRun resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @returns {string} Resource name string. + */ + scanRunPath(project:string,scanConfig:string,scanRun:string) { + return this.pathTemplates.scanRunPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + }); + } + + /** + * Parse the project from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; + } + + /** + * Parse the scan_config from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; + } + + /** + * Parse the scan_run from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; + } + + /** + * 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.webSecurityScannerStub && !this._terminated) { + return this.webSecurityScannerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json new file mode 100644 index 0000000..288b9b0 --- /dev/null +++ b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner": { + "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": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json new file mode 100644 index 0000000..1696775 --- /dev/null +++ b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/finding.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto", + "../../protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto" +] diff --git a/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..2c742f5 --- /dev/null +++ b/owl-bot-staging/v1alpha/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 websecurityscanner = require('@google-cloud/web-security-scanner'); + +function main() { + const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); +} + +main(); diff --git a/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..8bd7a23 --- /dev/null +++ b/owl-bot-staging/v1alpha/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; + +// check that the client class type name can be used +function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webSecurityScannerClient = new WebSecurityScannerClient(); + doStuffWithWebSecurityScannerClient(webSecurityScannerClient); +} + +main(); diff --git a/owl-bot-staging/v1alpha/system-test/install.ts b/owl-bot-staging/v1alpha/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1alpha/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/v1alpha/test/gapic_web_security_scanner_v1alpha.ts b/owl-bot-staging/v1alpha/test/gapic_web_security_scanner_v1alpha.ts new file mode 100644 index 0000000..653e5c5 --- /dev/null +++ b/owl-bot-staging/v1alpha/test/gapic_web_security_scanner_v1alpha.ts @@ -0,0 +1,2122 @@ +// 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 websecurityscannerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +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('v1alpha.WebSecurityScannerClient', () => { + it('has servicePath', () => { + const servicePath = websecurityscannerModule.v1alpha.WebSecurityScannerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = websecurityscannerModule.v1alpha.WebSecurityScannerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = websecurityscannerModule.v1alpha.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); + + it('has close method for the initialized client', done => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webSecurityScannerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + 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 websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + 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('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); + client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createScanConfig(request), expectedError); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + 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); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteScanConfig(request), expectedError); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); + client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanConfig(request), expectedError); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); + client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateScanConfig(request), expectedError); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); + client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startScanRun(request), expectedError); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); + client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanRun(request), expectedError); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); + client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopScanRun(request), expectedError); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()); + client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFinding(request), expectedError); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse()); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse()); + client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanConfigs(request), expectedError); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { + 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.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanRuns(request), expectedError); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { + 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.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert.strictEqual( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert.strictEqual( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), + ]; + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCrawledUrls(request), expectedError); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { + 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.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { + 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.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert.strictEqual( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert.strictEqual( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + finding: "findingValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + 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('scanConfig', () => { + const fakePath = "/rendered/path/scanConfig"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanConfigPath', () => { + const result = client.scanConfigPath("projectValue", "scanConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanConfigName', () => { + const result = client.matchProjectFromScanConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanConfigName', () => { + const result = client.matchScanConfigFromScanConfigName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('scanRun', () => { + const fakePath = "/rendered/path/scanRun"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + }; + const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanRunPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanRunPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanRunPath', () => { + const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanRunName', () => { + const result = client.matchProjectFromScanRunName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanRunName', () => { + const result = client.matchScanConfigFromScanRunName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromScanRunName', () => { + const result = client.matchScanRunFromScanRunName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1alpha/tsconfig.json b/owl-bot-staging/v1alpha/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1alpha/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/v1alpha/webpack.config.js b/owl-bot-staging/v1alpha/webpack.config.js new file mode 100644 index 0000000..ad3467d --- /dev/null +++ b/owl-bot-staging/v1alpha/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: 'WebSecurityScanner', + filename: './web-security-scanner.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/v1beta/.eslintignore b/owl-bot-staging/v1beta/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1beta/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1beta/.eslintrc.json b/owl-bot-staging/v1beta/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1beta/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1beta/.gitignore b/owl-bot-staging/v1beta/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1beta/.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/v1beta/.jsdoc.js b/owl-bot-staging/v1beta/.jsdoc.js new file mode 100644 index 0000000..65475a4 --- /dev/null +++ b/owl-bot-staging/v1beta/.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/web-security-scanner', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1beta/.mocharc.js b/owl-bot-staging/v1beta/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1beta/.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/v1beta/.prettierrc.js b/owl-bot-staging/v1beta/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1beta/.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/v1beta/README.md b/owl-bot-staging/v1beta/README.md new file mode 100644 index 0000000..727d3b6 --- /dev/null +++ b/owl-bot-staging/v1beta/README.md @@ -0,0 +1 @@ +Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/v1beta/linkinator.config.json b/owl-bot-staging/v1beta/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/v1beta/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/v1beta/package.json b/owl-bot-staging/v1beta/package.json new file mode 100644 index 0000000..d42ee9b --- /dev/null +++ b/owl-bot-staging/v1beta/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/web-security-scanner", + "version": "0.1.0", + "description": "Websecurityscanner client for Node.js", + "repository": "googleapis/nodejs-websecurityscanner", + "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 websecurityscanner", + "websecurityscanner", + "web security scanner" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "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.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto new file mode 100644 index 0000000..cbfead4 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto @@ -0,0 +1,41 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "CrawledUrlProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web +// Security Scanner Service crawls the web applications, following all links +// within the scope of sites, to find the URLs to test against. +message CrawledUrl { + // The http method of the request that was used to visit the URL, in + // uppercase. + string http_method = 1; + + // The URL that was crawled. + string url = 2; + + // The body of the request that was used to visit the URL. + string body = 3; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto new file mode 100644 index 0000000..999e092 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto @@ -0,0 +1,98 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/finding_addon.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A Finding resource represents a vulnerability instance identified during a +// ScanRun. +message Finding { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/Finding" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" + }; + + // The resource name of the Finding. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. + // The finding IDs are generated by the system. + string name = 1; + + // The type of the Finding. + // Detailed and up-to-date information on findings can be found here: + // https://cloud.google.com/security-scanner/docs/scan-result-details + string finding_type = 2; + + // The http method of the request that triggered the vulnerability, in + // uppercase. + string http_method = 3; + + // The URL produced by the server-side fuzzer and used in the request that + // triggered the vulnerability. + string fuzzed_url = 4; + + // The body of the request that triggered the vulnerability. + string body = 5; + + // The description of the vulnerability. + string description = 6; + + // The URL containing human-readable payload that user can leverage to + // reproduce the vulnerability. + string reproduction_url = 7; + + // If the vulnerability was originated from nested IFrame, the immediate + // parent IFrame is reported. + string frame_url = 8; + + // The URL where the browser lands when the vulnerability is detected. + string final_url = 9; + + // The tracking ID uniquely identifies a vulnerability instance across + // multiple ScanRuns. + string tracking_id = 10; + + // An addon containing information reported for a vulnerability with an HTML + // form, if any. + Form form = 16; + + // An addon containing information about outdated libraries. + OutdatedLibrary outdated_library = 11; + + // An addon containing detailed information regarding any resource causing the + // vulnerability such as JavaScript sources, image, audio files, etc. + ViolatingResource violating_resource = 12; + + // An addon containing information about vulnerable or missing HTTP headers. + VulnerableHeaders vulnerable_headers = 15; + + // An addon containing information about request parameters which were found + // to be vulnerable. + VulnerableParameters vulnerable_parameters = 13; + + // An addon containing information reported for an XSS, if any. + Xss xss = 14; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto new file mode 100644 index 0000000..c29f6ca --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto @@ -0,0 +1,90 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingAddonProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// ! Information about a vulnerability with an HTML. +message Form { + // ! The URI where to send the form when it's submitted. + string action_uri = 1; + + // ! The names of form fields related to the vulnerability. + repeated string fields = 2; +} + +// Information reported for an outdated library. +message OutdatedLibrary { + // The name of the outdated library. + string library_name = 1; + + // The version number. + string version = 2; + + // URLs to learn more information about the vulnerabilities in the library. + repeated string learn_more_urls = 3; +} + +// Information regarding any resource causing the vulnerability such +// as JavaScript sources, image, audio files, etc. +message ViolatingResource { + // The MIME type of this resource. + string content_type = 1; + + // URL of this violating resource. + string resource_url = 2; +} + +// Information about vulnerable request parameters. +message VulnerableParameters { + // The vulnerable parameter names. + repeated string parameter_names = 1; +} + +// Information about vulnerable or missing HTTP Headers. +message VulnerableHeaders { + // Describes a HTTP Header. + message Header { + // Header name. + string name = 1; + + // Header value. + string value = 2; + } + + // List of vulnerable headers. + repeated Header headers = 1; + + // List of missing headers. + repeated Header missing_headers = 2; +} + +// Information reported for an XSS. +message Xss { + // Stack traces leading to the point where the XSS occurred. + repeated string stack_traces = 1; + + // An error message generated by a javascript breakage. + string error_message = 2; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto new file mode 100644 index 0000000..9b21576 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto @@ -0,0 +1,36 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "FindingTypeStatsProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A FindingTypeStats resource represents stats regarding a specific FindingType +// of Findings under a given ScanRun. +message FindingTypeStats { + // The finding type associated with the stats. + string finding_type = 1; + + // The count of findings belonging to this finding type. + int32 finding_count = 2; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto new file mode 100644 index 0000000..b25c619 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto @@ -0,0 +1,193 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A ScanConfig resource contains the configurations to launch a scan. +message ScanConfig { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + pattern: "projects/{project}/scanConfigs/{scan_config}" + }; + + // Scan authentication configuration. + message Authentication { + // Describes authentication configuration that uses a Google account. + message GoogleAccount { + // Required. The user name of the Google account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the Google account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + } + + // Describes authentication configuration that uses a custom account. + message CustomAccount { + // Required. The user name of the custom account. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. The password of the custom account. The credential is stored encrypted + // and not returned in any response nor included in audit logs. + string password = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Required. The login form URL of the website. + string login_url = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. + // Authentication configuration + oneof authentication { + // Authentication using a Google account. + GoogleAccount google_account = 1; + + // Authentication using a custom account. + CustomAccount custom_account = 2; + } + } + + // Scan schedule configuration. + message Schedule { + // A timestamp indicates when the next run will be scheduled. The value is + // refreshed by the server after each run. If unspecified, it will default + // to current server time, which means the scan will be scheduled to start + // immediately. + google.protobuf.Timestamp schedule_time = 1; + + // Required. The duration of time between executions in days. + int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Type of user agents used for scanning. + enum UserAgent { + // The user agent is unknown. Service will default to CHROME_LINUX. + USER_AGENT_UNSPECIFIED = 0; + + // Chrome on Linux. This is the service default if unspecified. + CHROME_LINUX = 1; + + // Chrome on Android. + CHROME_ANDROID = 2; + + // Safari on IPhone. + SAFARI_IPHONE = 3; + } + + // Cloud platforms supported by Cloud Web Security Scanner. + enum TargetPlatform { + // The target platform is unknown. Requests with this enum value will be + // rejected with INVALID_ARGUMENT error. + TARGET_PLATFORM_UNSPECIFIED = 0; + + // Google App Engine service. + APP_ENGINE = 1; + + // Google Compute Engine service. + COMPUTE = 2; + } + + // Scan risk levels supported by Cloud Web Security Scanner. LOW impact + // scanning will minimize requests with the potential to modify data. To + // achieve the maximum scan coverage, NORMAL risk level is recommended. + enum RiskLevel { + // Use default, which is NORMAL. + RISK_LEVEL_UNSPECIFIED = 0; + + // Normal scanning (Recommended) + NORMAL = 1; + + // Lower impact scanning + LOW = 2; + } + + // Controls export of scan configurations and results to Cloud Security + // Command Center. + enum ExportToSecurityCommandCenter { + // Use default, which is ENABLED. + EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; + + // Export results of this scan to Cloud Security Command Center. + ENABLED = 1; + + // Do not export results of this scan to Cloud Security Command Center. + DISABLED = 2; + } + + // The resource name of the ScanConfig. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are + // generated by the system. + string name = 1; + + // Required. The user provided display name of the ScanConfig. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // The maximum QPS during scanning. A valid value ranges from 5 to 20 + // inclusively. If the field is unspecified or its value is set 0, server will + // default to 15. Other values outside of [5, 20] range will be rejected with + // INVALID_ARGUMENT error. + int32 max_qps = 3; + + // Required. The starting URLs from which the scanner finds site pages. + repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; + + // The authentication configuration. If specified, service will use the + // authentication configuration during scanning. + Authentication authentication = 5; + + // The user agent used during scanning. + UserAgent user_agent = 6; + + // The blacklist URL patterns as described in + // https://cloud.google.com/security-scanner/docs/excluded-urls + repeated string blacklist_patterns = 7; + + // The schedule of the ScanConfig. + Schedule schedule = 8; + + // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be + // used as a default. + repeated TargetPlatform target_platforms = 9; + + // Controls export of scan configurations and results to Cloud Security + // Command Center. + ExportToSecurityCommandCenter export_to_security_command_center = 10; + + // Latest ScanRun if available. + ScanRun latest_run = 11; + + // The risk level selected for the scan + RiskLevel risk_level = 12; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto new file mode 100644 index 0000000..3920b74 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto @@ -0,0 +1,190 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanConfigErrorProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Defines a custom error message used by CreateScanConfig and UpdateScanConfig +// APIs when scan configuration validation fails. It is also reported as part of +// a ScanRunErrorTrace message if scan validation fails due to a scan +// configuration error. +message ScanConfigError { + // Output only. + // Defines an error reason code. + // Next id: 44 + enum Code { + option allow_alias = true; + + // There is no error. + CODE_UNSPECIFIED = 0; + + // There is no error. + OK = 0; + + // Indicates an internal server error. + // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. + INTERNAL_ERROR = 1; + + // One of the seed URLs is an App Engine URL but we cannot validate the scan + // settings due to an App Engine API backend error. + APPENGINE_API_BACKEND_ERROR = 2; + + // One of the seed URLs is an App Engine URL but we cannot access the + // App Engine API to validate scan settings. + APPENGINE_API_NOT_ACCESSIBLE = 3; + + // One of the seed URLs is an App Engine URL but the Default Host of the + // App Engine is not set. + APPENGINE_DEFAULT_HOST_MISSING = 4; + + // Google corporate accounts can not be used for scanning. + CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; + + // The account of the scan creator can not be used for scanning. + CANNOT_USE_OWNER_ACCOUNT = 7; + + // This scan targets Compute Engine, but we cannot validate scan settings + // due to a Compute Engine API backend error. + COMPUTE_API_BACKEND_ERROR = 8; + + // This scan targets Compute Engine, but we cannot access the Compute Engine + // API to validate the scan settings. + COMPUTE_API_NOT_ACCESSIBLE = 9; + + // The Custom Login URL does not belong to the current project. + CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; + + // The Custom Login URL is malformed (can not be parsed). + CUSTOM_LOGIN_URL_MALFORMED = 11; + + // The Custom Login URL is mapped to a non-routable IP address in DNS. + CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; + + // The Custom Login URL is mapped to an IP address which is not reserved for + // the current project. + CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; + + // The Custom Login URL has a non-routable IP address. + CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; + + // The Custom Login URL has an IP address which is not reserved for the + // current project. + CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; + + // Another scan with the same name (case-sensitive) already exists. + DUPLICATE_SCAN_NAME = 16; + + // A field is set to an invalid value. + INVALID_FIELD_VALUE = 18; + + // There was an error trying to authenticate to the scan target. + FAILED_TO_AUTHENTICATE_TO_TARGET = 19; + + // Finding type value is not specified in the list findings request. + FINDING_TYPE_UNSPECIFIED = 20; + + // Scan targets Compute Engine, yet current project was not whitelisted for + // Google Compute Engine Scanning Alpha access. + FORBIDDEN_TO_SCAN_COMPUTE = 21; + + // User tries to update managed scan + FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; + + // The supplied filter is malformed. For example, it can not be parsed, does + // not have a filter type in expression, or the same filter type appears + // more than once. + MALFORMED_FILTER = 22; + + // The supplied resource name is malformed (can not be parsed). + MALFORMED_RESOURCE_NAME = 23; + + // The current project is not in an active state. + PROJECT_INACTIVE = 24; + + // A required field is not set. + REQUIRED_FIELD = 25; + + // Project id, scanconfig id, scanrun id, or finding id are not consistent + // with each other in resource name. + RESOURCE_NAME_INCONSISTENT = 26; + + // The scan being requested to start is already running. + SCAN_ALREADY_RUNNING = 27; + + // The scan that was requested to be stopped is not running. + SCAN_NOT_RUNNING = 28; + + // One of the seed URLs does not belong to the current project. + SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; + + // One of the seed URLs is malformed (can not be parsed). + SEED_URL_MALFORMED = 30; + + // One of the seed URLs is mapped to a non-routable IP address in DNS. + SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; + + // One of the seed URLs is mapped to an IP address which is not reserved + // for the current project. + SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; + + // One of the seed URLs has on-routable IP address. + SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; + + // One of the seed URLs has an IP address that is not reserved + // for the current project. + SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; + + // The Cloud Security Scanner service account is not configured under the + // project. + SERVICE_ACCOUNT_NOT_CONFIGURED = 36; + + // A project has reached the maximum number of scans. + TOO_MANY_SCANS = 37; + + // Resolving the details of the current project fails. + UNABLE_TO_RESOLVE_PROJECT_INFO = 38; + + // One or more blacklist patterns were in the wrong format. + UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; + + // The supplied filter is not supported. + UNSUPPORTED_FILTER = 40; + + // The supplied finding type is not supported. For example, we do not + // provide findings of the given finding type. + UNSUPPORTED_FINDING_TYPE = 41; + + // The URL scheme of one or more of the supplied URLs is not supported. + UNSUPPORTED_URL_SCHEME = 42; + } + + // Indicates the reason code for a configuration failure. + Code code = 1; + + // Indicates the full name of the ScanConfig field that triggers this error, + // for example "scan_config.max_qps". This field is provided for + // troubleshooting purposes only and its actual value can change in the + // future. + string field_name = 2; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto new file mode 100644 index 0000000..48800d2 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto @@ -0,0 +1,117 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// A ScanRun is a output-only resource representing an actual run of the scan. +// Next id: 12 +message ScanRun { + option (google.api.resource) = { + type: "websecurityscanner.googleapis.com/ScanRun" + pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" + }; + + // Types of ScanRun execution state. + enum ExecutionState { + // Represents an invalid state caused by internal server error. This value + // should never be returned. + EXECUTION_STATE_UNSPECIFIED = 0; + + // The scan is waiting in the queue. + QUEUED = 1; + + // The scan is in progress. + SCANNING = 2; + + // The scan is either finished or stopped by user. + FINISHED = 3; + } + + // Types of ScanRun result state. + enum ResultState { + // Default value. This value is returned when the ScanRun is not yet + // finished. + RESULT_STATE_UNSPECIFIED = 0; + + // The scan finished without errors. + SUCCESS = 1; + + // The scan finished with errors. + ERROR = 2; + + // The scan was terminated by user. + KILLED = 3; + } + + // The resource name of the ScanRun. The name follows the format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + // The ScanRun IDs are generated by the system. + string name = 1; + + // The execution state of the ScanRun. + ExecutionState execution_state = 2; + + // The result state of the ScanRun. This field is only available after the + // execution state reaches "FINISHED". + ResultState result_state = 3; + + // The time at which the ScanRun started. + google.protobuf.Timestamp start_time = 4; + + // The time at which the ScanRun reached termination state - that the ScanRun + // is either finished or stopped by user. + google.protobuf.Timestamp end_time = 5; + + // The number of URLs crawled during this ScanRun. If the scan is in progress, + // the value represents the number of URLs crawled up to now. + int64 urls_crawled_count = 6; + + // The number of URLs tested during this ScanRun. If the scan is in progress, + // the value represents the number of URLs tested up to now. The number of + // URLs tested is usually larger than the number URLS crawled because + // typically a crawled URL is tested with multiple test payloads. + int64 urls_tested_count = 7; + + // Whether the scan run has found any vulnerabilities. + bool has_vulnerabilities = 8; + + // The percentage of total completion ranging from 0 to 100. + // If the scan is in queue, the value is 0. + // If the scan is running, the value ranges from 0 to 100. + // If the scan is finished, the value is 100. + int32 progress_percent = 9; + + // If result_state is an ERROR, this field provides the primary reason for + // scan's termination and more details, if such are available. + ScanRunErrorTrace error_trace = 10; + + // A list of warnings, if such are encountered during this scan run. + repeated ScanRunWarningTrace warning_traces = 11; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto new file mode 100644 index 0000000..acbdef2 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto @@ -0,0 +1,76 @@ +// 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.websecurityscanner.v1beta; + +import "google/cloud/websecurityscanner/v1beta/scan_config_error.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunErrorTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Output only. +// Defines an error trace message for a ScanRun. +message ScanRunErrorTrace { + // Output only. + // Defines an error reason code. + // Next id: 7 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that the scan run failed due to an internal server error. + INTERNAL_ERROR = 1; + + // Indicates a scan configuration error, usually due to outdated ScanConfig + // settings, such as starting_urls or the DNS configuration. + SCAN_CONFIG_ISSUE = 2; + + // Indicates an authentication error, usually due to outdated ScanConfig + // authentication settings. + AUTHENTICATION_CONFIG_ISSUE = 3; + + // Indicates a scan operation timeout, usually caused by a very large site. + TIMED_OUT_WHILE_SCANNING = 4; + + // Indicates that a scan encountered excessive redirects, either to + // authentication or some other page outside of the scan scope. + TOO_MANY_REDIRECTS = 5; + + // Indicates that a scan encountered numerous errors from the web site + // pages. When available, most_common_http_error_code field indicates the + // most common HTTP error code encountered during the scan. + TOO_MANY_HTTP_ERRORS = 6; + } + + // Indicates the error reason code. + Code code = 1; + + // If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error + // message encountered during scan configuration validation that is performed + // before each scan run. + ScanConfigError scan_config_error = 2; + + // If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most + // common HTTP error code, if such is available. For example, if this code is + // 404, the scan has encountered too many NOT_FOUND responses. + int32 most_common_http_error_code = 3; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto new file mode 100644 index 0000000..6ee6b34 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto @@ -0,0 +1,59 @@ +// 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.websecurityscanner.v1beta; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "ScanRunWarningTraceProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Output only. +// Defines a warning trace message for ScanRun. Warning traces provide customers +// with useful information that helps make the scanning process more effective. +message ScanRunWarningTrace { + // Output only. + // Defines a warning message code. + // Next id: 6 + enum Code { + // Default value is never used. + CODE_UNSPECIFIED = 0; + + // Indicates that a scan discovered an unexpectedly low number of URLs. This + // is sometimes caused by complex navigation features or by using a single + // URL for numerous pages. + INSUFFICIENT_CRAWL_RESULTS = 1; + + // Indicates that a scan discovered too many URLs to test, or excessive + // redundant URLs. + TOO_MANY_CRAWL_RESULTS = 2; + + // Indicates that too many tests have been generated for the scan. Customer + // should try reducing the number of starting URLs, increasing the QPS rate, + // or narrowing down the scope of the scan using the excluded patterns. + TOO_MANY_FUZZ_TASKS = 3; + + // Indicates that a scan is blocked by IAP. + BLOCKED_BY_IAP = 4; + } + + // Indicates the warning code. + Code code = 1; +} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto new file mode 100644 index 0000000..79be175 --- /dev/null +++ b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto @@ -0,0 +1,413 @@ +// 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.websecurityscanner.v1beta; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/websecurityscanner/v1beta/crawled_url.proto"; +import "google/cloud/websecurityscanner/v1beta/finding.proto"; +import "google/cloud/websecurityscanner/v1beta/finding_type_stats.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_config.proto"; +import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; +option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; +option java_multiple_files = true; +option java_outer_classname = "WebSecurityScannerProto"; +option java_package = "com.google.cloud.websecurityscanner.v1beta"; +option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; +option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; + +// Cloud Web Security Scanner Service identifies security vulnerabilities in web +// applications hosted on Google Cloud Platform. It crawls your application, and +// attempts to exercise as many user inputs and event handlers as possible. +service WebSecurityScanner { + option (google.api.default_host) = "websecurityscanner.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new ScanConfig. + rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + post: "/v1beta/{parent=projects/*}/scanConfigs" + body: "scan_config" + }; + option (google.api.method_signature) = "parent,scan_config"; + } + + // Deletes an existing ScanConfig and its child resources. + rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanConfig. + rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/scanConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanConfigs under a given project. + rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*}/scanConfigs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a ScanConfig. This method support partial update of a ScanConfig. + rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { + option (google.api.http) = { + patch: "/v1beta/{scan_config.name=projects/*/scanConfigs/*}" + body: "scan_config" + }; + option (google.api.method_signature) = "scan_config,update_mask"; + } + + // Start a ScanRun according to the given ScanConfig. + rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/scanConfigs/*}:start" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a ScanRun. + rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + // stop time. + rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*}/scanRuns" + }; + option (google.api.method_signature) = "parent"; + } + + // Stops a ScanRun. The stopped ScanRun is returned. + rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { + option (google.api.http) = { + post: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // List CrawledUrls under a given ScanRun. + rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a Finding. + rpc GetFinding(GetFindingRequest) returns (Finding) { + option (google.api.http) = { + get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List Findings under a given ScanRun. + rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" + }; + option (google.api.method_signature) = "parent,filter"; + } + + // List all FindingTypeStats under a given ScanRun. + rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { + option (google.api.http) = { + get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request for the `CreateScanConfig` method. +message CreateScanConfigRequest { + // Required. The parent resource name where the scan is created, which should be a + // project resource name in the format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The ScanConfig to be created. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for the `DeleteScanConfig` method. +message DeleteScanConfigRequest { + // Required. The resource name of the ScanConfig to be deleted. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanConfig` method. +message GetScanConfigRequest { + // Required. The resource name of the ScanConfig to be returned. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `ListScanConfigs` method. +message ListScanConfigsRequest { + // Required. The parent resource name, which should be a project resource name in the + // format 'projects/{projectId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanConfigs to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Request for the `UpdateScanConfigRequest` method. +message UpdateScanConfigRequest { + // Required. The ScanConfig to be updated. The name field must be set to identify the + // resource to be updated. The values of fields not covered by the mask + // will be ignored. + ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The update mask applies to the resource. For the `FieldMask` definition, + // see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the `ListScanConfigs` method. +message ListScanConfigsResponse { + // The list of ScanConfigs returned. + repeated ScanConfig scan_configs = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `StartScanRun` method. +message StartScanRunRequest { + // Required. The resource name of the ScanConfig to be used. The name follows the + // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; +} + +// Request for the `GetScanRun` method. +message GetScanRunRequest { + // Required. The resource name of the ScanRun to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListScanRuns` method. +message ListScanRunsRequest { + // Required. The parent resource name, which should be a scan resource name in the + // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanConfig" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of ScanRuns to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListScanRuns` method. +message ListScanRunsResponse { + // The list of ScanRuns returned. + repeated ScanRun scan_runs = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `StopScanRun` method. +message StopScanRunRequest { + // Required. The resource name of the ScanRun to be stopped. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Request for the `ListCrawledUrls` method. +message ListCrawledUrlsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 2; + + // The maximum number of CrawledUrls to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 3; +} + +// Response for the `ListCrawledUrls` method. +message ListCrawledUrlsResponse { + // The list of CrawledUrls returned. + repeated CrawledUrl crawled_urls = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `GetFinding` method. +message GetFindingRequest { + // Required. The resource name of the Finding to be returned. The name follows the + // format of + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/Finding" + } + ]; +} + +// Request for the `ListFindings` method. +message ListFindingsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; + + // Required. The filter expression. The expression must be in the format: + // . + // Supported field: 'finding_type'. + // Supported operator: '='. + string filter = 2 [(google.api.field_behavior) = REQUIRED]; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous List request. + // If unspecified, the first page of results is returned. + string page_token = 3; + + // The maximum number of Findings to return, can be limited by server. + // If not specified or not positive, the implementation will select a + // reasonable value. + int32 page_size = 4; +} + +// Response for the `ListFindings` method. +message ListFindingsResponse { + // The list of Findings returned. + repeated Finding findings = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request for the `ListFindingTypeStats` method. +message ListFindingTypeStatsRequest { + // Required. The parent resource name, which should be a scan run resource name in the + // format + // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "websecurityscanner.googleapis.com/ScanRun" + } + ]; +} + +// Response for the `ListFindingTypeStats` method. +message ListFindingTypeStatsResponse { + // The list of FindingTypeStats returned. + repeated FindingTypeStats finding_type_stats = 1; +} diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json b/owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json new file mode 100644 index 0000000..7666716 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json @@ -0,0 +1,579 @@ +{ + "clientLibrary": { + "name": "nodejs-websecurityscanner", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.websecurityscanner.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async", + "title": "WebSecurityScanner createScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new ScanConfig.", + "canonical": true, + "file": "web_security_scanner.create_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "CreateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async", + "title": "WebSecurityScanner deleteScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes an existing ScanConfig and its child resources.", + "canonical": true, + "file": "web_security_scanner.delete_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "DeleteScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async", + "title": "WebSecurityScanner getScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.get_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async", + "title": "WebSecurityScanner listScanConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanConfigs under a given project.", + "canonical": true, + "file": "web_security_scanner.list_scan_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanConfigsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanConfigs", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async", + "title": "WebSecurityScanner updateScanConfig Sample", + "origin": "API_DEFINITION", + "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", + "canonical": true, + "file": "web_security_scanner.update_scan_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", + "async": true, + "parameters": [ + { + "name": "scan_config", + "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "UpdateScanConfig", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async", + "title": "WebSecurityScanner startScanRun Sample", + "origin": "API_DEFINITION", + "description": " Start a ScanRun according to the given ScanConfig.", + "canonical": true, + "file": "web_security_scanner.start_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "StartScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async", + "title": "WebSecurityScanner getScanRun Sample", + "origin": "API_DEFINITION", + "description": " Gets a ScanRun.", + "canonical": true, + "file": "web_security_scanner.get_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async", + "title": "WebSecurityScanner listScanRuns Sample", + "origin": "API_DEFINITION", + "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", + "canonical": true, + "file": "web_security_scanner.list_scan_runs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanRunsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListScanRuns", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async", + "title": "WebSecurityScanner stopScanRun Sample", + "origin": "API_DEFINITION", + "description": " Stops a ScanRun. The stopped ScanRun is returned.", + "canonical": true, + "file": "web_security_scanner.stop_scan_run.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "StopScanRun", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async", + "title": "WebSecurityScanner listCrawledUrls Sample", + "origin": "API_DEFINITION", + "description": " List CrawledUrls under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_crawled_urls.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListCrawledUrlsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListCrawledUrls", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async", + "title": "WebSecurityScanner getFinding Sample", + "origin": "API_DEFINITION", + "description": " Gets a Finding.", + "canonical": true, + "file": "web_security_scanner.get_finding.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.Finding", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "GetFinding", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async", + "title": "WebSecurityScanner listFindings Sample", + "origin": "API_DEFINITION", + "description": " List Findings under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_findings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindings", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + }, + { + "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async", + "title": "WebSecurityScanner listFindingTypeStats Sample", + "origin": "API_DEFINITION", + "description": " List all FindingTypeStats under a given ScanRun.", + "canonical": true, + "file": "web_security_scanner.list_finding_type_stats.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse", + "client": { + "shortName": "WebSecurityScannerClient", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" + }, + "method": { + "shortName": "ListFindingTypeStats", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", + "service": { + "shortName": "WebSecurityScanner", + "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js new file mode 100644 index 0000000..b788868 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.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(parent, scanConfig) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * Required. The ScanConfig to be created. + */ + // const scanConfig = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callCreateScanConfig() { + // Construct request + const request = { + parent, + scanConfig, + }; + + // Run request + const response = await websecurityscannerClient.createScanConfig(request); + console.log(response); + } + + callCreateScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js new file mode 100644 index 0000000..95697d1 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js @@ -0,0 +1,59 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callDeleteScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.deleteScanConfig(request); + console.log(response); + } + + callDeleteScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js new file mode 100644 index 0000000..0a29b79 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetFinding() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getFinding(request); + console.log(response); + } + + callGetFinding(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js new file mode 100644 index 0000000..26b9aaa --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js @@ -0,0 +1,59 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanConfig(request); + console.log(response); + } + + callGetScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js new file mode 100644 index 0000000..fec1f94 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callGetScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.getScanRun(request); + console.log(response); + } + + callGetScanRun(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js new file mode 100644 index 0000000..f091bce --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListCrawledUrls() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListCrawledUrls(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js new file mode 100644 index 0000000..cddb44f --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindingTypeStats() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await websecurityscannerClient.listFindingTypeStats(request); + console.log(response); + } + + callListFindingTypeStats(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js new file mode 100644 index 0000000..146fd9d --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.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, filter) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const parent = 'abc123' + /** + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + */ + // const filter = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListFindings() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const iterable = await websecurityscannerClient.listFindingsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListFindings(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js new file mode 100644 index 0000000..d7c1707 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js @@ -0,0 +1,73 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanConfigs(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js new file mode 100644 index 0000000..dc07d80 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js @@ -0,0 +1,73 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const parent = 'abc123' + /** + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + */ + // const pageToken = 'abc123' + /** + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + */ + // const pageSize = 1234 + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callListScanRuns() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await websecurityscannerClient.listScanRunsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListScanRuns(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js new file mode 100644 index 0000000..8abc20a --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js @@ -0,0 +1,59 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStartScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.startScanRun(request); + console.log(response); + } + + callStartScanRun(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js new file mode 100644 index 0000000..675070b --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js @@ -0,0 +1,60 @@ +// 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 websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + */ + // const name = 'abc123' + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callStopScanRun() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await websecurityscannerClient.stopScanRun(request); + console.log(response); + } + + callStopScanRun(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js new file mode 100644 index 0000000..311bd37 --- /dev/null +++ b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js @@ -0,0 +1,67 @@ +// 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(scanConfig, updateMask) { + // [START websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + */ + // const scanConfig = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Websecurityscanner library + const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; + + // Instantiates a client + const websecurityscannerClient = new WebSecurityScannerClient(); + + async function callUpdateScanConfig() { + // Construct request + const request = { + scanConfig, + updateMask, + }; + + // Run request + const response = await websecurityscannerClient.updateScanConfig(request); + console.log(response); + } + + callUpdateScanConfig(); + // [END websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/src/index.ts b/owl-bot-staging/v1beta/src/index.ts new file mode 100644 index 0000000..e3ed9d6 --- /dev/null +++ b/owl-bot-staging/v1beta/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 v1beta from './v1beta'; +const WebSecurityScannerClient = v1beta.WebSecurityScannerClient; +type WebSecurityScannerClient = v1beta.WebSecurityScannerClient; +export {v1beta, WebSecurityScannerClient}; +export default {v1beta, WebSecurityScannerClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json new file mode 100644 index 0000000..c531caa --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json @@ -0,0 +1,169 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.websecurityscanner.v1beta", + "libraryPackage": "@google-cloud/web-security-scanner", + "services": { + "WebSecurityScanner": { + "clients": { + "grpc": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "WebSecurityScannerClient", + "rpcs": { + "CreateScanConfig": { + "methods": [ + "createScanConfig" + ] + }, + "DeleteScanConfig": { + "methods": [ + "deleteScanConfig" + ] + }, + "GetScanConfig": { + "methods": [ + "getScanConfig" + ] + }, + "UpdateScanConfig": { + "methods": [ + "updateScanConfig" + ] + }, + "StartScanRun": { + "methods": [ + "startScanRun" + ] + }, + "GetScanRun": { + "methods": [ + "getScanRun" + ] + }, + "StopScanRun": { + "methods": [ + "stopScanRun" + ] + }, + "GetFinding": { + "methods": [ + "getFinding" + ] + }, + "ListFindingTypeStats": { + "methods": [ + "listFindingTypeStats" + ] + }, + "ListScanConfigs": { + "methods": [ + "listScanConfigs", + "listScanConfigsStream", + "listScanConfigsAsync" + ] + }, + "ListScanRuns": { + "methods": [ + "listScanRuns", + "listScanRunsStream", + "listScanRunsAsync" + ] + }, + "ListCrawledUrls": { + "methods": [ + "listCrawledUrls", + "listCrawledUrlsStream", + "listCrawledUrlsAsync" + ] + }, + "ListFindings": { + "methods": [ + "listFindings", + "listFindingsStream", + "listFindingsAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1beta/src/v1beta/index.ts b/owl-bot-staging/v1beta/src/v1beta/index.ts new file mode 100644 index 0000000..515d336 --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts new file mode 100644 index 0000000..2f9f35e --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts @@ -0,0 +1,1936 @@ +// 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1beta/web_security_scanner_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './web_security_scanner_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Cloud Web Security Scanner Service identifies security vulnerabilities in web + * applications hosted on Google Cloud Platform. It crawls your application, and + * attempts to exercise as many user inputs and event handlers as possible. + * @class + * @memberof v1beta + */ +export class WebSecurityScannerClient { + 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}; + webSecurityScannerStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of WebSecurityScannerClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WebSecurityScannerClient; + 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // 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 = { + findingPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + scanConfigPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}' + ), + scanRunPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' + ), + }; + + // 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 = { + listScanConfigs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), + listScanRuns: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), + listCrawledUrls: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), + listFindings: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', 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 = gax.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.webSecurityScannerStub) { + return this.webSecurityScannerStub; + } + + // Put together the "service stub" for + // google.cloud.websecurityscanner.v1beta.WebSecurityScanner. + this.webSecurityScannerStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1beta.WebSecurityScanner') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1beta.WebSecurityScanner, + 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 webSecurityScannerStubMethods = + ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + for (const methodName of webSecurityScannerStubMethods) { + const callPromise = this.webSecurityScannerStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.webSecurityScannerStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'websecurityscanner.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 'websecurityscanner.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 new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig + * Required. The ScanConfig to be created. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. + * 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/v1beta/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async + */ + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined + ]>; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + createScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createScanConfig(request, options, callback); + } +/** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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/v1beta/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async + */ + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined + ]>; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): void; + deleteScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteScanConfig(request, options, callback); + } +/** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. + * 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/v1beta/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async + */ + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined + ]>; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): void; + getScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getScanConfig(request, options, callback); + } +/** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. + * 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/v1beta/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async + */ + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined + ]>; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): void; + updateScanConfig( + request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|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' + ] = gax.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateScanConfig(request, options, callback); + } +/** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. + * 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/v1beta/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async + */ + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined + ]>; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>): void; + startScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.startScanRun(request, options, callback); + } +/** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. + * 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/v1beta/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async + */ + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined + ]>; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>): void; + getScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getScanRun(request, options, callback); + } +/** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. + * 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/v1beta/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async + */ + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined + ]>; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>): void; + stopScanRun( + request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.stopScanRun(request, options, callback); + } +/** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding}. + * 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/v1beta/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async + */ + getFinding( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined + ]>; + getFinding( + request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>): void; + getFinding( + request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getFinding(request, options, callback); + } +/** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 [ListFindingTypeStatsResponse]{@link google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse}. + * 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/v1beta/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async + */ + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined + ]>; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): void; + listFindingTypeStats( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFindingTypeStats(request, options, callback); + } + + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. + * 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 `listScanConfigsAsync()` + * 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. + */ + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + ]>; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; + listScanConfigs( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; + listScanConfigs( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listScanConfigs(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 resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig} 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 `listScanConfigsAsync()` + * 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. + */ + listScanConfigsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.createStream( + this.innerApiCalls.listScanConfigs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanConfigs`, 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 resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. 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/v1beta/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async + */ + listScanConfigsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanConfigs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanConfigs.asyncIterate( + this.innerApiCalls['listScanConfigs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. + * 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 `listScanRunsAsync()` + * 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. + */ + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + ]>; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; + listScanRuns( + request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; + listScanRuns( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listScanRuns(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 resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun} 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 `listScanRunsAsync()` + * 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. + */ + listScanRunsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.createStream( + this.innerApiCalls.listScanRuns as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listScanRuns`, 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 resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. 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/v1beta/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async + */ + listScanRunsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listScanRuns']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listScanRuns.asyncIterate( + this.innerApiCalls['listScanRuns'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1beta.CrawledUrl}. + * 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 `listCrawledUrlsAsync()` + * 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. + */ + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + ]>; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; + listCrawledUrls( + request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; + listCrawledUrls( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listCrawledUrls(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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1beta.CrawledUrl} 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 `listCrawledUrlsAsync()` + * 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. + */ + listCrawledUrlsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.createStream( + this.innerApiCalls.listCrawledUrls as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listCrawledUrls`, 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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [CrawledUrl]{@link google.cloud.websecurityscanner.v1beta.CrawledUrl}. 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/v1beta/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async + */ + listCrawledUrlsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listCrawledUrls']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listCrawledUrls.asyncIterate( + this.innerApiCalls['listCrawledUrls'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding}. + * 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 `listFindingsAsync()` + * 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. + */ + listFindings( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + ]>; + listFindings( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; + listFindings( + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; + listFindings( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding>): + Promise<[ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + ]>|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listFindings(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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding} 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 `listFindingsAsync()` + * 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. + */ + listFindingsStream( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.createStream( + this.innerApiCalls.listFindings as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listFindings`, 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 resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 + * [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding}. 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/v1beta/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async + */ + listFindingsAsync( + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listFindings']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listFindings.asyncIterate( + this.innerApiCalls['listFindings'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified finding resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @param {string} finding + * @returns {string} Resource name string. + */ + findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + return this.pathTemplates.findingPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + finding: finding, + }); + } + + /** + * Parse the project from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the project. + */ + matchProjectFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).project; + } + + /** + * Parse the scan_config from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + } + + /** + * Parse the scan_run from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; + } + + /** + * Parse the finding from Finding resource. + * + * @param {string} findingName + * A fully-qualified path representing Finding resource. + * @returns {string} A string representing the finding. + */ + matchFindingFromFindingName(findingName: string) { + return this.pathTemplates.findingPathTemplate.match(findingName).finding; + } + + /** + * 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 scanConfig resource name string. + * + * @param {string} project + * @param {string} scan_config + * @returns {string} Resource name string. + */ + scanConfigPath(project:string,scanConfig:string) { + return this.pathTemplates.scanConfigPathTemplate.render({ + project: project, + scan_config: scanConfig, + }); + } + + /** + * Parse the project from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; + } + + /** + * Parse the scan_config from ScanConfig resource. + * + * @param {string} scanConfigName + * A fully-qualified path representing ScanConfig resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanConfigName(scanConfigName: string) { + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; + } + + /** + * Return a fully-qualified scanRun resource name string. + * + * @param {string} project + * @param {string} scan_config + * @param {string} scan_run + * @returns {string} Resource name string. + */ + scanRunPath(project:string,scanConfig:string,scanRun:string) { + return this.pathTemplates.scanRunPathTemplate.render({ + project: project, + scan_config: scanConfig, + scan_run: scanRun, + }); + } + + /** + * Parse the project from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the project. + */ + matchProjectFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; + } + + /** + * Parse the scan_config from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_config. + */ + matchScanConfigFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; + } + + /** + * Parse the scan_run from ScanRun resource. + * + * @param {string} scanRunName + * A fully-qualified path representing ScanRun resource. + * @returns {string} A string representing the scan_run. + */ + matchScanRunFromScanRunName(scanRunName: string) { + return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; + } + + /** + * 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.webSecurityScannerStub && !this._terminated) { + return this.webSecurityScannerStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json new file mode 100644 index 0000000..ecb06a1 --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json @@ -0,0 +1,91 @@ +{ + "interfaces": { + "google.cloud.websecurityscanner.v1beta.WebSecurityScanner": { + "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": { + "CreateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanConfigs": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateScanConfig": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListScanRuns": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "StopScanRun": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListCrawledUrls": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetFinding": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindings": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListFindingTypeStats": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json new file mode 100644 index 0000000..abb1848 --- /dev/null +++ b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json @@ -0,0 +1,12 @@ +[ + "../../protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/finding.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_config.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_run.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto", + "../../protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto" +] diff --git a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..2c742f5 --- /dev/null +++ b/owl-bot-staging/v1beta/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 websecurityscanner = require('@google-cloud/web-security-scanner'); + +function main() { + const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); +} + +main(); diff --git a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..8bd7a23 --- /dev/null +++ b/owl-bot-staging/v1beta/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; + +// check that the client class type name can be used +function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const webSecurityScannerClient = new WebSecurityScannerClient(); + doStuffWithWebSecurityScannerClient(webSecurityScannerClient); +} + +main(); diff --git a/owl-bot-staging/v1beta/system-test/install.ts b/owl-bot-staging/v1beta/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1beta/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/v1beta/test/gapic_web_security_scanner_v1beta.ts b/owl-bot-staging/v1beta/test/gapic_web_security_scanner_v1beta.ts new file mode 100644 index 0000000..50e1e42 --- /dev/null +++ b/owl-bot-staging/v1beta/test/gapic_web_security_scanner_v1beta.ts @@ -0,0 +1,2122 @@ +// 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 websecurityscannerModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +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('v1beta.WebSecurityScannerClient', () => { + it('has servicePath', () => { + const servicePath = websecurityscannerModule.v1beta.WebSecurityScannerClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = websecurityscannerModule.v1beta.WebSecurityScannerClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = websecurityscannerModule.v1beta.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); + + it('has close method for the initialized client', done => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.webSecurityScannerStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + 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 websecurityscannerModule.v1beta.WebSecurityScannerClient({ + 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('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); + client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createScanConfig(request), expectedError); + assert((client.innerApiCalls.createScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + 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); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteScanConfig(request), expectedError); + assert((client.innerApiCalls.deleteScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); + client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanConfig(request), expectedError); + assert((client.innerApiCalls.getScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); + client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedHeaderRequestParams = "scan_config.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateScanConfig(request), expectedError); + assert((client.innerApiCalls.updateScanConfig as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); + request.scanConfig = {}; + request.scanConfig.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); + client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startScanRun(request), expectedError); + assert((client.innerApiCalls.startScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); + client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getScanRun(request), expectedError); + assert((client.innerApiCalls.getScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); + client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopScanRun(request), expectedError); + assert((client.innerApiCalls.stopScanRun as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()); + client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getFinding(request), expectedError); + assert((client.innerApiCalls.getFinding as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse()); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse()); + client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + assert((client.innerApiCalls.listFindingTypeStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanConfigs(request), expectedError); + assert((client.innerApiCalls.listScanConfigs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { + 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.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listScanRuns(request), expectedError); + assert((client.innerApiCalls.listScanRuns as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { + 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.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert.strictEqual( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); + assert.strictEqual( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), + ]; + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listCrawledUrls(request), expectedError); + assert((client.innerApiCalls.listCrawledUrls as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { + 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.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listFindings(request), expectedError); + assert((client.innerApiCalls.listFindings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { + 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.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert.strictEqual( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; + stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); + assert.strictEqual( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), + ]; + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('finding', () => { + const fakePath = "/rendered/path/finding"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + finding: "findingValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.findingPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.findingPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, "findingValue"); + assert((client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + 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('scanConfig', () => { + const fakePath = "/rendered/path/scanConfig"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanConfigPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanConfigPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanConfigPath', () => { + const result = client.scanConfigPath("projectValue", "scanConfigValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanConfigName', () => { + const result = client.matchProjectFromScanConfigName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanConfigName', () => { + const result = client.matchScanConfigFromScanConfigName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('scanRun', () => { + const fakePath = "/rendered/path/scanRun"; + const expectedParameters = { + project: "projectValue", + scan_config: "scanConfigValue", + scan_run: "scanRunValue", + }; + const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.scanRunPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.scanRunPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('scanRunPath', () => { + const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromScanRunName', () => { + const result = client.matchProjectFromScanRunName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanConfigFromScanRunName', () => { + const result = client.matchScanConfigFromScanRunName(fakePath); + assert.strictEqual(result, "scanConfigValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchScanRunFromScanRunName', () => { + const result = client.matchScanRunFromScanRunName(fakePath); + assert.strictEqual(result, "scanRunValue"); + assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1beta/tsconfig.json b/owl-bot-staging/v1beta/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1beta/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/v1beta/webpack.config.js b/owl-bot-staging/v1beta/webpack.config.js new file mode 100644 index 0000000..ad3467d --- /dev/null +++ b/owl-bot-staging/v1beta/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: 'WebSecurityScanner', + filename: './web-security-scanner.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 1ec1c0b0605d8a2cb62f58b3541fd11bf0bfec5d Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 09:50:52 +0000 Subject: [PATCH 2/2] =?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 - .../websecurityscanner/v1/crawled_url.proto | 40 - .../cloud/websecurityscanner/v1/finding.proto | 119 - .../websecurityscanner/v1/finding_addon.proto | 147 -- .../v1/finding_type_stats.proto | 35 - .../websecurityscanner/v1/scan_config.proto | 188 -- .../v1/scan_config_error.proto | 189 -- .../websecurityscanner/v1/scan_run.proto | 110 - .../v1/scan_run_error_trace.proto | 75 - .../v1/scan_run_warning_trace.proto | 58 - .../v1/web_security_scanner.proto | 337 --- ...ta.google.cloud.websecurityscanner.v1.json | 579 ----- ...web_security_scanner.create_scan_config.js | 62 - ...web_security_scanner.delete_scan_config.js | 58 - .../v1/web_security_scanner.get_finding.js | 59 - .../web_security_scanner.get_scan_config.js | 58 - .../v1/web_security_scanner.get_scan_run.js | 59 - .../web_security_scanner.list_crawled_urls.js | 73 - ...ecurity_scanner.list_finding_type_stats.js | 59 - .../v1/web_security_scanner.list_findings.js | 80 - .../web_security_scanner.list_scan_configs.js | 72 - .../v1/web_security_scanner.list_scan_runs.js | 72 - .../v1/web_security_scanner.start_scan_run.js | 58 - .../v1/web_security_scanner.stop_scan_run.js | 59 - ...web_security_scanner.update_scan_config.js | 65 - owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 169 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/src/v1/web_security_scanner_client.ts | 1819 -------------- .../web_security_scanner_client_config.json | 91 - .../v1/web_security_scanner_proto_list.json | 12 - .../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_web_security_scanner_v1.ts | 2008 ---------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1alpha/.eslintignore | 7 - owl-bot-staging/v1alpha/.eslintrc.json | 3 - owl-bot-staging/v1alpha/.gitignore | 14 - owl-bot-staging/v1alpha/.jsdoc.js | 55 - owl-bot-staging/v1alpha/.mocharc.js | 33 - owl-bot-staging/v1alpha/.prettierrc.js | 22 - owl-bot-staging/v1alpha/README.md | 1 - .../v1alpha/linkinator.config.json | 16 - owl-bot-staging/v1alpha/package.json | 64 - .../v1alpha/crawled_url.proto | 38 - .../websecurityscanner/v1alpha/finding.proto | 152 -- .../v1alpha/finding_addon.proto | 78 - .../v1alpha/finding_type_stats.proto | 35 - .../v1alpha/scan_config.proto | 157 -- .../websecurityscanner/v1alpha/scan_run.proto | 104 - .../v1alpha/web_security_scanner.proto | 410 ---- ...ogle.cloud.websecurityscanner.v1alpha.json | 579 ----- ...web_security_scanner.create_scan_config.js | 64 - ...web_security_scanner.delete_scan_config.js | 59 - .../web_security_scanner.get_finding.js | 60 - .../web_security_scanner.get_scan_config.js | 59 - .../web_security_scanner.get_scan_run.js | 60 - .../web_security_scanner.list_crawled_urls.js | 74 - ...ecurity_scanner.list_finding_type_stats.js | 60 - .../web_security_scanner.list_findings.js | 82 - .../web_security_scanner.list_scan_configs.js | 73 - .../web_security_scanner.list_scan_runs.js | 73 - .../web_security_scanner.start_scan_run.js | 59 - .../web_security_scanner.stop_scan_run.js | 60 - ...web_security_scanner.update_scan_config.js | 67 - owl-bot-staging/v1alpha/src/index.ts | 25 - .../v1alpha/src/v1alpha/gapic_metadata.json | 169 -- owl-bot-staging/v1alpha/src/v1alpha/index.ts | 19 - .../v1alpha/web_security_scanner_client.ts | 1936 --------------- .../web_security_scanner_client_config.json | 91 - .../web_security_scanner_proto_list.json | 9 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha/system-test/install.ts | 49 - .../gapic_web_security_scanner_v1alpha.ts | 2122 ----------------- owl-bot-staging/v1alpha/tsconfig.json | 19 - owl-bot-staging/v1alpha/webpack.config.js | 64 - owl-bot-staging/v1beta/.eslintignore | 7 - owl-bot-staging/v1beta/.eslintrc.json | 3 - owl-bot-staging/v1beta/.gitignore | 14 - owl-bot-staging/v1beta/.jsdoc.js | 55 - owl-bot-staging/v1beta/.mocharc.js | 33 - owl-bot-staging/v1beta/.prettierrc.js | 22 - owl-bot-staging/v1beta/README.md | 1 - owl-bot-staging/v1beta/linkinator.config.json | 16 - owl-bot-staging/v1beta/package.json | 64 - .../v1beta/crawled_url.proto | 41 - .../websecurityscanner/v1beta/finding.proto | 98 - .../v1beta/finding_addon.proto | 90 - .../v1beta/finding_type_stats.proto | 36 - .../v1beta/scan_config.proto | 193 -- .../v1beta/scan_config_error.proto | 190 -- .../websecurityscanner/v1beta/scan_run.proto | 117 - .../v1beta/scan_run_error_trace.proto | 76 - .../v1beta/scan_run_warning_trace.proto | 59 - .../v1beta/web_security_scanner.proto | 413 ---- ...oogle.cloud.websecurityscanner.v1beta.json | 579 ----- ...web_security_scanner.create_scan_config.js | 64 - ...web_security_scanner.delete_scan_config.js | 59 - .../web_security_scanner.get_finding.js | 60 - .../web_security_scanner.get_scan_config.js | 59 - .../web_security_scanner.get_scan_run.js | 60 - .../web_security_scanner.list_crawled_urls.js | 74 - ...ecurity_scanner.list_finding_type_stats.js | 60 - .../web_security_scanner.list_findings.js | 82 - .../web_security_scanner.list_scan_configs.js | 73 - .../web_security_scanner.list_scan_runs.js | 73 - .../web_security_scanner.start_scan_run.js | 59 - .../web_security_scanner.stop_scan_run.js | 60 - ...web_security_scanner.update_scan_config.js | 67 - owl-bot-staging/v1beta/src/index.ts | 25 - .../v1beta/src/v1beta/gapic_metadata.json | 169 -- owl-bot-staging/v1beta/src/v1beta/index.ts | 19 - .../src/v1beta/web_security_scanner_client.ts | 1936 --------------- .../web_security_scanner_client_config.json | 91 - .../web_security_scanner_proto_list.json | 12 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1beta/system-test/install.ts | 49 - .../test/gapic_web_security_scanner_v1beta.ts | 2122 ----------------- owl-bot-staging/v1beta/tsconfig.json | 19 - owl-bot-staging/v1beta/webpack.config.js | 64 - src/v1/web_security_scanner_client.ts | 11 +- src/v1alpha/web_security_scanner_client.ts | 11 +- src/v1beta/web_security_scanner_client.ts | 11 +- 135 files changed, 15 insertions(+), 21980 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/websecurityscanner/v1/crawled_url.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_finding.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_config.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_run.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_findings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.start_scan_run.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/web_security_scanner.update_scan_config.js delete mode 100644 owl-bot-staging/v1/src/index.ts 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/src/v1/web_security_scanner_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json 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_web_security_scanner_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/v1alpha/.eslintignore delete mode 100644 owl-bot-staging/v1alpha/.eslintrc.json delete mode 100644 owl-bot-staging/v1alpha/.gitignore delete mode 100644 owl-bot-staging/v1alpha/.jsdoc.js delete mode 100644 owl-bot-staging/v1alpha/.mocharc.js delete mode 100644 owl-bot-staging/v1alpha/.prettierrc.js delete mode 100644 owl-bot-staging/v1alpha/README.md delete mode 100644 owl-bot-staging/v1alpha/linkinator.config.json delete mode 100644 owl-bot-staging/v1alpha/package.json delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto delete mode 100644 owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js delete mode 100644 owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js delete mode 100644 owl-bot-staging/v1alpha/src/index.ts delete mode 100644 owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json delete mode 100644 owl-bot-staging/v1alpha/src/v1alpha/index.ts delete mode 100644 owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts delete mode 100644 owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json delete mode 100644 owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json delete mode 100644 owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1alpha/system-test/install.ts delete mode 100644 owl-bot-staging/v1alpha/test/gapic_web_security_scanner_v1alpha.ts delete mode 100644 owl-bot-staging/v1alpha/tsconfig.json delete mode 100644 owl-bot-staging/v1alpha/webpack.config.js delete mode 100644 owl-bot-staging/v1beta/.eslintignore delete mode 100644 owl-bot-staging/v1beta/.eslintrc.json delete mode 100644 owl-bot-staging/v1beta/.gitignore delete mode 100644 owl-bot-staging/v1beta/.jsdoc.js delete mode 100644 owl-bot-staging/v1beta/.mocharc.js delete mode 100644 owl-bot-staging/v1beta/.prettierrc.js delete mode 100644 owl-bot-staging/v1beta/README.md delete mode 100644 owl-bot-staging/v1beta/linkinator.config.json delete mode 100644 owl-bot-staging/v1beta/package.json delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto delete mode 100644 owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js delete mode 100644 owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js delete mode 100644 owl-bot-staging/v1beta/src/index.ts delete mode 100644 owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json delete mode 100644 owl-bot-staging/v1beta/src/v1beta/index.ts delete mode 100644 owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts delete mode 100644 owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json delete mode 100644 owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json delete mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1beta/system-test/install.ts delete mode 100644 owl-bot-staging/v1beta/test/gapic_web_security_scanner_v1beta.ts delete mode 100644 owl-bot-staging/v1beta/tsconfig.json delete mode 100644 owl-bot-staging/v1beta/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- 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 7821534..0000000 --- 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 5d32b23..0000000 --- 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 65475a4..0000000 --- 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/web-security-scanner', - 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 481c522..0000000 --- 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 494e147..0000000 --- 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 727d3b6..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Websecurityscanner: 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 befd23c..0000000 --- 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 d42ee9b..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/web-security-scanner", - "version": "0.1.0", - "description": "Websecurityscanner client for Node.js", - "repository": "googleapis/nodejs-websecurityscanner", - "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 websecurityscanner", - "websecurityscanner", - "web security scanner" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "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.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto deleted file mode 100644 index 37724b8..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/crawled_url.proto +++ /dev/null @@ -1,40 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "CrawledUrlProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web -// Security Scanner Service crawls the web applications, following all links -// within the scope of sites, to find the URLs to test against. -message CrawledUrl { - // Output only. The http method of the request that was used to visit the URL, in - // uppercase. - string http_method = 1; - - // Output only. The URL that was crawled. - string url = 2; - - // Output only. The body of the request that was used to visit the URL. - string body = 3; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto deleted file mode 100644 index 32bd5d8..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding.proto +++ /dev/null @@ -1,119 +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.websecurityscanner.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1/finding_addon.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A Finding resource represents a vulnerability instance identified during a -// ScanRun. -message Finding { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/Finding" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" - }; - - // The severity level of a vulnerability. - enum Severity { - // No severity specified. The default value. - SEVERITY_UNSPECIFIED = 0; - - // Critical severity. - CRITICAL = 1; - - // High severity. - HIGH = 2; - - // Medium severity. - MEDIUM = 3; - - // Low severity. - LOW = 4; - } - - // Output only. The resource name of the Finding. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. - // The finding IDs are generated by the system. - string name = 1; - - // Output only. The type of the Finding. - // Detailed and up-to-date information on findings can be found here: - // https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings - string finding_type = 2; - - // Output only. The severity level of the reported vulnerability. - Severity severity = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The http method of the request that triggered the vulnerability, in - // uppercase. - string http_method = 3; - - // Output only. The URL produced by the server-side fuzzer and used in the request that - // triggered the vulnerability. - string fuzzed_url = 4; - - // Output only. The body of the request that triggered the vulnerability. - string body = 5; - - // Output only. The description of the vulnerability. - string description = 6; - - // Output only. The URL containing human-readable payload that user can leverage to - // reproduce the vulnerability. - string reproduction_url = 7; - - // Output only. If the vulnerability was originated from nested IFrame, the immediate - // parent IFrame is reported. - string frame_url = 8; - - // Output only. The URL where the browser lands when the vulnerability is detected. - string final_url = 9; - - // Output only. The tracking ID uniquely identifies a vulnerability instance across - // multiple ScanRuns. - string tracking_id = 10; - - // Output only. An addon containing information reported for a vulnerability with an HTML - // form, if any. - Form form = 16; - - // Output only. An addon containing information about outdated libraries. - OutdatedLibrary outdated_library = 11; - - // Output only. An addon containing detailed information regarding any resource causing the - // vulnerability such as JavaScript sources, image, audio files, etc. - ViolatingResource violating_resource = 12; - - // Output only. An addon containing information about vulnerable or missing HTTP headers. - VulnerableHeaders vulnerable_headers = 15; - - // Output only. An addon containing information about request parameters which were found - // to be vulnerable. - VulnerableParameters vulnerable_parameters = 13; - - // Output only. An addon containing information reported for an XSS, if any. - Xss xss = 14; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto deleted file mode 100644 index 4fb7ec1..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_addon.proto +++ /dev/null @@ -1,147 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingAddonProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// ! Information about a vulnerability with an HTML. -message Form { - // ! The URI where to send the form when it's submitted. - string action_uri = 1; - - // ! The names of form fields related to the vulnerability. - repeated string fields = 2; -} - -// Information reported for an outdated library. -message OutdatedLibrary { - // The name of the outdated library. - string library_name = 1; - - // The version number. - string version = 2; - - // URLs to learn more information about the vulnerabilities in the library. - repeated string learn_more_urls = 3; -} - -// Information regarding any resource causing the vulnerability such -// as JavaScript sources, image, audio files, etc. -message ViolatingResource { - // The MIME type of this resource. - string content_type = 1; - - // URL of this violating resource. - string resource_url = 2; -} - -// Information about vulnerable request parameters. -message VulnerableParameters { - // The vulnerable parameter names. - repeated string parameter_names = 1; -} - -// Information about vulnerable or missing HTTP Headers. -message VulnerableHeaders { - // Describes a HTTP Header. - message Header { - // Header name. - string name = 1; - - // Header value. - string value = 2; - } - - // List of vulnerable headers. - repeated Header headers = 1; - - // List of missing headers. - repeated Header missing_headers = 2; -} - -// Information reported for an XSS. -message Xss { - // Types of XSS attack vector. - enum AttackVector { - // Unknown attack vector. - ATTACK_VECTOR_UNSPECIFIED = 0; - - // The attack comes from fuzzing the browser's localStorage. - LOCAL_STORAGE = 1; - - // The attack comes from fuzzing the browser's sessionStorage. - SESSION_STORAGE = 2; - - // The attack comes from fuzzing the window's name property. - WINDOW_NAME = 3; - - // The attack comes from fuzzing the referrer property. - REFERRER = 4; - - // The attack comes from fuzzing an input element. - FORM_INPUT = 5; - - // The attack comes from fuzzing the browser's cookies. - COOKIE = 6; - - // The attack comes from hijacking the post messaging mechanism. - POST_MESSAGE = 7; - - // The attack comes from fuzzing parameters in the url. - GET_PARAMETERS = 8; - - // The attack comes from fuzzing the fragment in the url. - URL_FRAGMENT = 9; - - // The attack comes from fuzzing the HTML comments. - HTML_COMMENT = 10; - - // The attack comes from fuzzing the POST parameters. - POST_PARAMETERS = 11; - - // The attack comes from fuzzing the protocol. - PROTOCOL = 12; - - // The attack comes from the server side and is stored. - STORED_XSS = 13; - - // The attack is a Same-Origin Method Execution attack via a GET parameter. - SAME_ORIGIN = 14; - - // The attack payload is received from a third-party host via a URL that is - // user-controllable - USER_CONTROLLABLE_URL = 15; - } - - // Stack traces leading to the point where the XSS occurred. - repeated string stack_traces = 1; - - // An error message generated by a javascript breakage. - string error_message = 2; - - // The attack vector of the payload triggering this XSS. - AttackVector attack_vector = 3; - - // The reproduction url for the seeding POST request of a Stored XSS. - string stored_xss_seeding_url = 4; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto deleted file mode 100644 index 7eca01e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto +++ /dev/null @@ -1,35 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingTypeStatsProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A FindingTypeStats resource represents stats regarding a specific FindingType -// of Findings under a given ScanRun. -message FindingTypeStats { - // Output only. The finding type associated with the stats. - string finding_type = 1; - - // Output only. The count of findings belonging to this finding type. - int32 finding_count = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto deleted file mode 100644 index 901d01e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config.proto +++ /dev/null @@ -1,188 +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.websecurityscanner.v1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A ScanConfig resource contains the configurations to launch a scan. -message ScanConfig { - // Scan authentication configuration. - message Authentication { - // Describes authentication configuration that uses a Google account. - message GoogleAccount { - // Required. The user name of the Google account. - string username = 1; - - // Required. Input only. The password of the Google account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2; - } - - // Describes authentication configuration that uses a custom account. - message CustomAccount { - // Required. The user name of the custom account. - string username = 1; - - // Required. Input only. The password of the custom account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2; - - // Required. The login form URL of the website. - string login_url = 3; - } - - // Describes authentication configuration for Identity-Aware-Proxy (IAP). - message IapCredential { - // Describes authentication configuration when Web-Security-Scanner - // service account is added in Identity-Aware-Proxy (IAP) access policies. - message IapTestServiceAccountInfo { - // Required. Describes OAuth2 client id of resources protected by - // Identity-Aware-Proxy (IAP). - string target_audience_client_id = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Identity-Aware-Proxy (IAP) Authentication Configuration - oneof iap_credentials { - // Authentication configuration when Web-Security-Scanner service - // account is added in Identity-Aware-Proxy (IAP) access policies. - IapTestServiceAccountInfo iap_test_service_account_info = 1; - } - } - - // Required. - // Authentication configuration - oneof authentication { - // Authentication using a Google account. - GoogleAccount google_account = 1; - - // Authentication using a custom account. - CustomAccount custom_account = 2; - - // Authentication using Identity-Aware-Proxy (IAP). - IapCredential iap_credential = 4; - } - } - - // Scan schedule configuration. - message Schedule { - // A timestamp indicates when the next run will be scheduled. The value is - // refreshed by the server after each run. If unspecified, it will default - // to current server time, which means the scan will be scheduled to start - // immediately. - google.protobuf.Timestamp schedule_time = 1; - - // Required. The duration of time between executions in days. - int32 interval_duration_days = 2; - } - - // Type of user agents used for scanning. - enum UserAgent { - // The user agent is unknown. Service will default to CHROME_LINUX. - USER_AGENT_UNSPECIFIED = 0; - - // Chrome on Linux. This is the service default if unspecified. - CHROME_LINUX = 1; - - // Chrome on Android. - CHROME_ANDROID = 2; - - // Safari on IPhone. - SAFARI_IPHONE = 3; - } - - // Scan risk levels supported by Web Security Scanner. LOW impact - // scanning will minimize requests with the potential to modify data. To - // achieve the maximum scan coverage, NORMAL risk level is recommended. - enum RiskLevel { - // Use default, which is NORMAL. - RISK_LEVEL_UNSPECIFIED = 0; - - // Normal scanning (Recommended) - NORMAL = 1; - - // Lower impact scanning - LOW = 2; - } - - // Controls export of scan configurations and results to Security - // Command Center. - enum ExportToSecurityCommandCenter { - // Use default, which is ENABLED. - EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; - - // Export results of this scan to Security Command Center. - ENABLED = 1; - - // Do not export results of this scan to Security Command Center. - DISABLED = 2; - } - - // The resource name of the ScanConfig. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are - // generated by the system. - string name = 1; - - // Required. The user provided display name of the ScanConfig. - string display_name = 2; - - // The maximum QPS during scanning. A valid value ranges from 5 to 20 - // inclusively. If the field is unspecified or its value is set 0, server will - // default to 15. Other values outside of [5, 20] range will be rejected with - // INVALID_ARGUMENT error. - int32 max_qps = 3; - - // Required. The starting URLs from which the scanner finds site pages. - repeated string starting_urls = 4; - - // The authentication configuration. If specified, service will use the - // authentication configuration during scanning. - Authentication authentication = 5; - - // The user agent used during scanning. - UserAgent user_agent = 6; - - // The excluded URL patterns as described in - // https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls - repeated string blacklist_patterns = 7; - - // The schedule of the ScanConfig. - Schedule schedule = 8; - - // Controls export of scan configurations and results to Security - // Command Center. - ExportToSecurityCommandCenter export_to_security_command_center = 10; - - // The risk level selected for the scan - RiskLevel risk_level = 12; - - // Whether the scan config is managed by Web Security Scanner, output - // only. - bool managed_scan = 13; - - // Whether the scan configuration has enabled static IP address scan feature. - // If enabled, the scanner will access applications from static IP addresses. - bool static_ip_scan = 14; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto deleted file mode 100644 index 5d54457..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_config_error.proto +++ /dev/null @@ -1,189 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigErrorProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Defines a custom error message used by CreateScanConfig and UpdateScanConfig -// APIs when scan configuration validation fails. It is also reported as part of -// a ScanRunErrorTrace message if scan validation fails due to a scan -// configuration error. -message ScanConfigError { - // Output only. - // Defines an error reason code. - // Next id: 44 - enum Code { - option allow_alias = true; - - // There is no error. - CODE_UNSPECIFIED = 0; - - // There is no error. - OK = 0; - - // Indicates an internal server error. - // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. - INTERNAL_ERROR = 1; - - // One of the seed URLs is an App Engine URL but we cannot validate the scan - // settings due to an App Engine API backend error. - APPENGINE_API_BACKEND_ERROR = 2; - - // One of the seed URLs is an App Engine URL but we cannot access the - // App Engine API to validate scan settings. - APPENGINE_API_NOT_ACCESSIBLE = 3; - - // One of the seed URLs is an App Engine URL but the Default Host of the - // App Engine is not set. - APPENGINE_DEFAULT_HOST_MISSING = 4; - - // Google corporate accounts can not be used for scanning. - CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; - - // The account of the scan creator can not be used for scanning. - CANNOT_USE_OWNER_ACCOUNT = 7; - - // This scan targets Compute Engine, but we cannot validate scan settings - // due to a Compute Engine API backend error. - COMPUTE_API_BACKEND_ERROR = 8; - - // This scan targets Compute Engine, but we cannot access the Compute Engine - // API to validate the scan settings. - COMPUTE_API_NOT_ACCESSIBLE = 9; - - // The Custom Login URL does not belong to the current project. - CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; - - // The Custom Login URL is malformed (can not be parsed). - CUSTOM_LOGIN_URL_MALFORMED = 11; - - // The Custom Login URL is mapped to a non-routable IP address in DNS. - CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; - - // The Custom Login URL is mapped to an IP address which is not reserved for - // the current project. - CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; - - // The Custom Login URL has a non-routable IP address. - CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; - - // The Custom Login URL has an IP address which is not reserved for the - // current project. - CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; - - // Another scan with the same name (case-sensitive) already exists. - DUPLICATE_SCAN_NAME = 16; - - // A field is set to an invalid value. - INVALID_FIELD_VALUE = 18; - - // There was an error trying to authenticate to the scan target. - FAILED_TO_AUTHENTICATE_TO_TARGET = 19; - - // Finding type value is not specified in the list findings request. - FINDING_TYPE_UNSPECIFIED = 20; - - // Scan targets Compute Engine, yet current project was not whitelisted for - // Google Compute Engine Scanning Alpha access. - FORBIDDEN_TO_SCAN_COMPUTE = 21; - - // User tries to update managed scan - FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; - - // The supplied filter is malformed. For example, it can not be parsed, does - // not have a filter type in expression, or the same filter type appears - // more than once. - MALFORMED_FILTER = 22; - - // The supplied resource name is malformed (can not be parsed). - MALFORMED_RESOURCE_NAME = 23; - - // The current project is not in an active state. - PROJECT_INACTIVE = 24; - - // A required field is not set. - REQUIRED_FIELD = 25; - - // Project id, scanconfig id, scanrun id, or finding id are not consistent - // with each other in resource name. - RESOURCE_NAME_INCONSISTENT = 26; - - // The scan being requested to start is already running. - SCAN_ALREADY_RUNNING = 27; - - // The scan that was requested to be stopped is not running. - SCAN_NOT_RUNNING = 28; - - // One of the seed URLs does not belong to the current project. - SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; - - // One of the seed URLs is malformed (can not be parsed). - SEED_URL_MALFORMED = 30; - - // One of the seed URLs is mapped to a non-routable IP address in DNS. - SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; - - // One of the seed URLs is mapped to an IP address which is not reserved - // for the current project. - SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; - - // One of the seed URLs has on-routable IP address. - SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; - - // One of the seed URLs has an IP address that is not reserved - // for the current project. - SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; - - // The Web Security Scanner service account is not configured under the - // project. - SERVICE_ACCOUNT_NOT_CONFIGURED = 36; - - // A project has reached the maximum number of scans. - TOO_MANY_SCANS = 37; - - // Resolving the details of the current project fails. - UNABLE_TO_RESOLVE_PROJECT_INFO = 38; - - // One or more blacklist patterns were in the wrong format. - UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; - - // The supplied filter is not supported. - UNSUPPORTED_FILTER = 40; - - // The supplied finding type is not supported. For example, we do not - // provide findings of the given finding type. - UNSUPPORTED_FINDING_TYPE = 41; - - // The URL scheme of one or more of the supplied URLs is not supported. - UNSUPPORTED_URL_SCHEME = 42; - } - - // Output only. Indicates the reason code for a configuration failure. - Code code = 1; - - // Output only. Indicates the full name of the ScanConfig field that triggers this error, - // for example "scan_config.max_qps". This field is provided for - // troubleshooting purposes only and its actual value can change in the - // future. - string field_name = 2; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto deleted file mode 100644 index 465c6cb..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run.proto +++ /dev/null @@ -1,110 +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.websecurityscanner.v1; - -import "google/cloud/websecurityscanner/v1/scan_run_error_trace.proto"; -import "google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// A ScanRun is a output-only resource representing an actual run of the scan. -// Next id: 12 -message ScanRun { - // Types of ScanRun execution state. - enum ExecutionState { - // Represents an invalid state caused by internal server error. This value - // should never be returned. - EXECUTION_STATE_UNSPECIFIED = 0; - - // The scan is waiting in the queue. - QUEUED = 1; - - // The scan is in progress. - SCANNING = 2; - - // The scan is either finished or stopped by user. - FINISHED = 3; - } - - // Types of ScanRun result state. - enum ResultState { - // Default value. This value is returned when the ScanRun is not yet - // finished. - RESULT_STATE_UNSPECIFIED = 0; - - // The scan finished without errors. - SUCCESS = 1; - - // The scan finished with errors. - ERROR = 2; - - // The scan was terminated by user. - KILLED = 3; - } - - // Output only. The resource name of the ScanRun. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - // The ScanRun IDs are generated by the system. - string name = 1; - - // Output only. The execution state of the ScanRun. - ExecutionState execution_state = 2; - - // Output only. The result state of the ScanRun. This field is only available after the - // execution state reaches "FINISHED". - ResultState result_state = 3; - - // Output only. The time at which the ScanRun started. - google.protobuf.Timestamp start_time = 4; - - // Output only. The time at which the ScanRun reached termination state - that the ScanRun - // is either finished or stopped by user. - google.protobuf.Timestamp end_time = 5; - - // Output only. The number of URLs crawled during this ScanRun. If the scan is in progress, - // the value represents the number of URLs crawled up to now. - int64 urls_crawled_count = 6; - - // Output only. The number of URLs tested during this ScanRun. If the scan is in progress, - // the value represents the number of URLs tested up to now. The number of - // URLs tested is usually larger than the number URLS crawled because - // typically a crawled URL is tested with multiple test payloads. - int64 urls_tested_count = 7; - - // Output only. Whether the scan run has found any vulnerabilities. - bool has_vulnerabilities = 8; - - // Output only. The percentage of total completion ranging from 0 to 100. - // If the scan is in queue, the value is 0. - // If the scan is running, the value ranges from 0 to 100. - // If the scan is finished, the value is 100. - int32 progress_percent = 9; - - // Output only. If result_state is an ERROR, this field provides the primary reason for - // scan's termination and more details, if such are available. - ScanRunErrorTrace error_trace = 10; - - // Output only. A list of warnings, if such are encountered during this scan run. - repeated ScanRunWarningTrace warning_traces = 11; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto deleted file mode 100644 index 5234eee..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto +++ /dev/null @@ -1,75 +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.websecurityscanner.v1; - -import "google/cloud/websecurityscanner/v1/scan_config_error.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunErrorTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Output only. -// Defines an error trace message for a ScanRun. -message ScanRunErrorTrace { - // Output only. - // Defines an error reason code. - // Next id: 7 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that the scan run failed due to an internal server error. - INTERNAL_ERROR = 1; - - // Indicates a scan configuration error, usually due to outdated ScanConfig - // settings, such as starting_urls or the DNS configuration. - SCAN_CONFIG_ISSUE = 2; - - // Indicates an authentication error, usually due to outdated ScanConfig - // authentication settings. - AUTHENTICATION_CONFIG_ISSUE = 3; - - // Indicates a scan operation timeout, usually caused by a very large site. - TIMED_OUT_WHILE_SCANNING = 4; - - // Indicates that a scan encountered excessive redirects, either to - // authentication or some other page outside of the scan scope. - TOO_MANY_REDIRECTS = 5; - - // Indicates that a scan encountered numerous errors from the web site - // pages. When available, most_common_http_error_code field indicates the - // most common HTTP error code encountered during the scan. - TOO_MANY_HTTP_ERRORS = 6; - } - - // Output only. Indicates the error reason code. - Code code = 1; - - // Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error - // message encountered during scan configuration validation that is performed - // before each scan run. - ScanConfigError scan_config_error = 2; - - // Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most - // common HTTP error code, if such is available. For example, if this code is - // 404, the scan has encountered too many NOT_FOUND responses. - int32 most_common_http_error_code = 3; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto deleted file mode 100644 index 43a5017..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto +++ /dev/null @@ -1,58 +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.websecurityscanner.v1; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunWarningTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Output only. -// Defines a warning trace message for ScanRun. Warning traces provide customers -// with useful information that helps make the scanning process more effective. -message ScanRunWarningTrace { - // Output only. - // Defines a warning message code. - // Next id: 6 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that a scan discovered an unexpectedly low number of URLs. This - // is sometimes caused by complex navigation features or by using a single - // URL for numerous pages. - INSUFFICIENT_CRAWL_RESULTS = 1; - - // Indicates that a scan discovered too many URLs to test, or excessive - // redundant URLs. - TOO_MANY_CRAWL_RESULTS = 2; - - // Indicates that too many tests have been generated for the scan. Customer - // should try reducing the number of starting URLs, increasing the QPS rate, - // or narrowing down the scope of the scan using the excluded patterns. - TOO_MANY_FUZZ_TASKS = 3; - - // Indicates that a scan is blocked by IAP. - BLOCKED_BY_IAP = 4; - } - - // Output only. Indicates the warning code. - Code code = 1; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto b/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto deleted file mode 100644 index 5f1bfcd..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto +++ /dev/null @@ -1,337 +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.websecurityscanner.v1; - -import "google/api/annotations.proto"; -import "google/cloud/websecurityscanner/v1/crawled_url.proto"; -import "google/cloud/websecurityscanner/v1/finding.proto"; -import "google/cloud/websecurityscanner/v1/finding_type_stats.proto"; -import "google/cloud/websecurityscanner/v1/scan_config.proto"; -import "google/cloud/websecurityscanner/v1/scan_run.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/api/client.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "WebSecurityScannerProto"; -option java_package = "com.google.cloud.websecurityscanner.v1"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1"; - -// Web Security Scanner Service identifies security vulnerabilities in web -// applications hosted on Google Cloud. It crawls your application, and -// attempts to exercise as many user inputs and event handlers as possible. -service WebSecurityScanner { - option (google.api.default_host) = "websecurityscanner.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new ScanConfig. - rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/scanConfigs" - body: "scan_config" - }; - } - - // Deletes an existing ScanConfig and its child resources. - rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/scanConfigs/*}" - }; - } - - // Gets a ScanConfig. - rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - get: "/v1/{name=projects/*/scanConfigs/*}" - }; - } - - // Lists ScanConfigs under a given project. - rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/scanConfigs" - }; - } - - // Updates a ScanConfig. This method support partial update of a ScanConfig. - rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - patch: "/v1/{scan_config.name=projects/*/scanConfigs/*}" - body: "scan_config" - }; - } - - // Start a ScanRun according to the given ScanConfig. - rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1/{name=projects/*/scanConfigs/*}:start" - body: "*" - }; - } - - // Gets a ScanRun. - rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}" - }; - } - - // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - // stop time. - rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*}/scanRuns" - }; - } - - // Stops a ScanRun. The stopped ScanRun is returned. - rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" - body: "*" - }; - } - - // List CrawledUrls under a given ScanRun. - rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" - }; - } - - // Gets a Finding. - rpc GetFinding(GetFindingRequest) returns (Finding) { - option (google.api.http) = { - get: "/v1/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" - }; - } - - // List Findings under a given ScanRun. - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" - }; - } - - // List all FindingTypeStats under a given ScanRun. - rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" - }; - } -} - -// Request for the `CreateScanConfig` method. -message CreateScanConfigRequest { - // Required. The parent resource name where the scan is created, which should be a - // project resource name in the format 'projects/{projectId}'. - string parent = 1; - - // Required. The ScanConfig to be created. - ScanConfig scan_config = 2; -} - -// Request for the `DeleteScanConfig` method. -message DeleteScanConfigRequest { - // Required. The resource name of the ScanConfig to be deleted. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1; -} - -// Request for the `GetScanConfig` method. -message GetScanConfigRequest { - // Required. The resource name of the ScanConfig to be returned. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1; -} - -// Request for the `ListScanConfigs` method. -message ListScanConfigsRequest { - // Required. The parent resource name, which should be a project resource name in the - // format 'projects/{projectId}'. - string parent = 1; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanConfigs to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Request for the `UpdateScanConfigRequest` method. -message UpdateScanConfigRequest { - // Required. The ScanConfig to be updated. The name field must be set to identify the - // resource to be updated. The values of fields not covered by the mask - // will be ignored. - ScanConfig scan_config = 2; - - // Required. The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 3; -} - -// Response for the `ListScanConfigs` method. -message ListScanConfigsResponse { - // The list of ScanConfigs returned. - repeated ScanConfig scan_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `StartScanRun` method. -message StartScanRunRequest { - // Required. The resource name of the ScanConfig to be used. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1; -} - -// Request for the `GetScanRun` method. -message GetScanRunRequest { - // Required. The resource name of the ScanRun to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1; -} - -// Request for the `ListScanRuns` method. -message ListScanRunsRequest { - // Required. The parent resource name, which should be a scan resource name in the - // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string parent = 1; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanRuns to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListScanRuns` method. -message ListScanRunsResponse { - // The list of ScanRuns returned. - repeated ScanRun scan_runs = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `StopScanRun` method. -message StopScanRunRequest { - // Required. The resource name of the ScanRun to be stopped. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1; -} - -// Request for the `ListCrawledUrls` method. -message ListCrawledUrlsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of CrawledUrls to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListCrawledUrls` method. -message ListCrawledUrlsResponse { - // The list of CrawledUrls returned. - repeated CrawledUrl crawled_urls = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `GetFinding` method. -message GetFindingRequest { - // Required. The resource name of the Finding to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - string name = 1; -} - -// Request for the `ListFindings` method. -message ListFindingsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1; - - // The filter expression. The expression must be in the format: - // . - // Supported field: 'finding_type'. - // Supported operator: '='. - string filter = 2; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 3; - - // The maximum number of Findings to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 4; -} - -// Response for the `ListFindings` method. -message ListFindingsResponse { - // The list of Findings returned. - repeated Finding findings = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `ListFindingTypeStats` method. -message ListFindingTypeStatsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1; -} - -// Response for the `ListFindingTypeStats` method. -message ListFindingTypeStatsResponse { - // The list of FindingTypeStats returned. - repeated FindingTypeStats finding_type_stats = 1; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json deleted file mode 100644 index a1b7591..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.websecurityscanner.v1.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-websecurityscanner", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.websecurityscanner.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async", - "title": "WebSecurityScanner createScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new ScanConfig.", - "canonical": true, - "file": "web_security_scanner.create_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1.ScanConfig" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.CreateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async", - "title": "WebSecurityScanner deleteScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing ScanConfig and its child resources.", - "canonical": true, - "file": "web_security_scanner.delete_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.DeleteScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async", - "title": "WebSecurityScanner getScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.get_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async", - "title": "WebSecurityScanner listScanConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanConfigs under a given project.", - "canonical": true, - "file": "web_security_scanner.list_scan_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListScanConfigsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanConfigs", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async", - "title": "WebSecurityScanner updateScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.update_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", - "async": true, - "parameters": [ - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1.ScanConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.UpdateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async", - "title": "WebSecurityScanner startScanRun Sample", - "origin": "API_DEFINITION", - "description": " Start a ScanRun according to the given ScanConfig.", - "canonical": true, - "file": "web_security_scanner.start_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StartScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async", - "title": "WebSecurityScanner getScanRun Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanRun.", - "canonical": true, - "file": "web_security_scanner.get_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async", - "title": "WebSecurityScanner listScanRuns Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", - "canonical": true, - "file": "web_security_scanner.list_scan_runs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListScanRunsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListScanRuns", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async", - "title": "WebSecurityScanner stopScanRun Sample", - "origin": "API_DEFINITION", - "description": " Stops a ScanRun. The stopped ScanRun is returned.", - "canonical": true, - "file": "web_security_scanner.stop_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.StopScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async", - "title": "WebSecurityScanner listCrawledUrls Sample", - "origin": "API_DEFINITION", - "description": " List CrawledUrls under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_crawled_urls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListCrawledUrls", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async", - "title": "WebSecurityScanner getFinding Sample", - "origin": "API_DEFINITION", - "description": " Gets a Finding.", - "canonical": true, - "file": "web_security_scanner.get_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.Finding", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.GetFinding", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async", - "title": "WebSecurityScanner listFindings Sample", - "origin": "API_DEFINITION", - "description": " List Findings under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListFindingsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindings", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async", - "title": "WebSecurityScanner listFindingTypeStats Sample", - "origin": "API_DEFINITION", - "description": " List all FindingTypeStats under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_finding_type_stats.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner.ListFindingTypeStats", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1.WebSecurityScanner" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js deleted file mode 100644 index e34cb80..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.create_scan_config.js +++ /dev/null @@ -1,62 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * Required. The ScanConfig to be created. - */ - // const scanConfig = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callCreateScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.createScanConfig(request); - console.log(response); - } - - callCreateScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_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/web_security_scanner.delete_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js deleted file mode 100644 index ec72736..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.delete_scan_config.js +++ /dev/null @@ -1,58 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callDeleteScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.deleteScanConfig(request); - console.log(response); - } - - callDeleteScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_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/web_security_scanner.get_finding.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_finding.js deleted file mode 100644 index d74e438..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_finding.js +++ /dev/null @@ -1,59 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetFinding() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.getFinding(request); - console.log(response); - } - - callGetFinding(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_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/web_security_scanner.get_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_config.js deleted file mode 100644 index 3811ccc..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_config.js +++ /dev/null @@ -1,58 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.getScanConfig(request); - console.log(response); - } - - callGetScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_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/web_security_scanner.get_scan_run.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_run.js deleted file mode 100644 index baab4b6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.get_scan_run.js +++ /dev/null @@ -1,59 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanRun() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.getScanRun(request); - console.log(response); - } - - callGetScanRun(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_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/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js deleted file mode 100644 index 64aca05..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_crawled_urls.js +++ /dev/null @@ -1,73 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListCrawledUrls() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCrawledUrls(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_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/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js deleted file mode 100644 index 59fa9a4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_finding_type_stats.js +++ /dev/null @@ -1,59 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindingTypeStats() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.listFindingTypeStats(request); - console.log(response); - } - - callListFindingTypeStats(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_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/web_security_scanner.list_findings.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_findings.js deleted file mode 100644 index 12f4bf7..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_findings.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - */ - // const filter = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindings() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_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/web_security_scanner.list_scan_configs.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_configs.js deleted file mode 100644 index 0649641..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_configs.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanConfigs() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listScanConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanConfigs(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_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/web_security_scanner.list_scan_runs.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_runs.js deleted file mode 100644 index 020c4ea..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.list_scan_runs.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanRuns() { - // Construct request - const request = { - }; - - // Run request - const iterable = await websecurityscannerClient.listScanRunsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanRuns(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_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/web_security_scanner.start_scan_run.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.start_scan_run.js deleted file mode 100644 index 0520702..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.start_scan_run.js +++ /dev/null @@ -1,58 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStartScanRun() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.startScanRun(request); - console.log(response); - } - - callStartScanRun(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_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/web_security_scanner.stop_scan_run.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js deleted file mode 100644 index 4779856..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.stop_scan_run.js +++ /dev/null @@ -1,59 +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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStopScanRun() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.stopScanRun(request); - console.log(response); - } - - callStopScanRun(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_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/web_security_scanner.update_scan_config.js b/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.update_scan_config.js deleted file mode 100644 index ff6e7b5..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/web_security_scanner.update_scan_config.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() { - // [START websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - */ - // const scanConfig = {} - /** - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callUpdateScanConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await websecurityscannerClient.updateScanConfig(request); - console.log(response); - } - - callUpdateScanConfig(); - // [END websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 76ce24a..0000000 --- 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 WebSecurityScannerClient = v1.WebSecurityScannerClient; -type WebSecurityScannerClient = v1.WebSecurityScannerClient; -export {v1, WebSecurityScannerClient}; -export default {v1, WebSecurityScannerClient}; -import * as protos from '../protos/protos'; -export {protos} 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 6c589c5..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.websecurityscanner.v1", - "libraryPackage": "@google-cloud/web-security-scanner", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - } - } - } - } -} 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 515d336..0000000 --- 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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/v1/src/v1/web_security_scanner_client.ts b/owl-bot-staging/v1/src/v1/web_security_scanner_client.ts deleted file mode 100644 index 567672e..0000000 --- a/owl-bot-staging/v1/src/v1/web_security_scanner_client.ts +++ /dev/null @@ -1,1819 +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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/web_security_scanner_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_security_scanner_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Web Security Scanner Service identifies security vulnerabilities in web - * applications hosted on Google Cloud. It crawls your application, and - * attempts to exercise as many user inputs and event handlers as possible. - * @class - * @memberof v1 - */ -export class WebSecurityScannerClient { - 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}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebSecurityScannerClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WebSecurityScannerClient; - 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' - ), - }; - - // 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 = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1.WebSecurityScanner', 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 = gax.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.webSecurityScannerStub) { - return this.webSecurityScannerStub; - } - - // Put together the "service stub" for - // google.cloud.websecurityscanner.v1.WebSecurityScanner. - this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1.WebSecurityScanner, - 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 webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; - for (const methodName of webSecurityScannerStubMethods) { - const callPromise = this.webSecurityScannerStub.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.innerApiCalls[methodName] = apiCall; - } - - return this.webSecurityScannerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'websecurityscanner.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 'websecurityscanner.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 new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig - * Required. The ScanConfig to be created. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. - * 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/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async - */ - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined - ]>; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createScanConfig(request, options, callback); - } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async - */ - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteScanConfig(request, options, callback); - } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. - * 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/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async - */ - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined - ]>; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getScanConfig(request, options, callback); - } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. - * 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/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async - */ - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateScanConfig(request, options, callback); - } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. - * 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/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async - */ - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined - ]>; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.startScanRun(request, options, callback); - } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. - * 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/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async - */ - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined - ]>; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getScanRun(request, options, callback); - } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. - * 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/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async - */ - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined - ]>; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.stopScanRun(request, options, callback); - } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1.Finding}. - * 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/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async - */ - getFinding( - request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined - ]>; - getFinding( - request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getFinding(request, options, callback); - } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ListFindingTypeStatsResponse]{@link google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse}. - * 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/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async - */ - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listFindingTypeStats(request, options, callback); - } - - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. - * 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 `listScanConfigsAsync()` - * 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. - */ - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]>; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listScanConfigs(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 resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig} 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 `listScanConfigsAsync()` - * 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. - */ - listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.createStream( - this.innerApiCalls.listScanConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanConfigs`, 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 resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [ScanConfig]{@link google.cloud.websecurityscanner.v1.ScanConfig}. 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/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async - */ - listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.asyncIterate( - this.innerApiCalls['listScanConfigs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. - * 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 `listScanRunsAsync()` - * 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. - */ - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]>; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): void; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): void; - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listScanRuns(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 resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun} 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 `listScanRunsAsync()` - * 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. - */ - listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.createStream( - this.innerApiCalls.listScanRuns as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanRuns`, 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 resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [ScanRun]{@link google.cloud.websecurityscanner.v1.ScanRun}. 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/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async - */ - listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.asyncIterate( - this.innerApiCalls['listScanRuns'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1.CrawledUrl}. - * 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 `listCrawledUrlsAsync()` - * 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. - */ - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]>; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCrawledUrls(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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1.CrawledUrl} 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 `listCrawledUrlsAsync()` - * 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. - */ - listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.createStream( - this.innerApiCalls.listCrawledUrls as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCrawledUrls`, 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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [CrawledUrl]{@link google.cloud.websecurityscanner.v1.CrawledUrl}. 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/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async - */ - listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.asyncIterate( - this.innerApiCalls['listCrawledUrls'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1.Finding}. - * 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 `listFindingsAsync()` - * 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. - */ - listFindings( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): void; - listFindings( - request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): void; - listFindings( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1.Finding} 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 `listFindingsAsync()` - * 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. - */ - listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, 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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [Finding]{@link google.cloud.websecurityscanner.v1.Finding}. 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/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the scan_config from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; - } - - /** - * Parse the scan_run from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json b/owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json deleted file mode 100644 index 2e226cb..0000000 --- a/owl-bot-staging/v1/src/v1/web_security_scanner_client_config.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "interfaces": { - "google.cloud.websecurityscanner.v1.WebSecurityScanner": { - "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": { - "CreateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanConfigs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanRuns": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "StopScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCrawledUrls": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFinding": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindingTypeStats": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json b/owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json deleted file mode 100644 index d036fd8..0000000 --- a/owl-bot-staging/v1/src/v1/web_security_scanner_proto_list.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - "../../protos/google/cloud/websecurityscanner/v1/crawled_url.proto", - "../../protos/google/cloud/websecurityscanner/v1/finding.proto", - "../../protos/google/cloud/websecurityscanner/v1/finding_addon.proto", - "../../protos/google/cloud/websecurityscanner/v1/finding_type_stats.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_config.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_config_error.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run_error_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1/scan_run_warning_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1/web_security_scanner.proto" -] 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 2c742f5..0000000 --- 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 websecurityscanner = require('@google-cloud/web-security-scanner'); - -function main() { - const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); -} - -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 8bd7a23..0000000 --- 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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; - -// check that the client class type name can be used -function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webSecurityScannerClient = new WebSecurityScannerClient(); - doStuffWithWebSecurityScannerClient(webSecurityScannerClient); -} - -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 8ec4522..0000000 --- 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_web_security_scanner_v1.ts b/owl-bot-staging/v1/test/gapic_web_security_scanner_v1.ts deleted file mode 100644 index 52769bf..0000000 --- a/owl-bot-staging/v1/test/gapic_web_security_scanner_v1.ts +++ /dev/null @@ -1,2008 +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 websecurityscannerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -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('v1.WebSecurityScannerClient', () => { - it('has servicePath', () => { - const servicePath = websecurityscannerModule.v1.WebSecurityScannerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = websecurityscannerModule.v1.WebSecurityScannerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - 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 websecurityscannerModule.v1.WebSecurityScannerClient({ - 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('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - 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); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.GetFindingRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse()); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse()); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { - 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.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { - 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.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert.strictEqual( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert.strictEqual( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { - 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.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { - 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.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert.strictEqual( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert.strictEqual( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.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 c78f1c8..0000000 --- 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 ad3467d..0000000 --- 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: 'WebSecurityScanner', - filename: './web-security-scanner.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/v1alpha/.eslintignore b/owl-bot-staging/v1alpha/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1alpha/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1alpha/.eslintrc.json b/owl-bot-staging/v1alpha/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1alpha/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1alpha/.gitignore b/owl-bot-staging/v1alpha/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1alpha/.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/v1alpha/.jsdoc.js b/owl-bot-staging/v1alpha/.jsdoc.js deleted file mode 100644 index 65475a4..0000000 --- a/owl-bot-staging/v1alpha/.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/web-security-scanner', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1alpha/.mocharc.js b/owl-bot-staging/v1alpha/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1alpha/.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/v1alpha/.prettierrc.js b/owl-bot-staging/v1alpha/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1alpha/.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/v1alpha/README.md b/owl-bot-staging/v1alpha/README.md deleted file mode 100644 index 727d3b6..0000000 --- a/owl-bot-staging/v1alpha/README.md +++ /dev/null @@ -1 +0,0 @@ -Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/v1alpha/linkinator.config.json b/owl-bot-staging/v1alpha/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1alpha/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/v1alpha/package.json b/owl-bot-staging/v1alpha/package.json deleted file mode 100644 index d42ee9b..0000000 --- a/owl-bot-staging/v1alpha/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/web-security-scanner", - "version": "0.1.0", - "description": "Websecurityscanner client for Node.js", - "repository": "googleapis/nodejs-websecurityscanner", - "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 websecurityscanner", - "websecurityscanner", - "web security scanner" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "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.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto deleted file mode 100644 index c22f427..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto +++ /dev/null @@ -1,38 +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.websecurityscanner.v1alpha; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "CrawledUrlProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web -// Security Scanner Service crawls the web applications, following all links -// within the scope of sites, to find the URLs to test against. -message CrawledUrl { - // Output only. The http method of the request that was used to visit the URL, in - // uppercase. - string http_method = 1; - - // Output only. The URL that was crawled. - string url = 2; - - // Output only. The body of the request that was used to visit the URL. - string body = 3; -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto deleted file mode 100644 index c02020f..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding.proto +++ /dev/null @@ -1,152 +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.websecurityscanner.v1alpha; - -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1alpha/finding_addon.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A Finding resource represents a vulnerability instance identified during a -// ScanRun. -message Finding { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/Finding" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" - }; - - // Types of Findings. - enum FindingType { - // The invalid finding type. - FINDING_TYPE_UNSPECIFIED = 0; - - // A page that was served over HTTPS also resources over HTTP. A - // man-in-the-middle attacker could tamper with the HTTP resource and gain - // full access to the website that loads the resource or to monitor the - // actions taken by the user. - MIXED_CONTENT = 1; - - // The version of an included library is known to contain a security issue. - // The scanner checks the version of library in use against a known list of - // vulnerable libraries. False positives are possible if the version - // detection fails or if the library has been manually patched. - OUTDATED_LIBRARY = 2; - - // This type of vulnerability occurs when the value of a request parameter - // is reflected at the beginning of the response, for example, in requests - // using JSONP. Under certain circumstances, an attacker may be able to - // supply an alphanumeric-only Flash file in the vulnerable parameter - // causing the browser to execute the Flash file as if it originated on the - // vulnerable server. - ROSETTA_FLASH = 5; - - // A cross-site scripting (XSS) bug is found via JavaScript callback. For - // detailed explanations on XSS, see - // https://www.google.com/about/appsecurity/learning/xss/. - XSS_CALLBACK = 3; - - // A potential cross-site scripting (XSS) bug due to JavaScript breakage. - // In some circumstances, the application under test might modify the test - // string before it is parsed by the browser. When the browser attempts to - // runs this modified test string, it will likely break and throw a - // JavaScript execution error, thus an injection issue is occurring. - // However, it may not be exploitable. Manual verification is needed to see - // if the test string modifications can be evaded and confirm that the issue - // is in fact an XSS vulnerability. For detailed explanations on XSS, see - // https://www.google.com/about/appsecurity/learning/xss/. - XSS_ERROR = 4; - - // An application appears to be transmitting a password field in clear text. - // An attacker can eavesdrop network traffic and sniff the password field. - CLEAR_TEXT_PASSWORD = 6; - - // An application returns sensitive content with an invalid content type, - // or without an 'X-Content-Type-Options: nosniff' header. - INVALID_CONTENT_TYPE = 7; - - // A cross-site scripting (XSS) vulnerability in AngularJS module that - // occurs when a user-provided string is interpolated by Angular. - XSS_ANGULAR_CALLBACK = 8; - - // A malformed or invalid valued header. - INVALID_HEADER = 9; - - // Misspelled security header name. - MISSPELLED_SECURITY_HEADER_NAME = 10; - - // Mismatching values in a duplicate security header. - MISMATCHING_SECURITY_HEADER_VALUES = 11; - } - - // The resource name of the Finding. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. - // The finding IDs are generated by the system. - string name = 1; - - // The type of the Finding. - FindingType finding_type = 2; - - // The http method of the request that triggered the vulnerability, in - // uppercase. - string http_method = 3; - - // The URL produced by the server-side fuzzer and used in the request that - // triggered the vulnerability. - string fuzzed_url = 4; - - // The body of the request that triggered the vulnerability. - string body = 5; - - // The description of the vulnerability. - string description = 6; - - // The URL containing human-readable payload that user can leverage to - // reproduce the vulnerability. - string reproduction_url = 7; - - // If the vulnerability was originated from nested IFrame, the immediate - // parent IFrame is reported. - string frame_url = 8; - - // The URL where the browser lands when the vulnerability is detected. - string final_url = 9; - - // The tracking ID uniquely identifies a vulnerability instance across - // multiple ScanRuns. - string tracking_id = 10; - - // An addon containing information about outdated libraries. - OutdatedLibrary outdated_library = 11; - - // An addon containing detailed information regarding any resource causing the - // vulnerability such as JavaScript sources, image, audio files, etc. - ViolatingResource violating_resource = 12; - - // An addon containing information about vulnerable or missing HTTP headers. - VulnerableHeaders vulnerable_headers = 15; - - // An addon containing information about request parameters which were found - // to be vulnerable. - VulnerableParameters vulnerable_parameters = 13; - - // An addon containing information reported for an XSS, if any. - Xss xss = 14; -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto deleted file mode 100644 index 3fafdb4..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto +++ /dev/null @@ -1,78 +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.websecurityscanner.v1alpha; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingAddonProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// Information reported for an outdated library. -message OutdatedLibrary { - // The name of the outdated library. - string library_name = 1; - - // The version number. - string version = 2; - - // URLs to learn more information about the vulnerabilities in the library. - repeated string learn_more_urls = 3; -} - -// Information regarding any resource causing the vulnerability such -// as JavaScript sources, image, audio files, etc. -message ViolatingResource { - // The MIME type of this resource. - string content_type = 1; - - // URL of this violating resource. - string resource_url = 2; -} - -// Information about vulnerable request parameters. -message VulnerableParameters { - // The vulnerable parameter names. - repeated string parameter_names = 1; -} - -// Information about vulnerable or missing HTTP Headers. -message VulnerableHeaders { - // Describes a HTTP Header. - message Header { - // Header name. - string name = 1; - - // Header value. - string value = 2; - } - - // List of vulnerable headers. - repeated Header headers = 1; - - // List of missing headers. - repeated Header missing_headers = 2; -} - -// Information reported for an XSS. -message Xss { - // Stack traces leading to the point where the XSS occurred. - repeated string stack_traces = 1; - - // An error message generated by a javascript breakage. - string error_message = 2; -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto deleted file mode 100644 index e46b330..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto +++ /dev/null @@ -1,35 +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.websecurityscanner.v1alpha; - -import "google/cloud/websecurityscanner/v1alpha/finding.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingTypeStatsProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A FindingTypeStats resource represents stats regarding a specific FindingType -// of Findings under a given ScanRun. -message FindingTypeStats { - // The finding type associated with the stats. - Finding.FindingType finding_type = 1; - - // The count of findings belonging to this finding type. - int32 finding_count = 2; -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto deleted file mode 100644 index 5497b1a..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto +++ /dev/null @@ -1,157 +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.websecurityscanner.v1alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A ScanConfig resource contains the configurations to launch a scan. -// next id: 12 -message ScanConfig { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - pattern: "projects/{project}/scanConfigs/{scan_config}" - }; - - // Scan authentication configuration. - message Authentication { - // Describes authentication configuration that uses a Google account. - message GoogleAccount { - // Required. The user name of the Google account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the Google account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - } - - // Describes authentication configuration that uses a custom account. - message CustomAccount { - // Required. The user name of the custom account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the custom account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Required. The login form URL of the website. - string login_url = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. - // Authentication configuration - oneof authentication { - // Authentication using a Google account. - GoogleAccount google_account = 1; - - // Authentication using a custom account. - CustomAccount custom_account = 2; - } - } - - // Scan schedule configuration. - message Schedule { - // A timestamp indicates when the next run will be scheduled. The value is - // refreshed by the server after each run. If unspecified, it will default - // to current server time, which means the scan will be scheduled to start - // immediately. - google.protobuf.Timestamp schedule_time = 1; - - // Required. The duration of time between executions in days. - int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Type of user agents used for scanning. - enum UserAgent { - // The user agent is unknown. Service will default to CHROME_LINUX. - USER_AGENT_UNSPECIFIED = 0; - - // Chrome on Linux. This is the service default if unspecified. - CHROME_LINUX = 1; - - // Chrome on Android. - CHROME_ANDROID = 2; - - // Safari on IPhone. - SAFARI_IPHONE = 3; - } - - // Cloud platforms supported by Cloud Web Security Scanner. - enum TargetPlatform { - // The target platform is unknown. Requests with this enum value will be - // rejected with INVALID_ARGUMENT error. - TARGET_PLATFORM_UNSPECIFIED = 0; - - // Google App Engine service. - APP_ENGINE = 1; - - // Google Compute Engine service. - COMPUTE = 2; - } - - // The resource name of the ScanConfig. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are - // generated by the system. - string name = 1; - - // Required. The user provided display name of the ScanConfig. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum QPS during scanning. A valid value ranges from 5 to 20 - // inclusively. If the field is unspecified or its value is set 0, server will - // default to 15. Other values outside of [5, 20] range will be rejected with - // INVALID_ARGUMENT error. - int32 max_qps = 3; - - // Required. The starting URLs from which the scanner finds site pages. - repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; - - // The authentication configuration. If specified, service will use the - // authentication configuration during scanning. - Authentication authentication = 5; - - // The user agent used during scanning. - UserAgent user_agent = 6; - - // The blacklist URL patterns as described in - // https://cloud.google.com/security-scanner/docs/excluded-urls - repeated string blacklist_patterns = 7; - - // The schedule of the ScanConfig. - Schedule schedule = 8; - - // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be - // used as a default. - repeated TargetPlatform target_platforms = 9; - - // Latest ScanRun if available. - ScanRun latest_run = 11; -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto deleted file mode 100644 index 79c5419..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto +++ /dev/null @@ -1,104 +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.websecurityscanner.v1alpha; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// A ScanRun is a output-only resource representing an actual run of the scan. -message ScanRun { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanRun" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" - }; - - // Types of ScanRun execution state. - enum ExecutionState { - // Represents an invalid state caused by internal server error. This value - // should never be returned. - EXECUTION_STATE_UNSPECIFIED = 0; - - // The scan is waiting in the queue. - QUEUED = 1; - - // The scan is in progress. - SCANNING = 2; - - // The scan is either finished or stopped by user. - FINISHED = 3; - } - - // Types of ScanRun result state. - enum ResultState { - // Default value. This value is returned when the ScanRun is not yet - // finished. - RESULT_STATE_UNSPECIFIED = 0; - - // The scan finished without errors. - SUCCESS = 1; - - // The scan finished with errors. - ERROR = 2; - - // The scan was terminated by user. - KILLED = 3; - } - - // The resource name of the ScanRun. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - // The ScanRun IDs are generated by the system. - string name = 1; - - // The execution state of the ScanRun. - ExecutionState execution_state = 2; - - // The result state of the ScanRun. This field is only available after the - // execution state reaches "FINISHED". - ResultState result_state = 3; - - // The time at which the ScanRun started. - google.protobuf.Timestamp start_time = 4; - - // The time at which the ScanRun reached termination state - that the ScanRun - // is either finished or stopped by user. - google.protobuf.Timestamp end_time = 5; - - // The number of URLs crawled during this ScanRun. If the scan is in progress, - // the value represents the number of URLs crawled up to now. - int64 urls_crawled_count = 6; - - // The number of URLs tested during this ScanRun. If the scan is in progress, - // the value represents the number of URLs tested up to now. The number of - // URLs tested is usually larger than the number URLS crawled because - // typically a crawled URL is tested with multiple test payloads. - int64 urls_tested_count = 7; - - // Whether the scan run has found any vulnerabilities. - bool has_vulnerabilities = 8; - - // The percentage of total completion ranging from 0 to 100. - // If the scan is in queue, the value is 0. - // If the scan is running, the value ranges from 0 to 100. - // If the scan is finished, the value is 100. - int32 progress_percent = 9; -} diff --git a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto b/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto deleted file mode 100644 index f34bd74..0000000 --- a/owl-bot-staging/v1alpha/protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto +++ /dev/null @@ -1,410 +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.websecurityscanner.v1alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1alpha/crawled_url.proto"; -import "google/cloud/websecurityscanner/v1alpha/finding.proto"; -import "google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto"; -import "google/cloud/websecurityscanner/v1alpha/scan_config.proto"; -import "google/cloud/websecurityscanner/v1alpha/scan_run.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "WebSecurityScannerProto"; -option java_package = "com.google.cloud.websecurityscanner.v1alpha"; - -// Cloud Web Security Scanner Service identifies security vulnerabilities in web -// applications hosted on Google Cloud Platform. It crawls your application, and -// attempts to exercise as many user inputs and event handlers as possible. -service WebSecurityScanner { - option (google.api.default_host) = "websecurityscanner.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new ScanConfig. - rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - post: "/v1alpha/{parent=projects/*}/scanConfigs" - body: "scan_config" - }; - option (google.api.method_signature) = "parent,scan_config"; - } - - // Deletes an existing ScanConfig and its child resources. - rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1alpha/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanConfig. - rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanConfigs under a given project. - rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*}/scanConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a ScanConfig. This method support partial update of a ScanConfig. - rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - patch: "/v1alpha/{scan_config.name=projects/*/scanConfigs/*}" - body: "scan_config" - }; - option (google.api.method_signature) = "scan_config,update_mask"; - } - - // Start a ScanRun according to the given ScanConfig. - rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1alpha/{name=projects/*/scanConfigs/*}:start" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanRun. - rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - // stop time. - rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*}/scanRuns" - }; - option (google.api.method_signature) = "parent"; - } - - // Stops a ScanRun. The stopped ScanRun is returned. - rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // List CrawledUrls under a given ScanRun. - rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a Finding. - rpc GetFinding(GetFindingRequest) returns (Finding) { - option (google.api.http) = { - get: "/v1alpha/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List Findings under a given ScanRun. - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" - }; - option (google.api.method_signature) = "parent,filter"; - } - - // List all FindingTypeStats under a given ScanRun. - rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { - option (google.api.http) = { - get: "/v1alpha/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request for the `CreateScanConfig` method. -message CreateScanConfigRequest { - // Required. The parent resource name where the scan is created, which should be a - // project resource name in the format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The ScanConfig to be created. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `DeleteScanConfig` method. -message DeleteScanConfigRequest { - // Required. The resource name of the ScanConfig to be deleted. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanConfig` method. -message GetScanConfigRequest { - // Required. The resource name of the ScanConfig to be returned. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `ListScanConfigs` method. -message ListScanConfigsRequest { - // Required. The parent resource name, which should be a project resource name in the - // format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanConfigs to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Request for the `UpdateScanConfigRequest` method. -message UpdateScanConfigRequest { - // Required. The ScanConfig to be updated. The name field must be set to identify the - // resource to be updated. The values of fields not covered by the mask - // will be ignored. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `ListScanConfigs` method. -message ListScanConfigsResponse { - // The list of ScanConfigs returned. - repeated ScanConfig scan_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `StartScanRun` method. -message StartScanRunRequest { - // Required. The resource name of the ScanConfig to be used. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanRun` method. -message GetScanRunRequest { - // Required. The resource name of the ScanRun to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListScanRuns` method. -message ListScanRunsRequest { - // Required. The parent resource name, which should be a scan resource name in the - // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanRuns to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListScanRuns` method. -message ListScanRunsResponse { - // The list of ScanRuns returned. - repeated ScanRun scan_runs = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `StopScanRun` method. -message StopScanRunRequest { - // Required. The resource name of the ScanRun to be stopped. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListCrawledUrls` method. -message ListCrawledUrlsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of CrawledUrls to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListCrawledUrls` method. -message ListCrawledUrlsResponse { - // The list of CrawledUrls returned. - repeated CrawledUrl crawled_urls = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `GetFinding` method. -message GetFindingRequest { - // Required. The resource name of the Finding to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/Finding" - } - ]; -} - -// Request for the `ListFindings` method. -message ListFindingsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // Required. The filter expression. The expression must be in the format: - // . - // Supported field: 'finding_type'. - // Supported operator: '='. - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 3; - - // The maximum number of Findings to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 4; -} - -// Response for the `ListFindings` method. -message ListFindingsResponse { - // The list of Findings returned. - repeated Finding findings = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `ListFindingTypeStats` method. -message ListFindingTypeStatsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Response for the `ListFindingTypeStats` method. -message ListFindingTypeStatsResponse { - // The list of FindingTypeStats returned. - repeated FindingTypeStats finding_type_stats = 1; -} diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json b/owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json deleted file mode 100644 index 28ee273..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/snippet_metadata.google.cloud.websecurityscanner.v1alpha.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-websecurityscanner", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.websecurityscanner.v1alpha", - "version": "v1alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async", - "title": "WebSecurityScanner createScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new ScanConfig.", - "canonical": true, - "file": "web_security_scanner.create_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.CreateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async", - "title": "WebSecurityScanner deleteScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing ScanConfig and its child resources.", - "canonical": true, - "file": "web_security_scanner.delete_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.DeleteScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async", - "title": "WebSecurityScanner getScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.get_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async", - "title": "WebSecurityScanner listScanConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanConfigs under a given project.", - "canonical": true, - "file": "web_security_scanner.list_scan_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanConfigsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanConfigs", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async", - "title": "WebSecurityScanner updateScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.update_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", - "async": true, - "parameters": [ - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1alpha.ScanConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.UpdateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async", - "title": "WebSecurityScanner startScanRun Sample", - "origin": "API_DEFINITION", - "description": " Start a ScanRun according to the given ScanConfig.", - "canonical": true, - "file": "web_security_scanner.start_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StartScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async", - "title": "WebSecurityScanner getScanRun Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanRun.", - "canonical": true, - "file": "web_security_scanner.get_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async", - "title": "WebSecurityScanner listScanRuns Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", - "canonical": true, - "file": "web_security_scanner.list_scan_runs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListScanRunsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListScanRuns", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async", - "title": "WebSecurityScanner stopScanRun Sample", - "origin": "API_DEFINITION", - "description": " Stops a ScanRun. The stopped ScanRun is returned.", - "canonical": true, - "file": "web_security_scanner.stop_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.StopScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async", - "title": "WebSecurityScanner listCrawledUrls Sample", - "origin": "API_DEFINITION", - "description": " List CrawledUrls under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_crawled_urls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListCrawledUrls", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async", - "title": "WebSecurityScanner getFinding Sample", - "origin": "API_DEFINITION", - "description": " Gets a Finding.", - "canonical": true, - "file": "web_security_scanner.get_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.Finding", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.GetFinding", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async", - "title": "WebSecurityScanner listFindings Sample", - "origin": "API_DEFINITION", - "description": " List Findings under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindings", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async", - "title": "WebSecurityScanner listFindingTypeStats Sample", - "origin": "API_DEFINITION", - "description": " List all FindingTypeStats under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_finding_type_stats.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner.ListFindingTypeStats", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.js deleted file mode 100644 index fb3314b..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.create_scan_config.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(parent, scanConfig) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * Required. The ScanConfig to be created. - */ - // const scanConfig = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callCreateScanConfig() { - // Construct request - const request = { - parent, - scanConfig, - }; - - // Run request - const response = await websecurityscannerClient.createScanConfig(request); - console.log(response); - } - - callCreateScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js deleted file mode 100644 index 1249e4e..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.delete_scan_config.js +++ /dev/null @@ -1,59 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callDeleteScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.deleteScanConfig(request); - console.log(response); - } - - callDeleteScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js deleted file mode 100644 index 9e4b0d1..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_finding.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetFinding() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getFinding(request); - console.log(response); - } - - callGetFinding(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js deleted file mode 100644 index c18c788..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_config.js +++ /dev/null @@ -1,59 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanConfig(request); - console.log(response); - } - - callGetScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js deleted file mode 100644 index 85b2c50..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.get_scan_run.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanRun(request); - console.log(response); - } - - callGetScanRun(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js deleted file mode 100644 index d5a4fcb..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js +++ /dev/null @@ -1,74 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListCrawledUrls() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCrawledUrls(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js deleted file mode 100644 index 215567d..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindingTypeStats() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await websecurityscannerClient.listFindingTypeStats(request); - console.log(response); - } - - callListFindingTypeStats(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.js deleted file mode 100644 index 406c31f..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_findings.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, filter) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - */ - // const filter = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const iterable = await websecurityscannerClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js deleted file mode 100644 index def6c77..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_configs.js +++ /dev/null @@ -1,73 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanConfigs(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js deleted file mode 100644 index 98d3c69..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.list_scan_runs.js +++ /dev/null @@ -1,73 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanRuns() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanRunsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanRuns(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js deleted file mode 100644 index 094582c..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.start_scan_run.js +++ /dev/null @@ -1,59 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStartScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.startScanRun(request); - console.log(response); - } - - callStartScanRun(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js deleted file mode 100644 index 70c97f1..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.stop_scan_run.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStopScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.stopScanRun(request); - console.log(response); - } - - callStopScanRun(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js b/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js deleted file mode 100644 index 6bfa7ee..0000000 --- a/owl-bot-staging/v1alpha/samples/generated/v1alpha/web_security_scanner.update_scan_config.js +++ /dev/null @@ -1,67 +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(scanConfig, updateMask) { - // [START websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - */ - // const scanConfig = {} - /** - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1alpha; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callUpdateScanConfig() { - // Construct request - const request = { - scanConfig, - updateMask, - }; - - // Run request - const response = await websecurityscannerClient.updateScanConfig(request); - console.log(response); - } - - callUpdateScanConfig(); - // [END websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha/src/index.ts b/owl-bot-staging/v1alpha/src/index.ts deleted file mode 100644 index a07223c..0000000 --- a/owl-bot-staging/v1alpha/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 v1alpha from './v1alpha'; -const WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; -type WebSecurityScannerClient = v1alpha.WebSecurityScannerClient; -export {v1alpha, WebSecurityScannerClient}; -export default {v1alpha, WebSecurityScannerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json b/owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json deleted file mode 100644 index 72e2c6b..0000000 --- a/owl-bot-staging/v1alpha/src/v1alpha/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.websecurityscanner.v1alpha", - "libraryPackage": "@google-cloud/web-security-scanner", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/index.ts b/owl-bot-staging/v1alpha/src/v1alpha/index.ts deleted file mode 100644 index 515d336..0000000 --- a/owl-bot-staging/v1alpha/src/v1alpha/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts deleted file mode 100644 index a69036f..0000000 --- a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client.ts +++ /dev/null @@ -1,1936 +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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha/web_security_scanner_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_security_scanner_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Cloud Web Security Scanner Service identifies security vulnerabilities in web - * applications hosted on Google Cloud Platform. It crawls your application, and - * attempts to exercise as many user inputs and event handlers as possible. - * @class - * @memberof v1alpha - */ -export class WebSecurityScannerClient { - 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}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebSecurityScannerClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WebSecurityScannerClient; - 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - scanConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}' - ), - scanRunPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' - ), - }; - - // 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 = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', 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 = gax.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.webSecurityScannerStub) { - return this.webSecurityScannerStub; - } - - // Put together the "service stub" for - // google.cloud.websecurityscanner.v1alpha.WebSecurityScanner. - this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1alpha.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1alpha.WebSecurityScanner, - 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 webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; - for (const methodName of webSecurityScannerStubMethods) { - const callPromise = this.webSecurityScannerStub.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.innerApiCalls[methodName] = apiCall; - } - - return this.webSecurityScannerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'websecurityscanner.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 'websecurityscanner.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 new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig - * Required. The ScanConfig to be created. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. - * 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/v1alpha/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async - */ - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined - ]>; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createScanConfig(request, options, callback); - } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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/v1alpha/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async - */ - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteScanConfig(request, options, callback); - } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. - * 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/v1alpha/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async - */ - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined - ]>; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getScanConfig(request, options, callback); - } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. - * 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/v1alpha/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async - */ - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateScanConfig(request, options, callback); - } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. - * 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/v1alpha/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async - */ - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined - ]>; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.startScanRun(request, options, callback); - } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. - * 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/v1alpha/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async - */ - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined - ]>; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getScanRun(request, options, callback); - } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. - * 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/v1alpha/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async - */ - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined - ]>; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.stopScanRun(request, options, callback); - } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding}. - * 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/v1alpha/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async - */ - getFinding( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined - ]>; - getFinding( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getFinding(request, options, callback); - } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ListFindingTypeStatsResponse]{@link google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse}. - * 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/v1alpha/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async - */ - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listFindingTypeStats(request, options, callback); - } - - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. - * 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 `listScanConfigsAsync()` - * 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. - */ - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]>; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listScanConfigs(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 resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig} 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 `listScanConfigsAsync()` - * 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. - */ - listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.createStream( - this.innerApiCalls.listScanConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanConfigs`, 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 resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [ScanConfig]{@link google.cloud.websecurityscanner.v1alpha.ScanConfig}. 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/v1alpha/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async - */ - listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.asyncIterate( - this.innerApiCalls['listScanConfigs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. - * 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 `listScanRunsAsync()` - * 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. - */ - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]>; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listScanRuns(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 resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun} 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 `listScanRunsAsync()` - * 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. - */ - listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.createStream( - this.innerApiCalls.listScanRuns as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanRuns`, 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 resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [ScanRun]{@link google.cloud.websecurityscanner.v1alpha.ScanRun}. 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/v1alpha/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async - */ - listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.asyncIterate( - this.innerApiCalls['listScanRuns'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1alpha.CrawledUrl}. - * 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 `listCrawledUrlsAsync()` - * 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. - */ - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]>; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCrawledUrls(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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1alpha.CrawledUrl} 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 `listCrawledUrlsAsync()` - * 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. - */ - listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.createStream( - this.innerApiCalls.listCrawledUrls as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCrawledUrls`, 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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [CrawledUrl]{@link google.cloud.websecurityscanner.v1alpha.CrawledUrl}. 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/v1alpha/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async - */ - listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.asyncIterate( - this.innerApiCalls['listCrawledUrls'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding}. - * 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 `listFindingsAsync()` - * 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. - */ - listFindings( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; - listFindings( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; - listFindings( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding} 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 `listFindingsAsync()` - * 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. - */ - listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, 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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [Finding]{@link google.cloud.websecurityscanner.v1alpha.Finding}. 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/v1alpha/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the scan_config from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; - } - - /** - * Parse the scan_run from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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 scanConfig resource name string. - * - * @param {string} project - * @param {string} scan_config - * @returns {string} Resource name string. - */ - scanConfigPath(project:string,scanConfig:string) { - return this.pathTemplates.scanConfigPathTemplate.render({ - project: project, - scan_config: scanConfig, - }); - } - - /** - * Parse the project from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; - } - - /** - * Parse the scan_config from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; - } - - /** - * Return a fully-qualified scanRun resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @returns {string} Resource name string. - */ - scanRunPath(project:string,scanConfig:string,scanRun:string) { - return this.pathTemplates.scanRunPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - }); - } - - /** - * Parse the project from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; - } - - /** - * Parse the scan_config from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; - } - - /** - * Parse the scan_run from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; - } - - /** - * 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.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json deleted file mode 100644 index 288b9b0..0000000 --- a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_client_config.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "interfaces": { - "google.cloud.websecurityscanner.v1alpha.WebSecurityScanner": { - "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": { - "CreateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanConfigs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanRuns": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "StopScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCrawledUrls": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFinding": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindingTypeStats": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json b/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json deleted file mode 100644 index 1696775..0000000 --- a/owl-bot-staging/v1alpha/src/v1alpha/web_security_scanner_proto_list.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/websecurityscanner/v1alpha/crawled_url.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/finding.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/finding_addon.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/finding_type_stats.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/scan_config.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/scan_run.proto", - "../../protos/google/cloud/websecurityscanner/v1alpha/web_security_scanner.proto" -] diff --git a/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2c742f5..0000000 --- a/owl-bot-staging/v1alpha/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 websecurityscanner = require('@google-cloud/web-security-scanner'); - -function main() { - const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); -} - -main(); diff --git a/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1alpha/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8bd7a23..0000000 --- a/owl-bot-staging/v1alpha/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; - -// check that the client class type name can be used -function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webSecurityScannerClient = new WebSecurityScannerClient(); - doStuffWithWebSecurityScannerClient(webSecurityScannerClient); -} - -main(); diff --git a/owl-bot-staging/v1alpha/system-test/install.ts b/owl-bot-staging/v1alpha/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1alpha/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/v1alpha/test/gapic_web_security_scanner_v1alpha.ts b/owl-bot-staging/v1alpha/test/gapic_web_security_scanner_v1alpha.ts deleted file mode 100644 index 653e5c5..0000000 --- a/owl-bot-staging/v1alpha/test/gapic_web_security_scanner_v1alpha.ts +++ /dev/null @@ -1,2122 +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 websecurityscannerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -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('v1alpha.WebSecurityScannerClient', () => { - it('has servicePath', () => { - const servicePath = websecurityscannerModule.v1alpha.WebSecurityScannerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = websecurityscannerModule.v1alpha.WebSecurityScannerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1alpha.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - 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 websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - 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('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - 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); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse()); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse()); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { - 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.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { - 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.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert.strictEqual( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert.strictEqual( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { - 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.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { - 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.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert.strictEqual( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert.strictEqual( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - 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('scanConfig', () => { - const fakePath = "/rendered/path/scanConfig"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanConfigPath', () => { - const result = client.scanConfigPath("projectValue", "scanConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanConfigName', () => { - const result = client.matchProjectFromScanConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanConfigName', () => { - const result = client.matchScanConfigFromScanConfigName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('scanRun', () => { - const fakePath = "/rendered/path/scanRun"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanRunPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanRunPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanRunPath', () => { - const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanRunName', () => { - const result = client.matchProjectFromScanRunName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanRunName', () => { - const result = client.matchScanConfigFromScanRunName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromScanRunName', () => { - const result = client.matchScanRunFromScanRunName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1alpha/tsconfig.json b/owl-bot-staging/v1alpha/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1alpha/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/v1alpha/webpack.config.js b/owl-bot-staging/v1alpha/webpack.config.js deleted file mode 100644 index ad3467d..0000000 --- a/owl-bot-staging/v1alpha/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: 'WebSecurityScanner', - filename: './web-security-scanner.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/v1beta/.eslintignore b/owl-bot-staging/v1beta/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1beta/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1beta/.eslintrc.json b/owl-bot-staging/v1beta/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1beta/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1beta/.gitignore b/owl-bot-staging/v1beta/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1beta/.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/v1beta/.jsdoc.js b/owl-bot-staging/v1beta/.jsdoc.js deleted file mode 100644 index 65475a4..0000000 --- a/owl-bot-staging/v1beta/.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/web-security-scanner', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1beta/.mocharc.js b/owl-bot-staging/v1beta/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1beta/.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/v1beta/.prettierrc.js b/owl-bot-staging/v1beta/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1beta/.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/v1beta/README.md b/owl-bot-staging/v1beta/README.md deleted file mode 100644 index 727d3b6..0000000 --- a/owl-bot-staging/v1beta/README.md +++ /dev/null @@ -1 +0,0 @@ -Websecurityscanner: Nodejs Client diff --git a/owl-bot-staging/v1beta/linkinator.config.json b/owl-bot-staging/v1beta/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/v1beta/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/v1beta/package.json b/owl-bot-staging/v1beta/package.json deleted file mode 100644 index d42ee9b..0000000 --- a/owl-bot-staging/v1beta/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/web-security-scanner", - "version": "0.1.0", - "description": "Websecurityscanner client for Node.js", - "repository": "googleapis/nodejs-websecurityscanner", - "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 websecurityscanner", - "websecurityscanner", - "web security scanner" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "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.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto deleted file mode 100644 index cbfead4..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto +++ /dev/null @@ -1,41 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "CrawledUrlProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web -// Security Scanner Service crawls the web applications, following all links -// within the scope of sites, to find the URLs to test against. -message CrawledUrl { - // The http method of the request that was used to visit the URL, in - // uppercase. - string http_method = 1; - - // The URL that was crawled. - string url = 2; - - // The body of the request that was used to visit the URL. - string body = 3; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto deleted file mode 100644 index 999e092..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding.proto +++ /dev/null @@ -1,98 +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.websecurityscanner.v1beta; - -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/finding_addon.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A Finding resource represents a vulnerability instance identified during a -// ScanRun. -message Finding { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/Finding" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}" - }; - - // The resource name of the Finding. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'. - // The finding IDs are generated by the system. - string name = 1; - - // The type of the Finding. - // Detailed and up-to-date information on findings can be found here: - // https://cloud.google.com/security-scanner/docs/scan-result-details - string finding_type = 2; - - // The http method of the request that triggered the vulnerability, in - // uppercase. - string http_method = 3; - - // The URL produced by the server-side fuzzer and used in the request that - // triggered the vulnerability. - string fuzzed_url = 4; - - // The body of the request that triggered the vulnerability. - string body = 5; - - // The description of the vulnerability. - string description = 6; - - // The URL containing human-readable payload that user can leverage to - // reproduce the vulnerability. - string reproduction_url = 7; - - // If the vulnerability was originated from nested IFrame, the immediate - // parent IFrame is reported. - string frame_url = 8; - - // The URL where the browser lands when the vulnerability is detected. - string final_url = 9; - - // The tracking ID uniquely identifies a vulnerability instance across - // multiple ScanRuns. - string tracking_id = 10; - - // An addon containing information reported for a vulnerability with an HTML - // form, if any. - Form form = 16; - - // An addon containing information about outdated libraries. - OutdatedLibrary outdated_library = 11; - - // An addon containing detailed information regarding any resource causing the - // vulnerability such as JavaScript sources, image, audio files, etc. - ViolatingResource violating_resource = 12; - - // An addon containing information about vulnerable or missing HTTP headers. - VulnerableHeaders vulnerable_headers = 15; - - // An addon containing information about request parameters which were found - // to be vulnerable. - VulnerableParameters vulnerable_parameters = 13; - - // An addon containing information reported for an XSS, if any. - Xss xss = 14; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto deleted file mode 100644 index c29f6ca..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto +++ /dev/null @@ -1,90 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingAddonProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// ! Information about a vulnerability with an HTML. -message Form { - // ! The URI where to send the form when it's submitted. - string action_uri = 1; - - // ! The names of form fields related to the vulnerability. - repeated string fields = 2; -} - -// Information reported for an outdated library. -message OutdatedLibrary { - // The name of the outdated library. - string library_name = 1; - - // The version number. - string version = 2; - - // URLs to learn more information about the vulnerabilities in the library. - repeated string learn_more_urls = 3; -} - -// Information regarding any resource causing the vulnerability such -// as JavaScript sources, image, audio files, etc. -message ViolatingResource { - // The MIME type of this resource. - string content_type = 1; - - // URL of this violating resource. - string resource_url = 2; -} - -// Information about vulnerable request parameters. -message VulnerableParameters { - // The vulnerable parameter names. - repeated string parameter_names = 1; -} - -// Information about vulnerable or missing HTTP Headers. -message VulnerableHeaders { - // Describes a HTTP Header. - message Header { - // Header name. - string name = 1; - - // Header value. - string value = 2; - } - - // List of vulnerable headers. - repeated Header headers = 1; - - // List of missing headers. - repeated Header missing_headers = 2; -} - -// Information reported for an XSS. -message Xss { - // Stack traces leading to the point where the XSS occurred. - repeated string stack_traces = 1; - - // An error message generated by a javascript breakage. - string error_message = 2; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto deleted file mode 100644 index 9b21576..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto +++ /dev/null @@ -1,36 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "FindingTypeStatsProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A FindingTypeStats resource represents stats regarding a specific FindingType -// of Findings under a given ScanRun. -message FindingTypeStats { - // The finding type associated with the stats. - string finding_type = 1; - - // The count of findings belonging to this finding type. - int32 finding_count = 2; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto deleted file mode 100644 index b25c619..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config.proto +++ /dev/null @@ -1,193 +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.websecurityscanner.v1beta; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A ScanConfig resource contains the configurations to launch a scan. -message ScanConfig { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - pattern: "projects/{project}/scanConfigs/{scan_config}" - }; - - // Scan authentication configuration. - message Authentication { - // Describes authentication configuration that uses a Google account. - message GoogleAccount { - // Required. The user name of the Google account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the Google account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - } - - // Describes authentication configuration that uses a custom account. - message CustomAccount { - // Required. The user name of the custom account. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. The password of the custom account. The credential is stored encrypted - // and not returned in any response nor included in audit logs. - string password = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // Required. The login form URL of the website. - string login_url = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. - // Authentication configuration - oneof authentication { - // Authentication using a Google account. - GoogleAccount google_account = 1; - - // Authentication using a custom account. - CustomAccount custom_account = 2; - } - } - - // Scan schedule configuration. - message Schedule { - // A timestamp indicates when the next run will be scheduled. The value is - // refreshed by the server after each run. If unspecified, it will default - // to current server time, which means the scan will be scheduled to start - // immediately. - google.protobuf.Timestamp schedule_time = 1; - - // Required. The duration of time between executions in days. - int32 interval_duration_days = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Type of user agents used for scanning. - enum UserAgent { - // The user agent is unknown. Service will default to CHROME_LINUX. - USER_AGENT_UNSPECIFIED = 0; - - // Chrome on Linux. This is the service default if unspecified. - CHROME_LINUX = 1; - - // Chrome on Android. - CHROME_ANDROID = 2; - - // Safari on IPhone. - SAFARI_IPHONE = 3; - } - - // Cloud platforms supported by Cloud Web Security Scanner. - enum TargetPlatform { - // The target platform is unknown. Requests with this enum value will be - // rejected with INVALID_ARGUMENT error. - TARGET_PLATFORM_UNSPECIFIED = 0; - - // Google App Engine service. - APP_ENGINE = 1; - - // Google Compute Engine service. - COMPUTE = 2; - } - - // Scan risk levels supported by Cloud Web Security Scanner. LOW impact - // scanning will minimize requests with the potential to modify data. To - // achieve the maximum scan coverage, NORMAL risk level is recommended. - enum RiskLevel { - // Use default, which is NORMAL. - RISK_LEVEL_UNSPECIFIED = 0; - - // Normal scanning (Recommended) - NORMAL = 1; - - // Lower impact scanning - LOW = 2; - } - - // Controls export of scan configurations and results to Cloud Security - // Command Center. - enum ExportToSecurityCommandCenter { - // Use default, which is ENABLED. - EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED = 0; - - // Export results of this scan to Cloud Security Command Center. - ENABLED = 1; - - // Do not export results of this scan to Cloud Security Command Center. - DISABLED = 2; - } - - // The resource name of the ScanConfig. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are - // generated by the system. - string name = 1; - - // Required. The user provided display name of the ScanConfig. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum QPS during scanning. A valid value ranges from 5 to 20 - // inclusively. If the field is unspecified or its value is set 0, server will - // default to 15. Other values outside of [5, 20] range will be rejected with - // INVALID_ARGUMENT error. - int32 max_qps = 3; - - // Required. The starting URLs from which the scanner finds site pages. - repeated string starting_urls = 4 [(google.api.field_behavior) = REQUIRED]; - - // The authentication configuration. If specified, service will use the - // authentication configuration during scanning. - Authentication authentication = 5; - - // The user agent used during scanning. - UserAgent user_agent = 6; - - // The blacklist URL patterns as described in - // https://cloud.google.com/security-scanner/docs/excluded-urls - repeated string blacklist_patterns = 7; - - // The schedule of the ScanConfig. - Schedule schedule = 8; - - // Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be - // used as a default. - repeated TargetPlatform target_platforms = 9; - - // Controls export of scan configurations and results to Cloud Security - // Command Center. - ExportToSecurityCommandCenter export_to_security_command_center = 10; - - // Latest ScanRun if available. - ScanRun latest_run = 11; - - // The risk level selected for the scan - RiskLevel risk_level = 12; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto deleted file mode 100644 index 3920b74..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto +++ /dev/null @@ -1,190 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanConfigErrorProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Defines a custom error message used by CreateScanConfig and UpdateScanConfig -// APIs when scan configuration validation fails. It is also reported as part of -// a ScanRunErrorTrace message if scan validation fails due to a scan -// configuration error. -message ScanConfigError { - // Output only. - // Defines an error reason code. - // Next id: 44 - enum Code { - option allow_alias = true; - - // There is no error. - CODE_UNSPECIFIED = 0; - - // There is no error. - OK = 0; - - // Indicates an internal server error. - // Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown. - INTERNAL_ERROR = 1; - - // One of the seed URLs is an App Engine URL but we cannot validate the scan - // settings due to an App Engine API backend error. - APPENGINE_API_BACKEND_ERROR = 2; - - // One of the seed URLs is an App Engine URL but we cannot access the - // App Engine API to validate scan settings. - APPENGINE_API_NOT_ACCESSIBLE = 3; - - // One of the seed URLs is an App Engine URL but the Default Host of the - // App Engine is not set. - APPENGINE_DEFAULT_HOST_MISSING = 4; - - // Google corporate accounts can not be used for scanning. - CANNOT_USE_GOOGLE_COM_ACCOUNT = 6; - - // The account of the scan creator can not be used for scanning. - CANNOT_USE_OWNER_ACCOUNT = 7; - - // This scan targets Compute Engine, but we cannot validate scan settings - // due to a Compute Engine API backend error. - COMPUTE_API_BACKEND_ERROR = 8; - - // This scan targets Compute Engine, but we cannot access the Compute Engine - // API to validate the scan settings. - COMPUTE_API_NOT_ACCESSIBLE = 9; - - // The Custom Login URL does not belong to the current project. - CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 10; - - // The Custom Login URL is malformed (can not be parsed). - CUSTOM_LOGIN_URL_MALFORMED = 11; - - // The Custom Login URL is mapped to a non-routable IP address in DNS. - CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 12; - - // The Custom Login URL is mapped to an IP address which is not reserved for - // the current project. - CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS = 13; - - // The Custom Login URL has a non-routable IP address. - CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 14; - - // The Custom Login URL has an IP address which is not reserved for the - // current project. - CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS = 15; - - // Another scan with the same name (case-sensitive) already exists. - DUPLICATE_SCAN_NAME = 16; - - // A field is set to an invalid value. - INVALID_FIELD_VALUE = 18; - - // There was an error trying to authenticate to the scan target. - FAILED_TO_AUTHENTICATE_TO_TARGET = 19; - - // Finding type value is not specified in the list findings request. - FINDING_TYPE_UNSPECIFIED = 20; - - // Scan targets Compute Engine, yet current project was not whitelisted for - // Google Compute Engine Scanning Alpha access. - FORBIDDEN_TO_SCAN_COMPUTE = 21; - - // User tries to update managed scan - FORBIDDEN_UPDATE_TO_MANAGED_SCAN = 43; - - // The supplied filter is malformed. For example, it can not be parsed, does - // not have a filter type in expression, or the same filter type appears - // more than once. - MALFORMED_FILTER = 22; - - // The supplied resource name is malformed (can not be parsed). - MALFORMED_RESOURCE_NAME = 23; - - // The current project is not in an active state. - PROJECT_INACTIVE = 24; - - // A required field is not set. - REQUIRED_FIELD = 25; - - // Project id, scanconfig id, scanrun id, or finding id are not consistent - // with each other in resource name. - RESOURCE_NAME_INCONSISTENT = 26; - - // The scan being requested to start is already running. - SCAN_ALREADY_RUNNING = 27; - - // The scan that was requested to be stopped is not running. - SCAN_NOT_RUNNING = 28; - - // One of the seed URLs does not belong to the current project. - SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT = 29; - - // One of the seed URLs is malformed (can not be parsed). - SEED_URL_MALFORMED = 30; - - // One of the seed URLs is mapped to a non-routable IP address in DNS. - SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS = 31; - - // One of the seed URLs is mapped to an IP address which is not reserved - // for the current project. - SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS = 32; - - // One of the seed URLs has on-routable IP address. - SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS = 33; - - // One of the seed URLs has an IP address that is not reserved - // for the current project. - SEED_URL_HAS_UNRESERVED_IP_ADDRESS = 35; - - // The Cloud Security Scanner service account is not configured under the - // project. - SERVICE_ACCOUNT_NOT_CONFIGURED = 36; - - // A project has reached the maximum number of scans. - TOO_MANY_SCANS = 37; - - // Resolving the details of the current project fails. - UNABLE_TO_RESOLVE_PROJECT_INFO = 38; - - // One or more blacklist patterns were in the wrong format. - UNSUPPORTED_BLACKLIST_PATTERN_FORMAT = 39; - - // The supplied filter is not supported. - UNSUPPORTED_FILTER = 40; - - // The supplied finding type is not supported. For example, we do not - // provide findings of the given finding type. - UNSUPPORTED_FINDING_TYPE = 41; - - // The URL scheme of one or more of the supplied URLs is not supported. - UNSUPPORTED_URL_SCHEME = 42; - } - - // Indicates the reason code for a configuration failure. - Code code = 1; - - // Indicates the full name of the ScanConfig field that triggers this error, - // for example "scan_config.max_qps". This field is provided for - // troubleshooting purposes only and its actual value can change in the - // future. - string field_name = 2; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto deleted file mode 100644 index 48800d2..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run.proto +++ /dev/null @@ -1,117 +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.websecurityscanner.v1beta; - -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// A ScanRun is a output-only resource representing an actual run of the scan. -// Next id: 12 -message ScanRun { - option (google.api.resource) = { - type: "websecurityscanner.googleapis.com/ScanRun" - pattern: "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}" - }; - - // Types of ScanRun execution state. - enum ExecutionState { - // Represents an invalid state caused by internal server error. This value - // should never be returned. - EXECUTION_STATE_UNSPECIFIED = 0; - - // The scan is waiting in the queue. - QUEUED = 1; - - // The scan is in progress. - SCANNING = 2; - - // The scan is either finished or stopped by user. - FINISHED = 3; - } - - // Types of ScanRun result state. - enum ResultState { - // Default value. This value is returned when the ScanRun is not yet - // finished. - RESULT_STATE_UNSPECIFIED = 0; - - // The scan finished without errors. - SUCCESS = 1; - - // The scan finished with errors. - ERROR = 2; - - // The scan was terminated by user. - KILLED = 3; - } - - // The resource name of the ScanRun. The name follows the format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - // The ScanRun IDs are generated by the system. - string name = 1; - - // The execution state of the ScanRun. - ExecutionState execution_state = 2; - - // The result state of the ScanRun. This field is only available after the - // execution state reaches "FINISHED". - ResultState result_state = 3; - - // The time at which the ScanRun started. - google.protobuf.Timestamp start_time = 4; - - // The time at which the ScanRun reached termination state - that the ScanRun - // is either finished or stopped by user. - google.protobuf.Timestamp end_time = 5; - - // The number of URLs crawled during this ScanRun. If the scan is in progress, - // the value represents the number of URLs crawled up to now. - int64 urls_crawled_count = 6; - - // The number of URLs tested during this ScanRun. If the scan is in progress, - // the value represents the number of URLs tested up to now. The number of - // URLs tested is usually larger than the number URLS crawled because - // typically a crawled URL is tested with multiple test payloads. - int64 urls_tested_count = 7; - - // Whether the scan run has found any vulnerabilities. - bool has_vulnerabilities = 8; - - // The percentage of total completion ranging from 0 to 100. - // If the scan is in queue, the value is 0. - // If the scan is running, the value ranges from 0 to 100. - // If the scan is finished, the value is 100. - int32 progress_percent = 9; - - // If result_state is an ERROR, this field provides the primary reason for - // scan's termination and more details, if such are available. - ScanRunErrorTrace error_trace = 10; - - // A list of warnings, if such are encountered during this scan run. - repeated ScanRunWarningTrace warning_traces = 11; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto deleted file mode 100644 index acbdef2..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto +++ /dev/null @@ -1,76 +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.websecurityscanner.v1beta; - -import "google/cloud/websecurityscanner/v1beta/scan_config_error.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunErrorTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Output only. -// Defines an error trace message for a ScanRun. -message ScanRunErrorTrace { - // Output only. - // Defines an error reason code. - // Next id: 7 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that the scan run failed due to an internal server error. - INTERNAL_ERROR = 1; - - // Indicates a scan configuration error, usually due to outdated ScanConfig - // settings, such as starting_urls or the DNS configuration. - SCAN_CONFIG_ISSUE = 2; - - // Indicates an authentication error, usually due to outdated ScanConfig - // authentication settings. - AUTHENTICATION_CONFIG_ISSUE = 3; - - // Indicates a scan operation timeout, usually caused by a very large site. - TIMED_OUT_WHILE_SCANNING = 4; - - // Indicates that a scan encountered excessive redirects, either to - // authentication or some other page outside of the scan scope. - TOO_MANY_REDIRECTS = 5; - - // Indicates that a scan encountered numerous errors from the web site - // pages. When available, most_common_http_error_code field indicates the - // most common HTTP error code encountered during the scan. - TOO_MANY_HTTP_ERRORS = 6; - } - - // Indicates the error reason code. - Code code = 1; - - // If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error - // message encountered during scan configuration validation that is performed - // before each scan run. - ScanConfigError scan_config_error = 2; - - // If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most - // common HTTP error code, if such is available. For example, if this code is - // 404, the scan has encountered too many NOT_FOUND responses. - int32 most_common_http_error_code = 3; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto deleted file mode 100644 index 6ee6b34..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto +++ /dev/null @@ -1,59 +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.websecurityscanner.v1beta; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "ScanRunWarningTraceProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Output only. -// Defines a warning trace message for ScanRun. Warning traces provide customers -// with useful information that helps make the scanning process more effective. -message ScanRunWarningTrace { - // Output only. - // Defines a warning message code. - // Next id: 6 - enum Code { - // Default value is never used. - CODE_UNSPECIFIED = 0; - - // Indicates that a scan discovered an unexpectedly low number of URLs. This - // is sometimes caused by complex navigation features or by using a single - // URL for numerous pages. - INSUFFICIENT_CRAWL_RESULTS = 1; - - // Indicates that a scan discovered too many URLs to test, or excessive - // redundant URLs. - TOO_MANY_CRAWL_RESULTS = 2; - - // Indicates that too many tests have been generated for the scan. Customer - // should try reducing the number of starting URLs, increasing the QPS rate, - // or narrowing down the scope of the scan using the excluded patterns. - TOO_MANY_FUZZ_TASKS = 3; - - // Indicates that a scan is blocked by IAP. - BLOCKED_BY_IAP = 4; - } - - // Indicates the warning code. - Code code = 1; -} diff --git a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto b/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto deleted file mode 100644 index 79be175..0000000 --- a/owl-bot-staging/v1beta/protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto +++ /dev/null @@ -1,413 +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.websecurityscanner.v1beta; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/websecurityscanner/v1beta/crawled_url.proto"; -import "google/cloud/websecurityscanner/v1beta/finding.proto"; -import "google/cloud/websecurityscanner/v1beta/finding_type_stats.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_config.proto"; -import "google/cloud/websecurityscanner/v1beta/scan_run.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.WebSecurityScanner.V1Beta"; -option go_package = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta;websecurityscanner"; -option java_multiple_files = true; -option java_outer_classname = "WebSecurityScannerProto"; -option java_package = "com.google.cloud.websecurityscanner.v1beta"; -option php_namespace = "Google\\Cloud\\WebSecurityScanner\\V1beta"; -option ruby_package = "Google::Cloud::WebSecurityScanner::V1beta"; - -// Cloud Web Security Scanner Service identifies security vulnerabilities in web -// applications hosted on Google Cloud Platform. It crawls your application, and -// attempts to exercise as many user inputs and event handlers as possible. -service WebSecurityScanner { - option (google.api.default_host) = "websecurityscanner.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new ScanConfig. - rpc CreateScanConfig(CreateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - post: "/v1beta/{parent=projects/*}/scanConfigs" - body: "scan_config" - }; - option (google.api.method_signature) = "parent,scan_config"; - } - - // Deletes an existing ScanConfig and its child resources. - rpc DeleteScanConfig(DeleteScanConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanConfig. - rpc GetScanConfig(GetScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/scanConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanConfigs under a given project. - rpc ListScanConfigs(ListScanConfigsRequest) returns (ListScanConfigsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*}/scanConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a ScanConfig. This method support partial update of a ScanConfig. - rpc UpdateScanConfig(UpdateScanConfigRequest) returns (ScanConfig) { - option (google.api.http) = { - patch: "/v1beta/{scan_config.name=projects/*/scanConfigs/*}" - body: "scan_config" - }; - option (google.api.method_signature) = "scan_config,update_mask"; - } - - // Start a ScanRun according to the given ScanConfig. - rpc StartScanRun(StartScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/scanConfigs/*}:start" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a ScanRun. - rpc GetScanRun(GetScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - // stop time. - rpc ListScanRuns(ListScanRunsRequest) returns (ListScanRunsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*}/scanRuns" - }; - option (google.api.method_signature) = "parent"; - } - - // Stops a ScanRun. The stopped ScanRun is returned. - rpc StopScanRun(StopScanRunRequest) returns (ScanRun) { - option (google.api.http) = { - post: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*}:stop" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // List CrawledUrls under a given ScanRun. - rpc ListCrawledUrls(ListCrawledUrlsRequest) returns (ListCrawledUrlsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/crawledUrls" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a Finding. - rpc GetFinding(GetFindingRequest) returns (Finding) { - option (google.api.http) = { - get: "/v1beta/{name=projects/*/scanConfigs/*/scanRuns/*/findings/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List Findings under a given ScanRun. - rpc ListFindings(ListFindingsRequest) returns (ListFindingsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findings" - }; - option (google.api.method_signature) = "parent,filter"; - } - - // List all FindingTypeStats under a given ScanRun. - rpc ListFindingTypeStats(ListFindingTypeStatsRequest) returns (ListFindingTypeStatsResponse) { - option (google.api.http) = { - get: "/v1beta/{parent=projects/*/scanConfigs/*/scanRuns/*}/findingTypeStats" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request for the `CreateScanConfig` method. -message CreateScanConfigRequest { - // Required. The parent resource name where the scan is created, which should be a - // project resource name in the format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The ScanConfig to be created. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `DeleteScanConfig` method. -message DeleteScanConfigRequest { - // Required. The resource name of the ScanConfig to be deleted. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanConfig` method. -message GetScanConfigRequest { - // Required. The resource name of the ScanConfig to be returned. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `ListScanConfigs` method. -message ListScanConfigsRequest { - // Required. The parent resource name, which should be a project resource name in the - // format 'projects/{projectId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanConfigs to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Request for the `UpdateScanConfigRequest` method. -message UpdateScanConfigRequest { - // Required. The ScanConfig to be updated. The name field must be set to identify the - // resource to be updated. The values of fields not covered by the mask - // will be ignored. - ScanConfig scan_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The update mask applies to the resource. For the `FieldMask` definition, - // see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `ListScanConfigs` method. -message ListScanConfigsResponse { - // The list of ScanConfigs returned. - repeated ScanConfig scan_configs = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `StartScanRun` method. -message StartScanRunRequest { - // Required. The resource name of the ScanConfig to be used. The name follows the - // format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; -} - -// Request for the `GetScanRun` method. -message GetScanRunRequest { - // Required. The resource name of the ScanRun to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListScanRuns` method. -message ListScanRunsRequest { - // Required. The parent resource name, which should be a scan resource name in the - // format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanConfig" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of ScanRuns to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListScanRuns` method. -message ListScanRunsResponse { - // The list of ScanRuns returned. - repeated ScanRun scan_runs = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `StopScanRun` method. -message StopScanRunRequest { - // Required. The resource name of the ScanRun to be stopped. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Request for the `ListCrawledUrls` method. -message ListCrawledUrlsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 2; - - // The maximum number of CrawledUrls to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 3; -} - -// Response for the `ListCrawledUrls` method. -message ListCrawledUrlsResponse { - // The list of CrawledUrls returned. - repeated CrawledUrl crawled_urls = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `GetFinding` method. -message GetFindingRequest { - // Required. The resource name of the Finding to be returned. The name follows the - // format of - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/Finding" - } - ]; -} - -// Request for the `ListFindings` method. -message ListFindingsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; - - // Required. The filter expression. The expression must be in the format: - // . - // Supported field: 'finding_type'. - // Supported operator: '='. - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // A token identifying a page of results to be returned. This should be a - // `next_page_token` value returned from a previous List request. - // If unspecified, the first page of results is returned. - string page_token = 3; - - // The maximum number of Findings to return, can be limited by server. - // If not specified or not positive, the implementation will select a - // reasonable value. - int32 page_size = 4; -} - -// Response for the `ListFindings` method. -message ListFindingsResponse { - // The list of Findings returned. - repeated Finding findings = 1; - - // Token to retrieve the next page of results, or empty if there are no - // more results in the list. - string next_page_token = 2; -} - -// Request for the `ListFindingTypeStats` method. -message ListFindingTypeStatsRequest { - // Required. The parent resource name, which should be a scan run resource name in the - // format - // 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "websecurityscanner.googleapis.com/ScanRun" - } - ]; -} - -// Response for the `ListFindingTypeStats` method. -message ListFindingTypeStatsResponse { - // The list of FindingTypeStats returned. - repeated FindingTypeStats finding_type_stats = 1; -} diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json b/owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json deleted file mode 100644 index 7666716..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/snippet_metadata.google.cloud.websecurityscanner.v1beta.json +++ /dev/null @@ -1,579 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-websecurityscanner", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.websecurityscanner.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async", - "title": "WebSecurityScanner createScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new ScanConfig.", - "canonical": true, - "file": "web_security_scanner.create_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "CreateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.CreateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async", - "title": "WebSecurityScanner deleteScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing ScanConfig and its child resources.", - "canonical": true, - "file": "web_security_scanner.delete_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "DeleteScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.DeleteScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async", - "title": "WebSecurityScanner getScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.get_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async", - "title": "WebSecurityScanner listScanConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanConfigs under a given project.", - "canonical": true, - "file": "web_security_scanner.list_scan_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanConfigsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanConfigs", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanConfigs", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async", - "title": "WebSecurityScanner updateScanConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ScanConfig. This method support partial update of a ScanConfig.", - "canonical": true, - "file": "web_security_scanner.update_scan_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", - "async": true, - "parameters": [ - { - "name": "scan_config", - "type": ".google.cloud.websecurityscanner.v1beta.ScanConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanConfig", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "UpdateScanConfig", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.UpdateScanConfig", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async", - "title": "WebSecurityScanner startScanRun Sample", - "origin": "API_DEFINITION", - "description": " Start a ScanRun according to the given ScanConfig.", - "canonical": true, - "file": "web_security_scanner.start_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "StartScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StartScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async", - "title": "WebSecurityScanner getScanRun Sample", - "origin": "API_DEFINITION", - "description": " Gets a ScanRun.", - "canonical": true, - "file": "web_security_scanner.get_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async", - "title": "WebSecurityScanner listScanRuns Sample", - "origin": "API_DEFINITION", - "description": " Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.", - "canonical": true, - "file": "web_security_scanner.list_scan_runs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListScanRunsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListScanRuns", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListScanRuns", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async", - "title": "WebSecurityScanner stopScanRun Sample", - "origin": "API_DEFINITION", - "description": " Stops a ScanRun. The stopped ScanRun is returned.", - "canonical": true, - "file": "web_security_scanner.stop_scan_run.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ScanRun", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "StopScanRun", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.StopScanRun", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async", - "title": "WebSecurityScanner listCrawledUrls Sample", - "origin": "API_DEFINITION", - "description": " List CrawledUrls under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_crawled_urls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListCrawledUrlsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListCrawledUrls", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListCrawledUrls", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async", - "title": "WebSecurityScanner getFinding Sample", - "origin": "API_DEFINITION", - "description": " Gets a Finding.", - "canonical": true, - "file": "web_security_scanner.get_finding.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.Finding", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "GetFinding", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.GetFinding", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async", - "title": "WebSecurityScanner listFindings Sample", - "origin": "API_DEFINITION", - "description": " List Findings under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_findings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindings", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindings", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - }, - { - "regionTag": "websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async", - "title": "WebSecurityScanner listFindingTypeStats Sample", - "origin": "API_DEFINITION", - "description": " List all FindingTypeStats under a given ScanRun.", - "canonical": true, - "file": "web_security_scanner.list_finding_type_stats.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse", - "client": { - "shortName": "WebSecurityScannerClient", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScannerClient" - }, - "method": { - "shortName": "ListFindingTypeStats", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner.ListFindingTypeStats", - "service": { - "shortName": "WebSecurityScanner", - "fullName": "google.cloud.websecurityscanner.v1beta.WebSecurityScanner" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.js deleted file mode 100644 index b788868..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.create_scan_config.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(parent, scanConfig) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * Required. The ScanConfig to be created. - */ - // const scanConfig = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callCreateScanConfig() { - // Construct request - const request = { - parent, - scanConfig, - }; - - // Run request - const response = await websecurityscannerClient.createScanConfig(request); - console.log(response); - } - - callCreateScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js deleted file mode 100644 index 95697d1..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.delete_scan_config.js +++ /dev/null @@ -1,59 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callDeleteScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.deleteScanConfig(request); - console.log(response); - } - - callDeleteScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js deleted file mode 100644 index 0a29b79..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_finding.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetFinding() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getFinding(request); - console.log(response); - } - - callGetFinding(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js deleted file mode 100644 index 26b9aaa..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_config.js +++ /dev/null @@ -1,59 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanConfig(request); - console.log(response); - } - - callGetScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js deleted file mode 100644 index fec1f94..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.get_scan_run.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callGetScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.getScanRun(request); - console.log(response); - } - - callGetScanRun(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js deleted file mode 100644 index f091bce..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_crawled_urls.js +++ /dev/null @@ -1,74 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListCrawledUrls() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listCrawledUrlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCrawledUrls(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js deleted file mode 100644 index cddb44f..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindingTypeStats() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await websecurityscannerClient.listFindingTypeStats(request); - console.log(response); - } - - callListFindingTypeStats(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.js deleted file mode 100644 index 146fd9d..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_findings.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, filter) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const parent = 'abc123' - /** - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - */ - // const filter = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListFindings() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const iterable = await websecurityscannerClient.listFindingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListFindings(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js deleted file mode 100644 index d7c1707..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_configs.js +++ /dev/null @@ -1,73 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanConfigs(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js deleted file mode 100644 index dc07d80..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.list_scan_runs.js +++ /dev/null @@ -1,73 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const parent = 'abc123' - /** - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - */ - // const pageToken = 'abc123' - /** - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - */ - // const pageSize = 1234 - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callListScanRuns() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await websecurityscannerClient.listScanRunsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListScanRuns(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js deleted file mode 100644 index 8abc20a..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.start_scan_run.js +++ /dev/null @@ -1,59 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStartScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.startScanRun(request); - console.log(response); - } - - callStartScanRun(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js deleted file mode 100644 index 675070b..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.stop_scan_run.js +++ /dev/null @@ -1,60 +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 websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - */ - // const name = 'abc123' - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callStopScanRun() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await websecurityscannerClient.stopScanRun(request); - console.log(response); - } - - callStopScanRun(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js b/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js deleted file mode 100644 index 311bd37..0000000 --- a/owl-bot-staging/v1beta/samples/generated/v1beta/web_security_scanner.update_scan_config.js +++ /dev/null @@ -1,67 +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(scanConfig, updateMask) { - // [START websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - */ - // const scanConfig = {} - /** - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - */ - // const updateMask = {} - - // Imports the Websecurityscanner library - const {WebSecurityScannerClient} = require('@google-cloud/web-security-scanner').v1beta; - - // Instantiates a client - const websecurityscannerClient = new WebSecurityScannerClient(); - - async function callUpdateScanConfig() { - // Construct request - const request = { - scanConfig, - updateMask, - }; - - // Run request - const response = await websecurityscannerClient.updateScanConfig(request); - console.log(response); - } - - callUpdateScanConfig(); - // [END websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1beta/src/index.ts b/owl-bot-staging/v1beta/src/index.ts deleted file mode 100644 index e3ed9d6..0000000 --- a/owl-bot-staging/v1beta/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 v1beta from './v1beta'; -const WebSecurityScannerClient = v1beta.WebSecurityScannerClient; -type WebSecurityScannerClient = v1beta.WebSecurityScannerClient; -export {v1beta, WebSecurityScannerClient}; -export default {v1beta, WebSecurityScannerClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json b/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json deleted file mode 100644 index c531caa..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/gapic_metadata.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.websecurityscanner.v1beta", - "libraryPackage": "@google-cloud/web-security-scanner", - "services": { - "WebSecurityScanner": { - "clients": { - "grpc": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "WebSecurityScannerClient", - "rpcs": { - "CreateScanConfig": { - "methods": [ - "createScanConfig" - ] - }, - "DeleteScanConfig": { - "methods": [ - "deleteScanConfig" - ] - }, - "GetScanConfig": { - "methods": [ - "getScanConfig" - ] - }, - "UpdateScanConfig": { - "methods": [ - "updateScanConfig" - ] - }, - "StartScanRun": { - "methods": [ - "startScanRun" - ] - }, - "GetScanRun": { - "methods": [ - "getScanRun" - ] - }, - "StopScanRun": { - "methods": [ - "stopScanRun" - ] - }, - "GetFinding": { - "methods": [ - "getFinding" - ] - }, - "ListFindingTypeStats": { - "methods": [ - "listFindingTypeStats" - ] - }, - "ListScanConfigs": { - "methods": [ - "listScanConfigs", - "listScanConfigsStream", - "listScanConfigsAsync" - ] - }, - "ListScanRuns": { - "methods": [ - "listScanRuns", - "listScanRunsStream", - "listScanRunsAsync" - ] - }, - "ListCrawledUrls": { - "methods": [ - "listCrawledUrls", - "listCrawledUrlsStream", - "listCrawledUrlsAsync" - ] - }, - "ListFindings": { - "methods": [ - "listFindings", - "listFindingsStream", - "listFindingsAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1beta/src/v1beta/index.ts b/owl-bot-staging/v1beta/src/v1beta/index.ts deleted file mode 100644 index 515d336..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/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 {WebSecurityScannerClient} from './web_security_scanner_client'; diff --git a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts deleted file mode 100644 index 2f9f35e..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client.ts +++ /dev/null @@ -1,1936 +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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1beta/web_security_scanner_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './web_security_scanner_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Cloud Web Security Scanner Service identifies security vulnerabilities in web - * applications hosted on Google Cloud Platform. It crawls your application, and - * attempts to exercise as many user inputs and event handlers as possible. - * @class - * @memberof v1beta - */ -export class WebSecurityScannerClient { - 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}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of WebSecurityScannerClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WebSecurityScannerClient; - 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // 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 = { - findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - scanConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}' - ), - scanRunPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' - ), - }; - - // 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 = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', 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 = gax.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.webSecurityScannerStub) { - return this.webSecurityScannerStub; - } - - // Put together the "service stub" for - // google.cloud.websecurityscanner.v1beta.WebSecurityScanner. - this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1beta.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1beta.WebSecurityScanner, - 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 webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; - for (const methodName of webSecurityScannerStubMethods) { - const callPromise = this.webSecurityScannerStub.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.innerApiCalls[methodName] = apiCall; - } - - return this.webSecurityScannerStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'websecurityscanner.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 'websecurityscanner.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 new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig - * Required. The ScanConfig to be created. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. - * 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/v1beta/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async - */ - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined - ]>; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createScanConfig(request, options, callback); - } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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/v1beta/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async - */ - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteScanConfig(request, options, callback); - } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. - * 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/v1beta/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async - */ - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined - ]>; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; - getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getScanConfig(request, options, callback); - } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. - * 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/v1beta/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async - */ - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; - updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|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' - ] = gax.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateScanConfig(request, options, callback); - } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. - * 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/v1beta/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async - */ - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined - ]>; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; - startScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.startScanRun(request, options, callback); - } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. - * 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/v1beta/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async - */ - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined - ]>; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; - getScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getScanRun(request, options, callback); - } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. - * 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/v1beta/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async - */ - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined - ]>; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; - stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.stopScanRun(request, options, callback); - } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding}. - * 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/v1beta/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async - */ - getFinding( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined - ]>; - getFinding( - request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; - getFinding( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getFinding(request, options, callback); - } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 [ListFindingTypeStatsResponse]{@link google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse}. - * 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/v1beta/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async - */ - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; - listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listFindingTypeStats(request, options, callback); - } - - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. - * 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 `listScanConfigsAsync()` - * 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. - */ - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]>; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; - listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; - listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listScanConfigs(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 resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig} 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 `listScanConfigsAsync()` - * 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. - */ - listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.createStream( - this.innerApiCalls.listScanConfigs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanConfigs`, 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 resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [ScanConfig]{@link google.cloud.websecurityscanner.v1beta.ScanConfig}. 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/v1beta/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async - */ - listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanConfigs.asyncIterate( - this.innerApiCalls['listScanConfigs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. - * 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 `listScanRunsAsync()` - * 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. - */ - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]>; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; - listScanRuns( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; - listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listScanRuns(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 resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun} 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 `listScanRunsAsync()` - * 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. - */ - listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.createStream( - this.innerApiCalls.listScanRuns as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listScanRuns`, 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 resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [ScanRun]{@link google.cloud.websecurityscanner.v1beta.ScanRun}. 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/v1beta/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async - */ - listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listScanRuns']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listScanRuns.asyncIterate( - this.innerApiCalls['listScanRuns'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1beta.CrawledUrl}. - * 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 `listCrawledUrlsAsync()` - * 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. - */ - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]>; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; - listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; - listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listCrawledUrls(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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [CrawledUrl]{@link google.cloud.websecurityscanner.v1beta.CrawledUrl} 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 `listCrawledUrlsAsync()` - * 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. - */ - listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.createStream( - this.innerApiCalls.listCrawledUrls as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCrawledUrls`, 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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [CrawledUrl]{@link google.cloud.websecurityscanner.v1beta.CrawledUrl}. 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/v1beta/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async - */ - listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listCrawledUrls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listCrawledUrls.asyncIterate( - this.innerApiCalls['listCrawledUrls'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding}. - * 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 `listFindingsAsync()` - * 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. - */ - listFindings( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]>; - listFindings( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; - listFindings( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; - listFindings( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]>|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listFindings(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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding} 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 `listFindingsAsync()` - * 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. - */ - listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.createStream( - this.innerApiCalls.listFindings as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listFindings`, 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 resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 - * [Finding]{@link google.cloud.websecurityscanner.v1beta.Finding}. 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/v1beta/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async - */ - listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listFindings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listFindings.asyncIterate( - this.innerApiCalls['listFindings'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified finding resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @param {string} finding - * @returns {string} Resource name string. - */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { - return this.pathTemplates.findingPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - finding: finding, - }); - } - - /** - * Parse the project from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the project. - */ - matchProjectFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).project; - } - - /** - * Parse the scan_config from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; - } - - /** - * Parse the scan_run from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_run; - } - - /** - * Parse the finding from Finding resource. - * - * @param {string} findingName - * A fully-qualified path representing Finding resource. - * @returns {string} A string representing the finding. - */ - matchFindingFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).finding; - } - - /** - * 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 scanConfig resource name string. - * - * @param {string} project - * @param {string} scan_config - * @returns {string} Resource name string. - */ - scanConfigPath(project:string,scanConfig:string) { - return this.pathTemplates.scanConfigPathTemplate.render({ - project: project, - scan_config: scanConfig, - }); - } - - /** - * Parse the project from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; - } - - /** - * Parse the scan_config from ScanConfig resource. - * - * @param {string} scanConfigName - * A fully-qualified path representing ScanConfig resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; - } - - /** - * Return a fully-qualified scanRun resource name string. - * - * @param {string} project - * @param {string} scan_config - * @param {string} scan_run - * @returns {string} Resource name string. - */ - scanRunPath(project:string,scanConfig:string,scanRun:string) { - return this.pathTemplates.scanRunPathTemplate.render({ - project: project, - scan_config: scanConfig, - scan_run: scanRun, - }); - } - - /** - * Parse the project from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the project. - */ - matchProjectFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).project; - } - - /** - * Parse the scan_config from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_config. - */ - matchScanConfigFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; - } - - /** - * Parse the scan_run from ScanRun resource. - * - * @param {string} scanRunName - * A fully-qualified path representing ScanRun resource. - * @returns {string} A string representing the scan_run. - */ - matchScanRunFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_run; - } - - /** - * 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.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json deleted file mode 100644 index ecb06a1..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_client_config.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "interfaces": { - "google.cloud.websecurityscanner.v1beta.WebSecurityScanner": { - "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": { - "CreateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanConfigs": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateScanConfig": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListScanRuns": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "StopScanRun": { - "timeout_millis": 600000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCrawledUrls": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetFinding": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindings": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListFindingTypeStats": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json b/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json deleted file mode 100644 index abb1848..0000000 --- a/owl-bot-staging/v1beta/src/v1beta/web_security_scanner_proto_list.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - "../../protos/google/cloud/websecurityscanner/v1beta/crawled_url.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/finding.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/finding_addon.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/finding_type_stats.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_config.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_config_error.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_run.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_error_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/scan_run_warning_trace.proto", - "../../protos/google/cloud/websecurityscanner/v1beta/web_security_scanner.proto" -] diff --git a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 2c742f5..0000000 --- a/owl-bot-staging/v1beta/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 websecurityscanner = require('@google-cloud/web-security-scanner'); - -function main() { - const webSecurityScannerClient = new websecurityscanner.WebSecurityScannerClient(); -} - -main(); diff --git a/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1beta/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 8bd7a23..0000000 --- a/owl-bot-staging/v1beta/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 {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; - -// check that the client class type name can be used -function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const webSecurityScannerClient = new WebSecurityScannerClient(); - doStuffWithWebSecurityScannerClient(webSecurityScannerClient); -} - -main(); diff --git a/owl-bot-staging/v1beta/system-test/install.ts b/owl-bot-staging/v1beta/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1beta/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/v1beta/test/gapic_web_security_scanner_v1beta.ts b/owl-bot-staging/v1beta/test/gapic_web_security_scanner_v1beta.ts deleted file mode 100644 index 50e1e42..0000000 --- a/owl-bot-staging/v1beta/test/gapic_web_security_scanner_v1beta.ts +++ /dev/null @@ -1,2122 +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 websecurityscannerModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -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('v1beta.WebSecurityScannerClient', () => { - it('has servicePath', () => { - const servicePath = websecurityscannerModule.v1beta.WebSecurityScannerClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = websecurityscannerModule.v1beta.WebSecurityScannerClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1beta.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - 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 websecurityscannerModule.v1beta.WebSecurityScannerClient({ - 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('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - assert((client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - 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); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - assert((client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - assert((client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedHeaderRequestParams = "scan_config.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - assert((client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest()); - request.scanConfig = {}; - request.scanConfig.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - assert((client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - assert((client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - assert((client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - assert((client.innerApiCalls.getFinding as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse()); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse()); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - assert((client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - assert((client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { - 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.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - assert((client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { - 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.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert.strictEqual( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert.strictEqual( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - assert((client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { - 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.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - assert((client.innerApiCalls.listFindings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { - 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.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert.strictEqual( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert.strictEqual( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - 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('scanConfig', () => { - const fakePath = "/rendered/path/scanConfig"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanConfigPath', () => { - const result = client.scanConfigPath("projectValue", "scanConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanConfigName', () => { - const result = client.matchProjectFromScanConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanConfigName', () => { - const result = client.matchScanConfigFromScanConfigName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('scanRun', () => { - const fakePath = "/rendered/path/scanRun"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.scanRunPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanRunPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanRunPath', () => { - const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromScanRunName', () => { - const result = client.matchProjectFromScanRunName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanConfigFromScanRunName', () => { - const result = client.matchScanConfigFromScanRunName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchScanRunFromScanRunName', () => { - const result = client.matchScanRunFromScanRunName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1beta/tsconfig.json b/owl-bot-staging/v1beta/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1beta/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/v1beta/webpack.config.js b/owl-bot-staging/v1beta/webpack.config.js deleted file mode 100644 index ad3467d..0000000 --- a/owl-bot-staging/v1beta/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: 'WebSecurityScanner', - filename: './web-security-scanner.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/v1/web_security_scanner_client.ts b/src/v1/web_security_scanner_client.ts index 5a91d53..0bb5628 100644 --- a/src/v1/web_security_scanner_client.ts +++ b/src/v1/web_security_scanner_client.ts @@ -72,7 +72,7 @@ export class WebSecurityScannerClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -95,11 +95,10 @@ export class WebSecurityScannerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/src/v1alpha/web_security_scanner_client.ts b/src/v1alpha/web_security_scanner_client.ts index 245dc5d..fe705c3 100644 --- a/src/v1alpha/web_security_scanner_client.ts +++ b/src/v1alpha/web_security_scanner_client.ts @@ -72,7 +72,7 @@ export class WebSecurityScannerClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -95,11 +95,10 @@ export class WebSecurityScannerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. diff --git a/src/v1beta/web_security_scanner_client.ts b/src/v1beta/web_security_scanner_client.ts index c107f08..5bf9058 100644 --- a/src/v1beta/web_security_scanner_client.ts +++ b/src/v1beta/web_security_scanner_client.ts @@ -72,7 +72,7 @@ export class WebSecurityScannerClient { * * @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/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -95,11 +95,10 @@ export class WebSecurityScannerClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields.